Пример #1
0
    def test_user_patient_EDITING(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(
            os.path.dirname(os.path.dirname(
                os.path.abspath(__file__)))) + "/configure/markDr.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')
        section = "login"  # 传入配置文件的section
        conf_Filename = "markDr.ini"
        Request = requestAPI(log, conf_Filename, section)
        result = Request.execute("config_markDr.xlsx", "common",
                                 "patientList_EDITING")

        # print(result)
        log.info("返回结果为:")
        log.info(result)

        if result["users"] != []:
            conf = Configure(path)
            for user in result["users"]:
                reportList_EDITING.append(user["record_id"])

                # 把List状态传到markDr.ini中
            for i in range(0, len(reportList_EDITING)):
                conf.Set("EDITING_report", "report" + str(i),
                         str(reportList_EDITING[i]))
        else:
            log.info("当前状态下没有报告")
Пример #2
0
    def test_block_index_until_exist_data(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(
            os.path.dirname(os.path.dirname(
                os.path.abspath(__file__)))) + "/configure/reviewDr.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')

        section = "AUDITING_report"  # 传入配置文件的section,审核中的数据
        # 把PDF状态传到temp.ini中,1为True 0为False
        conf = Configure(path)
        reportIds = conf.Get_items(section)  # 取出所有setion下面的键值对

        section1 = "login"  # 传入配置文件的section
        conf_Filename = "reviewDr.ini"
        Request = requestAPI(log, conf_Filename, section1)

        if reportIds != []:
            for reportId in reportIds:
                log.info("开始打开报告:" + str(reportId[1]) + ":")
                url = "/ecg/block_index_until_exist_data?report_id=" + str(
                    reportId[1]) + "&block_index=0"
                result = Request.execute("config_reviewDr.xlsx", "ecg",
                                         "block_index_until_exist_data", url)
                log.info("返回结果为:")
                log.info(result)
Пример #3
0
    def test_user_patient_ANALYZE_FAILED(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(
            os.path.dirname(os.path.dirname(
                os.path.abspath(__file__)))) + "/configure/uploaderDr.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')
        section = "login"  # 传入配置文件的section
        conf_filename = "uploaderDr.ini"
        Request = requestAPI(log, conf_filename, section)
        result = Request.execute("config_uploaderDr.xlsx", "common",
                                 "patientList_ANALYZE_FAILED")

        # print(result)
        log.info("返回结果为:")
        log.info(result)

        # 取到分析失败的报告ID放入 uploaderDr.ini中

        if result["users"] != []:
            conf = Configure(path)

            for user in result["users"]:
                reportList_ANALYZE_FAILED.append(user["record_id"])

                # 把List状态传到uploaderDr.ini中
            for i in range(0, len(reportList_ANALYZE_FAILED)):
                conf.Set("ANALYZE_FAILED_report", "report" + str(i),
                         str(reportList_ANALYZE_FAILED[i]))
        return result["users"]
Пример #4
0
    def test_login(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(
            os.path.dirname(os.path.dirname(
                os.path.abspath(__file__)))) + "/configure/reviewDr.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')
        conf = Configure(path)

        try:
            conf_Filename = "reviewDr.ini"
            Request = requestAPI(log, conf_Filename)
            res = Request.execute("config_reviewDr.xlsx", "checkLogin",
                                  "login_reviewDr")
            if res.status_code == 200:
                cookies = requests.utils.dict_from_cookiejar(
                    res.cookies)  # 返回值 jessionid
                result = res.json()  #返回值 json
                print(cookies)
                print(result)
                role = result["data"]["role"]
                user_id = (result["data"]["user_id"])
                #处理cookies格式
                key = cookies["SESSION"]
                cookies = "SESSION" + "=" + key
                #把cookies传递出去,后续请求使用

                conf.Set("login", "cookies", cookies)  # 设置 setion、option、value
                conf.Set("login", "role", str(role))
                conf.Set("login", "user_id", str(user_id))
        except Exception as e:
            log.error("=====case error ====%s" % e)
            pytest.fail("CASE FAIL")
Пример #5
0
    def test_pdf_generate(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(
            os.path.dirname(os.path.dirname(
                os.path.abspath(__file__)))) + "/configure/markDr.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')

        section = "EDITING_report"  # 传入配置文件的section,标注中的数据
        # 把PDF状态传到temp.ini中,1为True 0为False
        conf = Configure(path)
        reportIds = conf.Get_items(section)  # 取出所有setion下面的键值对

        section1 = "login"  # 传入配置文件的section
        conf_Filename = "markDr.ini"
        Request = requestAPI(log, conf_Filename, section1)

        if reportIds != []:
            for reportId in reportIds:
                log.info("开始打开报告:" + str(reportId[1]) + ":")
                url = "/pdf/generate/?report_id=" + str(reportId[1])
                result = Request.execute("config_markDr.xlsx", "pdf",
                                         "pdf_generate", url)
                time.sleep(1)
                log.info("返回结果为:")
                log.info(result)
Пример #6
0
    def test_user_patient_AUDIT_PASS(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(
            os.path.dirname(os.path.dirname(
                os.path.abspath(__file__)))) + "/configure/superAdmin.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')
        section = "login"  # 传入配置文件的section
        conf_filename = "superAdmin.ini"
        Request = requestAPI(log, conf_filename, section)
        result = Request.execute("config_superAdmin.xlsx", "common",
                                 "patientList_AUDIT_PASS")

        # print(result)
        log.info("返回结果为:")
        log.info(result)

        # 取到已审核的报告ID放入 superAdmin.ini中

        if result["users"] != []:
            conf = Configure(path)

            for user in result["users"]:
                reportList_AUDIT_PASS.append(user["record_id"])

                # 把List状态传到superAdmin.ini中
            for i in range(0, len(reportList_AUDIT_PASS)):
                conf.Set("AUDIT_PASS_report", "report" + str(i),
                         str(reportList_AUDIT_PASS[i]))
        else:
            return result["users"]
Пример #7
0
    def test_pdf_generate(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(
            os.path.dirname(os.path.dirname(
                os.path.abspath(__file__)))) + "/configure/dataManager.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')
        section = "FINISH_report"  #传入配置文件的section
        # 把PDF状态传到dataManager.ini中,1为True 0为False
        conf = Configure(path)
        reportIds = conf.Get_items(section)  # 取出所有setion下面的键值对

        section1 = "login"  # 传入配置文件的section
        conf_filename = "dataManager.ini"
        Request = requestAPI(log, conf_filename, section1)

        for reportId in reportIds:
            log.info("开始打开报告:" + str(reportId[1]) + ":")
            url = "/pdf/generate/?report_id=" + str(reportId[1])
            result = Request.execute("config_dataManager.xlsx", "pdf",
                                     "pdf_generate", url)
            log.info("返回结果为:")
            # log.info(result.content)
            log.info("-------------")
Пример #8
0
    def test_flow_AUDIT_PASS(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(
            os.path.dirname(os.path.dirname(
                os.path.abspath(__file__)))) + "/configure/dataManager.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')
        section = "AUDIT_PASS_report"  # 传入配置文件的section
        # 把PDF状态传到temp.ini中,1为True 0为False
        conf = Configure(path)
        reportIds = conf.Get_items(section)  # 取出所有setion下面的键值对

        section1 = "login"  # 传入配置文件的section
        conf_filename = "dataManager.ini"
        Request = requestAPI(log, conf_filename, section1)
        if reportIds != []:
            for reportId in reportIds:
                log.info("开始打开报告:" + str(reportId[1]) + ":")
                url = "/reports/" + str(reportId[1]) + "/flows"
                result = Request.execute("config_dataManager.xlsx", "report",
                                         "flows", url)
                log.info("返回结果为:")
                log.info(result)
                # log.info(result.content)
                log.info("-------------")
        else:
            log.info(section + ":" + "没有报告")
Пример #9
0
    def test_abnormal_fragment(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(
            os.path.dirname(os.path.dirname(
                os.path.abspath(__file__)))) + "/configure/markDr.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')

        section = "EDITING_report"  # 传入配置文件的section,标注中的数据
        # 把PDF状态传到temp.ini中,1为True 0为False
        conf = Configure(path)
        reportIds = conf.Get_items(section)  # 取出所有setion下面的键值对

        section1 = "login"  #传入配置文件的section
        conf_Filename = "markDr.ini"
        Request = requestAPI(log, conf_Filename, section1)

        #获取上一层接口(classification_rhythm_abnormal_list)返回的数据
        path1 = os.path.dirname(
            os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
        ) + "/configure/Mark_classification_rhythm_abnormal_list.yml"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')
        ye = yamlConf(path1)
        results = ye.LoadAll()
        n = 0

        ##分别针对每一份报告中,相应的position进行请求
        if reportIds != []:
            for result in results:
                log.info("--------------------------------------------")
                log.info("开始打开报告:" + str(reportIds[n][1]) + ":")
                print("--------------------------------------------")
                print("开始打开报告:" + str(reportIds[n][1]) + ":")
                for positions in result:
                    listPosition = positions["position"]
                    url = "/ecg/abnormal_fragment?report_id=" + str(
                        reportIds[n][1]) + "&position=" + str(
                            listPosition) + "&label=V"
                    result = Request.execute("config_markDr.xlsx", "ecg",
                                             "abnormal_fragment", url)
                    log.info("返回结果为:")
                    # log.info(result)
                    log.info("-------------")
                    time.sleep(1)
                print("结束打开报告:" + str(reportIds[n][1]) + ":")
                print("--------------------------------------------")
                log.info("结束打开此报告:" + str(reportIds[n][1]) + ":")
                log.info("----------------------------------------------")
                n = n + 1
        else:
            log.info(section + ":" + "没有报告")
Пример #10
0
    def test_fast_beat_list(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))+"/configure/markDr.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')
        section = "EDITING_report"  # 传入配置文件的section,标注中的数据
        # 把PDF状态传到temp.ini中,1为True 0为False
        conf = Configure(path)
        reportIds = conf.Get_items(section)  # 取出所有setion下面的键值对

        section1 = "login"  # 传入配置文件的section
        conf_Filename = "markDr.ini"
        Request = requestAPI(log, conf_Filename, section1)


        # 获取上一层接口(valid_dats)返回的数据
        path1 = os.path.dirname(os.path.dirname(
            os.path.dirname(os.path.abspath(__file__)))) + "/configure/Mark_valid_days.yml"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')
        ye = yamlConf(path1)
        allList = ye.LoadAll()
        n = 0


        #分别针对每一份报告中,相应的有效时间进行请求
        for valid_days_list in allList:
            log.info("--------------------------------------------")
            log.info("开始打开报告:" + str(reportIds[n][1]) + ":")
            print("--------------------------------------------")
            print("开始打开报告:" + str(reportIds[n][1]) + ":")
            for valid_day in valid_days_list:
                if valid_day["isContainData"] == True:
                    beginTime = valid_day["day"]
                    log.info("开始执行开始时间为:" + beginTime + " " + "的fastbeatlist")
                    print("开始执行开始时间为:" + beginTime + " " + "的fastbeatlist")
                    url = '/ecg/fast_beat_list?report_id=' + str(
                        reportIds[n][1]) + '&date=' + beginTime + "&start=0&end=-1"  # 构造灵活的URL
                    result = Request.execute("config_markDr.xlsx", "ecg", "fast_beat_list", url)
                    time.sleep(1)
                    log.info("返回结果为:")
            print("结束打开报告:" + str(reportIds[n][1]) + ":")
            print("--------------------------------------------")
            log.info("结束打开此报告:" + str(reportIds[n][1]) + ":")
            log.info("----------------------------------------------")
            n=n+1
    def test_doctorManager_UPLOADER(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))+"/configure/dataManager.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')
        section = "login"  # 传入配置文件的section
        conf_filename = "dataManager.ini"
        Request = requestAPI(log, conf_filename, section)
        result = Request.execute("config_dataManager.xlsx", "common", "doctorManager_UPLOADER")

        # print(result)
        log.info("返回结果为:")
        log.info(result)
Пример #12
0
    def test_institutionTree(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))+"/configure/reviewDr.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')
        section = "login"  # 传入配置文件的section
        conf_Filename = "reviewDr.ini"
        Request = requestAPI(log, conf_Filename,section)
        result = Request.execute("config_reviewDr.xlsx", "common", "institutionTree")


        # print(result)
        log.info("返回结果为:")
        log.info(result)
Пример #13
0
    def test_abnormal_list(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(
            os.path.dirname(os.path.dirname(
                os.path.abspath(__file__)))) + "/configure/markDr.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')
        section = "login"  # 传入配置文件的section
        conf_Filename = "markDr.ini"
        Request = requestAPI(log, conf_Filename, section)
        result = Request.execute("config_markDr.xlsx", "ecg", "abnormal_list")

        # print(result)
        log.info("返回结果为:")
        log.info(result)
Пример #14
0
    def test_fast_beat_list(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(
            os.path.dirname(os.path.dirname(
                os.path.abspath(__file__)))) + "/configure/reviewDr.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')
        section = "login"  # 传入配置文件的section
        conf_Filename = "reviewDr.ini"
        Request = requestAPI(log, conf_Filename, section)

        #获取审核中的报告:
        section1 = "AUDITING_report"  # 传入配置文件的section,审核中的数据
        # 把PDF状态传到temp.ini中,1为True 0为False
        conf = Configure(path)
        reportIds = conf.Get_items(section1)  # 取出所有setion下面的键值对

        # 获取上一层接口(valid_dats)返回的数据
        path1 = os.path.dirname(
            os.path.dirname(os.path.dirname(os.path.abspath(
                __file__)))) + "/configure/Review_valid_days.yml"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')
        ye = yamlConf(path1)
        allList = ye.LoadAll()

        #找出有效时间
        for valid_day in allList:
            if valid_day["isContainData"] == True:
                valid_days.append(valid_day["day"])

        #使用有效时间进行遍历访问,由于是审核中的报告,只会有一个报告,所以直接取得reportIds[0][1]
        for day in valid_days:
            beginTime = day
            log.info("开始执行开始时间为:" + beginTime + " " + "的fastbeatlist")
            print("开始执行开始时间为:" + beginTime + " " + "的fastbeatlist")
            url = '/ecg/fast_beat_list?report_id=' + str(
                reportIds[0]
                [1]) + '&date=' + beginTime + "&start=0&end=-1"  #构造灵活的URL
            result = Request.execute("config_markDr.xlsx", "ecg",
                                     "fast_beat_list", url)
            time.sleep(1)
            log.info("返回结果为:")
Пример #15
0
    def test_classification_rhythm_abnormal_header(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(
            os.path.dirname(os.path.dirname(
                os.path.abspath(__file__)))) + "/configure/markDr.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')

        section = "EDITING_report"  # 传入配置文件的section,标注中的数据
        conf = Configure(path)
        reportIds = conf.Get_items(section)  # 取出所有setion下面的键值对

        section1 = "login"  #传入配置文件的section
        conf_Filename = "markDr.ini"
        Request = requestAPI(log, conf_Filename, section1)
        if reportIds != []:
            for reportId in reportIds:
                log.info("开始打开报告:" + str(reportId[1]) + ":")
                url = "/ecg/classification_rhythm_abnormal_header?report_id=" + str(
                    reportId[1])
                result = Request.execute(
                    "config_markDr.xlsx", "ecg",
                    "classification_rhythm_abnormal_header", url)
                log.info("返回结果为:")
                log.info(result)
                # log.info(result.content)
                log.info("-------------")
                log.info(result.json())
                listJson.append(result.json())

                # 放入返回结果入相应的yml文件中,后续调用
            path = os.path.dirname(
                os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
            ) + "/configure/Mark_classification_rhythm_abnormal_header.yml"
            if 'Windows' in platform.system():
                # windows os
                path = path.replace('/', '\\')

                # 把返回值放入yaml文件中:
                ye = yamlConf(path)
                ye.DumpAll(listJson)
        else:
            log.info(section + ":" + "没有报告")
Пример #16
0
    def test_hospital(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(
            os.path.dirname(os.path.dirname(
                os.path.abspath(__file__)))) + "/configure/superAdmin.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')
        section = "login"  # 传入配置文件的section
        conf_filename = "superAdmin.ini"
        Request = requestAPI(log, conf_filename, section)
        result = Request.execute("config_superAdmin.xlsx", "hospital",
                                 "hospital")

        # print(result)
        log.info("返回结果为:")
        print(result)
        log.info(result)
Пример #17
0
    def test_valid_days(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(
            os.path.dirname(os.path.dirname(
                os.path.abspath(__file__)))) + "/configure/markDr.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')
        section = "EDITING_report"  # 传入配置文件的section,标注中的数据
        # 把PDF状态传到temp.ini中,1为True 0为False
        conf = Configure(path)
        reportIds = conf.Get_items(section)  # 取出所有setion下面的键值对

        section1 = "login"  # 传入配置文件的section
        conf_Filename = "markDr.ini"
        Request = requestAPI(log, conf_Filename, section1)

        if reportIds != []:
            for reportId in reportIds:
                log.info("开始打开报告:" + str(reportId[1]) + ":")
                url = "/ecg/valid_days?report_id=" + str(reportId[1])
                result = Request.execute("config_markDr.xlsx", "ecg",
                                         "valid_days", url)
                log.info("返回结果为:")
                log.info(result)
                results = result["timeArray"]
                listDay.append(results)

        #添加配置文件进入 Mark_valid_days.yml
        path1 = os.path.dirname(
            os.path.dirname(os.path.dirname(
                os.path.abspath(__file__)))) + "/configure/Mark_valid_days.yml"
        if 'Windows' in platform.system():
            # windows os
            path1 = path1.replace('/', '\\')

        ye = yamlConf(path1)
        ye.DumpAll(listDay)
Пример #18
0
    def test_overlay_positions(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(
            os.path.dirname(os.path.dirname(
                os.path.abspath(__file__)))) + "/configure/markDr.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')
        section = "EDITING_report"  # 传入配置文件的section,标注中的数据
        # 把PDF状态传到temp.ini中,1为True 0为False
        conf = Configure(path)
        reportIds = conf.Get_items(section)  # 取出所有setion下面的键值对

        section1 = "login"  # 传入配置文件的section
        conf_Filename = "markDr.ini"
        Request = requestAPI(log, conf_Filename, section1)

        # 打开配置文件Mark_valid_days.yml
        path1 = os.path.dirname(
            os.path.dirname(os.path.dirname(
                os.path.abspath(__file__)))) + "/configure/Mark_valid_days.yml"
        if 'Windows' in platform.system():
            # windows os
            path1 = path1.replace('/', '\\')

        ye = yamlConf(path1)
        results = ye.LoadAll()
        gettime = getTime()
        n = 0

        #分别针对每一份报告中,相应的有效时间进行请求
        if reportIds != []:
            for result in results:
                log.info("--------------------------------------------")
                log.info("开始打开报告:" + str(reportIds[n][1]) + ":")
                print("--------------------------------------------")
                print("开始打开报告:" + str(reportIds[n][1]) + ":")
                for res in result:
                    if res["isContainData"] == True:
                        beginTime = res['day'].replace('-',
                                                       "/") + " " + "00:00:00"
                        endTime = gettime.date_addta(beginTime, 1,
                                                     "%Y/%m/%d %H:%M:%S")
                        log.info("开始执行开始时间:" + beginTime + " " + "结束时间为:" +
                                 endTime + " " + "的预加载N")
                        print("开始执行开始时间:" + beginTime + " " + "结束时间为:" +
                              endTime + " " + "的预加载")
                        url = "/overlay/load/" + str(reportIds[n][1])
                        result = Request.execute("config_markDr.xlsx",
                                                 "overlay",
                                                 "overlay_load",
                                                 url,
                                                 beginTime=beginTime,
                                                 endTime=endTime,
                                                 beatType="N")
                        time.sleep(1)
                        log.info("开始执行开始时间:" + beginTime + " " + "结束时间为:" +
                                 endTime + " " + "SLOT0")
                        print("开始执行开始时间:" + beginTime + " " + "结束时间为:" +
                              endTime + " " + "SLOT0")
                        url = "/overlay/positions/" + str(
                            reportIds[n][1]) + "/SLOT_0"
                        result = Request.execute("config_markDr.xlsx",
                                                 "overlay",
                                                 "overlay_positions", url)
                        log.info("返回结果为:")
                print("结束打开报告:" + str(reportIds[n][1]) + ":")
                print("--------------------------------------------")
                log.info("结束打开此报告:" + str(reportIds[n][1]) + ":")
                log.info("----------------------------------------------")
                n = n + 1
        else:
            log.info("当前没有报告")