def areaViewGet(xmlData): areaCode = getAttributeFromXML(xmlData, "areaCode") data = Tbarea.objects.filter(areaCode__startswith=areaCode) if len(data) == 0: print "**API ERROR(areaViewGet): No records with areaCode=%s in DB." % areaCode return '' dataSeri = TbareaSeri(data, many=True) renderer = XMLRenderer() item_name = {0: ["area"]} content = renderer.get_xml(dataSeri.data, item_name) return setXMLSize(content, len(data))
def diabetesFlupViewGet(xmlData): #糖尿病随访查询(M0100070102) specialNo = getAttributeFromXML(xmlData, "specialNo") print(specialNo) data = Tbdiabetesflup.objects.filter(specialNo=specialNo) dataSeri = TbdiabetesflupSeri(data, many=True) renderer = XMLRenderer() item_name = {0: ["diabetesFlup"]} print("xxxxxxxxxxxxxxx2") content = renderer.get_xml(dataSeri.data, item_name) print("xxxxxxxxxxxxxxx1") return setXMLSize(content, len(data))
def medicalorganizationViewGet(xmlData): print xmlData # orgCode = getAttributeFromXML(xmlData, "orgCode") data = Tbmedicalorganization.objects.all() # return all organizations if len(data) == 0: print "**API ERROR(medicalorganizationViewGet): No records DB." return '' dataSeri = TbmedicalorganizationSeri(data, many=True) renderer = XMLRenderer() item_name = {0: ["org"]} content = renderer.get_xml(dataSeri.data, item_name) return setXMLSize(content, len(data))
def userViewGet(xmlData): orgCode = getAttributeFromXML(xmlData, "orgCode") orgObj = Tbmedicalorganization.objects.filter(orgCode=orgCode) data = UserProfile.objects.filter(orgCode=orgObj, type=1) # Only get doctor here. if len(data) == 0: print "**API ERROR(userViewGet): No records with orgCode=%s in DB." % orgCode return '' dataSeri = TbUserSeri(data, many=True) renderer = XMLRenderer() item_name = {0: ["user"]} content = renderer.get_xml(dataSeri.data, item_name) return setXMLSize(content, len(data))
def healexaminationViewGet(xmlData): healthFileNumber = getAttributeFromXML(xmlData, "healthFileNumber") data = Tbhealexamination.objects.filter(healthFileNumber=healthFileNumber) dataSeri = TbhealexaminationSeri(data, many=True) renderer = XMLRenderer() item_name = { 0: ["healthExamination"], 1: ["hospitalized", "familyBed", "medication", "vaccination"] } content = renderer.get_xml(dataSeri.data, item_name) res = delNodeFromXML(content, "healthExamination", "machineCode") res = delNodeFromXML(res, "healthExamination", "machineNo") return setXMLSize(res, len(data))
def hypertensionFlupViewGet(xmlData): specialNo = getAttributeFromXML(xmlData, "specialNo") print(specialNo) data = Tbhypertensionflup.objects.filter(specialNo=specialNo) dataSeri = TbhypertensionflupSeri(data, many=True) renderer = XMLRenderer() item_name = {0: ["hypertensionFlup"]} print("xxxxxxxxxxxxxxx2") content = renderer.get_xml(dataSeri.data, item_name) print(content) print("xxxxxxxxxxxxxxx1") # content = delNodeFromXML(content, "hypertensionFlup", "specialNo") content = delNodeFromXML(content, "hypertensionFlup", "healthFileNumber") print content return setXMLSize(content, len(data))
def hypertensionSpecialViewGet(xmlData): specialNo = getAttributeFromXML(xmlData, "specialNo") print(specialNo) data = Tbhypertensionspecial.objects.filter(specialNo=specialNo) dataSeri = TbhypertensionspecialSeri(data, many=True) renderer = XMLRenderer() item_name = {0: ["hypertensionSpecial"]} print("xxxxxxxxxxxxxxx2") content = renderer.get_xml(dataSeri.data, item_name) print(content) print("xxxxxxxxxxxxxxx1") res = delNodeFromXML(content, "hypertensionSpecial", "householdRegisterCode") res = delNodeFromXML(res, "hypertensionSpecial", "responsibleDoctorCode") res = delNodeFromXML(res, "hypertensionSpecial", "organization") res = delNodeFromXML(res, "hypertensionSpecial", "mechineCode") res = delNodeFromXML(res, "hypertensionSpecial", "mechineNo") res = delNodeFromXML(res, "hypertensionSpecial", "genderCode") print res return setXMLSize(res, len(data))
def diabetesSpecialViewGet(xmlData): #糖尿病专项查询 print("11111111111111") specialNo = getAttributeFromXML(xmlData, "specialNo") print(specialNo) data = TbdiabetesSpecial.objects.filter(specialNo=specialNo) print("xxxxxxxxxxxxxxx5") dataSeri = TbdiabetesSpecialSeri(data, many=True) print("xxxxxxxxxxxxxxx4") renderer = XMLRenderer() print("xxxxxxxxxxxxxxx3") item_name = {0: ["diabetesSpecial"]} print("xxxxxxxxxxxxxxx2") content = renderer.get_xml(dataSeri.data, item_name) print(content) print("xxxxxxxxxxxxxxx1") return setXMLSize(content, len(data))
def healthRecordViewGet(xmlData): # use area code to get data # householdRegisterCode = getAttributeFromXML(xmlData, "householdRegisterCode") # area = Tbarea.objects.filter(areaCode=householdRegisterCode) # data = Tbhealthrecord.objects.filter(householdRegisterCode=area) # use doctor id to get data responsibleDoctorCode = getAttributeFromXML(xmlData, "responsibleDoctorCode") print '++++======================R' print(responsibleDoctorCode) doctor = UserProfile.objects.filter(id=(int)(responsibleDoctorCode)) data = Tbhealthrecord.objects.filter(responsibleDoctorCode=doctor) dataSeri = TbhealthrecordSeri(data, many=True) renderer = XMLRenderer() item_name = {0: ["healthRecord"], 1: ["pastHistory"]} content = renderer.get_xml(dataSeri.data, item_name) res = delNodeFromXML(content, "healthRecord", "machineCode") res = delNodeFromXML(res, "healthRecord", "machineNo") print res return setXMLSize(res, len(data))