public BaseEmsDriver DriverWith(String id_srv, String sd_srvtp, BaseFormBizView context, Ent4BannerDTO bannerDto) { BaseEmsDriver emsFactory = null; if (context.Context == null) { context.SetStatusMsg("Context 上下文信息为空,不能创建医疗单"); return(null); } if (context.Context.PsnInfo == null) { context.SetStatusMsg("Context 上下文登录用户信息为空,不能创建医疗单"); return(null); } //读取医疗单匹配信息 SrvMatchEmsParamDTO dto = EmsMatchTool.GetSrvMatchEmsParamDTO(context.Context.Org.Id_org, context.Context.Group.Id_grp, context.Context.Dept.Id_dep, context.Context.PsnInfo.Id_psndoc, bannerDto.Code_entp, sd_srvtp, id_srv, EmsAppModeEnum.SVEMSAPPMODE); SrvMatchEmsRstDTO matchResult = this.GetSrvMatchEmsParamDTO(dto); if (matchResult == null) { context.SetStatusMsg( string.Format("服务类型{0}没有匹配到合适的医疗单,请在【医疗单维护】节点中维护相关数据!", sd_srvtp)); return(null); } string funcStr = matchResult.Funcclassstr; if (String.IsNullOrEmpty(funcStr)) { context.SetStatusMsg( string.Format("服务类型{0}对应的医疗单配置串为空,请从医疗单维护节点检查配置信息,先使用治疗医疗单!", sd_srvtp)); return(null); } emsFactory = this.GetEmsFactoryFromFuncStr(funcStr); emsFactory.Initialize(context, bannerDto, matchResult); return(emsFactory); }
/// <summary> /// 基于代表医疗单的的字符串反射创建对应的医疗单控件对象 /// </summary> /// <param name="funcStr"></param> /// <returns></returns> private BaseEmsDriver GetEmsFactoryFromFuncStr(String funcStr, object[] szParam = null) { EmsFunclassKVDTO funclassDTO = EmsMatchTool.GetEmsFunclassKVDTO(funcStr); string clazzStr = funclassDTO.Classpath_dll; string dllStr = funclassDTO.Dll; //String[] str = funcStr.Split(','); //string clazzStr = str[0]; //string dllStr = str[1]; try { //Assembly assembly = Assembly.LoadFrom(Application.StartupPath + "\\CiSheetPlus\\" + libName); Assembly assembly = Assembly.LoadFrom(Application.StartupPath + "\\" + dllStr); Type type = assembly.GetType(clazzStr); BaseEmsDriver r = (szParam == null ? (BaseEmsDriver)Activator.CreateInstance(type) : (BaseEmsDriver)Activator.CreateInstance(type, szParam)); return(r); } catch //(Exception e) { throw new Exception(string.Format("反射{0}时出现异常", funcStr)); } }
/// <summary> /// 创建默认的医疗单 /// </summary> /// <param name="emsFactory"></param> /// <param name="context"></param> /// <param name="bannerDto"></param> /// <returns></returns> private BaseEmsDriver creatDefaultEmsDriver(BaseEmsDriver emsFactory, BaseFormBizView context, Ent4BannerDTO bannerDto) { emsFactory = this.GetEmsFactoryFromFuncStr("iih.ci.ord.opemergency.emsfactory.EmsTreatDriver,iih.ci.ord.dll,8"); return(emsFactory.Initialize(context, bannerDto, null)); }