dossiers: begin "ajaxification" of patientrecord

WARNING: with this commit the patientrecord is not usable

Refs #2357
This commit is contained in:
Jérôme Schneider 2014-03-28 19:38:14 +01:00
parent 3a38fa869f
commit aa31cdc8f1
15 changed files with 1122 additions and 1061 deletions

View File

@ -1,6 +1,11 @@
{% extends "calebasse/base.html" %}
{% load url from future %}
{% block extrastyles %}
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/dossiers.css" />
{% endblock extrastyles %}
{% block extrascripts %}
<script src="{{ STATIC_URL }}js/jquery.parse-url.js"></script>
<script src="{{ STATIC_URL }}js/calebasse.dossiers.js"></script>

View File

@ -1,5 +1,4 @@
<form method="post" id="general-form" class="patientrecordform">{% csrf_token %}
<form method="post" action="tab1" id="general-form" class="patientrecordform">{% csrf_token %}
<div class="left">
<ul>
<li>
@ -41,7 +40,7 @@
{% else %}Aucun{% endif %}
</li>
<li><label>Commentaire </label> <button class="save enable-on-change btn-maj"></button><br/>
{{ forms.general.comment }}
{{ form.comment }}
</li>
</ul>
</div>
@ -84,11 +83,11 @@
<button type="button" id="patientrecord-history">Historique</button><br/>
<hr/>
<p id="confidential-msg" style="display: none; font-size: 10px;">Confidentialité mise à jour</p>
{{ forms.general.confidential.label_tag }} : {{ forms.general.confidential }}
{{ form.confidential.label_tag }} : {{ form.confidential }}
<p id="pause-msg" style="display: none; font-size: 10px;">Pause facturation mise à jour</p>
{{ forms.general.pause.label_tag }} : {{ forms.general.pause }}
{{ form.pause.label_tag }} : {{ form.pause }}
<br/><label>Commentaire de la pause facturation</label> <button class="save enable-on-change btn-maj"></button><br/>
{{ forms.general.pause_comment }}
{{ form.pause_comment }}
</div>
</form>
@ -106,7 +105,7 @@
{% endif %}
<form method="post" id="create-directory-form" action="create-directory">{% csrf_token %}
<form method="post" action="tab1" id="create-directory-form" action="create-directory">{% csrf_token %}
<button>Créer répertoire patient</button>
</form>
</div>

View File

@ -1,220 +1,221 @@
<form method="post" id="id-form" class="patientrecordform">
{% csrf_token %}
<div class="frame inline">
<h3>État civil</h3>
<div id="tabs-2">
<form method="post" action="tab2" id="id-form" class="patientrecordform">{% csrf_token %}
<div class="frame inline">
<h3>État civil</h3>
<button class="save"></button>
<table class="basic">
<tbody>
<tr><td class="width-limited">{{ forms.id.last_name.label_tag }}</td><td><span class="lastname">{{ forms.id.last_name }}</span></td><td>{{ forms.id.last_name.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.id.first_name.label_tag }}</td><td>{{ forms.id.first_name }}</td><td>{{ forms.id.first_name.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.id.birthplace.label_tag }}</td><td>{{ forms.id.birthplace }}</td><td>{{ forms.id.birthplace.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.id.birthdate.label_tag }}</td><td>{{ forms.id.birthdate }}</td><td>{{ forms.id.birthdate.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.id.gender.label_tag }}</td><td>{{ forms.id.gender }}</td><td>{{ forms.id.gender.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.id.nationality.label_tag }}</td><td>{{ forms.id.nationality }}</td><td>{{ forms.id.nationality.errors }}</td></tr>
</tbody>
</table>
<input type="hidden" name="tab" value="1">
</div>
</form>
<form method="post" id="inscription-form" class="patientrecordform">
{% csrf_token %}
<div class="frame inline">
<h3>Inscription</h3>
<button class="save"></button>
<table class="basic">
<tbody>
{% for field in forms.inscription %}
<tr><td class="width-limited">{{ field.label_tag }}</td><td>{{ field }}
<button type="button"
class="dialog-button"
data-url="../../ressources/{{ field.name }}/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_inscription-{{ field.name }}"
title="Ajouter un {{ field.label.lower }}"
type="button">+</button></td><td>{{ field.errors }}</td></tr>
{% endfor %}
</tbody>
</table>
<input type="hidden" name="tab" value="1">
</div>
</form>
<form method="post" id="out-form" class="patientrecordform">
{% csrf_token %}
<div class="frame inline">
<h3>Sortie</h3>
<button class="save"></button>
<table class="basic">
<tbody>
{% for field in forms.out %}
<tr><td class="width-limited">{{ field.label_tag }}</td><td>{{ field }}
<button type="button"
class="dialog-button"
data-url="../../ressources/{{ field.name }}/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_out-{{ field.name }}"
title="Ajouter un {{ field.label.lower }}"
type="button">+</button></td><td>{{ field.errors }}</td></tr>
{% endfor %}
</tbody>
</table>
<input type="hidden" name="tab" value="1">
</div>
</form>
<form method="post" id="family-form" class="patientrecordform">
{% csrf_token %}
<div class="frame inline">
<h3>Famille</h3>
<button class="save"></button>
<table class="basic">
<tbody>
<tr><td class="width-limited">{{ forms.family.sibship_place.label_tag }}</td><td>{{ forms.family.sibship_place }}</td><td>{{ forms.family.sibship_place.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.family.nb_children_family.label_tag }}</td><td>{{ forms.family.nb_children_family }}</td><td>{{ forms.family.nb_children_family.errors }}</td></tr>
<tr><td class="width-limited"><label>Rang (gémellité) : </label></td><td>{{ object.twinning_rank|default_if_none:"Aucun" }}</td><td></td></tr>
<tr><td class="width-limited">{{ forms.family.parental_authority.label_tag }}</td><td>{{ forms.family.parental_authority }}
<button type="button"
class="dialog-button"
data-url="../../ressources/parentalauthoritytype/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_family-parental_authority"
title="Ajouter un type d'autorité parentale">+</button></td><td>{{ forms.family.parental_authority.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.family.family_situation.label_tag }}</td><td>{{ forms.family.family_situation }}
<button type="button"
class="dialog-button"
data-url="../../ressources/familysituationtype/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_family-family_situation"
title="Ajouter un type de situation familiale">+</button></td><td>{{ forms.family.family_situation.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.family.child_custody.label_tag }}</td><td>{{ forms.family.child_custody }}
<button type="button"
class="dialog-button"
data-url="../../ressources/parentalcustodytype/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_family-child_custody"
title="Ajouter un type de garde parentale">+</button></td><td>{{ forms.family.child_custody.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.family.job_mother.label_tag }}</td><td>{{ forms.family.job_mother }}
<button type="button"
class="dialog-button"
data-url="../../ressources/job/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_family-job_mother"
title="Ajouter un type de profession">+</button></td><td>{{ forms.family.job_mother.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.family.job_father.label_tag }}</td><td>{{ forms.family.job_father }}
<button type="button"
class="dialog-button"
data-url="../../ressources/job/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_family-job_father"
title="Ajouter un type de profession">+</button></td><td>{{ forms.family.job_father.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.family.rm_mother.label_tag }}</td><td>{{ forms.family.rm_mother }}
<button type="button"
class="dialog-button"
data-url="../../ressources/maritalstatustype/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_family-rm_mother"
title="Ajouter un type de régime">+</button></td><td>{{ forms.family.rm_mother.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.family.rm_father.label_tag }}</td><td>{{ forms.family.rm_father }}
<button type="button"
class="dialog-button"
data-url="../../ressources/maritalstatustype/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_family-rm_father"
title="Ajouter un type de régime">+</button></td><td>{{ forms.family.rm_father.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.family.family_comment.label_tag }}</td><td>{{ forms.family.family_comment }}</td><td>{{ forms.family.family_comment.errors }}</td></tr>
</tbody>
</table>
<input type="hidden" name="tab" value="1">
</div>
</form>
<form method="post" id="transport-form" class="patientrecordform">
{% csrf_token %}
<div class="frame inline">
<h3>Transport</h3>
<button class="save"></button>
<table class="basic">
<tbody>
{% for field in forms.transport %}
<tr><td class="width-limited">{{ field.label_tag }}</td><td>{{ field }}
<button type="button"
class="dialog-button"
data-url="../../ressources/{{ field.name }}/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_transport-{{ field.name }}"
title="Ajouter {% if field.label.lower == "type de transport" %}un{% else %}une{% endif %} {{ field.label.lower }}">+</button></td><td>{{ field.errors }}</td></tr>
{% endfor %}
</tbody>
</table>
<br/>
<table>
<tr>
<td><!--<button id="attestation-transport-btn">Attestation de transport</button>--></td><td><button id="prescription-transport-btn">Prescription de transport</button></td>
</tr>
<tr>
<td></td>
<td>{% if last_prescription %} Dernière prescription le {{ last_prescription.created }}{% endif %}</td>
</tr>
</table>
<table class="basic">
<tbody>
<tr><td class="width-limited">{{ forms.id.last_name.label_tag }}</td><td><span class="lastname">{{ forms.id.last_name }}</span></td><td>{{ forms.id.last_name.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.id.first_name.label_tag }}</td><td>{{ forms.id.first_name }}</td><td>{{ forms.id.first_name.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.id.birthplace.label_tag }}</td><td>{{ forms.id.birthplace }}</td><td>{{ forms.id.birthplace.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.id.birthdate.label_tag }}</td><td>{{ forms.id.birthdate }}</td><td>{{ forms.id.birthdate.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.id.gender.label_tag }}</td><td>{{ forms.id.gender }}</td><td>{{ forms.id.gender.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.id.nationality.label_tag }}</td><td>{{ forms.id.nationality }}</td><td>{{ forms.id.nationality.errors }}</td></tr>
</tbody>
</table>
<input type="hidden" name="tab" value="1">
</div>
</form>
<form method="post" id="followup-form" class="patientrecordform">{% csrf_token %}
<form method="post" action="tab2" id="inscription-form" class="patientrecordform">
{% csrf_token %}
<div class="frame inline">
<h3>Inscription</h3>
<button class="save"></button>
<table class="basic">
<tbody>
{% for field in forms.inscription %}
<tr><td class="width-limited">{{ field.label_tag }}</td><td>{{ field }}
<button type="button"
class="dialog-button"
data-url="../../ressources/{{ field.name }}/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_inscription-{{ field.name }}"
title="Ajouter un {{ field.label.lower }}"
type="button">+</button></td><td>{{ field.errors }}</td></tr>
{% endfor %}
</tbody>
</table>
<input type="hidden" name="tab" value="1">
</div>
</form>
<form method="post" action="tab2" id="out-form" class="patientrecordform">
{% csrf_token %}
<div class="frame inline">
<h3>Sortie</h3>
<button class="save"></button>
<table class="basic">
<tbody>
{% for field in forms.out %}
<tr><td class="width-limited">{{ field.label_tag }}</td><td>{{ field }}
<button type="button"
class="dialog-button"
data-url="../../ressources/{{ field.name }}/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_out-{{ field.name }}"
title="Ajouter un {{ field.label.lower }}"
type="button">+</button></td><td>{{ field.errors }}</td></tr>
{% endfor %}
</tbody>
</table>
<input type="hidden" name="tab" value="1">
</div>
</form>
<form method="post" action="tab2" id="family-form" class="patientrecordform">
{% csrf_token %}
<div class="frame inline">
<h3>Famille</h3>
<button class="save"></button>
<table class="basic">
<tbody>
<tr><td class="width-limited">{{ forms.family.sibship_place.label_tag }}</td><td>{{ forms.family.sibship_place }}</td><td>{{ forms.family.sibship_place.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.family.nb_children_family.label_tag }}</td><td>{{ forms.family.nb_children_family }}</td><td>{{ forms.family.nb_children_family.errors }}</td></tr>
<tr><td class="width-limited"><label>Rang (gémellité) : </label></td><td>{{ object.twinning_rank|default_if_none:"Aucun" }}</td><td></td></tr>
<tr><td class="width-limited">{{ forms.family.parental_authority.label_tag }}</td><td>{{ forms.family.parental_authority }}
<button type="button"
class="dialog-button"
data-url="../../ressources/parentalauthoritytype/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_family-parental_authority"
title="Ajouter un type d'autorité parentale">+</button></td><td>{{ forms.family.parental_authority.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.family.family_situation.label_tag }}</td><td>{{ forms.family.family_situation }}
<button type="button"
class="dialog-button"
data-url="../../ressources/familysituationtype/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_family-family_situation"
title="Ajouter un type de situation familiale">+</button></td><td>{{ forms.family.family_situation.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.family.child_custody.label_tag }}</td><td>{{ forms.family.child_custody }}
<button type="button"
class="dialog-button"
data-url="../../ressources/parentalcustodytype/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_family-child_custody"
title="Ajouter un type de garde parentale">+</button></td><td>{{ forms.family.child_custody.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.family.job_mother.label_tag }}</td><td>{{ forms.family.job_mother }}
<button type="button"
class="dialog-button"
data-url="../../ressources/job/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_family-job_mother"
title="Ajouter un type de profession">+</button></td><td>{{ forms.family.job_mother.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.family.job_father.label_tag }}</td><td>{{ forms.family.job_father }}
<button type="button"
class="dialog-button"
data-url="../../ressources/job/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_family-job_father"
title="Ajouter un type de profession">+</button></td><td>{{ forms.family.job_father.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.family.rm_mother.label_tag }}</td><td>{{ forms.family.rm_mother }}
<button type="button"
class="dialog-button"
data-url="../../ressources/maritalstatustype/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_family-rm_mother"
title="Ajouter un type de régime">+</button></td><td>{{ forms.family.rm_mother.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.family.rm_father.label_tag }}</td><td>{{ forms.family.rm_father }}
<button type="button"
class="dialog-button"
data-url="../../ressources/maritalstatustype/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_family-rm_father"
title="Ajouter un type de régime">+</button></td><td>{{ forms.family.rm_father.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.family.family_comment.label_tag }}</td><td>{{ forms.family.family_comment }}</td><td>{{ forms.family.family_comment.errors }}</td></tr>
</tbody>
</table>
<input type="hidden" name="tab" value="1">
</div>
</form>
<form method="post" action="tab2" id="transport-form" class="patientrecordform">
{% csrf_token %}
<div class="frame inline">
<h3>Transport</h3>
<button class="save"></button>
<table class="basic">
<tbody>
{% for field in forms.transport %}
<tr><td class="width-limited">{{ field.label_tag }}</td><td>{{ field }}
<button type="button"
class="dialog-button"
data-url="../../ressources/{{ field.name }}/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_transport-{{ field.name }}"
title="Ajouter {% if field.label.lower == "type de transport" %}un{% else %}une{% endif %} {{ field.label.lower }}">+</button></td><td>{{ field.errors }}</td></tr>
{% endfor %}
</tbody>
</table>
<br/>
<table>
<tr>
<td><!--<button id="attestation-transport-btn">Attestation de transport</button>--></td><td><button id="prescription-transport-btn">Prescription de transport</button></td>
</tr>
<tr>
<td></td>
<td>{% if last_prescription %} Dernière prescription le {{ last_prescription.created }}{% endif %}</td>
</tr>
</table>
</div>
</form>
<form method="post" action="tab2" id="followup-form" class="patientrecordform">{% csrf_token %}
<div class="frame inline">
<h3>Suivi du patient</h3>
<button class="save"></button>
<table class="basic">
<tbody>
<tr><td class="width-limited">{{ forms.followup.coordinators.label_tag }}</td><td>{{ forms.followup.coordinators }}</td><td>{{ forms.followup.coordinators.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.followup.externaldoctor.label_tag }}</td><td>{{ forms.followup.externaldoctor }}
<button type="button"
class="dialog-button"
data-url="../../personnes/externaltherapist/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_followup-externaldoctor"
title="Ajouter un médecin extérieur">+</button></td><td>{{ forms.followup.externaldoctor.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.followup.externalintervener.label_tag }}</td><td>{{ forms.followup.externalintervener }}
<button type="button"
class="dialog-button"
data-url="../../personnes/externalworker/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_followup-externalintervener"
title="Ajouter un intervenant extérieur">+</button></td><td>{{ forms.followup.externalintervener.errors }}</td></tr>
</tbody>
</table>
<table class="basic">
<tbody>
<tr><td class="width-limited">{{ forms.followup.coordinators.label_tag }}</td><td>{{ forms.followup.coordinators }}</td><td>{{ forms.followup.coordinators.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.followup.externaldoctor.label_tag }}</td><td>{{ forms.followup.externaldoctor }}
<button type="button"
class="dialog-button"
data-url="../../personnes/externaltherapist/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_followup-externaldoctor"
title="Ajouter un médecin extérieur">+</button></td><td>{{ forms.followup.externaldoctor.errors }}</td></tr>
<tr><td class="width-limited">{{ forms.followup.externalintervener.label_tag }}</td><td>{{ forms.followup.externalintervener }}
<button type="button"
class="dialog-button"
data-url="../../personnes/externalworker/new/ #form-content"
data-default-button="Ajouter"
data-next-url="{{ request.get_full_path }}#tab=1"
data-add-select="#id_followup-externalintervener"
title="Ajouter un intervenant extérieur">+</button></td><td>{{ forms.followup.externalintervener.errors }}</td></tr>
</tbody>
</table>
</div>
<input type="hidden" name="tab" value="1">
<input type="hidden" name="tab" value="1">
</form>
<div class="frame">
<div class="frame">
<h3>Mesures de protection</h3>
<p><button id="new-protection-btn">Nouvelle mesure de protection</button></p>
{% for protection in object.protectionstate_set.all %}
<div class="subframe">
Depuis le {{ protection.start_date }} : {{ protection.status.name }}
<div class="buttons">
<button type="button" data-id="{{ protection.id }}" class="del-protection icon-minus" title="Supprimer"></button>
<button type="button" data-id="{{ protection.id }}" class="update-protection-btn icon-edit" title="Modifier"></button>
</div>
<div>
<ul>
{% if protection.end_date %}<li><label>Date de fin</label> : {{ protection.end_date }}</li>{% endif %}
{% if protection.comment %}<li><label>Commentaire</label> : {{ protection.comment }}</li>{% endif %}
</ul>
</div>
</div>
<div class="subframe">
Depuis le {{ protection.start_date }} : {{ protection.status.name }}
<div class="buttons">
<button type="button" data-id="{{ protection.id }}" class="del-protection icon-minus" title="Supprimer"></button>
<button type="button" data-id="{{ protection.id }}" class="update-protection-btn icon-edit" title="Modifier"></button>
</div>
<div>
<ul>
{% if protection.end_date %}<li><label>Date de fin</label> : {{ protection.end_date }}</li>{% endif %}
{% if protection.comment %}<li><label>Commentaire</label> : {{ protection.comment }}</li>{% endif %}
</ul>
</div>
</div>
{% endfor %}
</div>
</div>

