def test_ipt_21(self): # f2的检验,一组内两个药的生效时间分别为f3,d,第一个切片ccr90(预设值),第二个切片ccr为3,那么ccr取3 tem = Template() tem.send_data('ipt_ccr', '18', **tem.change_data) engineid = tem.get_ipt_engineid('ipt_ccr', '19', 1) res = tem.get_ipt_patient(engineid, 0) print(json.dumps(res, indent=2, sort_keys=False, ensure_ascii=False)) self.assertEqual(res['data']['ccr'], "3.0") ids = [engineid] tem.audit_multi(3, *ids) res = tem.get_ipt_patient(engineid, 1) self.assertEqual(res['data']['ccr'], "3.0")
def test_ipt_09(self): # 将生命体征数据作废,则体重只会从就诊信息取 tem = Template() tem.send_data('ipt_ccr', 'd1', **tem.change_data) engineid = tem.get_ipt_engineid('ipt_ccr', 'c2', 1) res = tem.get_ipt_patient(engineid, 0) print(json.dumps(res, indent=2, sort_keys=False, ensure_ascii=False)) patient = res['data'] self.assertEqual(patient['ccr'], "38.0139(计算值)") ids = [engineid] tem.audit_multi(3, *ids) res = tem.get_ipt_patient(engineid, 1) patient = res['data'] self.assertEqual(patient['ccr'], "38.0139(计算值)")
def test_ipt_07(self): # 同一xml就诊信息、生命体征都传身高体重,则取生命体征。非同一xml则就诊信息和生命体征取最新的一个 tem = Template() tem.send_data('ipt_ccr', 'b1', **tem.change_data) engineid = tem.get_ipt_engineid('ipt_ccr', 'b2', 2) res = tem.get_ipt_patient(engineid, 0) print(json.dumps(res, indent=2, sort_keys=False, ensure_ascii=False)) patient = res['data'] self.assertEqual(patient['ccr'], "38.0139(计算值)") ids = [engineid] tem.audit_multi(3, *ids) res = tem.get_ipt_patient(engineid, 1) patient = res['data'] self.assertEqual(patient['ccr'], "38.0139(计算值)")
def test_ipt_22(self): # 医嘱生效时间前有两个检验,则取最新的检验,且如果ccr和血肌酐都有则取ccr tem = Template() cal_ccr = Ccr(tem.get_ymd(0, 0), '1994-03-05') c1 = cal_ccr.ccr_calculate(sex='女', unit='mg/dL', age=cal_ccr.y,weight=60, scr=1) print(c1) tem.send_data('ipt_ccr', 'e1', **tem.change_data) tem.send_data('ipt_ccr', 'e2', **tem.change_data) engineid = tem.get_ipt_engineid('ipt_ccr', 'e3', 1) res = tem.get_ipt_patient(engineid, 0) print(json.dumps(res, indent=2, sort_keys=False, ensure_ascii=False)) # try: self.assertEqual(res['data']['ccr'], "4.0") # except AssertionError as e: # print(e) ids = [engineid] tem.audit_multi(3, *ids) res = tem.get_ipt_patient(engineid, 1) self.assertEqual(res['data']['ccr'], "4.0")
def test_ipt_03(self): # 同一患者两个任务,ccr需要能更新 --测试通过 tem = Template() engineid1 = tem.get_ipt_engineid('ipt_ccr', 'a1', 1) # 任务一,不传身高 体重 取身高/体重/ccr预设值 res = tem.get_ipt_patient(engineid1, 0) print(json.dumps(res, indent=2, sort_keys=False, ensure_ascii=False)) patient = res['data'] self.assertEqual(patient['ccr'], "90.0(预设值)") tem.send_data('ipt_ccr', 'a2', **tem.change_data) # 传patient+生命体征 tem.send_data('ipt_ccr', 'a3', **tem.change_data) # 再传生命体征 engineid2 = tem.get_ipt_engineid('ipt_ccr', 'a4', 2) # 任务二有scr,取a3的身高体重,且a3的体重去计算ccr res = tem.get_ipt_patient(engineid2, 0) patient = res['data'] self.assertEqual(patient['ccr'], "38.0139(计算值)") ids = [engineid1, engineid2] tem.audit_multi(3, *ids) res = tem.get_ipt_patient(engineid1, 1) patient = res['data'] self.assertEqual(patient['ccr'], "90.0(预设值)") res = tem.get_ipt_patient(engineid2, 1) patient = res['data'] self.assertEqual(patient['ccr'], "38.0139(计算值)")
def test_ipt_24(self): tem = Template() # 待审医嘱作为合并医嘱被删除后,原任务重新跑引擎,ccr值在已审页面展示正确 tem.send_data('ipt_delete', 'a2', **tem.change_data) # 发药嘱 tem.send_data('ipt_delete', 'a1', **tem.change_data) # 发草药嘱 tem.send_delete_1('ipt_delete', 'a4', **tem.change_data) # 删除药嘱 # 待审页面获取药嘱的引擎id param = { "patientId": tem.change_data['{{ts}}'] } url = tem.conf.get('auditcenter', 'address') + tem.conf.get('api', '查询待审住院任务列表') res = tem.post_json(url, param) engineid = res['data']['engineInfos'][0]['id'] res = tem.get_ipt_patient(engineid, 0) print(json.dumps(res, indent=2, sort_keys=False, ensure_ascii=False)) # try: self.assertEqual(res['data']['ccr'], "90.0(预设值)") # except AssertionError as e: # print(e) ids = [engineid] tem.audit_multi(3, *ids) res = tem.get_ipt_patient(engineid, 1) self.assertEqual(res['data']['ccr'], "90.0(预设值)")
class TestDelete(unittest.TestCase): def setUp(self): warnings.simplefilter("ignore", ResourceWarning) self.tem = Template() def test_opt_01(self): '''审核打回(双签),医生删除处方''' engineid = self.tem.get_opt_engineid('opt','处方一',1) # 审核打回 self.tem.opt_audit(engineid,1) self.tem.send_delete_1('doctor','opt_del_1',**self.tem.change_data) res = self.tem.get_opt_auditresult(engineid,1) self.assertEqual(0,res['data'][0]['rejectStatus']) def test_opt_02(self): '''审核打回,医生删除处方''' engineid = self.tem.get_opt_engineid('opt','处方一',1) # 审核打回 self.tem.opt_audit(engineid,0) self.tem.send_delete_1('doctor','opt_del_1',**self.tem.change_data) res = self.tem.get_opt_auditresult(engineid,1) self.assertEqual(0,res['data'][0]['rejectStatus']) def test_opt_03(self): '''审核通过,医生删除处方''' engineid = self.tem.get_opt_engineid('opt','处方一',1) # 审核打回 self.tem.opt_audit(engineid,2) self.tem.send_delete_1('doctor','opt_del_1',**self.tem.change_data) res = self.tem.get_opt_auditresult(engineid,1) self.assertEqual(0,res['data'][0]['rejectStatus']) def test_opt_04(self): '''审核打回,医生修改处方''' engineid = self.tem.get_opt_engineid('opt','处方一',1) # 审核打回 self.tem.opt_audit(engineid,0) self.tem.send_data('opt','修改处方一1',**self.tem.change_data) # 只修改处方头 res = self.tem.get_opt_auditresult(engineid,1) self.assertEqual(2,res['data'][0]['rejectStatus']) def test_opt_05(self): '''审核打回,医生修改处方''' engineid = self.tem.get_opt_engineid('opt', '处方一', 1) # 审核打回 self.tem.opt_audit(engineid, 0) self.tem.send_data('opt', '修改处方一2', **self.tem.change_data) # 修改部分药的处方明细 res = self.tem.get_opt_auditresult(engineid, 1) self.assertEqual(2, res['data'][0]['rejectStatus']) def test_opt_06(self): '''审核打回,医生修改处方''' engineid = self.tem.get_opt_engineid('opt','处方一',1) # 审核打回 self.tem.opt_audit(engineid,0) self.tem.send_data('opt','修改处方一3',**self.tem.change_data) # 修改全部药的处方明细 res = self.tem.get_opt_auditresult(engineid,1) print(res) self.assertEqual(2,res['data'][0]['rejectStatus']) def test_opt_07(self): '''审核通过,医生修改处方''' engineid = self.tem.get_opt_engineid('opt','处方一',1) # 审核打回 self.tem.opt_audit(engineid,0) self.tem.send_data('opt','修改处方一1',**self.tem.change_data) # 只修改处方头 res = self.tem.get_opt_auditresult(engineid,1) self.assertEqual(2,res['data'][0]['rejectStatus'])
def test_ipt_19(self): tem = Template() tem.send_data('ipt_ccr', '15', **tem.change_data) tem.send_data('ipt_ccr', '16', **tem.change_data)
def test_opt_12(self): # scr在检验有效期 tem = Template() tem.send_data('opt_ccr', '2', **tem.change_data)
def test_opt_16(self): # 两个任务里的检验都是9.0 tem = Template() tem.send_data('opt_ccr', 'a2', **tem.change_data) tem.send_data('opt_ccr', 'a3', **tem.change_data)