def patient_list(request): logging.info("entering patient list proc") username = request.REQUEST.get("username", None) password = request.REQUEST.get("password", None) omrs = openmrs.OpenMRS(username, password, settings.OPENMRS_SERVER_URL) try: patients_xml = omrs.get_all_patients() data = patient.parse_patient_list_xml(patients_xml) logging.info("we finished getting the patient list") response = json_succeed(data) except Exception, e: logging.error("Got exception while fetching patient list: %s" % e) response = json_fail("Problem while getting patient list: %s" % e)
def patient_list(request): logging.info("entering patient list proc") username = request.REQUEST.get("username", None) password = request.REQUEST.get("password", None) omrs = openmrs.OpenMRS(username,password, settings.OPENMRS_SERVER_URL) try: patients_xml = omrs.get_all_patients() data = patient.parse_patient_list_xml(patients_xml) logging.info("we finished getting the patient list") response = json_succeed(data) except Exception, e: logging.error("Got exception while fetching patient list: %s" % e) response = json_fail("Problem while getting patient list: %s" % e)
def read(self, request, patient_id=None): # Get patient by ID. username = request.REQUEST.get("username", None) password = request.REQUEST.get("password", None) logging.info("Setting up EMR connection. Username: %s Password: %s" % (username, password)) omrs = openmrs.OpenMRS(username,password, settings.OPENMRS_SERVER_URL) try: if patient_id is None: logging.info("Looking up all patients.") patients_xml = omrs.get_all_patients() logging.info("Got response from EMR: %s" % patients_xml) data = patient.parse_patient_list_xml(patients_xml) else: logging.info("Looking up patient id %s." % patient_id) patient_xml = omrs.get_patient(patient_id) logging.debug("Patient data returned by OpenMRS: %s" % patient_xml) data = patient.parse_patient_xml(patient_xml) response = succeed(data) except Exception, e: logging.error("Got error %s" % e) response = fail("couldn't get patient")
def read(self, request, patient_id=None): # Get patient by ID. username = request.REQUEST.get("username", None) password = request.REQUEST.get("password", None) logging.info("Setting up EMR connection. Username: %s Password: %s" % (username, password)) omrs = openmrs.OpenMRS(username, password, settings.OPENMRS_SERVER_URL) try: if patient_id is None: logging.info("Looking up all patients.") patients_xml = omrs.get_all_patients() logging.info("Got response from EMR: %s" % patients_xml) data = patient.parse_patient_list_xml(patients_xml) else: logging.info("Looking up patient id %s." % patient_id) patient_xml = omrs.get_patient(patient_id) logging.debug("Patient data returned by OpenMRS: %s" % patient_xml) data = patient.parse_patient_xml(patient_xml) response = succeed(data) except Exception, e: logging.error("Got error %s" % e) response = fail("couldn't get patient")