View File

@ -1,91 +1,92 @@
<form method="post" id="policyholder-form" class="patientrecordform">{% csrf_token %}
<div id="tabs-3">
<form method="post" action="tab3" id="policyholder-form" class="patientrecordform">{% csrf_token %}
<div class="contact patient">
<h4>{{ object.first_name }} <span class="lastname">{{ object.last_name }}</span> (Patient)</h4>
{% if nb_place_of_lifes > 1 %}
<p>{{ nb_place_of_lifes }} lieux de vie</p>
{% endif %}
<div class="right">Assuré
<input type="radio"
{% if object.policyholder.id == object.id %} checked="checked" {% endif %}
id="id_policyholder-policyholder_{{ object.id }}"
value="{{ object.id }}"
class="policyholder-radio"
name="policyholder-policyholder">
<button type="button" data-id="{{ object.id }}" class="update-contact-btn icon-edit" title="Modifier"></button>
</div>
<div>
{% include "dossiers/patientrecord_tab3_contact.html" with contact=object %}
<hr>
<span>
<label>Commentaire </label> <button class="save enable-on-change btn-maj"></button><br/>
{{ forms.policyholder.contact_comment }}
</span>
</div>
<div class="contact patient">
<h4>{{ object.first_name }} <span class="lastname">{{ object.last_name }}</span> (Patient)</h4>
{% if nb_place_of_lifes > 1 %}
<p>{{ nb_place_of_lifes }} lieux de vie</p>
{% endif %}
<div class="right">Assuré
<input type="radio"
{% if object.policyholder.id == object.id %} checked="checked" {% endif %}
id="id_policyholder-policyholder_{{ object.id }}"
value="{{ object.id }}"
class="policyholder-radio"
name="policyholder-policyholder">
<button type="button" data-id="{{ object.id }}" class="update-contact-btn icon-edit" title="Modifier"></button>
</div>
<div>
{% include "dossiers/patientrecord_tab3_contact.html" with contact=object %}
<hr>
<span>
<label>Commentaire </label> <button class="save enable-on-change btn-maj"></button><br/>
{{ forms.policyholder.contact_comment }}
</span>
</div>
</div>
<button type="button" id="new-address-btn">Nouvelle adresse</button>
<button type="button" id="new-contact-btn">Nouveau contact</button>
<button type="button" id="new-address-btn">Nouvelle adresse</button>
<button type="button" id="new-contact-btn">Nouveau contact</button>
{% for contact in object.contacts.all %}
{% for contact in object.contacts.all %}
{% if not contact.addresses.all %}
<div class="contact">
<h4>{% if contact.gender == 1 %}M.{% elif contact.gender == 2 %}Mme{% endif %}
{{ contact.first_name }} <span class="lastname">{{ contact.last_name }}</span> {% if contact.id == object.id %} (PATIENT){% endif %}</h4>
<div class="right">Assuré
<input type="radio"
{% if object.policyholder.id == contact.id %} checked="checked" {% endif %}
id="id_policyholder-policyholder_{{ contact.id }}"
value="{{ contact.id }}"
class="policyholder-radio"
name="policyholder-policyholder">
<button type="button" data-id="{{ contact.id }}" data-address-id="{{ address.id }}" class="del-contact icon-minus" title="Supprimer"></button>
<button type="button" data-id="{{ contact.id }}" class="update-contact-btn icon-edit" title="Modifier"></button>
</div>
<div>
{% include "dossiers/patientrecord_tab3_contact.html" %}
</div>
</div>
{% endif %}
{% endfor %}
{% for address in addresses %}
<div class="frame {% if address.place_of_life %}orange{% endif %}">
<h3>{{ address }}</h3>
<div class="buttons">
<button type="button" data-id="{{ address.id }}" class="del-address icon-minus" title="Supprimer"></button>
<button type="button" data-id="{{ address.id }}" class="update-address-btn icon-edit" title="Modifier"></button>
</div>
<div class="right">
<ul class="ajax_messages" style="display: none;"></ul>
<input type="checkbox" data-id="{{ address.id }}" class="place_of_life" {% if address.place_of_life %}checked{% endif %}>Lieu de vie</input>
</div>
{% if address.phone %}<p><span class="icon-home-space">{{ address.phone }}</span></p>{% endif %}
{% if address.comment %}<p><label>Commentaire :</label>{{ address.comment }}</p>{% endif %}
{% if not address.phone and not address.comment %}<p>&nbsp;<!-- intentionaly empty --></p>{% endif %}
{% for contact in address.patientcontact_set.all %}
{% if contact.id != object.id %}
<div class="contact">
<h4>{% if contact.gender == 1 %}M.{% elif contact.gender == 2 %}Mme{% endif %}
{{ contact.first_name }} <span class="lastname">{{ contact.last_name }}</span> {% if contact.id == object.id %} (PATIENT){% endif %}</h4>
{{ contact.first_name }} <span class="lastname">{{ contact.last_name }}</span> {% if contact.id == object.id %} (PATIENT){% endif %}</h4>
<div class="right">Assuré
<input type="radio"
{% if object.policyholder.id == contact.id %} checked="checked" {% endif %}
id="id_policyholder-policyholder_{{ contact.id }}"
value="{{ contact.id }}"
class="policyholder-radio"
name="policyholder-policyholder">
<button type="button" data-id="{{ contact.id }}" data-address-id="{{ address.id }}" class="del-contact icon-minus" title="Supprimer"></button>
<button type="button" data-id="{{ contact.id }}" class="update-contact-btn icon-edit" title="Modifier"></button>
<input type="radio"
{% if object.policyholder.id == contact.id %} checked="checked" {% endif %}
id="id_policyholder-policyholder_{{ contact.id }}"
value="{{ contact.id }}"
class="policyholder-radio"
name="policyholder-policyholder">
<button type="button" data-id="{{ contact.id }}" data-address-id="{{ address.id }}" class="del-contact icon-minus" title="Supprimer"></button>
<button type="button" data-id="{{ contact.id }}" class="update-contact-btn icon-edit" title="Modifier"></button>
</div>
<div>
{% include "dossiers/patientrecord_tab3_contact.html" %}
</div>
</div>
{% endif %}
{% endfor %}
{% for address in addresses %}
<div class="frame {% if address.place_of_life %}orange{% endif %}">
<h3>{{ address }}</h3>
<div class="buttons">
<button type="button" data-id="{{ address.id }}" class="del-address icon-minus" title="Supprimer"></button>
<button type="button" data-id="{{ address.id }}" class="update-address-btn icon-edit" title="Modifier"></button>
</div>
<div class="right">
<ul class="ajax_messages" style="display: none;"></ul>
<input type="checkbox" data-id="{{ address.id }}" class="place_of_life" {% if address.place_of_life %}checked{% endif %}>Lieu de vie</input>
</div>
{% if address.phone %}<p><span class="icon-home-space">{{ address.phone }}</span></p>{% endif %}
{% if address.comment %}<p><label>Commentaire :</label>{{ address.comment }}</p>{% endif %}
{% if not address.phone and not address.comment %}<p>&nbsp;<!-- intentionaly empty --></p>{% endif %}
{% for contact in address.patientcontact_set.all %}
{% if contact.id != object.id %}
<div class="contact">
<h4>{% if contact.gender == 1 %}M.{% elif contact.gender == 2 %}Mme{% endif %}
{{ contact.first_name }} <span class="lastname">{{ contact.last_name }}</span> {% if contact.id == object.id %} (PATIENT){% endif %}</h4>
<div class="right">Assuré
<input type="radio"
{% if object.policyholder.id == contact.id %} checked="checked" {% endif %}
id="id_policyholder-policyholder_{{ contact.id }}"
value="{{ contact.id }}"
class="policyholder-radio"
name="policyholder-policyholder">
<button type="button" data-id="{{ contact.id }}" data-address-id="{{ address.id }}" class="del-contact icon-minus" title="Supprimer"></button>
<button type="button" data-id="{{ contact.id }}" class="update-contact-btn icon-edit" title="Modifier"></button>
</div>
<div>
{% include "dossiers/patientrecord_tab3_contact.html" %}
</div>
</ul>
</span>
</div>
{% endif %}
{% endfor %}
</div>
{% endfor %}
</ul>
</span>
</div>
{% endif %}
{% endfor %}
</div>
{% endfor %}
</form>
</div>

