76 lines
2.7 KiB
Diff
76 lines
2.7 KiB
Diff
|
# HG changeset patch
|
||
|
# User Luis Falcon <falcon@gnuhealth.org>
|
||
|
# Date 1586114129 -3600
|
||
|
# Node ID 18af72df5cbef5adb45559c3c469f53bf40013a5
|
||
|
# Parent e8a18c4ad9b29a7f6af3a3ff3bd5d127c590e135
|
||
|
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.
|
||
|
|
||
|
diff --git a/health_crypto_lab/health_crypto_lab.py b/health_crypto_lab/health_crypto_lab.py
|
||
|
--- a/health_crypto_lab/health_crypto_lab.py
|
||
|
+++ b/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):
|
||
|
diff --git a/health/health.py b/health/health.py
|
||
|
--- a/health/health.py
|
||
|
+++ b/health/health.py
|
||
|
@@ -3476,6 +3476,7 @@
|
||
|
'node': condition_info.institution and condition_info.institution.name.rec_name
|
||
|
}
|
||
|
if (condition_info.pathology):
|
||
|
+ vals['health_condition'] = condition_info.pathology
|
||
|
vals['health_condition_text'] = condition_info.pathology.rec_name
|
||
|
vals['health_condition_code'] = condition_info.pathology.code
|
||
|
|