def testcase_011_schedule_info(self): """获取医生排班信息""" try: t = time.strftime('%Y-%m-%d', time.localtime()) method = 'post' paramtype = 'json' url = self.localhost + '/api/his-platform-global-clinic/v1/scheduling-setting/scheduleDoctorInfoPageForRegistration' datas = { "pageNo": 1, "pageSize": 20, "deptId": "", "orgId": self.orgid, "scheduleDate": t, "scheduleDetailsId": "", "shiftId": [], "userId": [] } headers = {'Authorization': self.Authorization} respone = R.request(method, url, datas, headers, paramtype) self.assertEqual(respone['msg'], '处理成功', msg=respone) lst = respone['data']['list'] for i in lst: if i['theSourceNumber'] == '0': lst.remove(i) self.g['scheduleinfo'] = random.choice(lst) Log.logsinfo('挂号医生信息:{0},挂号科室信息:{1}'.format( self.g['scheduleinfo']['userName'], self.g['scheduleinfo']['deptName'])) except Exception as e: Log.logsinfo(self._testMethodName + '\n' + str(e)) raise
def testcase_015_PayMoneyInfo(self): """获取挂号实际支付信息""" try: method = 'post' paramtype = 'json' url = self.localhost + '/api/his-platform-global-clinic/v1/globalRegistrationSystem/selectScheduleToCountMoney' datas = { "cardNo": self.g['card_no'], "deptId": self.g['scheduleinfo']['deptId'], "fee": self.g['scheduleinfo']['fee'], "isEnjoyDiscountCard": 0, "payCardNo": self.g['card_no'], "registrationDiscountId": self.g['discount']['id'], "scheduleDetailsId": self.g['scheduleinfo']['scheduleDetailsId'], "shiftId": self.g['scheduleinfo']['shiftId'], "userId": self.g['scheduleinfo']['userId'], "visitLevelId": self.g['scheduleinfo']['visitLevelId'] } headers = {'Authorization': self.Authorization} respone = R.request(method, url, datas, headers, paramtype) self.assertEqual(respone['msg'], '', msg=respone) self.g['PayInfo'] = respone['data'] except Exception as e: Log.logsinfo(self._testMethodName + '\n' + str(e)) raise
def gettoken(self): """登录账号角色""" self.get_deptidANDroleid() method = 'get' url = self.localhost + '/api/api-uaa/oauth/user/token' data1 = { 'username': self.name, 'password': self.passwd, 'deviceId': '7B2E6955-D77A-40F7-A37B-4281E703B2A2', 'orgId': self.g['orgid'], 'deptId': self.g['deptId'], 'roleId': self.g['roleId'] } headers = {'Authorization': self.Authorization} respone = R.request(method, url, data1, headers) if respone['msg'] == '': self.g['token'] = respone['data']['token_type'] + respone['data'][ 'access_token'] Log.logsinfo('获取token成功:{0}'.format(self.g['token'])) '''保存token到文件''' setdata(self.file, self.g['token'], 1, 0) return self.g['token'] else: Log.logsinfo('error!接口返回错误:{0}'.format(respone)) Log.logtraceback()
def testcase_014_getBillNo(self): """获取纸质发票流水号""" try: method = 'get' url = self.localhost + '/api/global-bill/v1/bill/use/getBillNowNo' datas = {'billTypeId': self.g['BillTypeId']} headers = {'Authorization': self.Authorization} respone = R.request(method, url, datas, headers) self.assertEqual(respone['msg'], '', msg=respone) self.g['billno'] = respone['data']['nowNum'] except Exception as e: Log.logsinfo(self._testMethodName + '\n' + str(e)) raise
def testcase_013_getBillTypeId(self): """获取纸质发票id""" try: method = 'get' url = self.localhost + '/api/his-platform-global-common/charge-business/getBillTypeIdByBusinessCode' datas = {'businessCode': 'registration'} headers = {'Authorization': self.Authorization} respone = R.request(method, url, datas, headers) self.assertEqual(respone['msg'], '', msg=respone) self.g['BillTypeId'] = respone['data'] except Exception as e: Log.logsinfo(self._testMethodName + '\n' + str(e)) raise
def testcase_010_regdiscounts(self): """获取挂号优惠信息""" try: method = 'get' url = self.localhost + '/api/his-platform-config-center/v1/registration-discount/page-list' datas = None headers = {'Authorization': self.Authorization} respone = R.request(method, url, datas, headers) self.assertEqual(respone['msg'], '处理成功', msg=respone) self.g['discount'] = random.choice(respone['data']) Log.logsinfo('挂号优惠信息:{0}'.format( self.g['discount']['registrationDiscountName'])) except Exception as e: Log.logsinfo(self._testMethodName + '\n' + str(e)) raise
def testcase_008_getcardno(self): """获取金卡卡号""" try: method = 'get' url = self.localhost + '/api/his-platform-global-clinic/v1/patient-card/generateCardNumberByCardType/{0}'.format( self.g['cardTypeid']) datas = None headers = {'Authorization': self.Authorization} respone = R.request(method, url, datas, headers) self.assertEqual(respone['msg'], '', msg=respone) self.g['card_no'] = respone['data'] Log.logsinfo('会员卡卡号:{0}'.format(self.g['card_no'])) except Exception as e: Log.logsinfo(self._testMethodName + '\n' + str(e)) raise
def testcase_006_getmaritalStatusid(self): """获取婚姻状况id""" try: method = 'get' url = self.localhost + '/api/his-platform-global-config/v1/dictionary-item/page' datas = {'pageNo': 1, 'pageSize': 10000, 'dictId': self.g['marry']} headers = {'Authorization': self.Authorization} respone = R.request(method, url, datas, headers) self.assertEqual(respone['msg'], '处理成功', msg=respone) lst = respone['data']['list'] self.g['maritalStatusid'] = lst[0]['id'] Log.logsinfo('婚姻状况未婚id:{0}'.format(self.g['maritalStatusid'])) except Exception as e: Log.logsinfo(self._testMethodName + '\n' + str(e)) raise
def testcase_007_getcardTypeId(self): """获取金卡id""" try: method = 'get' url = self.localhost + '/api/his-platform-global-common/v1/organization-card-type/valid-list' datas = {'orgId': self.orgid} headers = {'Authorization': self.Authorization} respone = R.request(method, url, datas, headers) self.assertEqual(respone['msg'], '', msg=respone) lst = respone['data'] for i in lst: if i['cardType'] == '金卡': self.g['cardTypeid'] = i['id'] Log.logsinfo('金卡id:{0}'.format(self.g['cardTypeid'])) except Exception as e: Log.logsinfo(self._testMethodName + '\n' + str(e)) raise
def testcase_016_getTreatmentTypeId(self): """获取治疗类型id""" try: method = 'get' url = self.localhost + '/api/his-platform-config-center/v1/treatment/type/list' datas = {'orgId': self.orgid} headers = {'Authorization': self.Authorization} respone = R.request(method, url, datas, headers) self.assertEqual(respone['msg'], '', msg=respone) lst = respone['data'] for i in lst: if i['name'] == '门诊': self.g['TreatmenTypeId'] = i['id'] self.g['TreatmenTypeName'] = i['name'] except Exception as e: Log.logsinfo(self._testMethodName + '\n' + str(e)) raise
def get_acctoken(self): """验证账号是否正确""" method = 'get' url = self.localhost + '/api/api-uaa/oauth/user/token' self.g['data'] = { 'username': self.name, 'password': self.passwd, 'deviceId': '7B2E6955-D77A-40F7-A37B-4281E703B2A2' } headers = {'Authorization': self.Authorization} respone = R.request(method, url, self.g['data'], headers) if respone['msg'] == '': self.g['acctoken'] = respone['data']['token_type'] + respone[ 'data']['access_token'] Log.logsinfo('获取acctoken成功:{0}'.format(self.g['acctoken'])) else: Log.logsinfo('error!接口返回错误:{0}'.format(respone)) Log.logtraceback()
def testcase_003_getcertificateTypeid(self): """获取证件类型id""" try: method = 'get' url = self.localhost + '/api/his-platform-global-common/common-dictionary/org/list' datas = {'dictTypeId': 1205314304593182722} headers = {'Authorization': self.Authorization} respone = R.request(method, url, datas, headers) self.assertEqual(respone['msg'], '', msg=respone) lst = respone['data'] for i in lst: if i['dictValue'] == '居民户口本': self.g['certificateTypeid'] = i['id'] Log.logsinfo('证据类型:居民户口本,证件id:{0}'.format( self.g['certificateTypeid'])) except Exception as e: Log.logsinfo(self._testMethodName + '\n' + str(e)) raise
def testcase_012_getclassinfo(self): """获取班次时间段信息""" try: method = 'get' url = self.localhost + '/api/his-platform-config-center/outCallClassesConfigController/page-list' datas = {'keyWord': '', 'pageNo': 1, 'pageSize': 1000} headers = {'Authorization': self.Authorization} respone = R.request(method, url, datas, headers) self.assertEqual(respone['msg'], '处理成功', msg=respone) lst = respone['data']['list'] for i in lst: if i['id'] == self.g['scheduleinfo']['shiftId']: self.g['visitShiftName'] = i['classesName'] + '(' + i[ 'classesStartDate'] + '-' + i['classesEndDate'] + ')' except Exception as e: Log.logsinfo(self._testMethodName + '\n' + str(e)) raise
def get_orgid(self): """如果账号正确,进行下一步,获取账号机构列表""" self.get_acctoken() method = 'get' url = self.localhost + '/api/his-user-center/staff_organization/getStaffOrganizationList' data = None headers = {'Authorization': self.g['acctoken']} respone = R.request(method, url, data, headers) if respone['msg'] == '': for i in respone['data']: # 遍历此账户所有机构 if i['orgName'] == self.orgname: self.g['orgid'] = i['id'] '''保存orgid到文件便于引用''' setdata(self.file, self.g['orgid'], 1, 1) return self.g['orgid'] Log.logsinfo('获取orgId成功:{0}'.format(self.g['orgid'])) else: Log.logsinfo('error!接口返回错误:{0}'.format(respone)) Log.logtraceback()
def testcase_002_getsexid(self): """获取性别id""" try: method = 'get' url = self.localhost + '/api/his-platform-global-config/v1/dictionary-item/page' datas = {'pageNo': 1, 'pageSize': 10000, 'dictId': self.g['sex']} headers = {'Authorization': self.Authorization} respone = R.request(method, url, datas, headers) self.assertEqual(respone['msg'], '处理成功', msg=respone) lst = respone['data']['list'] if persominfo['sex'] == '男': self.g['sexid'] = lst[1]['id'] elif persominfo['sex'] == '女': self.g['sexid'] = lst[3]['id'] Log.logsinfo('病人性别:{0},性别id:{1}'.format(persominfo['sex'], self.g['sexid'])) except Exception as e: Log.logsinfo(self._testMethodName + '\n' + str(e)) raise
def testcase_001_getdictionary(self): """获取病人注册相关各种字典id""" try: method = 'get' url = self.localhost + '/api/his-platform-global-config/v1/dictionary/page' datas = {'pageNo': 1, 'pageSize': 10000} headers = {'Authorization': self.Authorization} respone = R.request(method, url, datas, headers) self.assertEqual(respone['msg'], '处理成功', msg=respone) lst = respone['data']['list'] self.g['nation'] = lst[0]['id'] self.g['sex'] = lst[1]['id'] self.g['marry'] = lst[2]['id'] self.g['profession'] = lst[3]['id'] self.g['family'] = lst[4]['id'] self.g['country'] = lst[5]['id'] self.g['education'] = lst[6]['id'] Log.logsinfo('病人注册相关字典id:{0}'.format(lst)) except Exception as e: Log.logsinfo(self._testMethodName + '\n' + str(e)) raise
def testcase_017_getPayWayTypeId(self): """获取支付方式id""" try: method = 'get' url = self.localhost + '/api/his-platform-global-common/charge-business/list' datas = { 'businessCode': 'registration', 'cardNo': self.g['card_no'] } headers = {'Authorization': self.Authorization} respone = R.request(method, url, datas, headers) self.assertEqual(respone['msg'], '', msg=respone) lst = respone['data'] for i in lst: if i['businessDesc'] == '挂号': PayWayList = i['payWayList'] for j in PayWayList: for key, value in j.items(): if value == '现金': self.g['PayWayTypeId'] = key except Exception as e: Log.logsinfo(self._testMethodName + '\n' + str(e)) raise
def get_deptidANDroleid(self): """获取部门id和角色id""" self.get_orgid() method = 'get' url = self.localhost + '/api/his-user-center/staff_organization/getStaffDeptRoleList/{0}'.format( self.g['orgid']) data = None headers = {'Authorization': self.g['acctoken']} respone = R.request(method, url, data, headers) if respone['msg'] == '': for i in respone['data']: if i['roleName'] == self.rolename: self.g['deptId'] = i['deptId'] self.g['roleId'] = i['roleId'] Log.logsinfo('获取deptId成功:{0}'.format(self.g['deptId'])) Log.logsinfo('获取roleId成功:{0}'.format(self.g['roleId'])) else: Log.logsinfo('error!接口返回错误:{0}'.format(respone)) Log.logtraceback()
def testcase_018_registration(self): """挂号""" try: method = 'post' paramtype = 'json' url = self.localhost + '/api/his-platform-global-clinic/v1/globalRegistrationSystem/registrationRecord' datas = { "orgId": self.orgid, "groupId": None, "groupPatientId": self.g['groupPatientId'], "orgPatientId": self.g['orgPatientId'], "cardTypeId": self.g['cardTypeid'], "cardTypeName": "金卡", "cardStatus": "1", "patientName": persominfo['name'], "birthDate": persominfo['birthday_stamp'], "phoneNo": persominfo['phone'], "sex": self.g['sexid'], "age": persominfo['age'], "cardBalance": None, "balanceAmount": None, "cardDiscount": None, "insideDiscount": None, "extWhetherDiscount": None, "vipCard": None, "allowCharge": None, "payCardNo": self.g['card_no'], "cardNo": self.g['card_no'], "other": None, "registrationType": 1, "discountMoneyOfRegistration": self.g['PayInfo']['discountMoneyOfRegistration'], "discountMonetOfmemberCard": self.g['PayInfo']['discountMonetOfmemberCard'], "isEnjoyDiscountCard": self.g['PayInfo']['isEnjoyDiscountCard'], "invoiceNo": self.g['billno'], "payMoney": self.g['PayInfo']['payMoney'], "registrationDiscountId": self.g['discount']['id'], "invoiceType": 2, "treatmentTypeName": self.g['TreatmenTypeName'], "treatmentTypeId": self.g['TreatmenTypeId'], "billTypeId": self.g['BillTypeId'], "classesName": None, "deptId": self.g['scheduleinfo']['deptId'], "deptName": self.g['scheduleinfo']['deptName'], "fee": self.g['scheduleinfo']['fee'], "scheduleDetailsId": self.g['scheduleinfo']['scheduleDetailsId'], "shiftId": self.g['scheduleinfo']['shiftId'], "userId": self.g['scheduleinfo']['userId'], "userName": self.g['scheduleinfo']['userName'], "visitLevelId": self.g['scheduleinfo']['visitLevelId'], "visitLevelName": self.g['scheduleinfo']['visitLevelName'], "visitShiftName": self.g['visitShiftName'], "visitTimeDate": self.g['scheduleinfo']['scheduleDate'], "sourceNumberType": self.g['scheduleinfo']['sourceNumberWay'], "categoryDTOForMtList": self.g['PayInfo']['categoryDTOForMtList'], "feeDetailForPackageDTOS": self.g['PayInfo']['feeDetailForPackageDTOS'], "discountMembercardId": self.g['card_no'], "payCardId": self.g['PayInfo']['payCardId'], "isPrintInvoice": True, "tradeRecordPaymentTypeRequests": [{ "paymentType": self.g['PayWayTypeId'], "paymentTypeName": "现金", "payAmount": self.g['PayInfo']['payMoney'], "payType": 1 }], "gender": self.g['sexid'], "remark": "" } headers = {'Authorization': self.Authorization} respone = R.request(method, url, datas, headers, paramtype) self.assertEqual(respone['msg'], '挂号成功!', msg=respone) registrationID = respone['data']['id'] Log.logsinfo('挂号记录ID:{0}'.format(registrationID)) except Exception as e: Log.logsinfo(self._testMethodName + '\n' + str(e)) raise
def testcase_009_patient_reg(self): """病人注册""" try: method = 'post' url = self.localhost + '/api/his-platform-global-clinic/v1/patient-card' data = { 'threeNoPerson': False, 'crmId': '', 'id': '', 'groupPatientId': '', 'name': persominfo['name'], 'sex': self.g['sexid'], 'birthday': persominfo['birthday_stamp'], 'certificateType': self.g['certificateTypeid'], 'certificateNo': persominfo['idnum'], 'country': self.g['countyrid'], 'nation': self.g['nationid'], 'maritalStatus': self.g['maritalStatusid'], 'profession': '', 'educationLevel': '', 'phoneNo': persominfo['phone'], 'medicalInsuranceType': '', 'email': '', 'generalRegionProvince': '', 'generalRegionCity': '', 'generalRegionArea': '', 'domicileRegionProvince': '', 'domicileRegionCity': '', 'domicileRegionArea': '', 'mensesTime': '', 'remark': '', 'generalRegionDetail': '', 'domicileRegionDetail': '', 'contactName': '', 'contactRelationId': '', 'contactPhoneNo': '', 'orgPatientId': '', 'cardId': '', 'cardTypeId': self.g['cardTypeid'], 'cardNo': self.g['card_no'], 'cardPwd': 111111, 'invoiceType': '', 'lastMenstrualPeriod': '', 'billNo': '', 'paymentWayId': '', 'billTypeId': '', 'needCardNumberRule': '', 'cardStatus': 1, 'stamp': 2 } headers = {'Authorization': self.Authorization} respone = R.request(method, url, data, headers) self.assertEqual(respone['code'], 200, msg=respone) self.g['groupPatientId'] = respone['data']['groupPatientId'] self.g['orgPatientId'] = respone['data']['orgPatientId'] Log.logsinfo('病人注册接口返回信息:{0}'.format(respone['data'])) Log.logsinfo('病人身份信息:{0}'.format(persominfo)) except Exception as e: Log.logsinfo(self._testMethodName + '\n' + str(e)) Log.logsinfo('病人身份信息:{0}'.format(persominfo)) raise