View File

@ -1,215 +1,217 @@
{% if object.service.name == "CMPP" %}
<div class="notifs">
<h4>Information sur la prise en charge</h4>
<ul>
<li><span{% if hc_status.1 %} id="highlight"{% endif %}>{{ hc_status.0 }}</span></li>
{% if object.pause %}<li><span id="highlight">Le dossier est en pause facturation.</span></li>{% endif %}
{% if missing_policy %}<li><span id="highlight">Informations d'assuré sociale manquantes.</span></li>{% endif %}
{% if missing_birthdate %}<li><span id="highlight">Date de naissance manquante.</span></li>{% endif %}
{% if object.policyholder.ame %}<li><span id="highlight">Le contact assuré est AME.</span></li>{% endif %}
</div>
<p>
<button id="new-hcdiag-btn">Nouvelle PC diagnostic</button>
<button id="new-hctrait-btn">Nouvelle PC traitement</button>
</p>
{% if acts_losts %}
<p><strong>{{ acts_losts|length }}</strong> actes facturables qui ne peuvent pas être facturés :
<table class="basic">
<thead>
<tr> <th>Date</th> <th>Heure</th> <th>Type d'acte</th> <th>Intervenants</th> <th>Commentaire</th> <th>Refacturation</th></tr>
</thead>
<tbody>
{% for act in acts_losts %}
<tr>
<td>{{ act.date|date:"SHORT_DATE_FORMAT" }}</td>
<td>{{ act.time }}</td>
<td>{{ act.act_type }}</td>
<td>{% for participant in act.doctors.all %}
{{ participant.first_name }} <span class="lastname">{{ participant.last_name }}</span>
{% endfor %}</td>
<td>{{ act.comment|default_if_none:"" }}</td>
<td>{% for i in act.invoice_set.all %}{{ i.number }}{% if not forloop.last %} - {% endif %}{% endfor %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</p>
{% endif %}
{% if acts_pause %}
<p><strong>{{ acts_pause|length }}</strong> actes qui sont en pause :
<table class="basic">
<thead>
<tr> <th>Date</th> <th>Heure</th> <th>Type d'acte</th> <th>Intervenants</th> <th>Commentaire</th> <th>Refacturation</th></tr>
</thead>
<tbody>
{% for act in acts_pause %}
<tr>
<td>{{ act.date|date:"SHORT_DATE_FORMAT" }}</td>
<td>{{ act.time }}</td>
<td>{{ act.act_type }}</td>
<td>{% for participant in act.doctors.all %}
{{ participant.first_name }} <span class="lastname">{{ participant.last_name }}</span>
{% endfor %}</td>
<td>{{ act.comment|default_if_none:"" }}</td>
<td>{% for i in act.invoice_set.all %}{{ i.number }}{% if not forloop.last %} - {% endif %}{% endfor %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</p>
{% endif %}
{% if hcs %}
{% for hc, acts, acts_cared in hcs %}
{% if hc.cmpphealthcarediagnostic %}
<div id="patient-diag">
<div class="frame">
<div class="buttons">
<button type="button" data-id="{{ hc.id }}" class="del-hcdiag icon-minus" title="Supprimer"></button>
<button type="button" data-id="{{ hc.id }}" class="update-hcdiag-btn icon-edit" title="Modifier"></button>
</div>
<h3>Prise en charge de diagnostic, débutée le {{ hc.start_date|date:"d/m/Y" }}{% if hc.cmpphealthcarediagnostic.end_date %}, se terminant le {{ hc.cmpphealthcarediagnostic.end_date|date:"d/m/Y" }}{% endif %}</h3>
<ul>
{% if hc.cmpphealthcarediagnostic.end_date %}<li><label>Date de fin</label> : {{ hc.cmpphealthcarediagnostic.end_date|date:"d/m/Y" }}</li>{% endif %}
{% if hc.request_date %}<li><label>Date de demande</label> : {{ hc.request_date|date:"d/m/Y" }}</li>{% endif %}
{% if hc.comment %}<li><label>Commentaire</label> : {{ hc.comment }}</li>{% endif %}
<li><label>Nombres d'actes de la prise en charge</label> : <strong>{{ hc.cmpphealthcarediagnostic.get_act_number }}</strong></li>
{% if acts %}<li><strong>{{ acts|length }}</strong> actes pouvant être pris en charge lors de la prochaine facturation :</li>
<table class="basic">
<thead>
<tr> <th>Date</th> <th>Heure</th> <th>Type d'acte</th> <th>Intervenants</th> <th>Commentaire</th> <th>Refacturation</th></tr>
</thead>
<tbody>
{% for act in acts %}
<tr>
<td>{{ act.date|date:"SHORT_DATE_FORMAT" }}</td>
<td>{{ act.time }}</td>
<td>{{ act.act_type }}</td>
<td>{% for participant in act.doctors.all %}
{{ participant.first_name }} <span class="lastname">{{ participant.last_name }}</span>
{% endfor %}</td>
<td>{{ act.comment|default_if_none:"" }}</td>
<td>{% for i in act.invoice_set.all %}{{ i.number }}{% if not forloop.last %} - {% endif %}{% endfor %}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% if hc.get_nb_acts_cared %}
<li><strong>{{ hc.get_nb_acts_cared }}</strong> actes déja facturés :</li>
<table class="basic">
<thead>
<tr> <th>Date</th> <th>Heure</th> <th>N° facture</th> <th>Type d'acte</th> <th>Intervenants</th> <th>Commentaire</th></tr>
</thead>
<tbody>
{% for act in acts_cared %}
<tr>
<td>{{ act.date|date:"SHORT_DATE_FORMAT" }}</td>
<td>{{ act.time }}</td>
<td>{{ act.get_invoice_number|default_if_none:"Ancienne facturation" }}</td>
<td>{{ act.act_type }}</td>
<td>{% for participant in act.doctors.all %}
{{ participant.first_name }} <span class="lastname">{{ participant.last_name }}</span>
{% endfor %}</td>
<td>{{ act.comment|default_if_none:"" }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}<li>Aucun acte facturé.</li>
{% endif %}
</ul>
<div id="tabs-4">
{% if object.service.slug == "cmpp" %}
<div class="notifs">
<h4>Information sur la prise en charge</h4>
<ul>
<li><span{% if hc_status.1 %} id="highlight"{% endif %}>{{ hc_status.0 }}</span></li>
{% if object.pause %}<li><span id="highlight">Le dossier est en pause facturation.</span></li>{% endif %}
{% if missing_policy %}<li><span id="highlight">Informations d'assuré sociale manquantes.</span></li>{% endif %}
{% if missing_birthdate %}<li><span id="highlight">Date de naissance manquante.</span></li>{% endif %}
{% if object.policyholder.ame %}<li><span id="highlight">Le contact assuré est AME.</span></li>{% endif %}
</div>
</div>
{% else %}
<div id="patient-traitement">
<div class="frame">
<div class="buttons">
<button type="button" data-id="{{ hc.id }}" class="del-hctrait icon-minus" title="Supprimer"></button>
<button type="button" data-id="{{ hc.id }}" class="update-hctrait-btn icon-edit" title="Modifier"></button>
<p>
<button id="new-hcdiag-btn">Nouvelle PC diagnostic</button>
<button id="new-hctrait-btn">Nouvelle PC traitement</button>
</p>
{% if acts_losts %}
<p><strong>{{ acts_losts|length }}</strong> actes facturables qui ne peuvent pas être facturés :
<table class="basic">
<thead>
<tr> <th>Date</th> <th>Heure</th> <th>Type d'acte</th> <th>Intervenants</th> <th>Commentaire</th> <th>Refacturation</th></tr>
</thead>
<tbody>
{% for act in acts_losts %}
<tr>
<td>{{ act.date|date:"SHORT_DATE_FORMAT" }}</td>
<td>{{ act.time }}</td>
<td>{{ act.act_type }}</td>
<td>{% for participant in act.doctors.all %}
{{ participant.first_name }} <span class="lastname">{{ participant.last_name }}</span>
{% endfor %}</td>
<td>{{ act.comment|default_if_none:"" }}</td>
<td>{% for i in act.invoice_set.all %}{{ i.number }}{% if not forloop.last %} - {% endif %}{% endfor %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</p>
{% endif %}
{% if acts_pause %}
<p><strong>{{ acts_pause|length }}</strong> actes qui sont en pause :
<table class="basic">
<thead>
<tr> <th>Date</th> <th>Heure</th> <th>Type d'acte</th> <th>Intervenants</th> <th>Commentaire</th> <th>Refacturation</th></tr>
</thead>
<tbody>
{% for act in acts_pause %}
<tr>
<td>{{ act.date|date:"SHORT_DATE_FORMAT" }}</td>
<td>{{ act.time }}</td>
<td>{{ act.act_type }}</td>
<td>{% for participant in act.doctors.all %}
{{ participant.first_name }} <span class="lastname">{{ participant.last_name }}</span>
{% endfor %}</td>
<td>{{ act.comment|default_if_none:"" }}</td>
<td>{% for i in act.invoice_set.all %}{{ i.number }}{% if not forloop.last %} - {% endif %}{% endfor %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</p>
{% endif %}
{% if hcs %}
{% for hc, acts, acts_cared in hcs %}
{% if hc.cmpphealthcarediagnostic %}
<div id="patient-diag">
<div class="frame">
<div class="buttons">
<button type="button" data-id="{{ hc.id }}" class="del-hcdiag icon-minus" title="Supprimer"></button>
<button type="button" data-id="{{ hc.id }}" class="update-hcdiag-btn icon-edit" title="Modifier"></button>
</div>
<h3>Prise en charge de diagnostic, débutée le {{ hc.start_date|date:"d/m/Y" }}{% if hc.cmpphealthcarediagnostic.end_date %}, se terminant le {{ hc.cmpphealthcarediagnostic.end_date|date:"d/m/Y" }}{% endif %}</h3>
<ul>
{% if hc.cmpphealthcarediagnostic.end_date %}<li><label>Date de fin</label> : {{ hc.cmpphealthcarediagnostic.end_date|date:"d/m/Y" }}</li>{% endif %}
{% if hc.request_date %}<li><label>Date de demande</label> : {{ hc.request_date|date:"d/m/Y" }}</li>{% endif %}
{% if hc.comment %}<li><label>Commentaire</label> : {{ hc.comment }}</li>{% endif %}
<li><label>Nombres d'actes de la prise en charge</label> : <strong>{{ hc.cmpphealthcarediagnostic.get_act_number }}</strong></li>
{% if acts %}<li><strong>{{ acts|length }}</strong> actes pouvant être pris en charge lors de la prochaine facturation :</li>
<table class="basic">
<thead>
<tr> <th>Date</th> <th>Heure</th> <th>Type d'acte</th> <th>Intervenants</th> <th>Commentaire</th> <th>Refacturation</th></tr>
</thead>
<tbody>
{% for act in acts %}
<tr>
<td>{{ act.date|date:"SHORT_DATE_FORMAT" }}</td>
<td>{{ act.time }}</td>
<td>{{ act.act_type }}</td>
<td>{% for participant in act.doctors.all %}
{{ participant.first_name }} <span class="lastname">{{ participant.last_name }}</span>
{% endfor %}</td>
<td>{{ act.comment|default_if_none:"" }}</td>
<td>{% for i in act.invoice_set.all %}{{ i.number }}{% if not forloop.last %} - {% endif %}{% endfor %}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% if hc.get_nb_acts_cared %}
<li><strong>{{ hc.get_nb_acts_cared }}</strong> actes déja facturés :</li>
<table class="basic">
<thead>
<tr> <th>Date</th> <th>Heure</th> <th>N° facture</th> <th>Type d'acte</th> <th>Intervenants</th> <th>Commentaire</th></tr>
</thead>
<tbody>
{% for act in acts_cared %}
<tr>
<td>{{ act.date|date:"SHORT_DATE_FORMAT" }}</td>
<td>{{ act.time }}</td>
<td>{{ act.get_invoice_number|default_if_none:"Ancienne facturation" }}</td>
<td>{{ act.act_type }}</td>
<td>{% for participant in act.doctors.all %}
{{ participant.first_name }} <span class="lastname">{{ participant.last_name }}</span>
{% endfor %}</td>
<td>{{ act.comment|default_if_none:"" }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}<li>Aucun acte facturé.</li>
{% endif %}
</ul>
</div>
<h3>Prise en charge de traitement, débutée le {{ hc.start_date|date:"d/m/Y" }}{% if hc.cmpphealthcaretreatment.end_date %}, se terminant le {{ hc.cmpphealthcaretreatment.end_date|date:"d/m/Y" }}{% endif %}</h3>
<ul>
{% if hc.cmpphealthcaretreatment.end_date %}<li><label>Date de fin</label> : {{ hc.cmpphealthcaretreatment.end_date|date:"d/m/Y" }}</li>{% endif %}
{% if hc.request_date %}<li><label>Date de demande</label> : {{ hc.request_date|date:"d/m/Y" }}</li>{% endif %}
{% if hc.comment %}<li><label>Commentaire</label> : {{ hc.comment }}</li>{% endif %}
<li><label>Nombres d'actes de la prise en charge</label> : <strong>{{ hc.cmpphealthcaretreatment.get_act_number }}</strong></li>
{% if acts %}<li><strong>{{ acts|length }}</strong> actes pouvant être pris en charge lors de la prochaine facturation :</li>
<table class="basic">
<thead>
<tr> <th>Date</th> <th>Heure</th> <th>Type d'acte</th> <th>Intervenants</th> <th>Commentaire</th> <th>Refacturation</th></tr>
</thead>
<tbody>
{% for act in acts %}
<tr>
<td>{{ act.date|date:"SHORT_DATE_FORMAT" }}</td>
<td>{{ act.time }}</td>
<td>{{ act.act_type }}</td>
<td>{% for participant in act.doctors.all %}
{{ participant.first_name }} <span class="lastname">{{ participant.last_name }}</span>
{% endfor %}</td>
<td>{{ act.comment|default_if_none:"" }}</td>
<td>{% for i in act.invoice_set.all %}{{ i.number }}{% if not forloop.last %} - {% endif %}{% endfor %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div id="patient-traitement">
<div class="frame">
<div class="buttons">
<button type="button" data-id="{{ hc.id }}" class="del-hctrait icon-minus" title="Supprimer"></button>
<button type="button" data-id="{{ hc.id }}" class="update-hctrait-btn icon-edit" title="Modifier"></button>
</div>
<h3>Prise en charge de traitement, débutée le {{ hc.start_date|date:"d/m/Y" }}{% if hc.cmpphealthcaretreatment.end_date %}, se terminant le {{ hc.cmpphealthcaretreatment.end_date|date:"d/m/Y" }}{% endif %}</h3>
<ul>
{% if hc.cmpphealthcaretreatment.end_date %}<li><label>Date de fin</label> : {{ hc.cmpphealthcaretreatment.end_date|date:"d/m/Y" }}</li>{% endif %}
{% if hc.request_date %}<li><label>Date de demande</label> : {{ hc.request_date|date:"d/m/Y" }}</li>{% endif %}
{% if hc.comment %}<li><label>Commentaire</label> : {{ hc.comment }}</li>{% endif %}
<li><label>Nombres d'actes de la prise en charge</label> : <strong>{{ hc.cmpphealthcaretreatment.get_act_number }}</strong></li>
{% if acts %}<li><strong>{{ acts|length }}</strong> actes pouvant être pris en charge lors de la prochaine facturation :</li>
<table class="basic">
<thead>
<tr> <th>Date</th> <th>Heure</th> <th>Type d'acte</th> <th>Intervenants</th> <th>Commentaire</th> <th>Refacturation</th></tr>
</thead>
<tbody>
{% for act in acts %}
<tr>
<td>{{ act.date|date:"SHORT_DATE_FORMAT" }}</td>
<td>{{ act.time }}</td>
<td>{{ act.act_type }}</td>
<td>{% for participant in act.doctors.all %}
{{ participant.first_name }} <span class="lastname">{{ participant.last_name }}</span>
{% endfor %}</td>
<td>{{ act.comment|default_if_none:"" }}</td>
<td>{% for i in act.invoice_set.all %}{{ i.number }}{% if not forloop.last %} - {% endif %}{% endfor %}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% if hc.get_nb_acts_cared %}
<li><strong>{{ hc.get_nb_acts_cared }}</strong> actes déja facturés :</li>
<table class="basic">
<thead>
<tr> <th>Date</th> <th>Heure</th> <th>N° facture</th> <th>Type d'acte</th> <th>Intervenants</th> <th>Commentaire</th></tr>
</thead>
<tbody>
{% for act in acts_cared %}
<tr>
<td>{{ act.date|date:"SHORT_DATE_FORMAT" }}</td>
<td>{{ act.time }}</td>
<td>{{ act.get_invoice_number|default_if_none:"Ancienne facturation" }}</td>
<td>{{ act.act_type }}</td>
<td>{% for participant in act.doctors.all %}
{{ participant.first_name }} <span class="lastname">{{ participant.last_name }}</span>
{% endfor %}</td>
<td>{{ act.comment|default_if_none:"" }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}<li>Aucun acte facturé.</li>
{% endif %}
</ul>
</div>
</div>
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% if object.service.name == "SESSAD TED" or object.service.name == "SESSAD DYS" %}
<p>
<button id="new-notification-btn">Nouvelle notification</button>
</p>
{% if hcs %}
{% for hc in hcs %}
{% if hc.sessadhealthcarenotification %}
<div id="patient-diag">
<div class="frame">
<div class="buttons">
<button type="button" data-id="{{ hc.sessadhealthcarenotification.id }}" class="del-notification icon-minus" title="Supprimer"></button>
<button type="button" data-id="{{ hc.sessadhealthcarenotification.id }}" class="update-notification-btn icon-edit" title="Modifier"></button>
{% endif %}
{% if hc.get_nb_acts_cared %}
<li><strong>{{ hc.get_nb_acts_cared }}</strong> actes déja facturés :</li>
<table class="basic">
<thead>
<tr> <th>Date</th> <th>Heure</th> <th>N° facture</th> <th>Type d'acte</th> <th>Intervenants</th> <th>Commentaire</th></tr>
</thead>
<tbody>
{% for act in acts_cared %}
<tr>
<td>{{ act.date|date:"SHORT_DATE_FORMAT" }}</td>
<td>{{ act.time }}</td>
<td>{{ act.get_invoice_number|default_if_none:"Ancienne facturation" }}</td>
<td>{{ act.act_type }}</td>
<td>{% for participant in act.doctors.all %}
{{ participant.first_name }} <span class="lastname">{{ participant.last_name }}</span>
{% endfor %}</td>
<td>{{ act.comment|default_if_none:"" }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}<li>Aucun acte facturé.</li>
{% endif %}
</ul>
</div>
<h3>Notification</h3>
<ul>
{% if hc.start_date %}<li><label>Date de début</label> : {{ hc.start_date|date:"d/m/Y" }}</li>{% endif %}
{% if hc.sessadhealthcarenotification.end_date %}<li><label>Date de fin</label> : {{ hc.sessadhealthcarenotification.end_date|date:"d/m/Y" }}</li>{% endif %}
{% if hc.request_date %}<li><label>Date de demande</label> : {{ hc.request_date|date:"d/m/Y" }}</li>{% endif %}
{% if hc.agree_date %}<li><label>Date d'accord</label> : {{ hc.agree_date|date:"d/m/Y" }}</li>{% endif %}
{% if hc.insist_date %}<li><label>Date de relance</label> : {{ hc.insist_date|date:"d/m/Y" }}</li>{% endif %}
{% if hc.comment %}<li><label>Commentaire</label> : {{ hc.comment }}</li>{% endif %}
</ul>
</div>
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% if object.service.slug == "sessad-ted" or object.service.slug == "sessad-dys" %}
<p>
<button id="new-notification-btn">Nouvelle notification</button>
</p>
{% if hcs %}
{% for hc in hcs %}
{% if hc.sessadhealthcarenotification %}
<div id="patient-diag">
<div class="frame">
<div class="buttons">
<button type="button" data-id="{{ hc.sessadhealthcarenotification.id }}" class="del-notification icon-minus" title="Supprimer"></button>
<button type="button" data-id="{{ hc.sessadhealthcarenotification.id }}" class="update-notification-btn icon-edit" title="Modifier"></button>
</div>
<h3>Notification</h3>
<ul>
{% if hc.start_date %}<li><label>Date de début</label> : {{ hc.start_date|date:"d/m/Y" }}</li>{% endif %}
{% if hc.sessadhealthcarenotification.end_date %}<li><label>Date de fin</label> : {{ hc.sessadhealthcarenotification.end_date|date:"d/m/Y" }}</li>{% endif %}
{% if hc.request_date %}<li><label>Date de demande</label> : {{ hc.request_date|date:"d/m/Y" }}</li>{% endif %}
{% if hc.agree_date %}<li><label>Date d'accord</label> : {{ hc.agree_date|date:"d/m/Y" }}</li>{% endif %}
{% if hc.insist_date %}<li><label>Date de relance</label> : {{ hc.insist_date|date:"d/m/Y" }}</li>{% endif %}
{% if hc.comment %}<li><label>Commentaire</label> : {{ hc.comment }}</li>{% endif %}
</ul>
</div>
</div>
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
</div>
{% endif %}
{% endfor %}
{% endif %}
{% endif %}

