예제 #1
0
class AlterConfig:

    def __init__(self):
        self.conf = ReadConfig()
        self.request = HttpRequest()

    def alter_sys_config(self, id, value):
        url = self.conf.get('login', 'address') + '/syscenter/api/v1/config/updateConfig?id=' + str(id) + '&type=input'
        data = value
        response = self.request.put(url, data).json()
        print(response)

    def alter_default_setting(self, id, code, name, is_use, value):
        url = self.conf.get('login', 'address') + '/syscenter/api/v1/config/updateDefaultSetting'
        data = {
            "id": id,
            "settingCode": code,
            "settingName": name,
            "value": value,
            "valueType": None,
            "remark": None,
            "isUse": is_use,
            "systemCode": None,
            "zoneId": None,
            "typeData": "checkbox"
        }
        print('data', data)
        response = self.request.put(url, data).json()
        print('response', response)
예제 #2
0
 def test_fail(self, zy, body, xmlname):
     request = HttpRequest()
     response = request.put(
         auditcennter_url + "/api/v1/auditPlan/" + TestMatchPlan.planid,
         body)
     zy.send.send("ipt", xmlname, 1)
     assert (zy.selNotAuditIptList())['data']['engineInfos']  #1
예제 #3
0
 def __init__(self):
     self.send = SendData()
     self.conf = ReadConfig()
     self.request = HttpRequest()
     self.db = ConnectDB()
     self.conn = self.db.connect(self.db.db_sys)
     self.cur = self.db.get_cur(self.conn)
     username = self.conf.get('login', 'username')
     sql = self.conf.get('sql', 'zoneid')
     self.zoneid = (self.db.execute(self.cur, sql))[0]
예제 #4
0
class AuditTest(unittest.TestCase):
    doexcel = DoExcel(contants.cases_dir)
    cases = doexcel.read("audit")
    request = HttpRequest()

    def setUp(self):
        pass

    @data(*cases)
    def test_audit(self, case):
        logger.info("执行第{}条用例,用例标题是:{}".format(case["case_id"], case["title"]))

        res = self.request.request(case["method"], case["url"], case["data"])
        print("响应的结果:{}".format(res.json()))

        try:
            self.assertEqual(case["expectedresult"], res.text, "audit error")
            self.doexcel.write_back("audit", case["case_id"] + 1, res.text,
                                    "Pass")
            logger.error("第{}条用例执行的结果是:PASS".format(case["case_id"]))

        except AssertionError as e:
            self.doexcel.write_back("audit", case["case_id"] + 1, res.text,
                                    "Fail")
            logger.error("第{}条用例执行的结果是:FAIL".format(case["case_id"]))

            raise e

    def tearDown(self):
        pass
예제 #5
0
class AddTest(unittest.TestCase):
    request = HttpRequest()
    doexcel = DoExcel(cases_dir)
    cases = doexcel.read("add")  #获取测试数据

    def setUp(self):  #用例运行它就运行
        pass

    @data(*cases)
    def test_add(self, case):
        logger.info("开始执行{}条用例了,用例标题是:{}".format(case["case_id"],
                                                 case["title"]))
        res = self.request.request(case["method"], case["url"], case["data"])
        print("响应的结果:{}".format(res.json()))
        try:
            #self.assertEqual(case["expectedresult"],res.text,"add error!!")
            #self.doexcel.write_back("add",case["case_id"]+1,res.text,"PASS")
            logger.error("第{}条用例执行的结果是:PASS".format(case["case_id"]))

        except AssertionError as e:  #try监控断言,出错了继续执行下面的代码(假如不加断言,用例失败了,代码就停了)
            self.doexcel.write_back("add", case["case_id"] + 1, res.text,
                                    "FAIL")
            logger.error("第{}条用例执行的结果是:FAIL".format(case["case_id"]))

            raise e

    def tearDown(self):  #用例运行它就运行
        pass
