예제 #1
0
class TestBug(unittest.TestCase):
    def setUp(self):
        warnings.simplefilter("ignore", ResourceWarning)
        self.tem = Template()

    def test_01(self):
        """AUDIT-593"""
        engineid1 = self.tem.get_ipt_engineid('ipt', '医嘱一', 1)
        ids = [engineid1]
        self.tem.audit_multi(3, *ids)
        engineid2 = self.tem.get_ipt_engineid('ipt', '医嘱三包含医嘱一', 1)
        # self.tem.send_data('ipt','医嘱三包含医嘱一',**self.tem.change_data)
        print(engineid2)
        res = self.tem.get_ipt_result(engineid2,
                                      self.tem.change_data['{{gp}}'])
        print(res['data']['auditStatus'])
        self.assertEqual(1, res['data']['auditStatus'])
예제 #2
0
 def test_ipt_18(self):
     tem = Template()
     engineid = tem.get_ipt_engineid('ipt_ccr', '14', 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'], "90.0(预设值)")
     ids = [engineid]
     tem.audit_multi(3, *ids)
     res = tem.get_ipt_patient(engineid, 1)
     self.assertEqual(res['data']['ccr'], "90.0(预设值)")
예제 #3
0
 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")
예제 #4
0
 def test_ipt_20(self):
     # 一个xml传入两组药,如果两组药的使用时间有交叉,则两个任务都能取到ccr
     tem = Template()
     # tem.send_data('ipt_ccr', '17', **tem.change_data)
     engineid = tem.get_ipt_engineid('ipt_ccr', '17', 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")
예제 #5
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(计算值)")
예제 #6
0
 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(计算值)")
예제 #7
0
 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(计算值)")
예제 #8
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(计算值)")
예제 #9
0
 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(计算值)")
예제 #10
0
 def test_ipt_05(self):
     tem = Template()
     # 传入scr,但是性别为9 未说明的性别,则ccr取默认值 --测试通过
     engineid = tem.get_ipt_engineid('ipt_ccr', '4', 1)
     print(engineid)
     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'], "90.0(预设值)")
     ids = [engineid]
     tem.audit_multi(3, *ids)
     res = tem.get_ipt_patient(engineid, 1)
     patient = res['data']
     self.assertEqual(patient['ccr'], "90.0(预设值)")
예제 #11
0
 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(计算值)")
예제 #12
0
 def test_ipt_06(self):
     # 检验中传入在检验有效期内的ccr,则ccr取传入值  --测试通过
     tem = Template()
     # tem.send_data('ipt_ccr', '5', **tem.change_data)
     engineid = tem.get_ipt_engineid('ipt_ccr', '5', 1)
     print(engineid)
     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'], "3.0")
     ids = [engineid]
     tem.audit_multi(3, *ids)
     res = tem.get_ipt_patient(engineid, 1)
     patient = res['data']
     self.assertEqual(patient['ccr'], "3.0")
예제 #13
0
 def test_ipt_01(self):
     # ccr与scr都不传,则ccr取默认值90--测试通过
     tem = Template()
     # tem.send_data('ipt_ccr', '1', **tem.change_data)
     engineid = tem.get_ipt_engineid('ipt_ccr', '1', 1)
     print(engineid)
     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'], "90.0(预设值)")
     ids = [engineid]
     tem.audit_multi(3, *ids)
     res = tem.get_ipt_patient(engineid, 1)
     patient = res['data']
     self.assertEqual(patient['ccr'], "90.0(预设值)")
예제 #14
0
 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")