changeset 4805:32b3669a34d7

health_imaging: Complete task #16083: include context field in the Dx imaging study order
author Luis Falcon <falcon@gnuhealth.org>
date Sat, 27 Nov 2021 13:19:23 +0000
parents fbe1c9f5483e
children 2c318d8123f1
files tryton/health_imaging/health_imaging.py tryton/health_imaging/view/imaging_test_request_form.xml tryton/health_imaging/view/imaging_test_request_tree.xml tryton/health_imaging/view/patient_imaging_test_request_start_form.xml tryton/health_imaging/wizard/wizard_health_imaging.py tryton/health_services_imaging/wizard/wizard_health_services.py
diffstat 6 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tryton/health_imaging/health_imaging.py
+++ b/tryton/health_imaging/health_imaging.py
@@ -77,6 +77,12 @@
         ('requested', 'Requested'),
         ('done', 'Done'),
         ], 'State', readonly=True)
+
+    context = fields.Many2One('gnuhealth.pathology', 'Context',
+        help="Health context for this order. It can be a suspected or"
+             " existing health condition, a regular health checkup, ...",
+             select=True)
+
     comment = fields.Text('Additional Information')
     request = fields.Char('Order', readonly=True)
     urgent = fields.Boolean('Urgent')
--- a/tryton/health_imaging/view/imaging_test_request_form.xml
+++ b/tryton/health_imaging/view/imaging_test_request_form.xml
@@ -12,6 +12,8 @@
     <field name="requested_test"/>
     <label name="doctor"/>
     <field name="doctor"/>
+    <label name="context"/>
+    <field name="context"/>
     <group col="5" colspan="4" id="imaging_request_buttons">
         <label name="state"/>
         <field name="state"/>
--- a/tryton/health_imaging/view/imaging_test_request_tree.xml
+++ b/tryton/health_imaging/view/imaging_test_request_tree.xml
@@ -4,6 +4,7 @@
     <field name="patient" expand="1"/>
     <field name="date" widget="date"/>
     <field name="requested_test" expand="1"/>
+    <field name="context" expand="1"/>
     <field name="doctor"/>
     <field name="state"/>
     <field name="urgent"/>
--- a/tryton/health_imaging/view/patient_imaging_test_request_start_form.xml
+++ b/tryton/health_imaging/view/patient_imaging_test_request_start_form.xml
@@ -6,6 +6,8 @@
     <field name="urgent"/>
     <label name="patient"/>
     <field name="patient"/>
+    <label name="context"/>
+    <field name="context"/>
     <label name="doctor"/>
     <field name="doctor" widget="selection"/>
     <newline/>
--- a/tryton/health_imaging/wizard/wizard_health_imaging.py
+++ b/tryton/health_imaging/wizard/wizard_health_imaging.py
@@ -83,6 +83,10 @@
     patient = fields.Many2One('gnuhealth.patient', 'Patient', required=True)
     doctor = fields.Many2One('gnuhealth.healthprofessional', 'Health prof',
         required=True, help="Health professionalwho requests the lab tests.")
+    context = fields.Many2One('gnuhealth.pathology', 'Context',
+        help="Health context for this order. It can be a suspected or"
+             " existing health condition, a regular health checkup, ...",
+             select=True)
     tests = fields.Many2Many('gnuhealth.request-imaging-test', 'request',
         'test', 'Tests', required=True)
     urgent = fields.Boolean('Urgent')
@@ -131,6 +135,9 @@
             imaging_test['patient'] = self.start.patient.id
             if self.start.doctor:
                 imaging_test['doctor'] = self.start.doctor.id
+            if self.start.context:
+                imaging_test['context'] = self.start.context.id
+
             imaging_test['date'] = self.start.date
             imaging_test['urgent'] = self.start.urgent
             imaging_tests.append(imaging_test)
--- a/tryton/health_services_imaging/wizard/wizard_health_services.py
+++ b/tryton/health_services_imaging/wizard/wizard_health_services.py
@@ -68,6 +68,8 @@
             imaging_test['patient'] = self.start.patient.id
             if self.start.doctor:
                 imaging_test['doctor'] = self.start.doctor.id
+            if self.start.context:
+                imaging_test['context'] = self.start.context.id
             imaging_test['date'] = self.start.date
             imaging_test['urgent'] = self.start.urgent
             if self.start.service: