Mercurial > hgweb > health
changeset 3567:79084d43ec44
health_lab: task #15563: Assign health condition from a confirmed lab
* Include the lab_confirmed and lab test ID reference on the patient health condition model
* Include in the tree view lab confirmed conditions
* Search/ filter by lab confirmed pathologies
* Include the pathology in the patient lab test form
| author | Luis Falcon <falcon@gnuhealth.org> |
|---|---|
| date | Fri, 03 Apr 2020 23:26:26 +0100 |
| parents | bf15b71efbd4 |
| children | e8a18c4ad9b2 |
| files | tryton/health_lab/__init__.py tryton/health_lab/health_lab.py tryton/health_lab/health_lab_view.xml tryton/health_lab/view/gnuhealth_lab.xml tryton/health_lab/view/gnuhealth_patient_health_condition_form.xml tryton/health_lab/view/gnuhealth_patient_health_condition_tree.xml |
| diffstat | 6 files changed, 59 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/tryton/health_lab/__init__.py +++ b/tryton/health_lab/__init__.py @@ -40,6 +40,7 @@ CreateLabTestOrderInit, RequestTest, RequestPatientLabTestStart, + PatientHealthCondition, module='health_lab', type_='model') Pool.register( CreateLabTestOrder,
--- a/tryton/health_lab/health_lab.py +++ b/tryton/health_lab/health_lab.py @@ -27,12 +27,12 @@ from trytond.pool import Pool from trytond import backend from trytond.tools.multivalue import migrate_property - +from trytond.pyson import Eval, Not, Bool, PYSONEncoder, Equal, And, Or, If __all__ = ['GnuHealthSequences', 'GnuHealthSequenceSetup', 'PatientData', 'TestType', 'Lab', 'GnuHealthLabTestUnits', 'GnuHealthTestCritearea', - 'GnuHealthPatientLabTest'] + 'GnuHealthPatientLabTest','PatientHealthCondition'] sequences = ['lab_sequence', 'lab_request_sequence'] @@ -80,7 +80,7 @@ lab_sequence = fields.Many2One('ir.sequence', 'Lab Result Sequence', required=True, domain=[('code', '=', 'gnuhealth.lab')]) - + @classmethod def __register__(cls, module_name): TableHandler = backend.get('TableHandler') @@ -112,7 +112,7 @@ ModelData = pool.get('ir.model.data') return ModelData.get_id( 'health_lab', 'seq_gnuhealth_lab_test') - + # END SEQUENCE SETUP , MIGRATION FROM FIELDS.MultiValue @@ -194,6 +194,11 @@ date_analysis = fields.DateTime('Date of the Analysis', select=True) request_order = fields.Integer('Request', readonly=True) + pathology = fields.Many2One( + 'gnuhealth.pathology', 'Pathology', + help='Pathology confirmed / associated to this lab test. ' + 'If set, a new health condition will be generated for the person') + analytes_summary = \ fields.Function(fields.Text('Summary'), 'get_analytes_summary') @@ -415,3 +420,18 @@ default['date'] = cls.default_date() return super(GnuHealthPatientLabTest, cls).copy(tests, default=default) + +class PatientHealthCondition(ModelSQL, ModelView): + 'Patient Conditions History' + __name__ = 'gnuhealth.patient.disease' + + # Adds lab confirmed and the link to the test to the + # Patient health Condition + + lab_confirmed = fields.Boolean('Lab Confirmed', help='Confirmed by' + ' laboratory test') + + lab_test = fields.Many2One('gnuhealth.lab','Lab Test', + domain=[('patient', '=', Eval('name'))], depends=['name'], + states={'invisible': Not(Bool(Eval('lab_confirmed')))}, + help='Lab test that confirmed the condition')
--- a/tryton/health_lab/health_lab_view.xml +++ b/tryton/health_lab/health_lab_view.xml @@ -194,5 +194,19 @@ <field name="action" ref="act_patient_lab_history_form1"/> </record> +<!-- PATIENT HEALTH CONDITION --> + + <record model="ir.ui.view" id="view_gnuhealth_patient_diseases_view_form"> + <field name="model">gnuhealth.patient.disease</field> + <field name="inherit" ref="health.gnuhealth_patient_diseases_view_form"/> + <field name="name">gnuhealth_patient_health_condition_form</field> + </record> + + <record model="ir.ui.view" id="tree_gnuhealth_patient_diseases"> + <field name="model">gnuhealth.patient.disease</field> + <field name="inherit" ref="health.gnuhealth_patient_diseases_tree"/> + <field name="name">gnuhealth_patient_health_condition_tree</field> + </record> + </data> </tryton>
--- a/tryton/health_lab/view/gnuhealth_lab.xml +++ b/tryton/health_lab/view/gnuhealth_lab.xml @@ -20,6 +20,9 @@ <field name="requestor"/> <label name="request_order"/> <field name="request_order"/> + <label name="pathology"/> + <field name="pathology"/> + <newline/> <field name="critearea" colspan="4" view_ids="health_lab.test_critearea_view_tree_lab,health_lab.test_critearea_view_form_lab"/> </page> <page string="Extra Info" id="lab_extra_info">
new file mode 100644 --- /dev/null +++ b/tryton/health_lab/view/gnuhealth_patient_health_condition_form.xml @@ -0,0 +1,11 @@ +<?xml version="1.0"?> +<data> + <xpath expr="/form/group[@id="group_related_evaluations"]" position="before"> + <group string="Laboratory" colspan="4" id="group_lab_info"> + <label name="lab_confirmed"/> + <field name="lab_confirmed"/> + <label name="lab_test"/> + <field name="lab_test"/> + </group> + </xpath> +</data>
