Example #1
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 + ":" + "没有报告")
Example #2
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
Example #3
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("返回结果为:")
Example #4
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 + ":" + "没有报告")
Example #5
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)
    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("当前没有报告")