View File

@ -1,27 +1,29 @@
{% for state, last_rdvs in history %}
<div class="frame">
<h3>{{ state.status.name }} depuis le {{ state.date_selected|date:"SHORT_DATE_FORMAT" }}</h3>
{% if last_rdvs %}
<table class="basic">
<thead>
<tr> <th>Date</th> <th>Pointage</th> <th>Type d'acte</th> <th>Intervenants</th> <th>Commentaire</th></tr>
</thead>
<tbody>
{% for act, state, missing_workers in last_rdvs %}
<tr>
<td>{{ act.date|date:"SHORT_DATE_FORMAT" }} {{ act.time|date:"H:i" }}{% if missing_workers %} <span title="Au moins un intervenant est absent" class="icon-warning-sign absent"></span>{% endif %}</td>
<td>{% if state %}{% if act.is_absent %}<strong>{% endif %}{% if state.state_name == 'ACT_DOUBLE' or state.state_name == 'ACT_LOST' %}Présent ({{ state }}){% else %}{{ state }}{% endif %}{% if act.is_absent %}</strong>{% endif %}{% else %}Non pointé.{% endif %}</td>
<td>{{ act.act_type }}</td>
<td class="width-limited">{% for doctor in act.doctors.all %}
{% if doctor in missing_workers %}<span class="absent" title="Absent">{% endif %}
{{ doctor.first_name }} <span class="lastname">{{ doctor.last_name }}</span>
{% if doctor in missing_workers %}</span>{% endif %}
{% endfor %}</td>
<td class="width-limited">{% if act.comment %}{{ act.comment }}{% endif %}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
<div id="tabs-5">
{% for state, last_rdvs in history %}
<div class="frame">
<h3>{{ state.status.name }} depuis le {{ state.date_selected|date:"SHORT_DATE_FORMAT" }}</h3>
{% if last_rdvs %}
<table class="basic">
<thead>
<tr> <th>Date</th> <th>Pointage</th> <th>Type d'acte</th> <th>Intervenants</th> <th>Commentaire</th></tr>
</thead>
<tbody>
{% for act, state, missing_workers in last_rdvs %}
<tr>
<td>{{ act.date|date:"SHORT_DATE_FORMAT" }} {{ act.time|date:"H:i" }}{% if missing_workers %} <span title="Au moins un intervenant est absent" class="icon-warning-sign absent"></span>{% endif %}</td>
<td>{% if state %}{% if act.is_absent %}<strong>{% endif %}{% if state.state_name == 'ACT_DOUBLE' or state.state_name == 'ACT_LOST' %}Présent ({{ state }}){% else %}{{ state }}{% endif %}{% if act.is_absent %}</strong>{% endif %}{% else %}Non pointé.{% endif %}</td>
<td>{{ act.act_type }}</td>
<td class="width-limited">{% for doctor in act.doctors.all %}
{% if doctor in missing_workers %}<span class="absent" title="Absent">{% endif %}
{{ doctor.first_name }} <span class="lastname">{{ doctor.last_name }}</span>
{% if doctor in missing_workers %}</span>{% endif %}
{% endfor %}</td>
<td class="width-limited">{% if act.comment %}{{ act.comment }}{% endif %}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
{% endfor %}
</div>
{% endfor %}

View File

@ -1,24 +1,26 @@
<table class="basic">
<thead>
<tr> <th>Date</th> <th>Pointage</th> <th>Type d'acte</th> <th>Intervenants</th> <th>Commentaire</th> </tr>
</thead>
<tbody>
{% for event, state, missing_participants in next_rdvs %}
<tr>
<td>{% firstof event.start_datetime|date:"l d/m/y H:i"|title %}{% if missing_participants %} <span title="Au moins un intervenant est absent" class="icon-warning-sign absent"></span>{% endif %}</td>
<td>{% if state %}{% if state.state_name != 'VALIDE' %}<strong>{% endif %}{{ state }}{% if state.state_name != 'VALIDE' %}</strong>{% endif %}{% else %}Non pointé.{% endif %}</td>
<td>{{ event.act_type }}</td>
<td class="width-limited">{% for participant in event.participants.all %}
{% if participant in missing_participants %}<span class="absent" title="Absent">{% endif %}
{{ participant.first_name }} <span class="lastname">{{ participant.last_name }}</span>
{% if participant in missing_participants %}</span>{% endif %}
{% endfor %}</td>
{% if event.act.id %}
<td class="width-limited">{{ event.act.comment }}</td>
{% else %}
<td class="width-limited">{{ event.description }}</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
<div id="tabs-6">
<table class="basic">
<thead>
<tr> <th>Date</th> <th>Pointage</th> <th>Type d'acte</th> <th>Intervenants</th> <th>Commentaire</th> </tr>
</thead>
<tbody>
{% for event, state, missing_participants in next_rdvs %}
<tr>
<td>{% firstof event.start_datetime|date:"l d/m/y H:i"|title %}{% if missing_participants %} <span title="Au moins un intervenant est absent" class="icon-warning-sign absent"></span>{% endif %}</td>
<td>{% if state %}{% if state.state_name != 'VALIDE' %}<strong>{% endif %}{{ state }}{% if state.state_name != 'VALIDE' %}</strong>{% endif %}{% else %}Non pointé.{% endif %}</td>
<td>{{ event.act_type }}</td>
<td class="width-limited">{% for participant in event.participants.all %}
{% if participant in missing_participants %}<span class="absent" title="Absent">{% endif %}
{{ participant.first_name }} <span class="lastname">{{ participant.last_name }}</span>
{% if participant in missing_participants %}</span>{% endif %}
{% endfor %}</td>
{% if event.act.id %}
<td class="width-limited">{{ event.act.comment }}</td>
{% else %}
<td class="width-limited">{{ event.description }}</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</div>

