예제 #1
0
        /// <summary>
        /// Checks the database to see if the PharmCalcAccept table contains a record indicating that the
        /// calculation factor passed has been accepted..
        /// </summary>
        /// <param name="context"></param>
        protected override void DoWork(CodeActivityContext context)
        {
            int    rxoSetId   = RxoSetId.Get(context);
            double calcFactor = CalcFactor.Get(context);
            bool   result     = false;

            //Lookup all of the PharmCalcAccept records to get the minimum and maximum accepted values.
            EntityList <PharmCalcAccept> acceptRecords = PharmCalcAccept.FindByRxoSetId(PM, QueryStrategy.Normal, rxoSetId);
            PharmOrd pharmOrd = PharmOrd.GetEntityByRxoSetIdAndVersion0(rxoSetId, PM);

            var maxRecords = acceptRecords.Where(e => e.Accepted_High.HasValue);
            var minRecords = acceptRecords.Where(e => e.Accepted_Low.HasValue);

            double?maxAccepted = maxRecords.Count() == 0 ? (double?)null : maxRecords.Max(e => e.Accepted_High.Value);
            double?minAccepted = minRecords.Count() == 0 ? (double?)null : minRecords.Min(e => e.Accepted_Low.Value);

            if (maxAccepted != null && calcFactor <= maxAccepted && calcFactor >= pharmOrd.BSA)
            {
                result = true;
            }

            if (minAccepted != null && calcFactor >= minAccepted && calcFactor <= pharmOrd.BSA)
            {
                result = true;
            }

            Result.Set(context, result);
        }
예제 #2
0
        /// <summary>
        /// Checks the database to see if the PharmCalcAccept table contains a record indicating that the
        /// calculation factor passed has been accepted..
        /// </summary>
        /// <param name="context"></param>
        protected override void DoWork(CodeActivityContext context)
        {
            ImpacPersistenceManager pm = ImpacPersistenceManagerFactory.CreatePersistenceManager();
            int    rxoSetId            = RxoSetId.Get(context);
            double calcFactor          = CalcFactor.Get(context);

            //Lookup all of the PharmCalcAccept records to get the minimum and maximum accepted values.
            EntityList <PharmCalcAccept> acceptRecords = PharmCalcAccept.FindByRxoSetId(pm, QueryStrategy.Normal, rxoSetId);
            double maxAccepted = acceptRecords.Where(e => e.Accepted_High.HasValue).Max(e => e.Accepted_High.Value);
            double minAccepted = acceptRecords.Where(e => e.Accepted_Low.HasValue).Min(e => e.Accepted_Low.Value);

            Result.Set(context, calcFactor >= minAccepted && calcFactor <= maxAccepted);
        }
예제 #3
0
        /// <summary>
        /// Estimates the dose based on the pharmacy order and calculation factor passed in.
        /// </summary>
        /// <param name="context"></param>
        protected override void DoWork(CodeActivityContext context)
        {
            int    rxoId = RxoId.Get(context);
            double bsa   = CalcFactor.Get(context);

            var order = PM.GetEntity <PharmOrd>(new PrimaryKey(typeof(PharmOrd), rxoId));

            if (!order.IsNullEntity)
            {
                double calculatedDose;
                if (DoseCalcUtils.EstimateOrderingDose(order, bsa, out calculatedDose) == DoseCalcUtils.CalcStatus.CalcSucceed)
                {
                    SuggestedDose.Set(context, calculatedDose);
                }
            }
        }