def test_opt_01(self): # ccr与scr都不传,则ccr取默认值90 tem = Template() # tem.send_data('opt_ccr', '不传ccr和scr', **tem.change_data) engineid = tem.get_opt_engineid('opt_ccr', '不传ccr和scr', 1) res = tem.get_opt_recipeInfo(engineid, 0) outpatient = res['data']['outpatient'] print(json.dumps(res, indent=2, sort_keys=False, ensure_ascii=False)) self.assertEqual(outpatient['ccr'], "90.0(预设值)") ids = [engineid] tem.audit_multi(1, *ids) res = tem.get_opt_recipeInfo(engineid, 1) self.assertEqual(res['data']['outpatient']['ccr'], "90.0(预设值)")
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_14(self): # 19岁 女 umol/l scr为9.00umol/l tem = Template() cal_ccr = Ccr(tem.get_ymd(0, 0), '2000-03-05') # tem.send_data('opt_ccr', '传ccr_1.txt', **tem.change_data) engineid = tem.get_opt_engineid('opt_ccr', '10', 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'], "9.0") ids = [engineid] tem.audit_multi(1, *ids) res = tem.get_opt_recipeInfo(engineid, 1) self.assertEqual(res['data']['outpatient']['ccr'], "9.0")