# -*- encoding=utf8 -*-
from common.fileUtls import FileUtils

__author__ = "xiaohesheng"

"""
case_tag:api,mdm-web,a1供货关系申请_客户类型_医院_登录_医院登录获取医院id,id2255,id2255-1,sit,on
主数据平台:a1供货关系申请_客户类型_医院_登录_医院登录获取医院id 
"""

from common.common_func import commonFuc
from air_case.mdm_login.登录外网系统.登录外网系统 import login_system
from airtest.core.api import using
import sys
def h_login():
    module = "a4_mdm3_cm"
    # pro_path=commonFuc().get_pro_path()
    # sys.path.append(pro_path+r'\\air_case\\mdm3_hs\\注册医院审核通过.air')
    # using(pro_path+r'\\air_case\\mdm3_hs\\注册医院审核通过.air')
    # from 注册医院审核通过 import reg_and_audit_hospital
    # h_name=reg_and_audit_hospital()

    info = FileUtils().r_info("a3_mdm3_hs", "医院信息")
    print(info)
    h_name = info['h_name']
    print(h_name)
    """
     场景:a1供货关系申请_客户类型_医院_登录_医院登录获取医院id
     用例名称：a1供货关系申请_客户类型_医院_登录_医院登录获取医院id
     输入：用户名,密码
     输出："rtn_msg": token,projectCode,uxid,corpId,h_name
    """
    #供货关系申请_客户类型_医院_登录_医院登录获取医院id
    #如果需要h0347账号登录,这里就从文件获取
    module = "a4_mdm3_cm"
    username = h_name
    # print('医院名称',username)
    password = commonFuc().get_business_data(module, "password")
    print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
    # 获取token和projectCode
    while True:
        try:
            token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
        except:
            continue
        else:
            return token,projectCode,uxid,corpId,h_name

h_login()