# -*- encoding=utf8 -*-
from common.db.sql.sql_del_branch_info import delData

__author__ = "xiaohesheng"

"""
case_tag:api,herp-web,a1_医院信息登记,id2263,id2263-1,sit,on
主数据平台:a1_医院信息登记 
"""

from common.common_func import commonFuc
from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system
from airtest.core.api import using
import sys
def h_Register():
    module = "b2_herp3_bs"
    """
     场景:a1_医院信息登记
     用例名称：a1_医院信息登记
     输入：无
     输出："rtn_msg": {"code": 0, "msg": null,    "data": true}
    """
    #内网登录
    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)
    #医院信息登记接口
    url=commonFuc().get_api_url()+commonFuc().get_business_data(module, "9ea057742d4a406a9220b7113f81f61a_url")
    # print(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"))

    # 发送请求
    result = commonFuc().http_get(url, headers, params="")
    # print('result', result)
    #断言
    checkDict=commonFuc().get_business_data(module,'checkDict')
    commonFuc().check_result(checkDict,result)
#脚本运行前删删除上次的院区数据
delData().Delete_business_Data()
delData().Del_reporter_data()
h_Register()