View File

@ -1,60 +1,62 @@
<div class="frame">
<h3>Périodes de socialisation</h3>
<p><button id="new-socialisation-duration-btn">Nouvelle période de socialisation</button></p>
{% for duration in object.socialisation_durations.all %}
<div class="subframe">
Arrivée le <strong>{{ duration.start_date }}</strong> dans {% if duration.school %}l'établissement <strong>{{ duration.school }}</strong>{% else %}un établissement non renseigné{% endif %}{% if duration.level %} (en {{ duration.level }}){% endif %}
<div class="buttons">
<button type="button" data-id="{{ duration.id }}" class="del-duration icon-minus" title="Supprimer"></button>
<button type="button" data-id="{{ duration.id }}" class="update-duration-btn icon-edit" title="Modifier"></button>
</div>
<div>
<ul>
{% if duration.end_date %}<li><label>Date de départ</label> : {{ duration.end_date }}</li>{% endif %}
{% if duration.comment %}<li><label>Commentaire</label> : {{ duration.comment }}</li>{% endif %}
</ul>
<div id="tabs-7">
<div class="frame">
<h3>Périodes de socialisation</h3>
<p><button id="new-socialisation-duration-btn">Nouvelle période de socialisation</button></p>
{% for duration in object.socialisation_durations.all %}
<div class="subframe">
Arrivée le <strong>{{ duration.start_date }}</strong> dans {% if duration.school %}l'établissement <strong>{{ duration.school }}</strong>{% else %}un établissement non renseigné{% endif %}{% if duration.level %} (en {{ duration.level }}){% endif %}
<div class="buttons">
<button type="button" data-id="{{ duration.id }}" class="del-duration icon-minus" title="Supprimer"></button>
<button type="button" data-id="{{ duration.id }}" class="update-duration-btn icon-edit" title="Modifier"></button>
</div>
<div>
<ul>
{% if duration.end_date %}<li><label>Date de départ</label> : {{ duration.end_date }}</li>{% endif %}
{% if duration.comment %}<li><label>Commentaire</label> : {{ duration.comment }}</li>{% endif %}
</ul>
</div>
</div>
{% endfor %}
</div>
{% endfor %}
</div>
<div class="frame">
<h3>Demandes MDPH</h3>
<p><button id="new-mdph-request-btn">Nouvelle demande MDPH</button></p>
{% for request in object.mdph_requests.all %}
<div class="subframe">
Demande le <strong>{{ request.start_date }}</strong> à la MDPH <strong>{{ request.mdph }}</strong>
<div class="buttons">
<button type="button" data-id="{{ request.id }}" class="del-mdph-request icon-minus" title="Supprimer"></button>
<button type="button" data-id="{{ request.id }}" class="update-mdph-request-btn icon-edit" title="Modifier"></button>
</div>
<div>
<ul>
{% if request.comment %}<li><label>Commentaire</label> : {{ request.comment }}</li>{% endif %}
</ul>
<div class="frame">
<h3>Demandes MDPH</h3>
<p><button id="new-mdph-request-btn">Nouvelle demande MDPH</button></p>
{% for request in object.mdph_requests.all %}
<div class="subframe">
Demande le <strong>{{ request.start_date }}</strong> à la MDPH <strong>{{ request.mdph }}</strong>
<div class="buttons">
<button type="button" data-id="{{ request.id }}" class="del-mdph-request icon-minus" title="Supprimer"></button>
<button type="button" data-id="{{ request.id }}" class="update-mdph-request-btn icon-edit" title="Modifier"></button>
</div>
<div>
<ul>
{% if request.comment %}<li><label>Commentaire</label> : {{ request.comment }}</li>{% endif %}
</ul>
</div>
</div>
{% endfor %}
</div>
{% endfor %}
</div>
<div class="frame">
<h3>Réponses MDPH</h3>
<p><button id="new-mdph-response-btn">Nouvelle réponse MDPH</button></p>
{% for response in object.mdph_responses.all %}
<div class="subframe">
Du <strong>{{ response.start_date }}</strong> au <strong>{{ response.end_date }}</strong> à la MDPH <strong>{{ response.mdph }}</strong>
<div class="buttons">
<button type="button" data-id="{{ response.id }}" class="del-mdph-response icon-minus" title="Supprimer"></button>
<button type="button" data-id="{{ response.id }}" class="update-mdph-response-btn icon-edit" title="Modifier"></button>
</div>
<div>
<ul>
{% if response.comment %}<li><label>Commentaire</label> : {{ response.comment }}</li>{% endif %}
{% if response.type_aide %}<li><label>Type d'aide</label> : {{ response.type_aide }}</li>{% endif %}
{% if response.name %}<li><label>Nom</label> : {{ response.name }}</li>{% endif %}
{% if response.rate %}<li><label>Taux</label> : {{ response.rate }}</li>{% endif %}
</ul>
<div class="frame">
<h3>Réponses MDPH</h3>
<p><button id="new-mdph-response-btn">Nouvelle réponse MDPH</button></p>
{% for response in object.mdph_responses.all %}
<div class="subframe">
Du <strong>{{ response.start_date }}</strong> au <strong>{{ response.end_date }}</strong> à la MDPH <strong>{{ response.mdph }}</strong>
<div class="buttons">
<button type="button" data-id="{{ response.id }}" class="del-mdph-response icon-minus" title="Supprimer"></button>
<button type="button" data-id="{{ response.id }}" class="update-mdph-response-btn icon-edit" title="Modifier"></button>
</div>
<div>
<ul>
{% if response.comment %}<li><label>Commentaire</label> : {{ response.comment }}</li>{% endif %}
{% if response.type_aide %}<li><label>Type d'aide</label> : {{ response.type_aide }}</li>{% endif %}
{% if response.name %}<li><label>Nom</label> : {{ response.name }}</li>{% endif %}
{% if response.rate %}<li><label>Taux</label> : {{ response.rate }}</li>{% endif %}
</ul>
</div>
</div>
{% endfor %}
</div>
{% endfor %}
</div>

View File

@ -1,16 +1,18 @@
<form method="post" id="physiology-form" class="patientrecordform">
{% csrf_token %}
<button class="save enable-on-change">Enregistrer</button>
{% for field in forms.physiology %}
<p>
{{ field.errors }}
</p>
<p>
{{ field.label_tag }}
{{ field }}
</p>
{% endfor %}
</p>
<input type="hidden" name="tab" value="7">
<button class="save enable-on-change">Enregistrer</button>
</form>
<div id="tabs-8">
<form method="post" action="tab8" id="physiology-form" class="patientrecordform">
{% csrf_token %}
<button class="save enable-on-change">Enregistrer</button>
{% for field in forms.physiology %}
<p>
{{ field.errors }}
</p>
<p>
{{ field.label_tag }}
{{ field }}
</p>
{% endfor %}
</p>
<input type="hidden" name="tab" value="7">
<button class="save enable-on-change">Enregistrer</button>
</form>
</div>

View File

@ -23,54 +23,27 @@
{% block content %}
<div id="tabs">
<ul>
<li><a data-id="0" class="atabs" href="#tabs-1">Général</a></li>
<li><a data-id="1" class="atabs" href="#tabs-2">Fiche administrative</a></li>
<li><a data-id="2" class="atabs" href="#tabs-3">Adresses / contacts</a></li>
{% if object.service.name == "CMPP" %}
<li><a data-id="3" class="atabs" href="#tabs-4">Prise en charge</a></li>
{% elif object.service.name == "SESSAD TED" or object.service.name == "SESSAD DYS" %}
<li><a data-id="3" class="atabs" href="#tabs-4">Notifications</a></li>
<li id="tab1">
<a data-id="0" href="tab1" class="atabs">Général</a>
</li>
<li id="tab2">
<a data-id="1" href="tab2" class="atabs">Fiche administrative</a>
</li>
<li id="tab3">
<a data-id="2" href="tab3" class="atabs">Adresses / contacts</a>
</li>
{% if object.service.slug == "cmpp" %}
<li><a data-id="3" href="tab4" class="atabs">Prise en charge</a></li>
{% elif object.service.slug == "sessad-ted" or object.service.name == "sessad-dys" %}
<li><a data-id="3" href="tab4" class="atabs">Notifications</a></li>
{% else %}
<li style="display: none;"><a data-id="3" class="atabs" href="#tabs-4">Notifications</a></li>
<li style="display: none;"><a data-id="3" href="tab4" class="atabs">Notifications</a></li>
{% endif %}
<li><a data-id="4" class="atabs" href="#tabs-5">Actes passés</a>
<li><a data-id="5" class="atabs" href="#tabs-6">Prochains rendez-vous</a>
<li><a data-id="6" class="atabs" href="#tabs-7">Socialisation</a>
<li><a data-id="7" class="atabs" href="#tabs-8">Données à caractère médical</a>
<li><a data-id="4" class="atabs" href="tab5">Actes passés</a>
<li><a data-id="5" class="atabs" href="tab6">Prochains rendez-vous</a>
<li><a data-id="6" class="atabs" href="tab7">Socialisation</a>
<li><a data-id="7" class="atabs" href="tab8">Données à caractère médical</a>
</ul>
<div id="tabs-1"> <!-- Général -->
{% include "dossiers/patientrecord_tab1_general.html" %}
</div>
<div id="tabs-2"> <!-- Fiche administrative -->
{% include "dossiers/patientrecord_tab2_fiche_adm.html" %}
</div>
<div id="tabs-3"> <!-- Adresses / Contacts -->
{% include "dossiers/patientrecord_tab3_adresses.html" %}
</div>
<div id="tabs-4"> <!-- Prise en charge et notifications -->
{% include "dossiers/patientrecord_tab4_notifs.html" %}
</div>
<div id="tabs-5"> <!-- Actes passés -->
{% include "dossiers/patientrecord_tab5_actes_passes.html" %}
</div>
<div id="tabs-6"> <!-- Prochains rendez-vous -->
{% include "dossiers/patientrecord_tab6_next_rdv.html" %}
</div>
<div id="tabs-7"><!-- Période de socialisation -->
{% include "dossiers/patientrecord_tab7_socialisation.html" %}
</div>
<div id="tabs-8"><!-- Données à caractère médicale -->
{% include "dossiers/patientrecord_tab8_medical.html" %}
</div>
</div>
</div>
{% endblock %}

View File

