コード例 #1
0
ファイル: ipt.py プロジェクト: wmm0165/auditcenter_190912
 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]
コード例 #2
0
ファイル: chat.py プロジェクト: wmm0165/auditcenter_190912
 def __init__(self):
     self.tem = Template()
     cf = ReadConfig()
     self.audit_url = cf.get("auditcenter", "address")
     self.login_url = cf.get("login", "address")
     self.ts = self.tem.get_ts(0, 0) * 1000
     self.db = ConnectDB()
     self.conn = self.db.connect(self.db.db_sys)
     self.cur = self.db.get_cur(self.conn)
     sql = cf.get('sql', 'zoneid')
     self.zoneid = (self.db.execute(self.cur, sql))[0]
コード例 #3
0
 def get_database_data(self, planname):
     db = ConnectDB()
     cur = db.connect().cursor(pymysql.cursors.DictCursor)
     plan_name = 'and name like "%%%s%%"'  # SELECT name, category,user_name,created_time,modified_time
     sql = 'SELECT name, category,user_name FROM `sf_audit_plan` where 1 = 1 '
     if planname is not None:
         sql = (sql + plan_name) % planname
     cur.execute(sql)
     print(sql)
     database_data = cur.fetchall()
     return database_data
コード例 #4
0
ファイル: ipt.py プロジェクト: wmm0165/auditcenter_190912
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)
コード例 #5
0
# -*- coding: utf-8 -*-
# @Time : 2020/4/9 14:23
# @Author : wangmengmeng
import pytest
import time
from common.alter_config import AlterConfig
from common.connect_db import ConnectDB
from config.read_config import ReadConfig

db = ConnectDB()
conf = ReadConfig()


@pytest.fixture(scope='function')
def implant_config():
    sc = AlterConfig()
    yield sc


class TestIptImplant:
    """AUDIT-512 是否植入物"""
    @pytest.mark.parametrize("is_use,value,expected", [(0, 0, None),
                                                       (0, 1, None),
                                                       (1, 0, None),
                                                       (1, 1, None)])
    def test_implant_null(self, zy, implant_config, is_use, value, expected):
        implant_config.alter_default_setting(89, 'whether_Implanta', '是否有植入物',
                                             is_use, value)
        zy.send.send('ipt', 'audit512_1', 1)
        time.sleep(1)
        engineid = zy.get_engineid(1)
