示例#1
0
    def _get_patient(self, id_):
        """Deprecated"""
        patient = Patient.objects(id_patient=str(id_))

        #TODO: Is there a more elegant way to deal with that?
        if len(patient) == 0:
            logger.error('No Patient in the database')
            return 'ERR'

        self._currentPatient = patient.first()
        return patient
示例#2
0
    def read(self, **query):

        # TODO: Check query fields!

        if 'id_patient' in query.keys():
            query['id_patient'] = str(query['id_patient'])

        # return only present patients!
        query['status'] = 'Attivo'

        patients = Patient.objects(**query)

        # Patient list empty
        if patients.count() == 0:
            message = Message(PatientNoRecordHeader(), data=patients)
            logger.error(message.header.message)
            return message

        message = Message(PatientCorrectHeader(), data=patients)

        return message