Beispiel #1
0
        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 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);
        }
Beispiel #3
0
        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));
        }