예제 #1
0
 def get_notes_info(self, name):
     details = []
     qnotes = []
     if self.queue_notes:
         qnotes = map(lambda x: u' - '.join([x.note, x.byline]),
                      self.queue_notes)
         details.extend([qnotes.pop(0), '-' * 20])
     if self.encounter:
         details.extend(['Encounter started: %s' % (
                    localtime(self.encounter.start_time).strftime('%F %T'),),
                    '    %s' % self.encounter.short_summary])
     elif self.appointment:
         a = self.appointment
         details.extend(
             [u' '.join(x) for x in [
                 (u'Appointment: ',
                  localtime(a.appointment_date).strftime('%F %T')),
                 (u'    Specialty: ', a.speciality.name),
                 (u'    Status: ', a.state)]])
         if a.visit_reason:
             details.insert(-2, ' '.join((u'    Reason for visit:',
                                          a.visit_reason.rec_name)))
         # details.append('')
     # else:
     if self.triage_entry:
         details.append('Triage, first contact: %s,\n    status: %s' % (
                        localtime(
                            self.triage_entry.create_date).strftime('%F %T'),
                        self.triage_entry.status_display))
         details.extend(['    %s' % x for x in
                         filter(None, [self.triage_entry.complaint,
                                       self.triage_entry.notes])])
     if qnotes:
         details.extend(['-' * 20] + qnotes)
     return u'\n'.join(details)
예제 #2
0
    def do_goto_notification(self, action):

        enctr_id, encounter = self._get_active_encounter()

        # Does the notification entry already exist?
        notification = Pool().get('gnuhealth.disease_notification').search([
            ('encounter', '=', enctr_id)
        ])
        if notification:
            rd = {'active_id': notification[0].id}
            action['res_id'] = rd['active_id']
        else:
            now = datetime.now()
            patient = encounter.patient
            facility = encounter.institution
            rd = {}
            action['pyson_domain'] = PYSONEncoder().encode([
                ('encounter', '=', enctr_id), ('patient', '=', patient.id),
                ('reporting_facility', '=', facility.id),
                ('date_notified', '=', localtime(now).strftime('%F %T'))
            ])
            action['pyson_context'] = PYSONEncoder().encode({
                'encounter':
                enctr_id,
                'patient':
                patient.id,
                'reporting_facility':
                facility.id,
                'date_notified':
                now
            })

        return action, rd
예제 #3
0
 def get_writeinfo(cls, instances, name):
     if name == 'created':
         conv = lambda x: (x.id, x.write_date and x.write_date or x.
                           create_date)
     elif name == 'creator':
         conv = lambda x: (x.id, x.write_uid.name
                           if x.write_uid else x.create_uid.name)
     elif name == 'byline':
         conv = lambda x: (x.id, u'%s, %s' % (localtime(
             x.create_date).strftime('%Y-%m-%d %H:%M'), x.create_uid.name))
     else:
         conv = lambda x: (x.id, None)
     return dict(map(conv, instances))
예제 #4
0
 def get_start_time_time(self, name):
     # return self.start_time.strftime('%H:%M')
     return utils.localtime(self.start_time).time()
예제 #5
0
 def get_rec_name(self, name):
     localstart = utils.localtime(self.start_time)
     line = ['EV%05d' % self.id, self.patient.name.name,
             '(%s /MRN:%s)' % (self.upi, self.medical_record_num),
             self.sex_display, self.age, 'on %s' % localstart.ctime()]
     return ' '.join(line)
예제 #6
0
 def get_first_time_contact(self, name):
     '''This method gets the date and time 
        this person was first made contact
        with by the attending staff'''
     return localtime(self.create_date).strftime('%F %T')