def test_ipt_17(self): # 16岁 女 umol/L scr为1.00umol/L tem = Template() cal_ccr = Ccr(tem.get_ymd(-1, 0), '2003-03-05') c1 = cal_ccr.ccr_default_weight(sex='女', unit='umol/L', age=cal_ccr.y, scr=1) print(c1) engineid = tem.get_ipt_engineid('ipt_ccr', '13', 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'], "6438.6773(计算值)") ids = [engineid] tem.audit_multi(3, *ids) res = tem.get_ipt_patient(engineid, 1) self.assertEqual(res['data']['ccr'], "6438.6773(计算值)")
def test_ipt_12(self): # 19岁 男 mg/dl scr为1.00mg/dL tem = Template() cal_ccr = Ccr(tem.get_ymd(-1, 0), '2000-03-05') c1 = cal_ccr.ccr_default_weight(sex='男', unit='mg/dl', age=cal_ccr.y, scr=1) print(c1) engineid = tem.get_ipt_engineid('ipt_ccr', '8', 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'], "100.8333(计算值)") ids = [engineid] tem.audit_multi(3, *ids) res = tem.get_ipt_patient(engineid, 1) self.assertEqual(res['data']['ccr'], "100.8333(计算值)")
def test_ipt_16(self): # 16岁 男 scr为1.00umol/L tem = Template() # tem.send_data('ipt_ccr', '6', **tem.change_data) cal_ccr = Ccr(tem.get_ymd(-1, 0), '2003-03-05') c1 = cal_ccr.ccr_default_weight(sex='男', unit='umol/L', age=cal_ccr.y, scr=1) print(c1) engineid = tem.get_ipt_engineid('ipt_ccr', '12', 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'], "8610.2689(计算值)") ids = [engineid] tem.audit_multi(3, *ids) res = tem.get_ipt_patient(engineid, 1) self.assertEqual(res['data']['ccr'], "8610.2689(计算值)")
def test_opt_05(self): # 25岁 女 umol/l scr为9.00umol/l tem = Template() cal_ccr = Ccr(tem.get_ymd(0, 0), '1994-03-05') # tem.send_data('opt_ccr', '传ccr_1.txt', **tem.change_data) engineid = tem.get_opt_engineid('opt_ccr', '5', 1) res = tem.get_opt_recipeInfo(engineid, 0) outpatient = res['data']['outpatient'] print(json.dumps(res, indent=2, sort_keys=False, ensure_ascii=False)) expect = cal_ccr.ccr_calculate(sex='女', unit='umol/L', age=cal_ccr.y, weight=60, scr=9) print(expect) self.assertEqual(outpatient['ccr'], "796.6585(计算值)") ids = [engineid] tem.audit_multi(1, *ids) res = tem.get_opt_recipeInfo(engineid, 1) self.assertEqual(res['data']['outpatient']['ccr'], "796.6585(计算值)")
def test_opt_09(self): # 16岁 男 umol/l scr为9.00umol/l --测试不通过 tem = Template() cal_ccr = Ccr(tem.get_ymd(0, 0), '2003-03-05') # tem.send_data('opt_ccr', '传ccr_1.txt', **tem.change_data) engineid = tem.get_opt_engineid('opt_ccr', '9', 1) res = tem.get_opt_recipeInfo(engineid, 0) outpatient = res['data']['outpatient'] print(json.dumps(res, indent=2, sort_keys=False, ensure_ascii=False)) expect = cal_ccr.ccr_default_weight(sex='男', unit='umol/L', age=cal_ccr.y, scr=9) print(expect) self.assertEqual(outpatient['ccr'], "956.6965(计算值)") ids = [engineid] tem.audit_multi(1, *ids) res = tem.get_opt_recipeInfo(engineid, 1) self.assertEqual(res['data']['outpatient']['ccr'], "956.6965(计算值)")
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")