public EssentialDrugCategoryRate GetEssentialDrugCategoryRate(DateTime startTime, DateTime endTime)
        {
            var result = new EssentialDrugCategoryRate
            {
                EssentialDrugNums  = 80,
                DrugCategoriesNums = 120
            };

            return(result);
        }
        /// <summary>
        /// 获取基本药物品种率.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="startTime">The start time.</param>
        /// <param name="endTime">The end time.</param>
        /// <returns>ViewModel.EssentialDrugCategoryRate.</returns>
        /// <remarks>从取定时间段内的处方表中获取每个基本药物品种的代码集合,去重后得出品种数
        /// </remarks>
        public ViewModels.EssentialDrugCategoryRate GetEssentialDrugCategoryRate(DateTime startTime, DateTime endTime)
        {
            var result = new EssentialDrugCategoryRate
            {
                EssentialDrugNums  = this.DomainFactory.CreateEssentialDrugCategoryNumbers().GetEssentialDrugCategoryNumbers(startTime, endTime),
                DrugCategoriesNums = this.DomainFactory.CreateDrugCategoriesNumbers().GetDrugCategoriesNumbers(startTime, endTime)
            };

            return(result);
        }
Exemple #3
0
        public void GetEssentialDrugRateTest()
        {
            InitialBaseData();

            var mockData = new EssentialDrugCategoryRate
            {
                EssentialDrugNums  = 10,
                DrugCategoriesNums = 20
            };
            var essentialDrugRate = new Mock <IEssentialDrugRate>();

            essentialDrugRate.Setup(e => e.GetEssentialDrugCategoryRate(this.startTime, this.endTime)).Returns(mockData);
            Mock <IReporterViewFactory> factoryMock = new Mock <IReporterViewFactory>();


            factoryMock.Setup(f => f.CreateEssentialDrugRate()).Returns(essentialDrugRate.Object);
            var returnValue = essentialDrugRate.Object.GetEssentialDrugCategoryRate(this.startTime, this.endTime);

            Assert.AreEqual(returnValue.EssentialDrugNums, mockData.EssentialDrugNums);
            Assert.AreEqual(returnValue.Rate, Decimal.Round((Decimal)mockData.EssentialDrugNums * 100 / (Decimal)mockData.DrugCategoriesNums, 2));
        }
Exemple #4
0
        /// <summary>
        /// 基本药物占处方用药的百分率
        /// </summary>
        /// <param name="startTime">The start time.</param>
        /// <param name="endTime">The end time.</param>
        /// <returns>ActionResult.</returns>
        public ActionResult GetEssentialDrugRate(DateTime startTime, DateTime endTime)
        {
            ViewBag.startTime = startTime;
            ViewBag.endTime   = endTime.AddDays(1).AddMilliseconds(-1);
            endTime           = endTime.AddDays(1);
            EssentialDrugCategoryRate viewModel = null;
            var drugRateModel = this.ReporterViewFactory.CreateEssentialDrugRate();

            try
            {
                viewModel = drugRateModel.GetEssentialDrugCategoryRate(startTime, endTime);
            }
            catch (Exception)
            {
                viewModel = new EssentialDrugCategoryRate
                {
                    DrugCategoriesNums = -1,
                    EssentialDrugNums  = -1
                };
            }
            return(PartialView("_GetEssentialDrugRate", viewModel));
        }