Пример #1
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);
        }
        /// <summary>
        /// 2.5.3 2: ADR record (1.4.2) if its severity is “Mild”, not perform MDS checking for current ADR profile
        /// [IGNORE]2.5.3 4-2 ADR record,o	both hiclSeqNo and hicSeqNos is EMPTY or zero; and drugType = “D”
        /// Message: System cannot perform adverse drug reaction checking for the following ADR record(s) in the alert function: [drug from 1.4.2]
        /// </summary>
        /// <param name="alertProfileRes"></param>
        public void CheckADRProfileForMDSCheck(ref AlertProfileResult alertProfileRes, string caseNumber)
        {
            if (alertProfileRes.AdrProfile == null || alertProfileRes.AdrProfile.Count() == 0)
            {
                return;
            }

            AdrProfile[] adrProfiles = new AdrProfile[alertProfileRes.AdrProfile.Count()];
            alertProfileRes.AdrProfile.CopyTo(adrProfiles);
            //List<string> adrDrugList = new List<string>();
            foreach (var adrProfile in adrProfiles)
            {
                //2.5.3 2 if its severity is “Mild”, not perform MDS checking, no msg
                if ("MILD".Equals(adrProfile.Severity, StringComparison.OrdinalIgnoreCase))
                {
                    alertProfileRes.AdrProfile.Remove(alertProfileRes.AdrProfile.First(a => a.AdrSeqNo == adrProfile.AdrSeqNo));
                }
                //ignore 2.5.3 4
            }
        }
Пример #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));
        }
Пример #4
0
 public static IEnumerable <Allergies> ToConvert(this AlertProfileResult apr)
 {
     return(new List <Allergies>());
 }
Пример #5
0
 public static IEnumerable <PatientAllergyObj> ToConvert(this AlertProfileResult apr)
 {
     return(new List <PatientAllergyObj>());
 }
Пример #6
0
        public AllergyListDialog(AlertProfileResult alertProfile)
        {
            AlertProfile = alertProfile;

            InitializeComponent();
        }
Пример #7
0
 private static bool IsInvalidResponseResult(AlertProfileResult result)
 {
     return(result.ErrorMessage != null &&
            result.ErrorMessage.Count > 0 &&
            string.Compare(result.ErrorMessage[0].MsgCode, string.Empty) != 0);
 }
Пример #8
0
        private List <PatientAdrProfile> CreateMDSAdr(AlertProfileResult alertProfileRes)
        {
            List <PatientAdrProfile> patientAdrProfiles = new List <PatientAdrProfile>();

            foreach (var adrProfile in alertProfileRes.AdrProfile)
            {
                var patientAdrProfile = new PatientAdrProfile
                {
                    AdrSeqNo       = adrProfile.AdrSeqNo,
                    AllergenCode   = "",
                    Displayname    = adrProfile.DisplayName,
                    Aliasname      = adrProfile.AliasName,
                    Salt           = adrProfile.Salt,
                    NameType       = adrProfile.NameType,
                    Adr            = adrProfile.Drug,
                    AdrType        = adrProfile.DrugType,
                    Severity       = adrProfile.Severity,
                    Remark         = adrProfile.Remark,
                    SourceSystem   = "PMS",
                    CreateBy       = "",
                    CreateUserName = "",
                    CreateHosp     = "",
                    CreateRank     = "",
                    CreateRankDesc = "",
                    CreateDtm      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.0"),
                    UpdateBy       = adrProfile.UpdateBy,
                    UpdateUserName = adrProfile.UpdateUser,
                    UpdateHosp     = adrProfile.UpdateHospital,
                    UpdateRank     = adrProfile.UpdateUserRank,
                    UpdateRankDesc = adrProfile.UpdateRankDesc,
                    //TODO: MAYE NEED TO CHECK profile.UpdateDtm IS NULL
                    UpdateDtm = adrProfile.UpdateDtm,
                    Reactions = null,
                    HiclSeqNo = adrProfile.HiclSeqno,
                    HicSeqNos = new HiclSeqNos {
                        HicSeqNo = adrProfile.HicSeqno
                    }
                };

                /*<updateDtm>2020-02-24 10:02:15.0</updateDtm>
                 * <reactions>
                 *    <seqNo></seqNo>
                 *    <rDesc>Bronchospasm</rDesc>
                 *    <severCode>0</severCode>
                 *    <freqCode>0</freqCode>
                 * </reactions>
                 * <hiclSeqNo>13446</hiclSeqNo>
                 * <hicSeqNos/>
                 */
                patientAdrProfile.Reactions = new List <Reactions>();

                if (adrProfile.Reaction.IsNullOrWhiteSpace())
                {
                    continue;
                }

                foreach (var item in adrProfile.Reaction.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    patientAdrProfile.Reactions.Add(new Reactions
                    {
                        SeqNo     = "",
                        RDesc     = item,
                        SeverCode = "0",
                        FreqCode  = "0",
                    });
                }

                patientAdrProfiles.Add(patientAdrProfile);
            }

            return(patientAdrProfiles);
        }
