Mercurial > hgweb > health
changeset 1955:a13197c4d428
task #13483: Save checked-in time, compute the wait time, display on patient eval
| author | Chris Zimmerman <siv@riseup.net> |
|---|---|
| date | Fri, 29 May 2015 16:22:55 -0700 |
| parents | 64e1ee26c949 |
| children | dc19c79327af |
| files | tryton/health/health.py tryton/health/view/gnuhealth_patient_evaluation.xml |
| diffstat | 2 files changed, 34 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tryton/health/health.py +++ b/tryton/health/health.py @@ -2855,6 +2855,8 @@ appointment_date = fields.DateTime('Date and Time') + checked_in_date = fields.DateTime('Checked-in Time') + institution = fields.Many2One( 'gnuhealth.institution', 'Institution', help='Health Care Institution') @@ -2935,6 +2937,10 @@ values['name'] = Sequence.get_id( config.appointment_sequence.id) + #Update the checked-in time + if values.get('state') == 'checked_in': + values['checked_in_date'] = datetime.now() + return super(Appointment, cls).write(appointments, values) @classmethod @@ -4011,6 +4017,23 @@ return duration + def get_wait_time(self, name): #3.6 + # Compute wait time between checked-in and start of evaluation + if self.evaluation_date: + if self.evaluation_date.checked_in_date: + if self.evaluation_date.checked_in_date < self.evaluation_start: + return self.evaluation_start-self.evaluation_date.checked_in_date + + def get_string_wait_time(self, name): #3.4 + # Compute the string for the wait time + duration = '' + if self.evaluation_date: + if self.evaluation_date.checked_in_date: + if self.evaluation_date.checked_in_date < self.evaluation_start: + delta=self.evaluation_start-self.evaluation_date.checked_in_date + duration = str(int(round(delta.total_seconds()/60))) + return duration + patient = fields.Many2One('gnuhealth.patient', 'Patient', states = STATES) @@ -4032,6 +4055,15 @@ help="Duration of the evaluation, in minutes"), 'evaluation_duration') + # 3.6 + #wait_time = fields.Function(fields.TimeDelta('Patient wait time'), + #help="How long the patient waited"), + #'get_wait_time') + # 3.4 + wait_time = fields.Function(fields.Char('Patient wait time', + help="How long the patient waited, in minutes"), + 'get_string_wait_time') + state = fields.Selection([ ('in_progress', 'In progress'), ('done', 'Done'),
--- a/tryton/health/view/gnuhealth_patient_evaluation.xml +++ b/tryton/health/view/gnuhealth_patient_evaluation.xml @@ -11,6 +11,8 @@ <field name="healthprof"/> <label name="evaluation_start"/> <field name="evaluation_start"/> + <label name="wait_time"/> + <field name="wait_time"/> </group> <newline/> <separator colspan="4" id="separator_chief_complaint"/>