예제 #6
0
class RechargeTest(unittest.TestCase):
    doexcel=DoExcel(cases_dir)
    cases=doexcel.read("recharge")
    request=HttpRequest()#实例化一个对象request,再用request调用里面的函数

    def setUp(self):
        pass

    @data(*cases)
    def test_recharge(self,case):
        logger.info("正在执行{}条用例,用例标题是:{}".format(case["case_id"],case["title"]))
        res=self.request.request(case["method"],case["url"],case["data"])
        print('响应结果:',res.text)

        try:
            self.assertEqual(str(case["expectedresult"]),res.json()["code"],"recharge error!!!")

            self.doexcel.write_back("recharge",case["case_id"]+1,res.text,"PASS")
            logger.error("第{}条用例执行的结果是:PASS".format(case["case_id"]))
        except AssertionError as e:
            self.doexcel.write_back("recharge", case["case_id"] + 1, res.text, "FAIL")
            logger.error("第{}条用例执行的结果是:FAIL".format(case["case_id"]))
            raise e

    def tearDown(self):
        pass
    def send(self, dir_name, xml_name, type):
        """
        审方发数据的接口
        :param dir_name:
        :param xml_name:
        :param type: 1:开具医嘱或处方 2:撤销医嘱或删除处方 3:医生双签医嘱或双签处方 4:删除处方的另外一个接口
        :return:
        """
        xml_path = os.path.join(
            os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
            'data', dir_name, xml_name)
        url = ''
        if type == 1:
            url = self.conf.get('auditcenter',
                                'address') + '/api/v1/auditcenter'
        elif type == 2:
            url = self.conf.get('auditcenter',
                                'address') + "/api/v1/cancelgroupdrug"
        elif type == 3:
            url = self.conf.get('auditcenter',
                                'address') + "/api/v1/doublesign"
        else:
            url = self.conf.get('auditcenter',
                                'address') + "/api/v1/cancelRecipe"

        with open(xml_path, encoding="utf-8") as fp:
            body = fp.read()
        ss = body
        for k in self.change_data:
            ss = ss.replace(k, self.change_data[k])
        print(ss)
        return HttpRequest.post_xml(url, ss)
예제 #8
0
    def send(self, dir_name, xml_name, type):
        """
        审方发数据的接口
        :param dir_name:
        :param xml_name:
        :param type: 1:开具医嘱或处方 2:撤销医嘱或删除处方 3:医生双签医嘱或双签处方 4:删除处方的另外一个接口
        :return:
        """
        xml_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'data', dir_name, xml_name)
        url = ''
        if type == 1:
            url = self.conf.get('auditcenter', 'address') + '/api/v1/auditcenter'
            # url = 'http://10.1.1.120:2002/face?charset=UTF-8&serviceCode=SF_V4_AUDIT_CENTER&post_type=1'
        elif type == 2:
            # url = self.conf.get('auditcenter', 'address') + "/api/v1/cancelgroupdrug"
            url = 'http://10.1.1.120:2002/face?charset=UTF-8&serviceCode=CANCEL_GROUP_DRUG_V4&post_type=1'
        elif type == 3:
            url = self.conf.get('auditcenter', 'address') + "/api/v1/doublesign"
        else:
            url = self.conf.get('auditcenter', 'address') + "/api/v1/cancelRecipe"

        with open(xml_path, encoding="utf-8") as fp:
            body = fp.read()
        ss = body
        for k in self.change_data:
            ss = ss.replace(k, self.change_data[k])
        print(ss)
        return HttpRequest.post_xml(url, ss)
예제 #9
0
class LoginTest(unittest.TestCase):
    request = HttpRequest()
    doexcel = DoExcel(cases_dir)
    cases = doexcel.read("login")  # 获取登录的测试用例

    def setUp(self):
        pass

    @data(*cases)
    def test_login(self, case):
        logger.info("正在执行{}条用例,用例标题:{}".format(case["case_id"], case["title"]))
        res = self.request.request(case["method"], case["url"], case["data"])
        print("请求的url:", res.url)
        print("响应的结果:", res.json())
        try:
            # 用期望结果和实际结果做断言
            self.assertEqual(case["expectedresult"], res.text, "login error")
            #如果期望结果和实际结果相等,就写回
            self.doexcel.write_back("login", case["case_id"] + 1, res.text,
                                    "PASS")
            logger.error("第{}条用例执行结果:PASS".format(case["case_id"]))
        except AssertionError as e:
            self.doexcel.write_back("login", case["case_id"] + 1, res.text,
                                    "Fail")
            logger.error("第{}条用例执行结果:FAIL".format(case["case_id"]))
            raise e

    def tearDown(self):
        pass
예제 #10
0
def get_selNotAuditIptList():
    req = HttpRequest()
    url = "http://10.1.1.71:9999/auditcenter/api/v1/ipt/selNotAuditIptList"
    headers = {'Content-Type': "application/json"}
    param = {}
    res = req.post_json(url, param)
    if res['data']['engineInfos']:
        engineids = [i['id'] for i in res['data']['engineInfos']]
        # print(engineids)
        random_engineid = random.choice(engineids)
        print(random_engineid)
        url = 'http://10.1.1.71:9999/auditcenter/api/v1/ipt/orderList' + '?id=' + str(
            random_engineid)
        orderlist = req.get(url)
        print(orderlist['data'])
        gps = list(orderlist['data'].keys())
        gp = [
            i for i in list(orderlist['data'].keys())
            if orderlist['data'][i][0]['auditMarkStatus'] is None
        ]
        # for i in gps:
        #     print(i)
        #     print(orderlist['data'][i][0])
        #     print(orderlist['data'][i][0]['auditMarkStatus'])
        # print(type(orderlist['data'][i][0]))

        para = {
            "groupOrderList": [{
                "auditBoList": [],
                "groupNo": gp[0],
                "auditInfo": "必须修改",
                "auditStatus": 0,
                "engineId": random_engineid,
                "orderType": 1
            }]
        }
        aa = req.post_json(
            'http://10.1.1.71:9999/auditcenter/api/v1/ipt/auditSingle', para)
        print(aa)

        print(gps[0])
