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")
Beispiel #4
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'])