Пример #9
0
        private List <PatientAllergyProfile> CreateMDSAllergy(AlertProfileResult alertProfileRes)
        {
            List <PatientAllergyProfile> patientAllergyProfiles = new List <PatientAllergyProfile>();

            foreach (var profile in alertProfileRes.AllergyProfile)
            {
                var patientAllergyProfile = new PatientAllergyProfile
                {
                    AllergySeqNo   = profile.AllergySeqNo,
                    AllergenCode   = "",
                    Displayname    = profile.DisplayName,
                    Aliasname      = profile.AliasName,
                    Salt           = profile.Salt,
                    NameType       = profile.NameType,
                    Allergen       = profile.Allergen,
                    AllergenType   = profile.AllergenType,
                    Certainty      = profile.Certainty,
                    Remark         = profile.Remark,
                    SourceSystem   = "PMS",
                    CreateBy       = "",
                    CreateUserName = "",
                    CreateHosp     = "",
                    CreateRank     = "",
                    CreateRankDesc = "",
                    CreateDtm      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.0"),
                    UpdateBy       = profile.UpdateBy,
                    UpdateUserName = profile.UpdateUser,
                    UpdateHosp     = profile.UpdateHospital,
                    UpdateRank     = profile.UpdateUserRank,
                    UpdateRankDesc = profile.UpdateRankDesc,
                    //TODO: MAYE NEED TO CHECK profile.UpdateDtm IS NULL
                    UpdateDtm      = profile.UpdateDtm,
                    Manifestations = null,
                    EhrLocalDesc   = string.Empty,
                    HiclSeqNo      = profile.HiclSeqno,
                    HicSeqNos      = new HiclSeqNos {
                        HicSeqNo = profile.HicSeqno
                    }
                };

                /*
                 * <updateDtm>2019-08-16 17:27:01.0</updateDtm>
                 *  <manifestations>
                 *      <seqNo>0</seqNo>
                 *      <mDesc>Allergic rhinitis</mDesc>
                 *  </manifestations>
                 *  <manifestations>
                 *      <seqNo>0</seqNo>
                 *      <mDesc>Asthma</mDesc>
                 *  </manifestations>
                 *  <hiclSeqNo>12057</hiclSeqNo>
                 *  <hicSeqNos>
                 *      <hicSeqNo>1117</hicSeqNo>
                 *      <hicSeqNo>1121</hicSeqNo>
                 *  </hicSeqNos>
                 */

                if (profile.Manifestation.IsNullOrWhiteSpace())
                {
                    continue;
                }

                patientAllergyProfile.Manifestations = new List <Manifestations>();
                foreach (var item in profile.Manifestation.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    patientAllergyProfile.Manifestations.Add(
                        new Manifestations
                    {
                        SeqNo = "0",
                        MDesc = item,
                    });
                }

                patientAllergyProfiles.Add(patientAllergyProfile);
            }
            return(patientAllergyProfiles);
        }