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('预付费缴费脚本运行结束') if __name__ == '__main__': cache = Cache({}) browser = Common.browser() testcase = {'用户名': 'jfli', '密码': '123456'} login.test_login(browser, testcase, cache) cache.set('quit_sign', ['王易', '呼吸内科急诊', '普通', '刘馗', '2017-06-09']) cache.set('处方单',{'02A201706-1300038':'门诊药房(光谷)','02A201706-1300039':'门诊药房(光谷)'}) cache.set('检查单',{'02D2017061300046':'放射科','02D2017061200055':'超声影像科'}) cache.set('patient_card','%E?;2501218606=99015012538?+E?') test_prepay(browser, cache)
browser, (By.XPATH, "//div[contains(text(),'正在加载')]")) application_detail_text = browser.find_element_by_xpath( application_detail.申请单计费明细列表).text if application_detail_text.strip() != '': on_click(browser, (By.XPATH, '//button[contains(text(),"收费(Enter)")]')) on_click(browser, (By.XPATH, '//button[contains(text(),"是")]')) else: log.info('%s申请单已计费' % application[index]) element_wait(browser, (By.XPATH, application_detail.申请单计费明细列表)) browser.refresh() if __name__ == '__main__': cache = Cache({}) browser = Common.browser() testcase = {'用户名': 'jfli', '密码': '123456'} login.test_login(browser, testcase, cache) # cache.set('检验单',{'02C201706-1900002':'妇产前诊断实验室','02C201706-1900004':'妇产前诊断实验室','02C201706-1900003':'检验科'}) cache.set( '检查单', { '02D2017061900012': '超声影像科', '02D2017061900005': '放射科', '02D2017061900008': '放射科' }) # cache.set('病理类',{'02O201706-1600053':'病理科','02O201706-1600052':'病理科'}) cache.set('patient_card', '%E?;1004627675=99015017425?+E?') test_pay_org(browser, cache)
for i in range(0, len(ers_part_elements)): for j in range(0, len(ers_part_list)): if ers_part_list[j] == ers_part_elements[i].text: ers_part_elements[i].click() cache.set('pai_type', 'o') button_element = browser.find_element_by_xpath( ers_save).find_elements_by_tag_name('button')[1] button_element.click() CpoeSubmit.test_cpoe_submit(browser, '检查单') if __name__ == '__main__': browser = common.browser() testcase = {'用户名': 'jfli', '密码': '123456', '诊断类别': 1, '诊断名称': '神经痛'} cache = Cache({}) cache.set('resultType', 1) cache.set('specialName', '眼科门诊') cache.set('patient_card', '%E?;1004627675=99015017425?+E?') login.test_login(browser, testcase, cache) pai.test_workstation(browser, cache) pai.test_diagnose(browser, testcase, cache) test_case = { '附加项目': '', '患者姓名': '杨俊熙', '患者卡号': '%E?;1004627675=99015017425?+E?', '执行科室': '生殖医学中心', '检查部位/方法分组': '部位', '部位/方法': '纵膈', '医嘱名称': '彩超常规检查' } test_emr_ers(browser, test_case, cache)
zipname = zip.namelist() #返回压缩包中所有文件的文件名 zip.extractall() #解压所有文件 zip.close() f = open(zipname[0]) lines = f.readline() # print(lines) f.close() # 拼写制卡卡号 card = '%E?;' + lines.rstrip('\n').split("|")[1] + '?+E?' cache.set('patient_card', card) log.info(card) Utility.writeFile(card) # 删除解压文件 if os.path.exists(zipname[0]): os.remove(zipname[0]) if __name__ == "__main__": browser = common.browser() cache = Cache({}) testcase = {'用户名': 'jwang', '密码': '123456'} cache.set('resultType', '1') cache.set('specialName', '急诊内科') cache.set('userId', '%E?;2001065723=99015011437?+E?') login.test_login(browser, testcase, cache) test_businessCard(browser, cache) browser.find_elements_tag_name('img')[21].click() browser.find_elements_by_xpath('//img')[21].click()
for table_element in table_elements: div_elements = table_element.find_elements_by_tag_name('div') if div_elements[3].text>now: print(div_elements[5].text) if div_elements[4].text>div_elements[5].text: div_elements[4].click() break browser.find_element_by_xpath("//button[contains(text(),'预约并确认')]").click() browser.find_element_by_xpath("//button[contains(text(),'是')]").click() # browser.find_element_by_xpath("//button[text()='确认')]").click() locator = (By.XPATH,"//button[text()='确认']") on_click(browser,locator) time.sleep(4) url = "检查预约单" utility.microsoft_xps_document_writer(url) if __name__ == "__main__": browser = common.browser() cache = Cache({}) cache.set('检查单',{'02D2017060500055':'预约小组'}) cache.set('pai_type','o') cache.set('userId','%E?;1004627675=99015017425?+E?') testcase = {'用户名': 'jfli', '密码': '123456'} login.test_login(browser,testcase,cache) test_reservation_regist(browser, cache)
while True: if '暂时没有您需要的数据...' not in get_text( browser, (By.XPATH, PdsApplyPharmElement.div[5]['key'])): break if time.time() > end_time: log.info('核对发药页面加载超时或没有找到发药单') return # browser.find_element_by_xpath(PdsApplyPharmElement.fieldset[0]['key']).find_elements_by_tag_name('button')[0].click() browser.find_element_by_xpath("//button[contains(text(),'发药(O)')]").click() browser.find_element_by_xpath("//button[contains(text(),'是')]").click() log.info('供药脚本运行结束') if __name__ == "__main__": cache = Cache({}) cache.set('resultType', '1') cache.set('specialName', '急诊内科'), cache.set('处方单', {'02A201707-0400024': '门诊药房(光谷)'}) cache.set('patient_card', '%E?;1004627675=99015017425?+E?') cache.set('pds_emr', [{ '疗程': 1, '医嘱名称': '温胃舒胶囊', '每次用量': 1, '药品规格': '0.4g@合肥华润神鹿(24)', '频次': 1 }]) browser = Common.browser() testcase = {'用户名': 'jfli', '密码': '123456'} login.test_login(browser, testcase, cache) test_apply_pharm(browser, cache)
if rek_no in get_text( browser, (By.XPATH, application_detail_list.费用明细)): break if time.time() > end_time: log.info('加载消费明细失败') break on_click(browser, (By.XPATH, '//button[contains(text(),"打印")]')) on_click(browser, (By.XPATH, '//button[contains(text(),"确 定")]')) on_click(browser, (By.XPATH, '//button[contains(text(),"是")]')) microsoft_xps_document_writer('发票单') else: log.info('验证最小票据号窗口弹出异常') log.info('发票打印脚本运行结束') if __name__ == '__main__': cache = Cache({}) browser = Common.browser() testcase = {'用户名': 'jfli', '密码': '123456'} login.test_login(browser, testcase, cache) cache.set('quit_sign', ['王易', '呼吸内科急诊', '普通', '刘馗', '2017-06-09']) # cache.set('处方单',{'02A201706-1300038':'门诊药房(光谷)','02A201706-1300039':'门诊药房(光谷)'}) cache.set( '检查单', { '02D2017061200055': '超声影像科', '02D2017033000025': '放射科', '02D2017040100012': '超声影像科' }) cache.set('patient_card', '%E?;2501218606=99015012538?+E?') test_invoice_print(browser, cache)
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('运行预付费退费(窗口)脚本结束') if __name__ == '__main__': cache = Cache({}) browser = Common.browser() testcase = {'用户名': 'jfli', '密码': '123456'} login.test_login(browser, testcase, cache) cache.set('quit_sign', ['王易', '呼吸内科急诊', '普通', '刘馗', '2017-06-09']) cache.set('处方单', { '02A201706-1300038': '门诊药房(光谷)', '02A201706-1300039': '门诊药房(光谷)' }) cache.set('检查单', { '02D2017062000009': '超声影像科', '02D2017062000008': '超声影像科' }) cache.set('patient_card', '%E?;2501218606=99015012538?+E?') cache.set('草药', {'02A201706-2000024': '中药饮片药房(光谷)'}) test_pay_refund(browser, cache)
if not list_messages: log.info('内部挂号没有号源信息') return for list_message in list_messages: boolen = select_lists(browser, locator, list_message) if boolen: if boolen[0] == '留号': index = 12 if boolen[0] == '加号': index = 13 if boolen and boolen[index] == '未取号': on_click(browser, (By.XPATH, '//button[contains(text(),"取消预约")]')) on_click(browser, (By.XPATH, '//button[contains(text(),"是")]')) else: log.info('内部挂号列表验证fail') return if __name__ == '__main__': cache = Cache({}) browser = Common.browser() testcase = {'用户名': 'jfli', '密码': '123456'} login.test_login(browser, testcase, cache) cache.set( 'business_type', [['王易', '加号', '肝脏内科', '下午', '周毅'], ['杨竣熙', '加号', '肝脏内科', '上午', '周毅']]) # testcase = {'门诊时间': '下午', '患者姓名': '杨俊熙', '医生': '李德民', '门诊科室': '消化内科门诊', '就诊时间': '2017-06-05', # '患者卡号': '%E?;1004627675=99015017425?+E?', '专科名称': '消化内科','号源类别':'专家'} test_order_sign_list(browser, cache)
log = Log.Logger(__name__) def test_quit_sign_list(browser, cache): log.info('开始运行退号信息列表脚本') login.select_workstation(browser, '门诊挂号收费工作台', cache) # 工作站是否打开 on_click(browser, (By.XPATH, '//div[contains(text(),"门诊挂号")]')) on_click(browser, (By.LINK_TEXT, '退号信息列表')) remove_js = 'document.getElementsByTagName("input")[26].removeAttribute("readonly")' focus_js = "document.getElementsByTagName('input')[26].blur()" input_locator = (By.XPATH, head_button.退号开始日期) img_locator = (By.XPATH, head_button.退号开始日历) date = time.strftime("%Y-%m-%d", time.localtime()) calendar(browser, remove_js, focus_js, input_locator, img_locator, date) on_click(browser, (By.XPATH, '//button[contains(text(),"查询")]')) if select_lists(browser, (By.XPATH, body.号源列表), cache.get('quit_sign')): log.info('退号列表显示pass') else: log.info('退号列表显示pass') log.info('退号信息列表脚本运行结束') if __name__ == '__main__': cache = Cache({}) browser = Common.browser() testcase = {'用户名': 'jfli', '密码': '123456'} login.test_login(browser, testcase, cache) cache.set('quit_sign', ['王易', '呼吸内科急诊', '普通', '刘馗', '2017-06-09']) test_quit_sign_list(browser, cache)
''' 数据校验 ''' on_click(browser, (By.XPATH, '//button[contains(text(),"退费")]')) on_click(browser, (By.XPATH, '//button[contains(text(),"确定")]')) time.sleep(4) listUrl = '退费发票单' Utility.microsoft_xps_document_writer(listUrl) browser.implicitly_wait(30) on_click(browser, (By.XPATH, '//button[contains(text(),"确定")]')) return else: apply_card = [] browser.refresh() if __name__ == '__main__': cache = Cache({}) browser = Common.browser() testcase = {'用户名': 'jfli', '密码': '123456'} login.test_login(browser, testcase, cache) cache.set('apply_date', '2017-07-04') cache.set('apply_card', ['02A201707-0400024']) cache.set('patient_card', '%E?;1004627675=99015017425?+E?') test_outbill_prepay_refuse(browser, cache)