Commit 9a3d4dba authored by xiao-hesheng's avatar xiao-hesheng
Browse files

新增科室

parent acc5da1b
# -*- encoding=utf8 -*-
from common.db.sql.sql_del_branch_info import delByBranchId
from common.db.sql.sql_del_notices_info import delByNoticeName
from common.fileUtls import FileUtils
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,b8_厂商管理_厂商查询byName,id2263,id2263-18,sit,on
主数据平台:b8_厂商管理_厂商查询byName
"""
from common.common_func import commonFuc
from air_case.a1_herp3_login.登录内网系统.登录内网系统 import login_system
module = "a2_herp3_bs"
def facturer_query_byID():
"""
场景:b8_厂商管理_厂商查询byName
用例名称:b8_厂商管理_厂商查询byName
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": 1}
"""
#内网登录
username = commonFuc().get_business_data(module, "username")
# print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
#b8_厂商管理_厂商查询byName
notices_id = FileUtils().r_info3(module, '公告新增')["notices_id"]
url=commonFuc().get_api_url()+commonFuc().get_business_data(module, "firmpage_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
# # print(notices_id,notices_title)
# expireDate=timeUtils().get_time_add(30)
# # print(expireDate)
# #请求体
request_body=commonFuc().get_business_data(module, "payload12")
# print(request_body)
# # # 发送请求
result = commonFuc().http_post(url,request_body,headers)
print('result', result)
# checkDict=commonFuc().get_business_data(module,'checkDict2')
# #断言
# id=commonFuc().analysis_json('id',commonFuc().analysis_json('data',commonFuc().analysis_json('data',result)))
# print(id)
commonFuc().check_text_exist('国药集团浙江医疗器材有限公司',result)
facturer_query_byID()
# -*- encoding=utf8 -*-
from common.db.sql.sql_del_branch_info import delByBranchId
from common.db.sql.sql_del_notices_info import delByNoticeName
from common.fileUtls import FileUtils
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,b9_科室管理_科室登记_科室查询,id2263,id2263-19,sit,on
主数据平台:b9_科室管理_科室登记_科室查询
"""
from common.common_func import commonFuc
from air_case.a1_herp3_login.登录内网系统.登录内网系统 import login_system
module = "a2_herp3_bs"
def dept_query_byID():
"""
场景:b9_科室管理_科室登记_科室查询
用例名称:b9_科室管理_科室登记_科室查询
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": 1}
"""
#内网登录
username = commonFuc().get_business_data(module, "username")
# print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
#b9_科室管理_科室登记_科室查询
branch_id = FileUtils().r_info(module, '院区新增')["branch_id"]
url=commonFuc().get_api_url()+commonFuc().get_business_data(module, "deptPage_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
# #请求体
request_body=commonFuc().get_business_data(module, "payload13",branch_id)
print(request_body)
# # # 发送请求
result = commonFuc().http_post(url,request_body,headers)
print('result', result)
# #断言
commonFuc().check_text_exist('[]',result)
dept_query_byID()
# -*- encoding=utf8 -*-
from common.db.sql.sql_del_branch_info import delByBranchId
from common.db.sql.sql_del_notices_info import delByNoticeName
from common.fileUtls import FileUtils
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,c0_新增科室_特殊科室_设备科_中心库房,id2263,id2263-20,sit,on
主数据平台:c0_新增科室_特殊科室_设备科_中心库房
"""
from common.common_func import commonFuc
from air_case.a1_herp3_login.登录内网系统.登录内网系统 import login_system
module = "a2_herp3_bs"
def add_center_dept():
"""
场景:c0_新增科室_特殊科室_设备科_中心库房
用例名称:c0_新增科室_特殊科室_设备科_中心库房
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": 1}
"""
#内网登录
username = commonFuc().get_business_data(module, "username")
# print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
#c0_新增科室_特殊科室_设备科_中心库房
branch_id = FileUtils().r_info(module, '院区新增')["branch_id"]
url=commonFuc().get_api_url()+commonFuc().get_business_data(module, "dept_insert_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
# #请求体
request_body=commonFuc().get_business_data(module, "payload14",branch_id)
print(request_body)
# # # 发送请求
result = commonFuc().http_post(url,request_body,headers)
print('result', result)
# #断言
checkDict=commonFuc().get_business_data(module,'checkDict2')
commonFuc().check_result(checkDict,result)
add_center_dept()
# -*- encoding=utf8 -*-
from common.db.sql.sql_del_branch_info import delByBranchId
from common.db.sql.sql_del_notices_info import delByNoticeName
from common.fileUtls import FileUtils
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,c1_新增科室_科室已存在,id2263,id2263-21,sit,on
主数据平台:c1_新增科室_科室已存在
"""
from common.common_func import commonFuc
from air_case.a1_herp3_login.登录内网系统.登录内网系统 import login_system
module = "a2_herp3_bs"
def add_center_dept():
"""
场景:c1_新增科室_科室已存在
用例名称:c1_新增科室_科室已存在
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": 1}
"""
#内网登录
username = commonFuc().get_business_data(module, "username")
# print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
#c1_新增科室_科室已存在
branch_id = FileUtils().r_info(module, '院区新增')["branch_id"]
url=commonFuc().get_api_url()+commonFuc().get_business_data(module, "dept_insert_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
# #请求体
request_body=commonFuc().get_business_data(module, "payload14",branch_id)
print(request_body)
# # # 发送请求
result = commonFuc().http_post(url,request_body,headers)
print('result', result)
# #断言
checkDict=commonFuc().get_business_data(module,'checkDict7')
commonFuc().check_result(checkDict,result)
add_center_dept()
# -*- encoding=utf8 -*-
from common.db.sql.sql_del_branch_info import delByBranchId
from common.db.sql.sql_del_notices_info import delByNoticeName
from common.fileUtls import FileUtils
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,c2_新增科室后查询科室,id2263,id2263-22,sit,on
主数据平台:c2_新增科室后查询科室
"""
from common.common_func import commonFuc
from air_case.a1_herp3_login.登录内网系统.登录内网系统 import login_system
module = "a2_herp3_bs"
def add_select_dept():
"""
场景:c2_新增科室后查询科室
用例名称:c2_新增科室后查询科室
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": 1}
"""
#内网登录
username = commonFuc().get_business_data(module, "username")
# print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
#c2_新增科室后查询科室
branch_id = FileUtils().r_info(module, '院区新增')["branch_id"]
url=commonFuc().get_api_url()+commonFuc().get_business_data(module, "deptPage_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
# #请求体
request_body=commonFuc().get_business_data(module, "payload13",branch_id)
print(request_body)
# # # 发送请求
result = commonFuc().http_post(url,request_body,headers)
print('result', result)
# #断言
total=commonFuc().analysis_json('total',commonFuc().analysis_json('data',result))
if total>=1:
commonFuc().check_text_exist('0',result)
else:
commonFuc().check_text_exist('500', result)
add_select_dept()
# -*- encoding=utf8 -*-
from common.db.sql.sql_del_branch_info import delByBranchId
from common.db.sql.sql_del_notices_info import delByNoticeName
from common.fileUtls import FileUtils
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,c0_新增科室_特殊科室_设备科_中心库房,id2263,id2263-23,sit,on
主数据平台:c0_新增科室_特殊科室_设备科_中心库房
"""
from common.common_func import commonFuc
from air_case.a1_herp3_login.登录内网系统.登录内网系统 import login_system
module = "a2_herp3_bs"
def add_center_dept():
"""
场景:c0_新增科室_特殊科室_设备科_中心库房
用例名称:c0_新增科室_特殊科室_设备科_中心库房
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": 1}
"""
#内网登录
username = commonFuc().get_business_data(module, "username")
# print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
#c0_新增科室_特殊科室_设备科_中心库房
branch_id = FileUtils().r_info(module, '院区新增')["branch_id"]
url=commonFuc().get_api_url()+commonFuc().get_business_data(module, "dept_insert_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
# #请求体
request_body=commonFuc().get_business_data(module, "payload15",branch_id)
print(request_body)
# # # 发送请求
result = commonFuc().http_post(url,request_body,headers)
print('result', result)
# #断言
checkDict=commonFuc().get_business_data(module,'checkDict2')
commonFuc().check_result(checkDict,result)
add_center_dept()
# -*- encoding=utf8 -*-
from common.db.sql.sql_del_branch_info import delByBranchId
from common.db.sql.sql_del_notices_info import delByNoticeName
from common.fileUtls import FileUtils
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,c4_新增科室后查询科室ID,id2263,id2263-24,sit,on
主数据平台:c4_新增科室后查询科室ID
"""
from common.common_func import commonFuc
from air_case.a1_herp3_login.登录内网系统.登录内网系统 import login_system
module = "a2_herp3_bs"
def add_select_dept():
"""
场景:c4_新增科室后查询科室ID
用例名称:c4_新增科室后查询科室ID
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": 1}
"""
#内网登录
username = commonFuc().get_business_data(module, "username")
# print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
#c4_新增科室后查询科室ID
branch_id = FileUtils().r_info(module, '院区新增')["branch_id"]
url=commonFuc().get_api_url()+commonFuc().get_business_data(module, "deptPage_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
# #请求体
request_body=commonFuc().get_business_data(module, "payload13",branch_id)
print(request_body)
# # # 发送请求
result = commonFuc().http_post(url,request_body,headers)
print('result', result)
# #断言
total=commonFuc().analysis_json('total',commonFuc().analysis_json('data',result))
if total>=2:
commonFuc().check_text_exist('0',result)
data=commonFuc().analysis_json('data',commonFuc().analysis_json('data',result))
deptid2=commonFuc().analysis_json('id',data[1])
ename2=commonFuc().analysis_json('ename',data[1])
print('deptid2',deptid2,ename2)
info=(deptid2,ename2)
titlename=('科室id','科室名称')
#将二级科室id写入文件中
FileUtils().w_info4(info,module,'科室信息',titlename)
else:
commonFuc().check_text_exist('500', result)
add_select_dept()
......@@ -6,7 +6,7 @@ import pymysql
class delByBranchId(object):
def Delete_branch_by_id(self,id):
connection = pymysql.connect(host="10.17.65.108", user="root", password="Gyxc.2023", database="spd3_herp_test2",
connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd3_herp_test2",
charset="utf8")
cursor = connection.cursor()
# 删除新增的院区数据,减少垃圾数据的产生,保证脚本下次还可以正常运行,接口脚本每次都使用新增数据
......
......@@ -6,7 +6,7 @@ import pymysql
class delByNoticeName(object):
def delete_ByNoticeName(self):
connection = pymysql.connect(host="10.17.65.108", user="root", password="Gyxc.2023", database="spd3_herp_test2",
connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd3_herp_test2",
charset="utf8")
cursor = connection.cursor()
# 删除新增的院区数据,减少垃圾数据的产生,保证脚本下次还可以正常运行,接口脚本每次都使用新增数据
......
......@@ -52,7 +52,32 @@ class FileUtils(object):
# 写入到yaml文件
with open(yamlpath, "w", encoding="utf-8") as f:
yaml.dump(dict, f, Dumper=yaml.RoundTripDumper,allow_unicode=True)
#写入院区数据,新函数,存在已有内容,替换掉旧内容
def w_info2_new(self, newinfo, module, keyname, oldinfo):
module = module
dict = {}
value = {}
value['branch_id'] = newinfo[0]
value['branch_name'] = newinfo[1]
key = keyname
dict[key] = value
w_path = rootPath + os.sep + 'data' + os.sep + module
# print(w_path)
yamlpath = os.path.join(w_path, "message")
if (self.r_info(module, keyname) != None):
# 替换文件内容
file = open(yamlpath, "r+", encoding="utf-8")
content = file.read()
for i in range(len(newinfo)):
new_content = content.replace(oldinfo[i], newinfo[i])
file.seek(0)
file.write(new_content)
file.close()
else:
# 写入到yaml文件
with open(yamlpath, "a", encoding="utf-8") as f:
yaml.dump(dict, f, Dumper=yaml.RoundTripDumper, allow_unicode=True)
#写入院区数据
def w_info2(self, info,module,keyname):
module=module
dict = {}
......@@ -101,6 +126,28 @@ class FileUtils(object):
return None
else:
return None
#写入科室信息
def w_info4(self, info,module,keyname,titlename):
module=module
dict = {}
value = {}
value[titlename[0]] = info[0]
value[titlename[1]] = info[1]
key=keyname
dict[key] = value
w_path=rootPath+os.sep+'data'+os.sep+module
# print(w_path)
yamlpath = os.path.join(w_path, "message")
if (self.r_info(module,keyname)!=None):
print('已有相同信息,不写入')
# 写入到yaml文件
# with open(yamlpath, "w", encoding="utf-8") as f:
# yaml.dump(dict, f, Dumper=yaml.RoundTripDumper,allow_unicode=True)
else:
# 写入到yaml文件
with open(yamlpath, "a", encoding="utf-8") as f:
yaml.dump(dict, f, Dumper=yaml.RoundTripDumper, allow_unicode=True)
if __name__ == '__main__':
# info=("aaaa","bbbbbb","mdm3-pim")
# FileUtils().w_info(info,"产品新增")
......
......@@ -9,6 +9,8 @@
"update_url": "/hospitaltest2api/platformService/basic/notice/update"
"del_url": "/hospitaltest2api/platformService/basic/notice/del/"
"firmpage_url": "/hospitaltest2api/herpService/basic/firm/page/"
"deptPage_url": "/hospitaltest2api/platformService/sys/org/v2/deptPage/"
"dept_insert_url": "/hospitaltest2api/platformService/sys/org/v2/insert/"
"username": "xhs1009"
"password": "1qaz!QAZ"
"X-APP-CODE": "herp.pc"
......@@ -75,6 +77,34 @@ json_headers2: {
"payload9": {"pageNum": 1,"pageSize": 50,"queryObject": {"title": "不存在的公告","mgrRangeKind": "","publishDateBegin": "", "publishDateEnd": "", "corpId": "h0347"}}
"payload10": {"content": "%s","expireDate": "%s","mgrRangeId": "","title": "%supdate","id": "%s","topFlag": "0","mgrRangeKind": "1","corpId": "h0347","noticeType": 1}
"payload11": {"pageNum": 1,"pageSize": 50,"queryObject": {"hosId": "h0347","searchText": "p56a4","firmType": 1}}
"payload12": {"pageNum": 1,"pageSize": 50,"queryObject": {"hosId": "h0347","searchText": "国药集团浙江医疗器材有限公司","firmType": 1}}
"payload13": {"pageNum": 1,"pageSize": 50,"orderBy": "code asc","queryObject": {"ename": "","branchId": "院区id", "branchId": "%s", "hosId": "医院id", "hosId": "h0347" }}
"payload14": {
"branchId": "%s",
"cname": "",
"ename": "设备科室001",
"code": "001",
"address": "设备科室001001",
"contactWay": "设备科室001001",
"deptKind": 1,
"deptCate": 1,
"deptLevel": "1",
"flag": "1",
"corpId": "h0347"
}
"payload15": {
"branchId": "%s",
"cname": "",
"ename": "二级科室002",
"code": "002",
"address": "二级科室002",
"contactWay": "二级科室002",
"deptKind": 2,
"deptCate": 1,
"deptLevel": "2",
"flag": "1",
"corpId": "h0347"
}
checkDict: {"code": 0,'msg': None,'data': True}
checkDict1: {
......@@ -140,3 +170,5 @@ checkDict3: {"code": 400,'msg': '供销关系已存在!请勿重复添加','da
checkDict4: {"code": 400,'msg': None,'data':None}
checkDict5: {'code': 400, 'msg': '数据更新不成功,可能数据的版本不一致!请刷新页面重试', 'data': None}
checkDict6: {'code': 0, 'msg': None, 'data': []}
checkDict7: {'code': 1100000, 'msg':'暂时没有定义异码,中文描述为:同一院区下科室编码不可重复','data':'/platformService:gyqx.spd.platform.sys.service.impl.SysOrgServiceImpl:156'}
院区新增:
branch_id: h0347-2011
branch_name: 东土城路院区
\ No newline at end of file
branch_id: h0347-2658
branch_name: 东土城路院区pOryX
科室信息:
科室id: 8f3aed0a165c486a92721cccb4298abc
科室名称: 二级科室002
......@@ -72,9 +72,9 @@
</tr>
<tr width="600">
<td class="details-col-elapsed"><a href='../log/b4_查询公告_精确查询_不存在/log.html' target='_blank'>b4_查询公告_精确查询_不存在</a></td>
<td class="details-col-elapsed"><a href='../log/c4_新增科室后查询科室ID/log.html' target='_blank'>c4_新增科室后查询科室ID</a></td>
<td class="success">成功</td>
<td class="details-col-elapsed">0.604</td>
<td class="details-col-elapsed">0.69</td>
<td class="details-col-elapsed">xiaohesheng</td>
</tr>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment