def test_plus_sign(browser, testcase, cache):
    log.info('开始运行加号脚本')
    login.select_workstation(browser, '门诊挂号收费工作台', cache)  # 工作站是否打开
    on_click(browser, (By.XPATH, '//div[contains(text(),"门诊挂号")]'))
    on_click(browser, (By.LINK_TEXT, '加号'))
    # 调取挂号验证模板
    RegSource = dao.outp_regist_master(testcase)
    temp.outp_reg_source_temp(RegSource)
    current_no = RegSource.OutpRegMaster.current_no
    current_limits = RegSource.OutpRegMaster.current_limits
    #刷卡
    send_value(browser, (By.XPATH, PlusSignInput.swipe_card),
               (testcase[plus_sign['patient_card']] + '\n'))
    #输入科室名称进行过滤
    num = len(
        browser.find_elements(By.XPATH, PlusSignDiv.special_list + '//tr'))
    send_value(browser, (By.XPATH, PlusSignInput.doctor_name),
               testcase[plus_sign['doctor_name']])
    locator = (By.XPATH, PlusSignDiv.special_list + '//tr')
    list_message = [testcase[plus_sign['special_name']]]
    if not filter_lists(browser, locator, list_message, num, 'button'):
        log.info('没有号源信息')
        return
    on_click(browser, (By.XPATH, '//button[contains(text(),"是")]'))
    #判断提示框中的内容是否正确
    if get_prompt(browser):
        prompt_text = get_prompt(browser)
        on_click(browser, (By.XPATH, '//button[contains(text(),"确定"   )]'))
    else:
        browser.refresh()
    # 调取挂号验证模板
    RegSourceAfter = dao.outp_regist_master(testcase)
    temp.outp_reg_source_temp(RegSourceAfter)
    # 数据验证
    if RegSourceAfter.OutpRegMaster.current_no - current_no == 0 and current_limits - RegSourceAfter.OutpRegMaster.current_limits == 0:
        Utility.writeFile('当前号和已挂数  pass')
    else:
        Utility.writeFile('当前号和已挂数  fail')
    business_type = cache.get('business_type')
    if not business_type:
        cache.set('business_type', [[
            '加号', testcase[plus_sign['name']],
            testcase[plus_sign['special_name']],
            testcase[plus_sign['outp_time']],
            testcase[plus_sign['doctor_name']]
        ]])
    else:
        business_type.append([
            '加号', testcase[plus_sign['name']],
            testcase[plus_sign['special_name']],
            testcase[plus_sign['outp_time']],
            testcase[plus_sign['doctor_name']]
        ])
    log.info('挂号留号运行结束')
Ejemplo n.º 2
0
def test_arrearage_settle_accounts(browser, cache):
    log.info('开始运行欠费结账脚本')
    login.select_workstation(browser, '门诊挂号收费工作台', cache)  # 工作站是否打开
    on_click(browser, (By.XPATH, '//div[contains(text(),"欠费管理")]'))
    on_click(browser, (By.LINK_TEXT, '欠费结账/退费'))
    boolen = get_prompt(browser)
    if boolen:
        if re.sub('\D', '', boolen) == '0':
            log.info(boolen)
            return
        else:
            on_click(browser, (By.XPATH, "//button[contains(text(),'确定')]"))
    #刷卡
    send_value(browser, (By.XPATH, patient_message.刷卡),
               cache.get('patient_card') + '\n')
    on_click(browser, (By.XPATH, '//button[contains(text(),"收 费")]'))
    on_click(browser, (By.XPATH, '//button[contains(text(),"是")]'))
    text = get_text(browser, (By.XPATH, "//label"))
    if "交款方式" not in text:
        microsoft_xps_document_writer('欠费结账单')
    else:
        send_value(browser, (By.XPATH, recharge_window.支付类型), '1')
        on_click(browser, (By.XPATH, '//button[contains(text(),"确认")]'))
        on_click(browser, (By.XPATH, '//button[contains(text(),"是")]'))
        microsoft_xps_document_writer('欠费结账充值单')
