Beispiel #1
0
 private MDSCheck_UserInfo CreateMDSUserInfo(PatientDemoEnquiry patientEnquiry)
 {
     return(new MDSCheck_UserInfo
     {
         HospCode = patientEnquiry.CaseList[0].HospitalCode,
         PharSpec = patientEnquiry.CaseList[0].Specialty,
         WrkStnID = UtilityHelper.GetLoalIPAddress(),
         WrkStnType = "I"
     });
 }
Beispiel #2
0
 private MDSCheck_PatientInfo CreateMDSPatientInfo(PatientDemoEnquiry patientEnquiry)
 {
     return(new MDSCheck_PatientInfo
     {
         HKID = patientEnquiry.Patient.HKID,
         PatientKey = patientEnquiry.Patient.Key,
         Sex = patientEnquiry.Patient.Sex,
         //Number of days between Current Date and Patient DOB  \\TODO-JERIFFE: CONFIRM THE AgeInDats Type
         AgeInDays = (DateTime.Now - patientEnquiry.Patient.DOB.ToDateTime()).TotalDays.ToString(),
         HeightInCM = "0",
         BSAInM2 = "0",
         WeightInKG = "0",
         DataUpdated = "N",
         DataWithinValidPeriod = "N"
     });
 }
        public static PatientVisit ToConvert(this PatientDemoEnquiry pr)
        {
            PatientVisit pv = new PatientVisit();
            PatientObj   p  = Mapper.Map <PatientDemoEnquiry, PatientObj>(pr);

            pv.Pateint = p;

            foreach (var item in pr.CaseList)
            {
                VisitObj v = Mapper.Map <Case, VisitObj>(item);
                v.PatientID = p.PatientId;

                pv.Vists.Add(v);
            }

            return(pv);
        }
Beispiel #4
0
        public MDSCheckInputParm CreateMDSRequest(PatientDemoEnquiry patientEnquiry,
                                                  AlertProfileResult alertProfileRes,
                                                  GetDrugMdsPropertyHqResponse getDrugMdsPropertyHqRes,
                                                  GetPreparationResponse getPreparationRes,
                                                  ref string drugName
                                                  )
        {
            var patientCache = FullCacheHK.PataientCache[patientEnquiry.CaseList[0].Number.Trim().ToUpper()];

            var mdsInput = new MDSCheckInputParm
            {
                PatientInfo = CreateMDSPatientInfo(patientEnquiry),

                UserInfo = CreateMDSUserInfo(patientEnquiry),

                PatientAllergyProfile = CreateMDSAllergy(alertProfileRes),

                PatientAdrProfile = CreateMDSAdr(alertProfileRes),

                CurrentRxDrugProfile = CreateMDSRxDrugProfileIfSkipMDS(getDrugMdsPropertyHqRes, getPreparationRes, patientEnquiry.CaseList[0].HospitalCode),

                CheckDscm    = false,
                CheckDrcm    = false,
                CheckDlcm    = false,
                CheckSteroid = false,
                CheckDiscon  = false,
                CheckHepaB   = false,
                HasPregnancy = false,
                CheckDdim    = false,

                HasG6pdDeficiency  = true,
                CheckDdcm          = true,
                CheckDam           = true,
                CheckAdr           = true,
                CallerSourceSystem = "PMS",
            };

            //show at msg title: CAUTION for + uppercase[drugDdimDisplayName from 2.5.1]
            drugName = mdsInput.CurrentRxDrugProfile.DrugDdimDisplayName.ToUpper();

            return(mdsInput);
        }
Beispiel #5
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));
        }
Beispiel #6
0
 public static PatientVisit ToConvert(this PatientDemoEnquiry pr)
 {
     return(new PatientVisit());
 }