예제 #11
0
class RegisterTest(unittest.TestCase):
    request = HttpRequest()
    doexcel = DoExcel(cases_dir)
    cases = doexcel.read("register")  #获取注册的测试用例

    # print(type(max_mobilephone))#数据库取出来的vachar类型,也就是str类型

    def setUp(self):  #每个用例执行开始前,都要运行,获取数据库里面最大的手机号
        self.mysql = MysqlUtil()  # 创建数据库连接,打开查询页面
        sql = "select MAX(MobilePhone)from future.member"  # 查询数据库里面最大的手机号
        self.max_mobilephone = self.mysql.fetch_one(sql)[
            0]  # 从数据库里面查询出来的数据类型是:元组,要用下标取值;数据库里面最大的手机号是:max_mobilephone

    @data(*cases)
    def test_register(self, case):
        logger.info("正在执行{}条用例,用例标题是:{}".format(case["case_id"],
                                                case["title"]))

        import json
        data_dict = json.loads(
            case["data"])  #excel表中的data数据是str类型,需要转成json字典格式的字符串

        if data_dict[
                "mobilephone"] == "$register_mobilephone":  #转成json格式,可以根据key取值,判断value是否等于excel表中做的标记$register_mobilephone
            data_dict["mobilephone"] = int(
                self.max_mobilephone
            ) + 1  #如果value等于excel表中做的标记$register_mobilephone,那查出来的最大手机号再加上1,再去请求

        # 调用请求接口,接口请求后,会有返回结果,也就是实际结果
        res = self.request.request(case["method"], case["url"],
                                   data_dict)  #把case[data]换成最新的data_dict字典去做请求

        #预期结果和实际结果的断言
        try:
            self.assertEqual(case["expectedresult"], res.text,
                             "register error!!!")
            #断言成功,测试结果就写PASS
            self.doexcel.write_back("register", case["case_id"] + 1, res.text,
                                    "PASS")
            logger.error("第{}条用例执行的结果是:PASS".format(case["case_id"]))
        except AssertionError as e:
            # 断言失败,测试结果就写Fail
            self.doexcel.write_back("register", case["case_id"] + 1, res.text,
                                    "FAIL")
            logger.error("第{}条用例执行的结果是:FAIL".format(case["case_id"]))
            raise e

    def tearDown(self):
        self.mysql.close()
예제 #12
0
# -*- coding: utf-8 -*-
# @Time : 2019/12/12 15:05
# @Author : wangmengmeng
import pytest
from common.alter_config import AlterConfig
from common.request import HttpRequest
from config.read_config import ReadConfig
import time

sc = AlterConfig()
hq = HttpRequest()
rc = ReadConfig()
url = rc.get('auditcenter', 'address')