Ejemplo n.º 3
0
def click_application(browser, application_type_list, cache):
    for application_type in application_type_list:
        diction = cache.get(application_type)
        if diction:
            application_list = list(diction.keys())
            executive_department_list = list(diction.values())

            for t in list(set(executive_department_list)):
                # 刷卡
                send_value(browser, (By.XPATH, head_button.刷卡),
                           cache.get('patient_card') + '\n')
                # 判断弹出窗口是否正确弹出
                if not is_text(browser,
                               (By.XPATH, application_list_window.申请单列表),
                               '申请单列表'):
                    log.info('没有找到申请单列表窗口')
                    return
                apply_messages = get_text(
                    browser, (By.XPATH, application_list_window.申请单信息))
                if application_type in ['处方单', '毒麻单', '草药']:
                    on_click(browser,
                             (By.XPATH, "//span[contains(text(),'全部药品')]"))
                date = time.strftime("%Y-%m-%d", time.localtime())
                send_value(browser, (By.XPATH, application_list_window.开始时间),
                           '2017-6-12')
                on_click(browser,
                         (By.XPATH, "//button[contains(text(),'查询(Q)')]"))
                first_pos = 0
                status = False  #执行状态
                for i in range(executive_department_list.count(t)):
                    new_list = executive_department_list[first_pos:]
                    next_pos = new_list.index(t) + 1
                    index = first_pos + new_list.index(t)
                    print(application_list[index])
                    first_pos += next_pos
                    locator = (By.XPATH, '//div[contains(text(),"' +
                               application_list[index] + '")]')
                    if application_list[index] in apply_messages:
                        status = True
                        focus(browser, locator)
                    else:
                        log.info('不存在%s申请单' % application_list[index])
                if not status:
                    on_click(browser,
                             (By.XPATH, '//button[contains(text(),"取消(C)")]'))
                    continue
                on_click(browser,
                         (By.XPATH, "//button[contains(text(),'确定(S)')]"))
                time.sleep(0.5)
                send_value(browser, (By.XPATH, body.缴费方式), '\n')
                if get_prompt(browser):
                    on_click(browser,
                             (By.XPATH, "//button[contains(text(),'是')]"))
                    microsoft_xps_document_writer(application_type)
    log.info('欠费记账脚本运行结束')
Ejemplo n.º 4
0
def test_arrearage_return_premium(browser, cache):
    log.info('开始运行欠费退费脚本')
    login.select_workstation(browser, '门诊挂号收费工作台', cache)  # 工作站是否打开
    on_click(browser, (By.XPATH, '//div[contains(text(),"欠费管理")]'))
    on_click(browser, (By.LINK_TEXT, '欠费结账/退费'))
    boolen = get_prompt(browser)
    if boolen:
        if re.sub('\D', '', boolen) == '0':
            log.info(boolen)
            return
        else:
            on_click(browser, (By.XPATH, "//button[contains(text(),'确定')]"))
    #刷卡
    send_value(browser, (By.XPATH, patient_message.刷卡),
               cache.get('patient_card') + '\n')
    end_time = time.time() + 1
    # arrearage_list_text = ''    #欠费记账列表信息
    while True:
        arrearage_list_text = get_text(browser,
                                       (By.XPATH, arrearage_list.欠费记账患者列表))
        if '暂无可显示的欠费病人信息' not in arrearage_list_text:
            break
        if time.time() > end_time:
            log.info('欠费记账患者列表加载超时')
            return
    lists = ['处方单', '毒麻单', '检查单', '检验单', '治疗单', '皮试单', '输液单', '草药', '病理类']
    applys = []  #所有申请单号
    for appply_type in lists:
        applycation = cache.get(appply_type)
        if applycation:
            applys = applys + list(applycation)
    for apply_id in applys:
        if is_selected(browser, ((By.XPATH, arrearage_list.全选))):
            on_click(browser, (By.XPATH, arrearage_list.全选))
        rek_no = find_rek_no(apply_id)
        if rek_no == []:
            log.info('%s申请单未计费或已退费' % rek_no)
            continue
        elif rek_no in arrearage_list_text:
            on_click(browser,
                     (By.XPATH, '//div[contains(text(),"%s")]' % rek_no))
            on_click(browser, (By.XPATH, '//div[contains(text(),"退 费")]'))
            element_wait(browser,
                         (By.XPATH, '//span[contains(text(),"欠费记账退费窗口")]'))
            if '正常' in get_text(browser,
                                (By.XPATH, arrearage_return_premium.退费列表)):
                webElement = browser.find_elements_by_xpath(
                    arrearage_return_premium.退费列表 +
                    '//label[contains(text(),"正常")]')
                for element in webElement:
                    element.click()
            on_click(browser, (By.XPATH, '//button[contains(text(),"确定退费")]'))
            on_click(browser, (By.XPATH, '//button[contains(text(),"是")]'))
            microsoft_xps_document_writer('欠费退费单')