@ -3,78 +3,54 @@ from django.conf.urls import patterns, url
from calebasse.cbv import ListView, CreateView, DeleteView, UpdateView
from models import PatientRecord
from views import (patientrecord_home, patient_record, state_form,
new_patient_record, patientrecord_delete, new_patient_contact,
new_patient_address, delete_patient_contact, delete_patient_address,
update_paper_id, update_patient_address, update_patient_contact,
new_healthcare_treatment,
update_healthcare_treatment,
delete_healthcare_treatment,
new_healthcare_diagnostic,
update_healthcare_diagnostic,
delete_healthcare_diagnostic,
new_healthcare_notification,
update_healthcare_notification,
delete_healthcare_notification,
new_socialisation_duration,
update_socialisation_duration,
delete_socialisation_duration,
update_patient_state,
delete_patient_state,
new_mdph_request,
update_mdph_request,
delete_mdph_request,
new_mdph_response,
update_mdph_response,
delete_mdph_response,
generate_rtf_form,
patientrecord_quotations,
patientrecord_waiting_queue,
create_directory,
prescription_transport,
new_protection,
update_protection,
delete_protection)
from forms import EditPatientRecordForm
urlpatterns = patterns('',
url(r'^$', patientrecord_home),
url(r'^quotations$', patientrecord_quotations),
url(r'^waiting-queue$', patientrecord_waiting_queue),
url(r'^new$', new_patient_record),
url(r'^(?P<pk>\d+)/view$', patient_record),
url(r'^(?P<pk>\d+)/delete$', patientrecord_delete),
url(r'^(?P<pk>\d+)/update/paper_id$', update_paper_id),
url(r'^(?P<patientrecord_id>\d+)/update-state$', state_form),
url(r'^(?P<patientrecord_id>\d+)/address/new$', new_patient_address),
url(r'^(?P<patientrecord_id>\d+)/address/(?P<pk>\d+)/update$', update_patient_address),
url(r'^(?P<patientrecord_id>\d+)/address/(?P<pk>\d+)/del$', delete_patient_address),
url(r'^(?P<patientrecord_id>\d+)/contact/new$', new_patient_contact),
url(r'^(?P<patientrecord_id>\d+)/contact/(?P<pk>\d+)/update$', update_patient_contact),
url(r'^(?P<patientrecord_id>\d+)/contact/(?P<pk>\d+)/del$', delete_patient_contact),
url(r'^(?P<patientrecord_id>\d+)/healthcare_treatment/new$', new_healthcare_treatment),
url(r'^(?P<patientrecord_id>\d+)/healthcare_treatment/(?P<pk>\d+)/update$', update_healthcare_treatment),
url(r'^(?P<patientrecord_id>\d+)/healthcare_treatment/(?P<pk>\d+)/del$', delete_healthcare_treatment),
url(r'^(?P<patientrecord_id>\d+)/healthcare_diagnostic/new$', new_healthcare_diagnostic),
url(r'^(?P<patientrecord_id>\d+)/healthcare_diagnostic/(?P<pk>\d+)/update$', update_healthcare_diagnostic),
url(r'^(?P<patientrecord_id>\d+)/healthcare_diagnostic/(?P<pk>\d+)/del$', delete_healthcare_diagnostic),
url(r'^(?P<patientrecord_id>\d+)/healthcare_notification/new$', new_healthcare_notification),
url(r'^(?P<patientrecord_id>\d+)/healthcare_notification/(?P<pk>\d+)/update$', update_healthcare_notification),
url(r'^(?P<patientrecord_id>\d+)/healthcare_notification/(?P<pk>\d+)/del$', delete_healthcare_notification),
url(r'^(?P<patientrecord_id>\d+)/socialisation/new$', new_socialisation_duration),
url(r'^(?P<patientrecord_id>\d+)/socialisation/(?P<pk>\d+)/update$', update_socialisation_duration),
url(r'^(?P<patientrecord_id>\d+)/socialisation/(?P<pk>\d+)/del$', delete_socialisation_duration),
url(r'^(?P<patientrecord_id>\d+)/state/(?P<pk>\d+)/update$', update_patient_state),
url(r'^(?P<patientrecord_id>\d+)/state/(?P<pk>\d+)/del$', delete_patient_state),
url(r'^(?P<patientrecord_id>\d+)/mdph_request/new$', new_mdph_request),
url(r'^(?P<patientrecord_id>\d+)/mdph_request/(?P<pk>\d+)/update$', update_mdph_request),
url(r'^(?P<patientrecord_id>\d+)/mdph_request/(?P<pk>\d+)/del$', delete_mdph_request),
url(r'^(?P<patientrecord_id>\d+)/mdph_response/new$', new_mdph_response),
url(r'^(?P<patientrecord_id>\d+)/mdph_response/(?P<pk>\d+)/update$', update_mdph_response),
url(r'^(?P<patientrecord_id>\d+)/mdph_response/(?P<pk>\d+)/del$', delete_mdph_response),
url(r'^(?P<patientrecord_id>\d+)/generate$', generate_rtf_form),
url(r'^(?P<patientrecord_id>\d+)/create-directory$', create_directory),
url(r'^(?P<patientrecord_id>\d+)/prescription-transport$', prescription_transport),
url(r'^(?P<patientrecord_id>\d+)/protection/new$', new_protection),
url(r'^(?P<patientrecord_id>\d+)/protection/(?P<pk>\d+)/update$', update_protection),
url(r'^(?P<patientrecord_id>\d+)/protection/(?P<pk>\d+)/del$', delete_protection),)
urlpatterns = patterns('calebasse.dossiers.views',
url(r'^$', 'patientrecord_home'),
url(r'^quotations$', 'patientrecord_quotations'),
url(r'^waiting-queue$', 'patientrecord_waiting_queue'),
url(r'^new$', 'new_patient_record'),
url(r'^(?P<pk>\d+)/view$', 'patient_record'),
url(r'^(?P<pk>\d+)/tab1$', 'tab1_general'),
url(r'^(?P<pk>\d+)/tab2$', 'tab2_fiche_adm'),
url(r'^(?P<pk>\d+)/tab3$', 'tab3_addresses'),
url(r'^(?P<pk>\d+)/tab4$', 'tab4_notifs'),
url(r'^(?P<pk>\d+)/tab5$', 'tab5_old_acts'),
url(r'^(?P<pk>\d+)/tab6$', 'tab6_next_rdv'),
url(r'^(?P<pk>\d+)/tab7$', 'tab7_socialisation'),
url(r'^(?P<pk>\d+)/tab8$', 'tab8_medical'),
url(r'^(?P<pk>\d+)/delete$', 'patientrecord_delete'),
url(r'^(?P<pk>\d+)/update/paper_id$', 'update_paper_id'),
url(r'^(?P<patientrecord_id>\d+)/update-state$', 'state_form'),
url(r'^(?P<patientrecord_id>\d+)/address/new$', 'new_patient_address'),
url(r'^(?P<patientrecord_id>\d+)/address/(?P<pk>\d+)/update$', 'update_patient_address'),
url(r'^(?P<patientrecord_id>\d+)/address/(?P<pk>\d+)/del$', 'delete_patient_address'),
url(r'^(?P<patientrecord_id>\d+)/contact/new$', 'new_patient_contact'),
url(r'^(?P<patientrecord_id>\d+)/contact/(?P<pk>\d+)/update$', 'update_patient_contact'),
url(r'^(?P<patientrecord_id>\d+)/contact/(?P<pk>\d+)/del$', 'delete_patient_contact'),
url(r'^(?P<patientrecord_id>\d+)/healthcare_treatment/new$', 'new_healthcare_treatment'),
url(r'^(?P<patientrecord_id>\d+)/healthcare_treatment/(?P<pk>\d+)/update$', 'update_healthcare_treatment'),
url(r'^(?P<patientrecord_id>\d+)/healthcare_treatment/(?P<pk>\d+)/del$', 'delete_healthcare_treatment'),
url(r'^(?P<patientrecord_id>\d+)/healthcare_diagnostic/new$', 'new_healthcare_diagnostic'),
url(r'^(?P<patientrecord_id>\d+)/healthcare_diagnostic/(?P<pk>\d+)/update$', 'update_healthcare_diagnostic'),
url(r'^(?P<patientrecord_id>\d+)/healthcare_diagnostic/(?P<pk>\d+)/del$', 'delete_healthcare_diagnostic'),
url(r'^(?P<patientrecord_id>\d+)/healthcare_notification/new$', 'new_healthcare_notification'),
url(r'^(?P<patientrecord_id>\d+)/healthcare_notification/(?P<pk>\d+)/update$', 'update_healthcare_notification'),
url(r'^(?P<patientrecord_id>\d+)/healthcare_notification/(?P<pk>\d+)/del$', 'delete_healthcare_notification'),
url(r'^(?P<patientrecord_id>\d+)/socialisation/new$', 'new_socialisation_duration'),
url(r'^(?P<patientrecord_id>\d+)/socialisation/(?P<pk>\d+)/update$', 'update_socialisation_duration'),
url(r'^(?P<patientrecord_id>\d+)/socialisation/(?P<pk>\d+)/del$', 'delete_socialisation_duration'),
url(r'^(?P<patientrecord_id>\d+)/state/(?P<pk>\d+)/update$', 'update_patient_state'),
url(r'^(?P<patientrecord_id>\d+)/state/(?P<pk>\d+)/del$', 'delete_patient_state'),
url(r'^(?P<patientrecord_id>\d+)/mdph_request/new$', 'new_mdph_request'),
url(r'^(?P<patientrecord_id>\d+)/mdph_request/(?P<pk>\d+)/update$', 'update_mdph_request'),
url(r'^(?P<patientrecord_id>\d+)/mdph_request/(?P<pk>\d+)/del$', 'delete_mdph_request'),
url(r'^(?P<patientrecord_id>\d+)/mdph_response/new$', 'new_mdph_response'),
url(r'^(?P<patientrecord_id>\d+)/mdph_response/(?P<pk>\d+)/update$', 'update_mdph_response'),
url(r'^(?P<patientrecord_id>\d+)/mdph_response/(?P<pk>\d+)/del$', 'delete_mdph_response'),
url(r'^(?P<patientrecord_id>\d+)/generate$', 'generate_rtf_form'),
url(r'^(?P<patientrecord_id>\d+)/create-directory$', 'create_directory'),
url(r'^(?P<patientrecord_id>\d+)/prescription-transport$', 'prescription_transport'),
url(r'^(?P<patientrecord_id>\d+)/protection/new$', 'new_protection'),
url(r'^(?P<patientrecord_id>\d+)/protection/(?P<pk>\d+)/update$', 'update_protection'),
url(r'^(?P<patientrecord_id>\d+)/protection/(?P<pk>\d+)/del$', 'delete_protection'),)

View File

