/// <summary> /// 重复开药(同一天) ///医嘱不可重复:在医保共享数据中若已存在某医嘱,本次开立的医嘱中,不能有保内的同样的医嘱。再确认一下。 //若出现重复,提示信息【医嘱共享数据中已存在该药品,不可重复开立】,按钮【放弃开立】【自费开立】 /// <param name="historyTradeInfo"></param> /// <param name="Itemcode"></param> /// <returns></returns> public static string repeatDrug(ClincHistoryTradeInfo historyTradeInfo, MedicalSharingDTO medicalSharingDto, DateTime systemDateTime) { string info = ""; List <TradeInfoEach> list = historyTradeInfo.TradeInfoEachs; if (list != null && list.Count > 0) { foreach (TradeInfoEach tradeInfo in list) { List <FeeItemEach> FeeList = tradeInfo.FeeItemEaches; if (FeeList != null && FeeList.Count > 0) { foreach (FeeItemEach feeItem in FeeList) { if (feeItem.ItemCode != null && feeItem.ItemCode.Equals(medicalSharingDto.Code)) { // dt.GetDateTimeFormats('D')[0].ToString();//2005年11月5日 string[] times = systemDateTime.GetDateTimeFormats('D'); ///string tmp= systemDateTime.GetDateTimeFormats('D')[3].ToString(); //string tmp2 = ((DateTime) tradeInfo.TradeDate).GetDateTimeFormats('D')[3].ToString(); if (systemDateTime.GetDateTimeFormats('D')[0].ToString() == ((DateTime)tradeInfo.TradeDate).GetDateTimeFormats('D')[0].ToString()) { medicalSharingDto.Name14 = feeItem.ItemName; info = "该病人在" + tradeInfo.TradeDate + "在" + tradeInfo.TradeMiName + " 开过" + medicalSharingDto.Name_srv + "药 ,按医保要求,今天不能再开"; } } } } } } return(info); }
//接诊时调用医保的共享数据 缓存在客户端 public String getMedicalsharingData(Ent4BannerDTO ent4Banner, BaseContext context, out string errMessage, string str) { ClincHistoryTradeInfo historyInfo = null; EachCommDTO eachCommDTO = new EachCommDTO(); eachCommDTO.Code_hp = ent4Banner.No_hp; eachCommDTO.Id_grp = context.Group.Id_grp; eachCommDTO.Id_org = context.Org.Id_org; eachCommDTO.Id_pat = ent4Banner.Id_pat; historyInfo = MedicalSharingCache.getMedicalData(ent4Banner.No_hp); if (historyInfo != null && historyInfo.SysInfo != null && historyInfo.SysInfo.ServerDateTime != null) { DateTime systemDateTime = LogicEx.GetInstance().GetSystemDateTime(); DateTime serverDateTime2 = (DateTime)historyInfo.SysInfo.ServerDateTime; System.TimeSpan timespan = systemDateTime.Subtract(serverDateTime2); if (timespan != null && timespan.TotalMinutes > 10) { historyInfo = service.GetClincHistoryInfo(eachCommDTO, out errMessage, str); //historyInfo = service.GetClincHistoryInfoByTest(); } } else { //historyInfo = service.GetClincHistoryInfoByTest(); // historyInfo = service.GetClincHistoryInfo(icno, out errMessage, str); historyInfo = service.GetClincHistoryInfo(eachCommDTO, out errMessage, str); } // ClincHistoryTradeInfo historyInfo = service.GetClincHistoryInfo(icno, out errMessage, str); // ClincHistoryTradeInfo historyInfo = service.GetClincHistoryInfoByTest();//测试数据 errMessage = ""; MedicalSharingCache.setMedicalSharingData(ent4Banner.No_hp, historyInfo, errMessage); return(""); }
/// <summary> /// //不限制药品 //中草药,葡萄糖及氯化钠相关注射液。溶媒类 /// </summary> /// <param name="historyTradeInfo"></param> /// <param name="Itemcode"></param> /// <returns></returns> public static Boolean NoLimitDrug(ClincHistoryTradeInfo historyTradeInfo, MedicalSharingDTO medicalSharingDto) { if (medicalSharingDto != null && medicalSharingDto.Sd_srvtp != null && (medicalSharingDto.Sd_srvtp.StartsWith(BdSrvDictCodeConst.SD_SRVTP_DRUG_WESTDRUG_DSY) || medicalSharingDto.Sd_srvtp.StartsWith(BdSrvDictCodeConst.SD_SRVTP_HERBDRUG))) { return(true); } return(false); }
/// <summary> /// 药品的唯一编码 /// </summary> /// <param name="icno">医保卡号</param> /// <returns></returns> public static List <MedicalSharingDTO> MedicalSharingValidate(BaseContext context, MedicalSharingDTO[] medicalSharingDto, Ent4BannerDTO ent4BannerDto) { ciOrderQryService = XapServiceMgr.find <ICiOrdQryService>(); string errMsg = ""; //当前时间 DateTime systemDateTime = LogicEx.GetInstance().GetSystemDateTime(); infoMedicalSharingDto = new List <MedicalSharingDTO>(); //本院数据 签署未交费的验证 // LocalValiDate(context, medicalSharingDto, ent4BannerDto, systemDateTime); // -- 2017-1--16 Bug:0109210, 废弃不用 (费用负责) //医保中心的50天的数据 //判断时间是否超出 10分钟 //医保中心的数据 ClincHistoryTradeInfo historyTradeInfo = MedicalSharingCache.getMedicalData(ent4BannerDto.No_hp); if (historyTradeInfo == null) { return(infoMedicalSharingDto); } DateTime?serverDateTime = historyTradeInfo.SysInfo.ServerDateTime; DateTime serverDateTime2 = new DateTime(); if (serverDateTime != null) { serverDateTime2 = (DateTime)serverDateTime; } System.TimeSpan timespan = systemDateTime.Subtract(serverDateTime2); if (timespan != null && timespan.TotalMinutes > 10) { GetMedicalsharingData.Instance.getMedicalsharingData(ent4BannerDto, context, out errMsg, ""); } //判断排斥有的药品 //不限制药品 //中草药,葡萄糖及氯化钠相关注射液。溶媒类 //重复开药(同一天) //医嘱不可重复:在医保共享数据中若已存在某医嘱,本次开立的医嘱中,不能有保内的同样的医嘱。再确认一下。 //若出现重复,提示信息【医嘱共享数据中已存在该药品,不可重复开立】,按钮【放弃开立】【自费开立】 // 【医嘱共享数据中已存在该药品,不可重复开立】,按钮【放弃开立】【自费开立】"; //天数是否超出 //遍历医保共享数据,若(交易日期 + 药品开立天数)- 当前日期 > 5时,该医嘱不可开立 OutValiDate(context, medicalSharingDto, historyTradeInfo, ent4BannerDto, systemDateTime); //return dict; return(infoMedicalSharingDto); }
/// <summary> /// set 医保数据 /// </summary> /// <param name="icno"></param> /// <param name="historyInfo"></param> /// <param name="errMeage"></param> public static void setMedicalSharingData(string icno, ClincHistoryTradeInfo historyInfo, string errMeage) { if (icno != null) { if (medicalData == null) { medicalData = new Dictionary <string, ClincHistoryTradeInfo>(); } if (medicalData.ContainsKey(icno)) { medicalData.Remove(icno); medicalData.Add(icno, historyInfo); } else { medicalData.Add(icno, historyInfo); } } }
/// <summary> /// 天数是否超出 /// 遍历医保共享数据,若(交易日期 + 药品开立天数)- 当前日期 > 5时,该医嘱不可开立 /// </summary> /// <param name="historyTradeInfo"></param> /// <param name="Itemcode"></param> /// <returns></returns> public static String Daysexceeding(ClincHistoryTradeInfo historyTradeInfo, MedicalSharingDTO medicalSharingDto, DateTime systemDateTime, string code) { String info = null; List <TradeInfoEach> list = historyTradeInfo.TradeInfoEachs; if (list != null && list.Count > 0) { foreach (TradeInfoEach tradeInfo in list) { List <FeeItemEach> FeeList = tradeInfo.FeeItemEaches; string tradMicode = tradeInfo.TradeMiCode; if (tradMicode != null && tradMicode == code) { Hospital_code = tradeInfo.TradeMiName; } if (FeeList != null && FeeList.Count > 0) { foreach (FeeItemEach feeItem in FeeList) { if (feeItem.ItemCode != null && feeItem.ItemCode.Equals(medicalSharingDto.Code) && tradeInfo.TradeFundType != null && tradeInfo.TradeFundType.Equals(MedicalSharingCache.getcodeHpKind())) { int num = sumDys(tradeInfo.TradeDate, feeItem.Days, systemDateTime); if (num > 5) { medicalSharingDto.Name14 = feeItem.ItemName; info = "该病人在" + tradeInfo.TradeDate + "在" + tradeInfo.TradeMiName + " 开过" + medicalSharingDto.Name_srv + "药 ,\n 用药" + feeItem.Days + "天,按领量未服用完,按医保要求,今天不能再开"; } } } } } } return(info); }
/// <summary> /// 外院数据验证 /// </summary> /// <param name="context"></param> /// <param name="medicalSharingDto"></param> /// <param name="ent4BannerDto"></param> /// <param name="systemDateTime"></param> private static void OutValiDate(BaseContext context, MedicalSharingDTO[] medicalSharingDto, ClincHistoryTradeInfo historyTradeInfo, Ent4BannerDTO ent4BannerDto, DateTime systemDateTime) { foreach (MedicalSharingDTO medical in medicalSharingDto) { //判断排斥有的药品 //不限制药品 //中草药,葡萄糖及氯化钠相关注射液。溶媒类 if (excludeDrug(medical)) { continue; } if (NoLimitDrug(historyTradeInfo, medical)) { continue; } MedicalSharingDTO infoDto = new MedicalSharingDTO(); //1 同一天重复开药 string message2 = repeatDrug(historyTradeInfo, medical, systemDateTime); if (message2 != "") { infoDto.Id_or = medical.Id_or; infoDto.Id_orsrv = medical.Id_orsrv; if (!medical.Sd_srvtp.StartsWith("0103")) { infoDto.Name_srv = medical.Name_srv + "(" + medical.Name14 + ")"; } else { infoDto.Name_srv = medical.Name_srv; } infoDto.Code_or = medical.Code_or; infoDto.Reason = message2; } string message = Daysexceeding(historyTradeInfo, medical, systemDateTime, context.Org.Code); if (message != "") { infoDto.Id_or = medical.Id_or; infoDto.Id_orsrv = medical.Id_orsrv; if (!medical.Sd_srvtp.StartsWith("0103")) { infoDto.Name_srv = medical.Name_srv + "(" + medical.Name14 + ")"; } else { infoDto.Name_srv = medical.Name_srv; } infoDto.Code_or = medical.Code_or; if (infoDto.Reason != null) { infoDto.Reason = "\n " + message; } else { infoDto.Reason = message; } } if (infoDto.Reason != null) { infoMedicalSharingDto.Add(infoDto); } } }