Ejemplo n.º 5
0
def test_prepay(browser,cache):
    log.info('开始运行预付费缴费脚本')
    login.select_workstation(browser, '门诊挂号收费工作台', cache)  # 工作站是否打开
    on_click(browser,(By.XPATH,'//div[contains(text(),"门诊缴费管理")]'))
    on_click(browser,(By.LINK_TEXT,'预付费缴费'))
    boolen = get_prompt(browser)
    if  boolen:
        if re.sub('\D', '', boolen) == '0':
           log.info(boolen)
           return
        else:
           on_click(browser, (By.XPATH, "//button[contains(text(),'确定')]"))

    lists = ['处方单', '毒麻单', '检查单', '检验单', '治疗单', '皮试单', '输液单', '草药', '病理类']
    click_application(browser,lists,cache)
    # 收费状态
    cache.set('prepay_status',1)
Ejemplo n.º 6
0
def test_pay_refund(browser, cache):
    log.info('开始运行预付费退费(窗口)脚本')
    login.select_workstation(browser, '门诊挂号收费工作台', cache)  # 工作站是否打开
    on_click(browser, (By.XPATH, '//div[contains(text(),"门诊退费管理")]'))
    on_click(browser, (By.LINK_TEXT, '预付费退费(窗口)'))
    boolen = get_prompt(browser)
    if boolen:
        if re.sub('\D', '', boolen) == '0':
            log.info(boolen)
            return
        else:
            on_click(browser, (By.XPATH, "//button[contains(text(),'确定')]"))

    lists = ['处方单', '毒麻单', '检查单', '检验单', '治疗单', '皮试单', '输液单', '草药', '病理类']
    rek_no_list = []
    for list_type in lists:
        applys = cache.get(list_type)
        if applys == None:
            continue
        for apply_id in list(applys.keys()):
            result = find_rek_no(apply_id)
            if result != []:
                rek_no_list.append(result.Rek.rek_no)
            else:
                log.info('%s申请单未收费或已退费' % apply_id)
    for rek_no in rek_no_list:
        # print(rek_no)
        send_value(browser, (By.XPATH, query_area.缴费流水号), rek_no + '\n')
        apply_status = get_text(browser,
                                (By.XPATH, list_area.退费明细列表 + '//label'))
        if '正常' in apply_status:
            status_elements = browser.find_elements_by_xpath(list_area.退费明细列表 +
                                                             '//label')
            for status_element in status_elements:
                status_element.click()
        if '取消' in get_text(browser, (By.XPATH, list_area.退费明细列表 + '//label')):
            on_click(browser, (By.XPATH, query_area.退费))
            on_click(browser, (By.XPATH, '//button[contains(text(),"确定")]'))
            microsoft_xps_document_writer('退费单')
            on_click(browser, (By.XPATH, '//button[contains(text(),"确定")]'))
    log.info('运行预付费退费(窗口)脚本结束')