@ -19,6 +19,7 @@ from django.shortcuts import get_object_or_404
from calebasse import cbv
from calebasse.doc_templates import make_doc_from_template
from calebasse.dossiers import forms
from calebasse.dossiers.views_utils import get_next_rdv, get_last_rdv, get_status
from calebasse.dossiers.transport import render_transport
from calebasse.agenda.models import Event, EventWithAct
from calebasse.actes.models import Act
@ -34,39 +35,6 @@ from calebasse.facturation.list_acts import list_acts_for_billing_CMPP_per_patie
from calebasse.decorators import validator_only
def get_next_rdv(patient_record):
Q = models.Q
today = date.today()
qs = EventWithAct.objects.filter(patient=patient_record) \
.filter(exception_to__isnull=True, canceled=False) \
.filter(Q(start_datetime__gte=today) \
| Q(exceptions__isnull=False) \
| ( Q(recurrence_periodicity__isnull=False) \
& (Q(recurrence_end_date__gte=today) \
| Q(recurrence_end_date__isnull=True) \
))) \
.distinct() \
.select_related() \
.prefetch_related('participants', 'exceptions__eventwithact')
occurrences = []
for event in qs:
occurrences.extend(filter(lambda e: e.start_datetime.date() >= today, event.all_occurences(limit=180)))
occurrences = sorted(occurrences, key=lambda e: e.start_datetime)
if occurrences:
return occurrences[0]
else:
return None
def get_last_rdv(patient_record):
last_rdv = {}
event = Event.objects.last_appointment(patient_record)
if event:
last_rdv['start_datetime'] = event.start_datetime
last_rdv['participants'] = event.participants.all()
last_rdv['act_type'] = event.eventwithact.act_type
last_rdv['act_state'] = event.act.get_state()
last_rdv['is_absent'] = event.is_absent()
return last_rdv
class NewPatientRecordView(cbv.FormView, cbv.ServiceViewMixin):
form_class = forms.NewPatientRecordForm
@ -157,7 +125,9 @@ class UpdatePatientAddressView(cbv.UpdateView):
success_url = '../../view#tab=2'
def form_valid(self, form):
messages.add_message(self.request, messages.INFO, u'Modification enregistrée avec succès.')
messages.add_message(self.request,
messages.INFO,
u'Modification enregistrée avec succès.')
return super(UpdatePatientAddressView, self).form_valid(form)
update_patient_address = UpdatePatientAddressView.as_view()
@ -243,36 +213,18 @@ class StateFormView(cbv.FormView):
state_form = StateFormView.as_view()
class PatientRecordView(cbv.ServiceViewMixin, cbv.MultiUpdateView):
class PatientRecordView(cbv.UpdateView):
model = PatientRecord
forms_classes = {
'general': forms.GeneralForm,
'contact': forms.PatientContactForm,
'id': forms.CivilStatusForm,
'physiology': forms.PhysiologyForm,
'inscription': forms.InscriptionForm,
'out': forms.OutForm,
'family': forms.FamilyForm,
'transport': forms.TransportFrom,
'followup': forms.FollowUpForm,
'policyholder': forms.PolicyHolderForm
}
template_name = 'dossiers/patientrecord_update.html'
success_url = './view'
def get_success_url(self):
if self.request.POST.has_key('tab'):
return self.success_url + '#tab=' + self.request.POST['tab']
else:
return self.success_url
def get_context_data(self, **kwargs):
ctx = super(PatientRecordView, self).get_context_data(**kwargs)
ctx['object'].create_diag_healthcare(self.request.user)
ctx['object'].automated_switch_state(self.request.user)
ctx['initial_state'] = ctx['object'].get_initial_state()
current_state = ctx['object'].get_current_state()
if not current_state:
current_state = ctx['object'].get_state()
ctx['future_state'] = True
if STATES_MAPPING.has_key(current_state.status.type):
state = STATES_MAPPING[current_state.status.type]
else:
@ -282,6 +234,160 @@ class PatientRecordView(cbv.ServiceViewMixin, cbv.MultiUpdateView):
ctx['states'] = FileState.objects.filter(patient=self.object) \
.filter(status__services=self.service) \
.order_by('-date_selected')
return ctx
patient_record = PatientRecordView.as_view()
class PatientRecordGeneralView(cbv.UpdateView):
model = PatientRecord
form_class = forms.GeneralForm
template_name = 'dossiers/patientrecord_tab1_general.html'
success_url = './view'
def get_context_data(self, **kwargs):
ctx = super(PatientRecordGeneralView, self).get_context_data(**kwargs)
ctx['nb_place_of_lifes'] = ctx['object'].addresses.filter(place_of_life=True).count()
ctx['initial_state'] = ctx['object'].get_initial_state()
ctx['last_rdv'] = get_last_rdv(ctx['object'])
ctx['next_rdv'] = get_next_rdv(ctx['object'])
current_state = ctx['object'].get_current_state()
if STATES_MAPPING.has_key(current_state.status.type):
state = STATES_MAPPING[current_state.status.type]
else:
state = current_state.status.name
ctx['current_state'] = current_state
ctx['status'], ctx['hc_status'] = get_status(ctx, self.request.user)
ctx['missing_policy'] = False
if not self.object.policyholder or \
not self.object.policyholder.health_center or \
not self.object.policyholder.social_security_id:
ctx['missing_policy'] = True
ctx['missing_birthdate'] = False
if not self.object.birthdate:
ctx['missing_birthdate'] = True
return ctx
tab1_general = PatientRecordGeneralView.as_view()
class PatientRecordAdmView(cbv.ServiceViewMixin, cbv.MultiUpdateView):
model = PatientRecord
forms_classes = {
'id': forms.CivilStatusForm,
'inscription': forms.InscriptionForm,
'out': forms.OutForm,
'family': forms.FamilyForm,
'transport': forms.TransportFrom,
'followup': forms.FollowUpForm,
}
template_name = 'dossiers/patientrecord_tab2_fiche_adm.html'
success_url = './view#tab=1'
def get_context_data(self, **kwargs):
ctx = super(PatientRecordAdmView, self).get_context_data(**kwargs)
try:
ctx['last_prescription'] = TransportPrescriptionLog.objects.filter(patient=ctx['object']).latest('created')
except:
pass
return ctx
tab2_fiche_adm = PatientRecordAdmView.as_view()
class PatientRecordAddrView(cbv.ServiceViewMixin, cbv.MultiUpdateView):
model = PatientRecord
forms_classes = {
'contact': forms.PatientContactForm,
'policyholder': forms.PolicyHolderForm
}
template_name = 'dossiers/patientrecord_tab3_adresses.html'
success_url = './view#tab=2'
def get_context_data(self, **kwargs):
ctx = super(PatientRecordAddrView, self).get_context_data(**kwargs)
ctx['nb_place_of_lifes'] = ctx['object'].addresses.filter(place_of_life=True).count()
ctx['addresses'] = ctx['object'].addresses.order_by('-place_of_life', 'id')
return ctx
tab3_addresses = PatientRecordAddrView.as_view()
class PatientRecordNotifsView(cbv.DetailView):
model = PatientRecord
template_name = 'dossiers/patientrecord_tab4_notifs.html'
def get_context_data(self, **kwargs):
ctx = super(PatientRecordNotifsView, self).get_context_data(**kwargs)
ctx['status'], ctx['hc_status'] = get_status(ctx, self.request.user)
if ctx['object'].service.slug == "cmpp":
(acts_not_locked, days_not_locked, acts_not_valide,
acts_not_billable, acts_pause, acts_per_hc, acts_losts) = \
list_acts_for_billing_CMPP_per_patient(self.object,
datetime.today(), self.service)
ctx['acts_losts'] = acts_losts
ctx['acts_pause'] = acts_pause
hcs_used = acts_per_hc.keys()
hcs = None
if not hcs_used:
hcs = [(hc, None) for hc in HealthCare.objects.filter(patient=self.object).order_by('-start_date')]
else:
hcs = []
for hc in HealthCare.objects.filter(patient=self.object).order_by('-start_date'):
acts = None
if hasattr(hc, 'cmpphealthcarediagnostic') and hc.cmpphealthcarediagnostic in hcs_used:
acts = acts_per_hc[hc.cmpphealthcarediagnostic]
elif hasattr(hc, 'cmpphealthcaretreatment') and hc.cmpphealthcaretreatment in hcs_used:
acts = acts_per_hc[hc.cmpphealthcaretreatment]
hcs.append((hc, acts))
ctx['hcs'] = []
for hc, acts in hcs:
ctx['hcs'].append((hc, acts, hc.act_set.order_by('date', 'time')))
elif ctx['object'].service.slug == "sessad-ted" or ctx['object'].service.slug == "sessad-dys":
ctx['hcs'] = HealthCare.objects.filter(patient=self.object).order_by('-start_date')
return ctx
tab4_notifs = PatientRecordNotifsView.as_view()
class PatientRecordOldActs(cbv.DetailView):
model = PatientRecord
template_name = 'dossiers/patientrecord_tab5_actes_passes.html'
def get_context_data(self, **kwargs):
ctx = super(PatientRecordOldActs, self).get_context_data(**kwargs)
ctx['last_rdvs'] = []
for act in Act.objects.last_acts(ctx['object']).prefetch_related('doctors'):
state = act.get_state()
if state and not state.previous_state and state.state_name == 'NON_VALIDE':
state = None
missing_workers = []
try:
missing_workers = [participant.worker for participant in act.event.get_missing_participants()]
except:
pass
ctx['last_rdvs'].append((act, state, missing_workers))
history = []
i = 0
for state in ctx['object'].filestate_set.order_by('-date_selected'):
acts = []
try:
while ctx['last_rdvs'][i][0].date >= state.date_selected.date():
acts.append(ctx['last_rdvs'][i])
i += 1
except:
pass
history.append((state, acts))
if i < len(ctx['last_rdvs']) - 1:
history.append((None, ctx['last_rdvs'][i:]))
ctx['history'] = history
return ctx
tab5_old_acts = PatientRecordOldActs.as_view()
class PatientRecordNextAppointmentsView(cbv.DetailView):
model = PatientRecord
template_name = 'dossiers/patientrecord_tab6_next_rdv.html'
def get_context_data(self, **kwargs):
ctx = super(PatientRecordNextAppointmentsView, self).get_context_data(**kwargs)
ctx['next_rdvs'] = []
Q = models.Q
today = date.today()
@ -309,190 +415,23 @@ class PatientRecordView(cbv.ServiceViewMixin, cbv.MultiUpdateView):
if state and not state.previous_state and state.state_name == 'NON_VALIDE':
state = None
ctx['next_rdvs'].append((event, state, event.get_missing_participants()))
if ctx['next_rdvs']:
ctx['next_rdv'] = ctx['next_rdvs'][0][0]
ctx['last_rdvs'] = []
for act in Act.objects.last_acts(ctx['object']).prefetch_related('doctors'):
state = act.get_state()
if state and not state.previous_state and state.state_name == 'NON_VALIDE':
state = None
missing_workers = []
try:
missing_workers = [participant.worker for participant in act.event.get_missing_participants()]
except:
pass
ctx['last_rdvs'].append((act, state, missing_workers))
history = []
i = 0
for state in ctx['object'].filestate_set.order_by('-date_selected'):
acts = []
try:
while ctx['last_rdvs'][i][0].date >= state.date_selected.date():
acts.append(ctx['last_rdvs'][i])
i += 1
except:
pass
history.append((state, acts))
if i < len(ctx['last_rdvs']) -1:
history.append((None, ctx['last_rdvs'][i:]))
ctx['history'] = history
ctx['last_rdv'] = get_last_rdv(ctx['object'])
ctx['missing_policy'] = False
if not self.object.policyholder or \
not self.object.policyholder.health_center or \
not self.object.policyholder.social_security_id:
ctx['missing_policy'] = True
ctx['missing_birthdate'] = False
if not self.object.birthdate:
ctx['missing_birthdate'] = True
ctx['status'] = []
close_btn = STATES_BTN_MAPPER['CLOS']
if 'next_rdv' in ctx:
close_btn = STATES_BTN_MAPPER['CLOS_RDV']
if ctx['object'].service.name == "CMPP":
ctx['can_rediag'] = self.object.create_diag_healthcare(self.request.user)
status = self.object.get_healthcare_status()
highlight = False
if status[0] == -1:
status = 'Indéterminé.'
highlight = True
elif status[0] == 0:
status = "Prise en charge de diagnostic en cours."
elif status[0] == 1:
status = 'Patient jamais pris en charge.'
elif status[0] == 2:
status = "Prise en charge de diagnostic complète, faire une demande de prise en charge de traitement."
highlight = True
elif status[0] == 3:
if ctx['can_rediag']:
status = "Prise en charge de traitement expirée. Patient élligible en rediagnostic."
highlight = True
else:
status = "Prise en charge de traitement expirée. La demande d'un renouvellement est possible."
highlight = True
elif status[0] == 4:
status = "Il existe une prise en charge de traitement mais qui ne prendra effet que le %s." % str(status[1])
elif status[0] == 5:
status = "Prise en charge de traitement en cours."
elif status[0] == 6:
status = "Prise en charge de traitement complète mais qui peut être prolongée."
highlight = True
elif status[0] == 7:
status = "Prise en charge de traitement complète et déjà prolongée, se terminant le %s." % \
formats.date_format(status[2], "SHORT_DATE_FORMAT")
else:
status = 'Statut inconnu.'
ctx['hc_status'] = (status, highlight)
if ctx['object'].last_state.status.type == "ACCUEIL":
# Inscription automatique au premier acte facturable valide
ctx['status'] = [STATES_BTN_MAPPER['FIN_ACCUEIL'],
STATES_BTN_MAPPER['DIAGNOSTIC'],
STATES_BTN_MAPPER['TRAITEMENT']]
elif ctx['object'].last_state.status.type == "FIN_ACCUEIL":
# Passage automatique en diagnostic ou traitement
ctx['status'] = [STATES_BTN_MAPPER['ACCUEIL'],
STATES_BTN_MAPPER['DIAGNOSTIC'],
STATES_BTN_MAPPER['TRAITEMENT']]
elif ctx['object'].last_state.status.type == "DIAGNOSTIC":
# Passage automatique en traitement
ctx['status'] = [STATES_BTN_MAPPER['TRAITEMENT'],
close_btn,
STATES_BTN_MAPPER['ACCUEIL']]
elif ctx['object'].last_state.status.type == "TRAITEMENT":
# Passage automatique en diagnostic si on ajoute une prise en charge diagnostic,
# ce qui est faisable dans l'onglet prise en charge par un bouton visible sous conditions
ctx['status'] = [STATES_BTN_MAPPER['DIAGNOSTIC'],
close_btn,
STATES_BTN_MAPPER['ACCUEIL']]
elif ctx['object'].last_state.status.type == "CLOS":
# Passage automatique en diagnostic ou traitement
ctx['status'] = [STATES_BTN_MAPPER['DIAGNOSTIC'],
STATES_BTN_MAPPER['TRAITEMENT'],
STATES_BTN_MAPPER['ACCUEIL']]
(acts_not_locked, days_not_locked, acts_not_valide,
acts_not_billable, acts_pause, acts_per_hc, acts_losts) = \
list_acts_for_billing_CMPP_per_patient(self.object,
datetime.today(), self.service)
ctx['acts_losts'] = acts_losts
ctx['acts_pause'] = acts_pause
hcs_used = acts_per_hc.keys()
hcs = None
if not hcs_used:
hcs = [(hc, None) for hc in HealthCare.objects.filter(patient=self.object).order_by('-start_date')]
else:
hcs = []
for hc in HealthCare.objects.filter(patient=self.object).order_by('-start_date'):
acts = None
if hasattr(hc, 'cmpphealthcarediagnostic') and hc.cmpphealthcarediagnostic in hcs_used:
acts = acts_per_hc[hc.cmpphealthcarediagnostic]
elif hasattr(hc, 'cmpphealthcaretreatment') and hc.cmpphealthcaretreatment in hcs_used:
acts = acts_per_hc[hc.cmpphealthcaretreatment]
hcs.append((hc, acts))
ctx['hcs'] = []
for hc, acts in hcs:
ctx['hcs'].append((hc, acts, hc.act_set.order_by('date', 'time')))
elif ctx['object'].service.name == "CAMSP":
if ctx['object'].last_state.status.type == "ACCUEIL":
ctx['status'] = [STATES_BTN_MAPPER['FIN_ACCUEIL'],
STATES_BTN_MAPPER['BILAN']]
elif ctx['object'].last_state.status.type == "FIN_ACCUEIL":
ctx['status'] = [STATES_BTN_MAPPER['ACCUEIL'],
STATES_BTN_MAPPER['BILAN'],
STATES_BTN_MAPPER['SURVEILLANCE'],
STATES_BTN_MAPPER['SUIVI'],
close_btn]
elif ctx['object'].last_state.status.type == "BILAN":
ctx['status'] = [STATES_BTN_MAPPER['SURVEILLANCE'],
STATES_BTN_MAPPER['SUIVI'],
close_btn,
STATES_BTN_MAPPER['ACCUEIL']]
elif ctx['object'].last_state.status.type == "SURVEILLANCE":
ctx['status'] = [STATES_BTN_MAPPER['SUIVI'],
close_btn,
STATES_BTN_MAPPER['ACCUEIL'],
STATES_BTN_MAPPER['BILAN']]
elif ctx['object'].last_state.status.type == "SUIVI":
ctx['status'] = [close_btn,
STATES_BTN_MAPPER['ACCUEIL'],
STATES_BTN_MAPPER['BILAN'],
STATES_BTN_MAPPER['SURVEILLANCE']]
elif ctx['object'].last_state.status.type == "CLOS":
ctx['status'] = [STATES_BTN_MAPPER['ACCUEIL'],
STATES_BTN_MAPPER['BILAN'],
STATES_BTN_MAPPER['SURVEILLANCE'],
STATES_BTN_MAPPER['SUIVI']]
elif ctx['object'].service.name == "SESSAD TED" or ctx['object'].service.name == "SESSAD DYS":
if ctx['object'].last_state.status.type == "ACCUEIL":
ctx['status'] = [STATES_BTN_MAPPER['FIN_ACCUEIL'],
STATES_BTN_MAPPER['TRAITEMENT']]
elif ctx['object'].last_state.status.type == "FIN_ACCUEIL":
ctx['status'] = [STATES_BTN_MAPPER['ACCUEIL'],
STATES_BTN_MAPPER['TRAITEMENT'],
close_btn]
elif ctx['object'].last_state.status.type == "TRAITEMENT":
ctx['status'] = [close_btn,
STATES_BTN_MAPPER['ACCUEIL']]
elif ctx['object'].last_state.status.type == "CLOS":
ctx['status'] = [STATES_BTN_MAPPER['ACCUEIL'],
STATES_BTN_MAPPER['TRAITEMENT']]
ctx['hcs'] = HealthCare.objects.filter(patient=self.object).order_by('-start_date')
try:
ctx['last_prescription'] = TransportPrescriptionLog.objects.filter(patient=ctx['object']).latest('created')
except:
pass
ctx['addresses'] = ctx['object'].addresses.order_by('-place_of_life', 'id')
ctx['nb_place_of_lifes'] = ctx['object'].addresses.filter(place_of_life=True).count()
return ctx
def form_valid(self, form):
messages.add_message(self.request, messages.INFO, u'Modification enregistrée avec succès.')
return super(PatientRecordView, self).form_valid(form)
tab6_next_rdv = PatientRecordNextAppointmentsView.as_view()
class PatientRecordSocialisationView(cbv.DetailView):
model = PatientRecord
template_name = 'dossiers/patientrecord_tab7_socialisation.html'
patient_record = PatientRecordView.as_view()
tab7_socialisation = PatientRecordSocialisationView.as_view()
class PatientRecordMedicalView(cbv.ServiceViewMixin, cbv.MultiUpdateView):
model = PatientRecord
forms_classes = {'physiology': forms.PhysiologyForm}
template_name = 'dossiers/patientrecord_tab8_medical.html'
success_url = './view#tab=7'
tab8_medical = PatientRecordMedicalView.as_view()
class PatientRecordsHomepageView(cbv.ListView):
model = PatientRecord

