Mercurial > hgweb > health
changeset 3569:18af72df5cbe
task #15563: Assign health condition from a confirmed lab. Health_crypto_lab
health_crypto_lab:
Once the lab test is VALIDATED, and the confirmed pathology is enter in the lab test, the following events will be automatically triggered:
-> A new health condition will be created in the patient history, with the condition confirmed, and the link to the the lab test.
-> Two pages of life (PoL) will be created:
One for the Lab test
One for the Health condition
Remember that the validation functionality of the lab test requires the health_crypto_lab.
| author | Luis Falcon <falcon@gnuhealth.org> |
|---|---|
| date | Sun, 05 Apr 2020 20:15:29 +0100 |
| parents | e8a18c4ad9b2 |
| children | f09b60b3525b |
| files | tryton/health_crypto_lab/health_crypto_lab.py tryton/health_lab/health_lab.py |
| diffstat | 2 files changed, 28 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/tryton/health_crypto_lab/health_crypto_lab.py +++ b/tryton/health_crypto_lab/health_crypto_lab.py @@ -176,6 +176,12 @@ if (document.patient.name.federation_account): cls.create_lab_pol (document) + # Create Health condition to the patient + # if there is a confirmed pathology associated and + # validated to the lab test result + if (document.pathology): + cls.create_health_condition (document) + @classmethod def get_serial(cls,document): @@ -241,6 +247,27 @@ 'invisible': Not(Eval('state') == 'validated'), })] + @classmethod + def create_health_condition(cls, lab_info): + """ Create the health condition when specified and + validated in the lab test + """ + HealthCondition = Pool().get('gnuhealth.patient.disease') + health_condition = [] + + vals = { + 'name': lab_info.patient.id, + 'pathology': lab_info.pathology, + 'diagnosed_date': lab_info.date_analysis.date(), + 'lab_confirmed': True, + 'lab_test': lab_info.id, + 'extra_info': lab_info.diagnosis, + 'healthprof': lab_info.requestor + } + + health_condition.append(vals) + HealthCondition.create(health_condition) + @classmethod def create_lab_pol(cls,lab_info):
--- a/tryton/health_lab/health_lab.py +++ b/tryton/health_lab/health_lab.py @@ -349,7 +349,7 @@ class GnuHealthPatientLabTest(ModelSQL, ModelView): 'Patient Lab Test' __name__ = 'gnuhealth.patient.lab.test' - + name = fields.Many2One('gnuhealth.lab.test_type', 'Test Type', required=True, select=True) date = fields.DateTime('Date', select=True)