コード例 #6
0
ファイル: chat.py プロジェクト: wmm0165/auditcenter_190912
class Chat:
    def __init__(self):
        self.tem = Template()
        cf = ReadConfig()
        self.audit_url = cf.get("auditcenter", "address")
        self.login_url = cf.get("login", "address")
        self.ts = self.tem.get_ts(0, 0) * 1000
        self.db = ConnectDB()
        self.conn = self.db.connect(self.db.db_sys)
        self.cur = self.db.get_cur(self.conn)
        sql = cf.get('sql', 'zoneid')
        self.zoneid = (self.db.execute(self.cur, sql))[0]
        # print(self.zoneid)

    def doc_ipt_send(self, engineid, gp):
        """医生端住院发消息
        :param engineid: 引擎id
        :param gp: 组号
        """
        url = self.audit_url + "/api/v1/sendChatMessageNoLogin"
        param = {
            "hospitalCode": "H0003",
            "userId": "09",
            "source": "住院",
            "attachKey": engineid,
            "attachSecondKey": gp,
            "message": "这是医生消息",
            "userRole": "医生"
        }
        self.tem.post_json(url, param)

    def doc_opt_send(self, engineid):
        """
        医生端门诊发消息
        :param engineid: 引擎id
        """
        url = self.audit_url + "/api/v1/sendChatMessageNoLogin"
        param = {
            "hospitalCode": "H0003",
            "userId": "09",
            "source": "门诊",
            "attachKey": engineid,
            "message": "这是医生消息",
            "userRole": "医生"
        }
        self.tem.post_json(url, param)

    # 医生端获取消息
    def doc_ipt_query(self, engineid, gp):
        url = (
            self.audit_url +
            "/api/v1/queryChatMessageNoLogin?hospitalCode=H0003&userId=09&source=%s&attachKey=%s&attachSecondKey=%s&t=%s"
        ) % ('%E4%BD%8F%E9%99%A2', engineid, gp, self.ts)
        # print(url)
        return self.tem.get(url)

    def doc_opt_query(self, engineid):
        url = (
            self.audit_url +
            "/api/v1/queryChatMessageNoLogin?hospitalCode=H0003&userId=09&source=%s&attachKey=%s&t=%s"
        ) % ('%E9%97%A8%E8%AF%8A', engineid, self.ts)
        return self.tem.get(url)

    # 药师端 查看未读消息列表
    def phar_notread(self):
        url = self.login_url + "/syscenter/api/v1/message/getMessages"
        param = {"page": 1, "pageSize": 9, "status": "STATUS_UNREAD"}
        self.tem.post_json(url, param)

    def ipt_chat_flag(self, engineid, gp):
        res = self.tem.get_ipt_orderlist(engineid, 1)
        medicalIds = res['data'][gp][0]['id']
        medicalHisIds = res['data'][gp][0]['orderId']
        url = self.audit_url + "/api/v1/ipt/all/mergeEngineMsgList"
        param = {
            "engineId": engineid,
            "zoneId": self.zoneid,
            "groupNo": gp,
            "medicalIds": [medicalIds],
            "medicalHisIds": [medicalHisIds],
            "herbMedicalIds": [],
            "herbMedicalHisIds": []
        }
        return self.tem.post_json(url, param)

    def opt_chat_flag(self, recipeId, id, type):
        """
        获取记录按钮是否展示标识
        :param recipeId:  第一次跑引擎的engineid
        :param id:  第二次跑引擎的engineid
        :param type: type = 0代表待审页面,type = 1代表已审页面
        :return:
        """
        if type == 0:
            url = (self.audit_url +
                   "/api/v1/opt/mergeAuditResult?recipeId=%s&id=%s") % (
                       recipeId, id)
        else:
            url = (self.audit_url +
                   "/api/v1/opt/all/mergeAuditResult?recipeId=%s&id=%s") % (
                       recipeId, id)
        return self.tem.get(url)

    def phar_ipt_send(self, engineid, gp):
        url = self.audit_url + "/api/v1/sendChatMessage"
        param = {
            "zoneId": self.zoneid,
            "category": 3,
            "attachKey": engineid,
            "attachSecondKey": gp,
            "message": "这是药师消息",
            "userRole": "药师"
        }
        self.tem.post_json(url, param)

    def phar_opt_send(self, engineid):
        url = self.audit_url + "/api/v1/sendChatMessage"
        param = {
            "zoneId": self.zoneid,
            "category": 1,
            "attachKey": engineid,
            "message": "这是药师消息",
            "userRole": "药师"
        }
        self.tem.post_json(url, param)

    # 药师端 门诊查看记录列表
    def phar_query_chat(self, engineid):
        url = (self.audit_url +
               "/api/v1/queryChatMessage?category=1&zoneId=%s&attachKey=%s"
               ) % (self.zoneid, engineid)
        return self.tem.get(url)

    # 药师端 住院查看记录列表
    def phar_ipt_query_chat(self, engineid, gp):
        url = (
            self.audit_url +
            "/api/v1/queryChatMessage?category=3&zoneId=%s&attachKey=%s&attachSecondKey=%s"
        ) % (self.zoneid, engineid, gp)
        return self.tem.get(url)
コード例 #7
0
ファイル: ipt_all.py プロジェクト: wmm0165/auditcenter_190912
 def __init__(self):
     db = ConnectDB()
     conn = db.connect(db.db_sf_full)
     self.cur = db.get_cur(conn)