View File

@ -0,0 +1,157 @@
# -*- coding: utf-8 -*-
from datetime import date
from django.db import models
from django.utils import formats
from calebasse.agenda.models import Event, EventWithAct
from calebasse.dossiers.states import STATES_BTN_MAPPER
def get_status(ctx, user):
"""
Return status and hc_status
"""
status = []
close_btn = STATES_BTN_MAPPER['CLOS']
if 'next_rdv' in ctx:
close_btn = STATES_BTN_MAPPER['CLOS_RDV']
if ctx['object'].service.slug == "cmpp":
ctx['can_rediag'] = ctx['object'].create_diag_healthcare(user)
status = ctx['object'].get_healthcare_status()
highlight = False
if status[0] == -1:
status = 'Indéterminé.'
highlight = True
elif status[0] == 0:
status = "Prise en charge de diagnostic en cours."
elif status[0] == 1:
status = 'Patient jamais pris en charge.'
elif status[0] == 2:
status = "Prise en charge de diagnostic complète, faire une demande de prise en charge de traitement."
highlight = True
elif status[0] == 3:
if ctx['can_rediag']:
status = "Prise en charge de traitement expirée. Patient élligible en rediagnostic."
highlight = True
else:
status = "Prise en charge de traitement expirée. La demande d'un renouvellement est possible."
highlight = True
elif status[0] == 4:
status = "Il existe une prise en charge de traitement mais qui ne prendra effet que le %s." % str(status[1])
elif status[0] == 5:
status = "Prise en charge de traitement en cours."
elif status[0] == 6:
status = "Prise en charge de traitement complète mais qui peut être prolongée."
highlight = True
elif status[0] == 7:
status = "Prise en charge de traitement complète et déjà prolongée, se terminant le %s." % \
formats.date_format(status[2], "SHORT_DATE_FORMAT")
else:
status = 'Statut inconnu.'
hc_status = (status, highlight)
if ctx['object'].last_state.status.type == "ACCUEIL":
# Inscription automatique au premier acte facturable valide
status = [STATES_BTN_MAPPER['FIN_ACCUEIL'],
STATES_BTN_MAPPER['DIAGNOSTIC'],
STATES_BTN_MAPPER['TRAITEMENT']]
elif ctx['object'].last_state.status.type == "FIN_ACCUEIL":
# Passage automatique en diagnostic ou traitement
status = [STATES_BTN_MAPPER['ACCUEIL'],
STATES_BTN_MAPPER['DIAGNOSTIC'],
STATES_BTN_MAPPER['TRAITEMENT']]
elif ctx['object'].last_state.status.type == "DIAGNOSTIC":
# Passage automatique en traitement
status = [STATES_BTN_MAPPER['TRAITEMENT'],
close_btn,
STATES_BTN_MAPPER['ACCUEIL']]
elif ctx['object'].last_state.status.type == "TRAITEMENT":
# Passage automatique en diagnostic si on ajoute une prise en charge diagnostic,
# ce qui est faisable dans l'onglet prise en charge par un bouton visible sous conditions
status = [STATES_BTN_MAPPER['DIAGNOSTIC'],
close_btn,
STATES_BTN_MAPPER['ACCUEIL']]
elif ctx['object'].last_state.status.type == "CLOS":
# Passage automatique en diagnostic ou traitement
status = [STATES_BTN_MAPPER['DIAGNOSTIC'],
STATES_BTN_MAPPER['TRAITEMENT'],
STATES_BTN_MAPPER['ACCUEIL']]
elif ctx['object'].service.slug == "camsp":
if ctx['object'].last_state.status.type == "ACCUEIL":
status = [STATES_BTN_MAPPER['FIN_ACCUEIL'],
STATES_BTN_MAPPER['BILAN']]
elif ctx['object'].last_state.status.type == "FIN_ACCUEIL":
status = [STATES_BTN_MAPPER['ACCUEIL'],
STATES_BTN_MAPPER['BILAN'],
STATES_BTN_MAPPER['SURVEILLANCE'],
STATES_BTN_MAPPER['SUIVI'],
close_btn]
elif ctx['object'].last_state.status.type == "BILAN":
status = [STATES_BTN_MAPPER['SURVEILLANCE'],
STATES_BTN_MAPPER['SUIVI'],
close_btn,
STATES_BTN_MAPPER['ACCUEIL']]
elif ctx['object'].last_state.status.type == "SURVEILLANCE":
status = [STATES_BTN_MAPPER['SUIVI'],
close_btn,
STATES_BTN_MAPPER['ACCUEIL'],
STATES_BTN_MAPPER['BILAN']]
elif ctx['object'].last_state.status.type == "SUIVI":
status = [close_btn,
STATES_BTN_MAPPER['ACCUEIL'],
STATES_BTN_MAPPER['BILAN'],
STATES_BTN_MAPPER['SURVEILLANCE']]
elif ctx['object'].last_state.status.type == "CLOS":
status = [STATES_BTN_MAPPER['ACCUEIL'],
STATES_BTN_MAPPER['BILAN'],
STATES_BTN_MAPPER['SURVEILLANCE'],
STATES_BTN_MAPPER['SUIVI']]
elif ctx['object'].service.slug == "sessad-ted" or ctx['object'].service.slug == "sessad-dys":
if ctx['object'].last_state.status.type == "ACCUEIL":
status = [STATES_BTN_MAPPER['FIN_ACCUEIL'],
STATES_BTN_MAPPER['TRAITEMENT']]
elif ctx['object'].last_state.status.type == "FIN_ACCUEIL":
status = [STATES_BTN_MAPPER['ACCUEIL'],
STATES_BTN_MAPPER['TRAITEMENT'],
close_btn]
elif ctx['object'].last_state.status.type == "TRAITEMENT":
status = [close_btn,
STATES_BTN_MAPPER['ACCUEIL']]
elif ctx['object'].last_state.status.type == "CLOS":
status = [STATES_BTN_MAPPER['ACCUEIL'],
STATES_BTN_MAPPER['TRAITEMENT']]
return (status, hc_status)
def get_last_rdv(patient_record):
last_rdv = {}
event = Event.objects.last_appointment(patient_record)
if event:
last_rdv['start_datetime'] = event.start_datetime
last_rdv['participants'] = event.participants.all()
last_rdv['act_type'] = event.eventwithact.act_type
last_rdv['act_state'] = event.act.get_state()
last_rdv['is_absent'] = event.is_absent()
return last_rdv
def get_next_rdv(patient_record):
Q = models.Q
today = date.today()
qs = EventWithAct.objects.filter(patient=patient_record) \
.filter(exception_to__isnull=True, canceled=False) \
.filter(Q(start_datetime__gte=today) \
| Q(exceptions__isnull=False) \
| ( Q(recurrence_periodicity__isnull=False) \
& (Q(recurrence_end_date__gte=today) \
| Q(recurrence_end_date__isnull=True) \
))) \
.distinct() \
.select_related() \
.prefetch_related('participants', 'exceptions__eventwithact')
occurrences = []
for event in qs:
occurrences.extend(filter(lambda e: e.start_datetime.date() >= today, event.all_occurences(limit=180)))
occurrences = sorted(occurrences, key=lambda e: e.start_datetime)
if occurrences:
return occurrences[0]
else:
return None

View File

@ -0,0 +1,91 @@
#tabs-2 select {
width: auto;
height: auto;
}
#tabs-2 table {
width: 100%;
text-align: center;
}
#tabs-3 div {
margin-top: 1em;
position: relative;
}
#tabs-3 div.contact {
margin: 12px;
background: #eee;
padding: 1em;
border-radius: 10px;
}
#tabs-3 div.contact.patient {
background: #ddd;
border-width: 2px;
}
#tabs-3 div.contact h4 {
margin: 0;
}
#contact-add-address {
margin-top: 5px;
margin-left: 10px;
}
div#tabs-3 div.right {
text-align: right;
border: 0;
position: absolute;
top: 20px;
right: 0;
width: 350px;
padding-right: 30px;
}
div#tabs-3 div.right button {
margin-left: 20px;
}
div#tabs-3 div.contact div.right {
padding-right: 18px; /* 30px - 12px */
top: -4px;
}
div#tabs-2 div,
div#tabs-3 div,
div#tabs-4 div.frame,
div#tabs-7 div.frame {
position: relative;
}
#info-membre div button.save,
div.group_holidays button.save,
div#tabs-7 div div.buttons,
div#tabs-4 div div.buttons,
div#tabs-3 div div.buttons,
div#tabs-2 div button.save {
position: absolute;
top: 0;
right: 0;
}
#tabs-2 div.frame div.subframe,
#tabs-7 div.frame div.subframe {
position: relative;
margin: 12px;
background: #eee;
padding: 1em;
border-radius: 10px;
}
div#tabs-3 div div.buttons,
div#tabs-4 div div.buttons {
border: 0;
margin: 0;
}
#tabs-8 form p {
clear: both;
}

View File

@ -706,94 +706,6 @@ div.frame p {
margin: 0 1ex;
}
#tabs-2 select {
width: auto;
height: auto;
}
#tabs-2 table {
width: 100%;
text-align: center;
}
#tabs-3 div {
margin-top: 1em;
position: relative;
}
#tabs-3 div.contact {
margin: 12px;
background: #eee;
padding: 1em;
border-radius: 10px;
}
#tabs-3 div.contact.patient {
background: #ddd;
border-width: 2px;
}
#tabs-3 div.contact h4 {
margin: 0;
}
#contact-add-address {
margin-top: 5px;
margin-left: 10px;
}
div#tabs-3 div.right {
text-align: right;
border: 0;
position: absolute;
top: 20px;
right: 0;
width: 350px;
padding-right: 30px;
}
div#tabs-3 div.right button {
margin-left: 20px;
}
div#tabs-3 div.contact div.right {
padding-right: 18px; /* 30px - 12px */
top: -4px;
}
div#tabs-2 div,
div#tabs-3 div,
div#tabs-4 div.frame,
div#tabs-7 div.frame {
position: relative;
}
#info-membre div button.save,
div.group_holidays button.save,
div#tabs-7 div div.buttons,
div#tabs-4 div div.buttons,
div#tabs-3 div div.buttons,
div#tabs-2 div button.save {
position: absolute;
top: 0;
right: 0;
}
#tabs-2 div.frame div.subframe,
#tabs-7 div.frame div.subframe {
position: relative;
margin: 12px;
background: #eee;
padding: 1em;
border-radius: 10px;
}
div#tabs-3 div div.buttons,
div#tabs-4 div div.buttons {
border: 0;
margin: 0;
}
#info-membre div, div.group_holidays {
position: relative;
}
@ -1281,9 +1193,6 @@ a [class^="icon-"], a [class*=" icon-"] {
overflow-y: scroll;
}
#tabs-8 form p {
clear: both;
}
ul.messages, ul.ajax_messages {
position: absolute;