class TestSysconfig:
    """测试审方系统在用户中心的配置项是否正确"""
    @pytest.mark.parametrize("value,expected", [(0, 0), (1, 1), (2, 2),
                                                (3, 3)])
    def test_40009(self, value, expected):
        """新任务提醒(是否有提示音)"""
        sc.alter_sys_config(40009, value)
        res = hq.get(url + '/api/v1/newTaskHint')
        actual = res['data']['taskHint']
        assert actual == str(expected)

    def test_40011(self):
        """是否显示住院任务剩余时间"""
        pass

    @pytest.mark.parametrize("value,expected_ipt,expected_opt",
예제 #13
0
class Opt:
    def __init__(self):
        self.send = SendData()
        self.conf = ReadConfig()
        self.auditcenter_url = self.conf.get('auditcenter', 'address')
        self.request = HttpRequest()

    @wait
    def selNotAuditOptList(self, num):
        """
        待审门诊列表根据处方号查询
        :return:   通过return结果可以获得以下数据:engineid res['data']['optRecipeList'][0]['id']
        """
        url = self.conf.get('auditcenter',
                            'address') + '/api/v1/opt/selNotAuditOptList'
        recipeno = 'r' + ''.join(
            str(num)) + '_' + self.send.change_data['{{ts}}']
        param = {"recipeNo": recipeno}
        res = self.request.post_json(url, param)
        return res

    @wait
    def waitOptList(self, num):
        """
        待审门诊列表根据处方号查询
        :return:   通过return结果可以获得以下数据:engineid res['data']['optRecipeList'][0]['id']
        """
        # self.send.send('ipt', '医嘱一', 1)
        # time.sleep(3)
        url = self.conf.get('auditcenter',
                            'address') + '/api/v1/opt/selNotAuditOptList'
        recipeno = 'r' + ''.join(
            str(num)) + '_' + self.send.change_data['{{ts}}']
        param = {"recipeNo": recipeno}
        res = self.request.post_json(url, param)
        optRecipeList = res['data']['optRecipeList']  # 待审列表的处方数据
        infos = []
        engineid = ''
        if optRecipeList is not None:  # 待审列表的处方不为空的时候执行下述语句
            infos = res['data']['optRecipeList'][0]['infos']
            engineid = res['data']['optRecipeList'][0]['optRecipe']['id']
        return optRecipeList, infos, engineid

    def get_engineid(self, num):
        """
        待审列表获取引擎id
        :param num: 根据处方号获取引擎id,注意看xml中处方号r后拼接的是1还是2
        :return:
        """
        res = self.selNotAuditOptList(num)
        return res['data']['optRecipeList'][0]['optRecipe']['id']

    def audit_multi(self, *ids):
        """
        待审门诊任务列表批量通过
        :param ids:  引擎id
        """
        url = self.conf.get('auditcenter',
                            'address') + '/api/v1/auditBatchAgree'
        param = {
            "ids": ids,
            "auditType": 1,  # 1指门急诊
            "auditWay": 2
        }
        self.request.post_json(url, param)

    def opt_audit(self, engineid, audit_type):
        """
        处方详情审核任务
        :param engineid:
        :param audit_type: 0 审核打回  1 审核打回(可双签) 2 审核通过
        """
        url = ''
        param = ''
        if audit_type == 0:
            url = self.conf.get(
                'auditcenter',
                'address') + '/api/v1/detailPageAuditRefuse?auditWay=2'
            param = {
                "optRecipeId": engineid,
                "auditResult": "打回必须修改",
                "operationRecordList": [],
                "messageStatus": 0
            }
        elif audit_type == 1:
            url = self.conf.get(
                'auditcenter',
                'address') + '/api/v1/detailPageAuditRefuse?auditWay=2'
            param = {
                "optRecipeId": engineid,
                "auditResult": "打回可双签",
                "operationRecordList": [],
                "messageStatus": 1
            }
        elif audit_type == 2:
            url = self.conf.get(
                'auditcenter',
                'address') + '/api/v1/detailPageAuditAgree?auditWay=2'
            param = {"optRecipeId": engineid, "auditResult": "审核通过"}
        self.request.post_json(url, param)

    def get_recipeInfo(self, engineid, type):
        """
        获取处方(包括处方头与处方明细)信息与患者信息
        :param engineid:
        :param type: 0 待审页面 1 已审页面
        :return:
        """
        if type == 0:
            url = self.conf.get(
                'auditcenter',
                'address') + '/api/v1/opt/recipeInfo/' + str(engineid)
        else:
            url = self.conf.get(
                'auditcenter',
                'address') + '/api/v1/opt/all/recipeInfo/' + str(engineid)
        return self.request.get(url)

    def get_operation(self, engineid, type):
        """获取门诊手术信息"""
        if type == 0:
            url = self.conf.get(
                'auditcenter',
                'address') + '/api/v1/opt/optOperationList/' + str(engineid)
        else:
            url = self.conf.get(
                'auditcenter', 'address'
            ) + '/api/v1/opt/all/optOperationList/' + str(engineid)
        return self.request.get(url)

    def mergeAuditResult(self, recipeId, id, type):
        """
        获取处方的操作(干预理由、药师、医生等)记录
        :param recipeId:  第一次跑引擎的engineid
        :param id:  第二次跑引擎的engineid
        :param type: type = 0代表待审页面,type = 1代表已审页面
        :return:
        """
        if type == 0:
            url = (self.auditcenter_url +
                   "/api/v1/opt/mergeAuditResult?recipeId=%s&id=%s") % (
                       recipeId, id)
        else:
            url = (self.auditcenter_url +
                   "/api/v1/opt/all/mergeAuditResult?recipeId=%s&id=%s") % (
                       recipeId, id)
        return self.request.get(url)
예제 #14
0
class Ipt:
    def __init__(self):
        self.send = SendData()
        self.conf = ReadConfig()
        self.request = HttpRequest()
        self.db = ConnectDB()
        self.conn = self.db.connect(self.db.db_sys)
        self.cur = self.db.get_cur(self.conn)
        username = self.conf.get('login', 'username')
        sql = self.conf.get('sql', 'zoneid')
        self.zoneid = (self.db.execute(self.cur, sql))[0]
        # sql_uid = self.conf.get('sql', 'userid')
        # self.uid = (self.db.execute_pid(self.cur, sql_uid, username))[0]

    @wait
    def selNotAuditIptList(self):
        """
        待审住院列表根据患者号查询
        :return:   通过return结果可以获得以下数据:engineid res['data']['engineInfos'][0]['id']
        """
        url = self.conf.get('auditcenter',
                            'address') + '/api/v1/ipt/selNotAuditIptList'
        param = {"patientId": self.send.change_data['{{ts}}']}
        res = self.request.post_json(url, param)
        return res

    def get_engineid(self, n):
        """
        待审列表获取引擎id
        :param n: 如果某患者有多条待审任务则会有多个引擎id,n代表取第几个引擎id
        :return:
        """
        res = self.selNotAuditIptList()
        return res['data']['engineInfos'][n - 1]['id']

    def audit_multi(self, *ids):
        """
        待审住院任务列表批量通过
        :param ids:  引擎id
        """
        url = self.conf.get('auditcenter',
                            'address') + '/api/v1/auditBatchAgree'
        param = {
            "ids": ids,
            "auditType": 3,  # 3指住院
            "auditWay": 2
        }
        self.request.post_json(url, param)

    def ipt_audit(self, gp, engineid, audit_type):
        """
        医嘱详情审核任务
        :param gp:
        :param engineid:
        :param audit_type: 0 审核打回  1 审核打回(可双签) 2 审核通过
        orderType : 1:药物医嘱; 2:非药物医嘱;3:草药医嘱
        """
        url = self.conf.get('auditcenter',
                            'address') + '/api/v1/ipt/auditSingle'
        param = ''
        if audit_type == 0:
            param = {
                "groupOrderList": [{
                    "auditBoList": [],
                    "groupNo": gp,
                    "auditInfo": "必须修改",
                    "auditStatus": 0,
                    "engineId": engineid,
                    "orderType": 1
                }]
            }
        elif audit_type == 1:
            param = {
                "groupOrderList": [{
                    "auditBoList": [],
                    "groupNo": gp,
                    "auditInfo": "打回可双签",
                    "auditStatus": 0,
                    "engineId": engineid,
                    "orderType": 1,
                    "messageStatus": 1
                }]
            }
        elif audit_type == 2:
            param = {
                "groupOrderList": [{
                    "auditBoList": [],
                    "groupNo": gp,
                    "auditInfo": "审核通过",
                    "auditStatus": 1,
                    "engineId": engineid,
                    "orderType": 1
                }]
            }
        self.request.post_json(url, param)

    def orderList(self, engineid, type):
        """
        获取药嘱信息
        :param engineid:
        :param type: 0 待审页面 1 已审页面
        :return:
        """
        if type == 0:
            url = self.conf.get(
                'auditcenter',
                'address') + '/api/v1/ipt/orderList' + '?id=' + str(engineid)
        else:
            url = self.conf.get(
                'auditcenter', 'address'
            ) + '/api/v1/ipt/all/orderList' + '?id=' + str(engineid)
        return self.request.get(url)

    def herbOrderList(self, engineid, type):
        if type == 0:
            url = self.conf.get(
                'auditcenter', 'address'
            ) + '/api/v1/ipt/herbOrderList' + '?id=' + str(engineid)
        else:
            url = self.conf.get(
                'auditcenter', 'address'
            ) + '/api/v1/ipt/all/herbOrderList' + '?id=' + str(engineid)
        return self.request.get(url)

    # def mergeEngineMsgList(self, engineid, type, gno):
    #     """获取医嘱详情右侧的审核记录、警示信息等信息"""
    #     ol = self.orderList(engineid, type)
    #     hl = self.herbOrderList(engineid, type)
    #     medicalIds = []
    #     medicalHisIds = []
    #     herbMedicalIds = []
    #     herbMedicalHisIds = []
    #     if ol['data']:
    #         medicalIds = [i['id'] for i in ol['data'][gno]]
    #         medicalHisIds = [i['orderId'] for i in ol['data'][gno]]
    #     if hl['data']:
    #         herbMedicalIds = [i['drugId'] for i in hl['data'][0]['itemList']]
    #         herbMedicalHisIds = [i['herbMedicalId'] for i in hl['data'][0]['itemList']]
    #     if type == 0:
    #         url = self.conf.get('auditcenter', 'address') + '/api/v1/ipt/mergeEngineMsgList'
    #         param = {
    #             "auditWay": 2,
    #             "engineId": engineid,
    #             "zoneId": self.zoneid,
    #             "groupNo": gno,
    #             "medicalIds": medicalIds,
    #             "medicalHisIds": medicalHisIds,
    #             "herbMedicalIds": herbMedicalIds,
    #             "herbMedicalHisIds": herbMedicalHisIds
    #         }
    #     else:
    #         url = self.conf.get('auditcenter', 'address') + '/api/v1/ipt/all/mergeEngineMsgList'
    #         param = {
    #             "engineId": engineid,
    #             "zoneId": self.zoneid,
    #             "groupNo": gno,
    #             "medicalIds": medicalIds,
    #             "medicalHisIds": medicalHisIds,
    #             "herbMedicalIds": herbMedicalIds,
    #             "herbMedicalHisIds": herbMedicalHisIds
    #         }
    #     return self.request.post_json(url, param)
    @wait
    def waitIptList(self):
        """
        待审住院列表根据患者号查询 作用同函数selNotAuditIptList(),是其优化版本
        :return:   通过return结果可以获得以下等数据:engineid res['data']['engineInfos'][0]['id']
        """
        # self.send.send('ipt', '医嘱一', 1)
        # time.sleep(3)
        url = self.conf.get('auditcenter',
                            'address') + '/api/v1/ipt/selNotAuditIptList'
        param = {"patientId": self.send.change_data['{{ts}}']}
        res = self.request.post_json(url, param)
        engineInfos = res['data']['engineInfos']  # 待审列表的医嘱数据
        engineMsg = []
        engineids = []
        if engineInfos is not None:  # 待审列表有数据的时候执行下述语句
            engineMsg = res['data']['engineInfos'][0]['engineMsg']  # 医嘱对应的警示信息
            engineids = [i['id']
                         for i in res['data']['engineInfos']]  # 同一患者的所有引擎id
        return engineInfos, engineMsg, engineids

    @wait
    def mergeEngineMsgList(self, engineid, type, gno):
        """获取医嘱详情右侧的审核记录、警示信息等信息"""
        ol = self.orderList(engineid, type)
        # hl = self.herbOrderList(engineid, type)
        medicalIds = []
        medicalHisIds = []
        if ol['data']:
            medicalIds = [i['id'] for i in ol['data'][gno]]
            medicalHisIds = [i['orderId'] for i in ol['data'][gno]]
        if type == 0:
            url = self.conf.get('auditcenter',
                                'address') + '/api/v1/ipt/mergeEngineMsgList'
            param = {
                "auditWay": 2,
                "engineId": engineid,
                "zoneId": self.zoneid,
                "groupNo": gno,
                "medicalIds": medicalIds,
                "medicalHisIds": medicalHisIds,
                "herbMedicalIds": [],
                "herbMedicalHisIds": []
            }
        else:
            url = self.conf.get(
                'auditcenter',
                'address') + '/api/v1/ipt/all/mergeEngineMsgList'
            param = {
                "engineId": engineid,
                "zoneId": self.zoneid,
                "groupNo": gno,
                "medicalIds": medicalIds,
                "medicalHisIds": medicalHisIds,
                "herbMedicalIds": [],
                "herbMedicalHisIds": []
            }
        return self.request.post_json(url, param)

    def get_patient(self, engineid, type):
        """获取住院患者信息"""
        if type == 0:
            url = self.conf.get(
                'auditcenter',
                'address') + '/api/v1/ipt/iptPatient' + '?id=' + str(engineid)
        else:
            url = self.conf.get(
                'auditcenter', 'address'
            ) + '/api/v1/ipt/all/iptPatient' + '?id=' + str(engineid)
        return self.request.get(url)

    def get_operation(self, engineid, type):
        """获取住院手术信息"""
        if type == 0:
            url = self.conf.get(
                'auditcenter', 'address'
            ) + '/api/v1/ipt/operationList' + '?id=' + str(engineid)
        else:
            url = self.conf.get(
                'auditcenter', 'address'
            ) + '/api/v1/ipt/all/operationList' + '?id=' + str(engineid)
        return self.request.get(url)

    def isIptCollected(self, engineid, gno):
        ol = self.orderList(engineid, type)
        medicalIds = [i['id'] for i in ol['data'][gno]]
        medicalHisIds = [i['orderId'] for i in ol['data'][gno]]
        url = self.conf.get('auditcenter',
                            'address') + '/api/v1/collect/isIptCollected'
        param = {
            "collectPeopleId": self.uid,
            "engineId": engineid,
            "groupNo": gno,
            "herbMedicalIds": [],
            "medicalIds": medicalIds
        }
        return self.request.post_json(url, param)
예제 #15
0
# -*- coding: utf-8 -*-
# @Time : 2019/12/4 22:08
# @Author : wangmengmeng
import pytest
from common.request import HttpRequest
from common.handle_yaml import HandleYaml

requ = HttpRequest()
hy = HandleYaml()
datas = hy.read_yaml('auditcenter.yaml')
print(datas)
auditcenter_url = 'http://10.1.1.89:9999/auditcenter'


@pytest.mark.parametrize("api,method,data,params,headers,assert_code", datas)
def test_single_api(api, method, data, params, headers, assert_code):
    res = requ.req(auditcenter_url + api, method, data, params, headers)
    assert res.json()['code'] == str(assert_code)
예제 #16
0
 def __init__(self):
     self.conf = ReadConfig()
     self.request = HttpRequest()
예제 #17
0
 def __init__(self):
     self.send = SendData()
     self.conf = ReadConfig()
     self.auditcenter_url = self.conf.get('auditcenter', 'address')
     self.request = HttpRequest()
예제 #18
0
class Opt:
    def __init__(self):
        self.send = SendData()
        self.conf = ReadConfig()
        self.request = HttpRequest()

    @wait
    def selNotAuditOptList(self, num):
        """
        待审门诊列表根据处方号查询
        :return:   通过return结果可以获得以下数据:engineid res['data']['engineInfos'][0]['id']
        """
        # self.send.send('ipt', '医嘱一', 1)
        # time.sleep(3)
        url = self.conf.get('auditcenter',
                            'address') + '/api/v1/opt/selNotAuditOptList'
        recipeno = 'r' + ''.join(
            str(num)) + '_' + self.send.change_data['{{ts}}']
        param = {"recipeNo": recipeno}
        res = self.request.post_json(url, param)
        return res

    def get_engineid(self, num):
        """
        待审列表获取引擎id
        :param n: 如果某患者有多条待审任务则会有多个引擎id,n代表取第几个引擎id
        :return:
        """
        res = self.selNotAuditOptList(num)
        return res['data']['optRecipeList'][0]['optRecipe']['id']

    def audit_multi(self, *ids):
        """
        待审门诊任务列表批量通过
        :param ids:  引擎id
        """
        url = self.conf.get('auditcenter',
                            'address') + '/api/v1/auditBatchAgree'
        param = {
            "ids": ids,
            "auditType": 1,  # 1指门急诊
            "auditWay": 2
        }
        self.request.post_json(url, param)

    def opt_audit(self, engineid, audit_type):
        """
        处方详情审核任务
        :param engineid:
        :param audit_type: 0 审核打回  1 审核打回(可双签) 2 审核通过
        """
        url = self.conf.get('auditcenter',
                            'address') + '/api/v1/ipt/auditSingle'
        param = ''
        if audit_type == 0:
            param = {
                "optRecipeId": engineid,
                "auditResult": "打回必须修改",
                "operationRecordList": [],
                "messageStatus": 0
            }
        elif audit_type == 1:
            param = {
                "optRecipeId": engineid,
                "auditResult": "打回可双签",
                "operationRecordList": [],
                "messageStatus": 1
            }
        elif audit_type == 2:
            param = {"optRecipeId": engineid, "auditResult": "审核通过"}
        self.request.post_json(url, param)

    def get_recipeInfo(self, engineid, type):
        """
        获取处方(包括处方头与处方明细)信息与患者信息
        :param engineid:
        :param type: 0 待审页面 1 已审页面
        :return:
        """
        if type == 0:
            url = self.conf.get(
                'auditcenter',
                'address') + '/api/v1/opt/recipeInfo/' + str(engineid)
        else:
            url = self.conf.get(
                'auditcenter',
                'address') + '/api/v1/opt/all/recipeInfo/' + str(engineid)
        return self.request.get(url)

    def get_operation(self, engineid, type):
        """获取门诊手术信息"""
        if type == 0:
            url = self.conf.get(
                'auditcenter',
                'address') + '/api/v1/opt/optOperationList/' + str(engineid)
        else:
            url = self.conf.get(
                'auditcenter', 'address'
            ) + '/api/v1/opt/all/optOperationList/' + str(engineid)
        return self.request.get(url)
예제 #19
0
 def __init__(self):
     conf = ReadConfig()
     self.auditcenter_url = conf.get('auditcenter', 'address')
     self.request = HttpRequest()
예제 #20
0
class QualityEvaluate:
    def __init__(self):
        conf = ReadConfig()
        self.auditcenter_url = conf.get('auditcenter', 'address')
        self.request = HttpRequest()

    def ipt_checklist(self, starttime, endtime, ids):
        url = self.auditcenter_url + '/api/v1/analysis/ipt/extractIptCheckData'
        param = {
            "currentPage": 1,
            "pageSize": 20,
            "startTime": starttime,
            "endTime": endtime,
            "source": "3",
            "type": "1",
            "auditIdList": ids
        }
        res = self.request.post_json(url, param)
        return res['data']

    def opt_checklist(self, starttime, endtime, ids, source):
        """
        获取抽取项目总条数
        :param starttime: 开始日期
        :param endtime: 结束日期
        :param ids: audit_doctor_id
        :param source: 门急诊:0 门诊:1 急诊:2
        :return:
        """
        url = self.auditcenter_url + '/api/v1/analysis/opt/getCheckList'
        param = {
            "currentPage": 1,
            "pageSize": 20,
            "startTime": starttime,
            "endTime": endtime,
            "source": source,
            "type": "1",
            "auditIdList": ids
        }
        res = self.request.post_json(url, param)
        return res['data']

    def opt_ResultList(self, starttime, endtime, id, source):
        """只能查到审方药师为自己的数据"""
        url = self.auditcenter_url + '/api/v1/analysis/opt/reviewResultList'
        param = {
            "pageSize": 20,
            "currentPage": 1,
            "startTime": starttime,
            "endTime": endtime,
            "source": source,
            "checkPeopleId": id
        }
        res = self.request.get_with_params(url, **param)

    def opt_ResultList1(self):
        url = self.auditcenter_url + '/api/v1/analysis/opt/reviewResultList'
        param = {
            "pageSize": 20,
            "currentPage": 1,
            "startTime": 1577203200000,
            "endTime": 1577289599000,
            "source": "0",
            "checkPeopleId": 6
        }
        res = self.request.get_with_params(url, param)
        print(type(res))
        print(res.url)
        print(res.json())
        return res
예제 #21
0
 def __init__(self):
     self.send = SendData()
     self.conf = ReadConfig()
     self.request = HttpRequest()
예제 #22
0
class Ipt:
    def __init__(self):
        self.send = SendData()
        self.conf = ReadConfig()
        self.request = HttpRequest()

    @wait
    def selNotAuditIptList(self):
        """
        待审住院列表根据患者号查询
        :return:   通过return结果可以获得以下数据:engineid res['data']['engineInfos'][0]['id']
        """
        # self.send.send('ipt', '医嘱一', 1)
        # time.sleep(3)
        url = self.conf.get('auditcenter', 'address') + '/api/v1/ipt/selNotAuditIptList'
        param = {
            "patientId": self.send.change_data['{{ts}}']
        }
        res = self.request.post_json(url, param)
        return res

    def get_engineid(self, n):
        """
        待审列表获取引擎id
        :param n: 如果某患者有多条待审任务则会有多个引擎id,n代表取第几个引擎id
        :return:
        """
        res = self.selNotAuditIptList()
        return res['data']['engineInfos'][n - 1]['id']

    def audit_multi(self, *ids):
        """
        待审住院任务列表批量通过
        :param ids:  引擎id
        """
        url = self.conf.get('auditcenter', 'address') + '/api/v1/auditBatchAgree'
        param = {
            "ids": ids,
            "auditType": 3,  # 3指住院
            "auditWay": 2
        }
        self.request.post_json(url, param)

    def ipt_audit(self, gp, engineid, audit_type):
        """
        医嘱详情审核任务
        :param gp:
        :param engineid:
        :param audit_type: 0 审核打回  1 审核打回(可双签) 2 审核通过
        orderType : 1:药物医嘱; 2:非药物医嘱;3:草药医嘱
        """
        url = self.conf.get('auditcenter', 'address') + '/api/v1/ipt/auditSingle'
        param = ''
        if audit_type == 0:
            param = {
                "groupOrderList": [{
                    "auditBoList": [],
                    "groupNo": gp,
                    "auditInfo": "必须修改",
                    "auditStatus": 0,
                    "engineId": engineid,
                    "orderType": 1
                }]
            }
        elif audit_type == 1:
            param = {
                "groupOrderList": [{
                    "auditBoList": [],
                    "groupNo": gp,
                    "auditInfo": "打回可双签",
                    "auditStatus": 0,
                    "engineId": engineid,
                    "orderType": 1,
                    "messageStatus": 1
                }]
            }
        elif audit_type == 2:
            param = {
                "groupOrderList": [{
                    "auditBoList": [],
                    "groupNo": gp,
                    "auditInfo": "审核通过",
                    "auditStatus": 1,
                    "engineId": engineid,
                    "orderType": 1
                }]
            }
        self.request.post_json(url, param)

    def orderList(self, engineid, type):
        """
        获取药嘱信息
        :param engineid:
        :param type: 0 待审页面 1 已审页面
        :return:
        """
        if type == 0:
            url = self.conf.get('auditcenter', 'address') + '/api/v1/ipt/orderList' + '?id=' + str(engineid)
        else:
            url = self.conf.get('auditcenter', 'address') + '/api/v1/ipt/all/orderList' + '?id=' + str(engineid)
        return self.request.get(url)

    def herbOrderList(self, engineid, type):
        if type == 0:
            url = self.conf.get('auditcenter', 'address') + '/api/v1/ipt/herbOrderList' + '?id=' + str(engineid)
        else:
            url = self.conf.get('auditcenter', 'address') + '/api/v1/ipt/all/herbOrderList' + '?id=' + str(engineid)
        return self.request.get(url)

    def get_patient(self, engineid, type):
        """获取住院患者信息"""
        if type == 0:
            url = self.conf.get('auditcenter', 'address') + '/api/v1/ipt/iptPatient' + '?id=' + str(engineid)
        else:
            url = self.conf.get('auditcenter', 'address') + '/api/v1/ipt/all/iptPatient' + '?id=' + str(engineid)
        return self.request.get(url)

    def get_operation(self, engineid, type):
        """获取住院手术信息"""
        if type == 0:
            url = self.conf.get('auditcenter', 'address') + '/api/v1/ipt/operationList' + '?id=' + str(engineid)
        else:
            url = self.conf.get('auditcenter', 'address') + '/api/v1/ipt/all/operationList' + '?id=' + str(engineid)
        return self.request.get(url)