public GetDrugMdsPropertyHqResponse getDrugMdsPropertyHq(GetDrugMdsPropertyHqRequest request) { HttpContext.Current.Request.InputStream.Position = 0; var requestStr = new StreamReader(HttpContext.Current.Request.InputStream, Encoding.UTF8).ReadToEnd(); WorkContext = new WorkContextSoapHeader(); /* * HttpContext.Current.Request.InputStream.Position = 0; * * var jsonString = new StreamReader(HttpContext.Current.Request.InputStream, Encoding.UTF8).ReadToEnd(); */ try { var file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, string.Format("bin/Data/DM/getDrugMdsPropertyHq/{0}.xml", 1)); var relativeItemCode = request.Arg0.ItemCode[0]; if (RuleMappingHelper.ItemCode_HKID_Mapping.ContainsKey(relativeItemCode)) { relativeItemCode = RuleMappingHelper.ItemCode_HKID_Mapping[relativeItemCode]; } file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, string.Format("bin/Data/DM/getDrugMdsPropertyHq/{0}.xml", relativeItemCode)); var doc = XDocument.Load(file); XNamespace x = "http://schemas.xmlsoap.org/soap/envelope/"; XNamespace x2 = "http://biz.dms.pms.model.ha.org.hk/"; var element = doc.Descendants(x + "Body") .Descendants(x2 + "getDrugMdsPropertyHqResponse").First(); var str = element.ToString().Replace("ns2:getDrugMdsPropertyHqRespons", "getDrugMdsPropertyHqRespons"); var response = XmlHelper.XmlDeserialize <GetDrugMdsPropertyHqResponse>(str); /* * var element1 = doc.Descendants(x + "Body") * .Descendants(x2 + "getDrugMdsPropertyHqResponse") * .Descendants("return"); * var returnStrs = string.Format(@"<getDrugMdsPropertyHqResponse>{0}</getDrugMdsPropertyHqResponse>", string.Join("", element1.Select(item => item.ToString()).ToArray())); * var response = XmlHelper.XmlDeserialize<GetDrugMdsPropertyHqResponse>(returnStrs); */ return(response); } catch (Exception ex) { ex = ex; //Logger ex return(new GetDrugMdsPropertyHqResponse()); } }
private void btnRequest_Click(object sender, EventArgs e) { scintillaRes.Text = string.Empty; try { var str = scintillaReq.Text.Trim(); GetDrugMdsPropertyHqRequest request = null; using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(str))) { var argElement = XDocument.Load(ms).Descendants("arg0").First(); var arg0 = XmlHelper.XmlDeserialize <Arg>(argElement.ToString()); request = new GetDrugMdsPropertyHqRequest { Arg0 = arg0 }; } var res = soapService.GetDrugMdsPropertyHq(request); var resStr = XmlHelper.XmlSerializeToString(res); scintillaRes.Text = XmlHelper.FormatXML(resStr); scintillaRes.FormatStyle(StyleType.Xml); scintillaRes.Focus(); } catch (Exception ex) { logger.Error(ex, ex.Message); MessageBox.Show(ex.Message); } }
public ReturnObj[] getDrugMdsPropertyHq([System.Xml.Serialization.XmlElementAttribute("getDrugMdsPropertyHq", Namespace = "http://biz.dms.pms.model.ha.org.hk/", IsNullable = true)] GetDrugMdsPropertyHqRequest getDrugMdsPropertyHq1) { object[] results = this.Invoke("getDrugMdsPropertyHq", new object[] { getDrugMdsPropertyHq1 }); return((ReturnObj[])(results[0])); }
/// <remarks/> public void getDrugMdsPropertyHqAsync(GetDrugMdsPropertyHqRequest getDrugMdsPropertyHq1, object userState) { if ((this.getDrugMdsPropertyHqOperationCompleted == null)) { this.getDrugMdsPropertyHqOperationCompleted = new System.Threading.SendOrPostCallback(this.OngetDrugMdsPropertyHqOperationCompleted); } this.InvokeAsync("getDrugMdsPropertyHq", new object[] { getDrugMdsPropertyHq1 }, this.getDrugMdsPropertyHqOperationCompleted, userState); }
public void Test_GetDrugMdsPropertyHqResponse_Successful() { var itemCode = new List <string> { "AMET02", "METH66", "DEXT1Q", "LEVE01" }; var getDrugMdsPropertyHq = new GetDrugMdsPropertyHqRequest { Arg0 = new Arg { ItemCode = itemCode } }; var actualResult = parser.GetDrugMdsPropertyHq(getDrugMdsPropertyHq); Assert.IsNotNull(actualResult); // var actualProfileJSONStr = JsonHelper.ToJson(actualResult); }
public MdsCheckFinalResult MDSCheck(InventoryObj drugItem, string caseNumber, PatientDemoEnquiry patientEnquiry, AlertProfileResult alertProfileRes) { MDSCheckResult resultBeforeMDS = new MDSCheckResult() { hasMdsAlert = false }; if (alertProfileRes == null || (alertProfileRes.AdrProfile.Count == 0 && alertProfileRes.AlertProfile.Count == 0 && alertProfileRes.AllergyProfile.Count == 0) ) { /*ErrorMessage = "System cannot perform Allergy, ADR and G6PD Deficiency Contraindication checking. * Please exercise your professional judgement during the downtime period and contact [vendor contact information].*/ resultBeforeMDS.errorCode = "8520001001"; //system error, hasMdsAlert = false, only medication alert, hasMdsAlert = true resultBeforeMDS.errorDesc = "System cannot perform Allergy, AlertProfile is empty."; //here should use drug name, not drugItemCode return(resultBeforeMDS.ToConvert(drugItem.CommonName)); } #region check if need MDS check /****2.5.3 3:System should not perform MDS checking on a drug item if its itemCode starts with “PDF”, * e.g. “PDF 2Q “, “PDF 48”. no prompt message *****/ if (mdsChecker.CheckDrugCodeIfNoNeedMDSCheck(drugItem.Billnum)) { //here should use drug name, not drugItemCode return(resultBeforeMDS.ToConvert(drugItem.CommonName)); } /*****2.5.3 2: ADR record (1.4.2) if its severity is “Mild”, not perform MDS checking for current ADR profile*****/ mdsChecker.CheckADRProfileForMDSCheck(ref alertProfileRes, caseNumber); #endregion var CASE_NUMBER = patientEnquiry.CaseList[0].Number.Trim().ToUpper(); var patientCache = FullCacheHK.PataientCache[CASE_NUMBER]; var getDrugMdsPropertyHqReq = new GetDrugMdsPropertyHqRequest { Arg0 = new Arg { ItemCode = new List <string> { drugItem.Billnum } } }; var getDrugMdsPropertyHqRes = soapSvc.GetDrugMdsPropertyHq(getDrugMdsPropertyHqReq); #region JUST FOR SIMULATOR if (patientCache != null) { patientCache.MDSCache.Register(drugItem.Billnum, new MDSCheckResultCache { DrugMdsPropertyHqReq = getDrugMdsPropertyHqReq, DrugMdsPropertyHqRes = getDrugMdsPropertyHqRes }); } #endregion if (getDrugMdsPropertyHqRes == null || getDrugMdsPropertyHqRes.Return.Count == 0) { resultBeforeMDS.errorCode = "8520001002"; resultBeforeMDS.errorDesc = "System cannot perform Allergy, Drug Master Response is empty."; return(resultBeforeMDS.ToConvert(drugItem.CommonName)); } var drugProperty = getDrugMdsPropertyHqRes.Return[0].DrugProperty; var getPreparationReq = new GetPreparationRequest { Arg0 = new Arg0 { DispHospCode = "", DispWorkstore = "", ItemCode = drugItem.Billnum, TrueDisplayname = drugProperty.Displayname, FormCode = drugProperty.FormCode, SaltProperty = drugProperty.SaltProperty, DrugScope = "I", SpecialtyType = "I", PasSpecialty = "", PasSubSpecialty = "", CostIncluded = true, HqFlag = true } }; var getPreparationRes = soapSvc.GetPreparation(getPreparationReq); if (getPreparationRes == null || getPreparationRes.Return == null) { resultBeforeMDS.errorCode = "8520001003"; resultBeforeMDS.errorDesc = "System cannot perform Allergy, Drug Preparation Response is empty."; return(resultBeforeMDS.ToConvert(drugItem.CommonName)); } #region JUST FOR SIMULATOR if (patientCache != null) { patientCache.MDSCache[drugItem.Billnum].PreparationReq = getPreparationReq; patientCache.MDSCache[drugItem.Billnum].PreparationRes = getPreparationRes; } #endregion string drugName = drugProperty.Displayname; /*if hasG6pdDeficiency is true or hasPregnancy is true, then “true”, else “false”*/ bool hasG6pdDeficiency = mdsChecker.CheckIsG6PD(alertProfileRes.AlertProfile); bool checkDdcm = hasG6pdDeficiency; bool checkDam = alertProfileRes.AllergyProfile.Count() > 0; bool checkAdr = alertProfileRes.AdrProfile.Count() > 0; //if no ddcm, no allergy, no adr, then no need do MDS check if (!checkDdcm && !checkDam && !checkAdr) { return(new MdsCheckFinalResult()); } MDSCheckInputParm mdsRequest = new MDSCreater().CreateMDSRequest(patientEnquiry, alertProfileRes, getDrugMdsPropertyHqRes, getPreparationRes, ref drugName ); /************do Final MDS Check*********************/ MDSCheckResult mdsCheckResult = restSvc.CheckMDS(mdsRequest); //filter final MDS check result mdsCheckResult.FilterMdsResult(); #region JUST FOR SIMULATOR if (patientCache != null) { patientCache.MDSCache[drugItem.Billnum].Req = mdsRequest; patientCache.MDSCache[drugItem.Billnum].Res = mdsCheckResult; } #endregion //convert mds result to message object to show return(mdsCheckResult.ToConvert(drugName)); }
/// <remarks/> public void getDrugMdsPropertyHqAsync(GetDrugMdsPropertyHqRequest getDrugMdsPropertyHq1) { this.getDrugMdsPropertyHqAsync(getDrugMdsPropertyHq1, null); }
/// <remarks/> public System.IAsyncResult BegingetDrugMdsPropertyHq(GetDrugMdsPropertyHqRequest getDrugMdsPropertyHq1, System.AsyncCallback callback, object asyncState) { return(this.BeginInvoke("getDrugMdsPropertyHq", new object[] { getDrugMdsPropertyHq1 }, callback, asyncState)); }