Beispiel #1
0
        protected override void Operation(WordDocument doc)
        {
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            DateTime             date = StartDate;

            doc.ReplaceText("Org", GetOrgName(SecurityHelper.CurrentPrincipal.OrgId));
            //doc.ReplaceText("Year", (date.Year - 1911).ToString());
            doc.ReplaceText("Year", date.Year.ToString());
            doc.ReplaceText("Month", date.Month.ToString());
            var    constraintList = reportManageService.GetConstraintList(date);
            string key            = string.Empty;

            dynamic[] tags = new dynamic[] {
                new { Type = "ExecReason", Value = "001", Text = "因预防跌倒而使用身体约束人数(bl)" },
                new { Type = "ExecReason", Value = "002", Text = "因预防自拔管路而使用身体约束人数(b2)" },
                new { Type = "ExecReason", Value = "003", Text = "因预防自伤而使用身体约束人数(b3)" },
                new { Type = "ExecReason", Value = "004", Text = "因行为紊乱而使用身体约束人数(b4)" },
                new { Type = "ExecReason", Value = "005", Text = "因协助治疗而使用身体约束人数(b5)" },
                new { Type = "ExecReason", Value = "006", Text = "因其他因素而使用身体约束人数(b6)" },
                new { Type = "Duration", Value = "001", Text = "约束持续小於等於4小时人数(c1)" },
                new { Type = "Duration", Value = "002", Text = "约束持续大於4小时小於等於8小时人数(c2)" },
                new { Type = "Duration", Value = "003", Text = "约束持续大於8小时小於等於16小时人数(c3)" },
                new { Type = "Duration", Value = "004", Text = "约束持续大於16小时小於等於24小时人数(c4)" },
                new { Type = "Duration", Value = "005", Text = "约束持续大於24小时人数(c5)" },
                new { Type = "ConstraintWay", Value = "002", Text = "受身体约束二种以上住民人数(d)" },
                new { Type = "Cancel", Value = "24Flag", Text = "当月移除身体约束至少维持24小时以上之住民人数(e)" },
            };
            DataTable dt = new DataTable();
            DataRow   dr;

            dt.Columns.Add("name");
            dt.Columns.Add("total");
            foreach (dynamic item in tags)
            {
                dr         = dt.NewRow();
                dr["name"] = item.Text;
                switch ((string)item.Type)
                {
                case "ExecReason":
                    dr["total"] = constraintList.Count(it => it.ExecReason == item.Value);
                    break;

                case "Duration":
                    dr["total"] = constraintList.Count(it => it.Duration == item.Value);
                    break;

                case "ConstraintWay":
                    dr["total"] = constraintList.Count(it => it.ConstraintWayCnt == "002");
                    break;

                case "Cancel":
                    dr["total"] = constraintList.Count(it => it.Cancel24Flag);
                    break;
                }
                dt.Rows.Add(dr);
                doc.ReplaceText(string.Format("{0}{1}", item.Type, item.Value), dr["total"].ToString());
            }
            doc.FillChartData(0, dt, 10);
            dt.Dispose();
        }
Beispiel #2
0
        protected override void Operation(WordDocument doc)
        {
            int seqNo = (int)ParamId;

            doc.ReplaceText("Org", GetOrgName(SecurityHelper.CurrentPrincipal.OrgId));
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            var nscpl = reportManageService.GetNSCPLReportView(seqNo);

            if (nscpl == null)
            {
                InitData(typeof(NSCPLReportView), doc);
                return;
            }
            BindData(nscpl, doc);
            //doc.ReplaceText("Org", nscpl.Org);
            //doc.ReplaceText("SeqNo", nscpl.SeqNo.ToString());
            //doc.ReplaceText("StartDate", nscpl.StartDate);
            //doc.ReplaceText("EndDate", nscpl.EndDate);
            //doc.ReplaceText("RegName", nscpl.RegName);
            //doc.ReplaceText("FeeNo", nscpl.FeeNo.ToString());
            //doc.ReplaceText("Sex", nscpl.Sex);
            //doc.ReplaceText("Age", nscpl.Age);
            //doc.ReplaceText("EmpName", nscpl.EmpName);
            //doc.ReplaceText("CpLevel", nscpl.CpLevel);
            //doc.ReplaceText("CpDiag", nscpl.CpDiag);
            //doc.ReplaceText("CpReason", nscpl.CpReason);
            //doc.ReplaceText("NsDesc", nscpl.NsDesc);
            //doc.ReplaceText("CpResult", nscpl.CpResult);
            //doc.ReplaceText("TotalDays", nscpl.TotalDays);
            //doc.ReplaceText("NscplGoal", nscpl.NscplGoal);
            //doc.ReplaceText("NscplActivity", nscpl.NscplActivity);
            //doc.ReplaceText("AssessValue", nscpl.AssessValue);
        }
Beispiel #3
0
        protected override void Operation(WordDocument doc)
        {
            long feeNo = ParamId;

            doc.ReplaceText("Org", GetOrgName(SecurityHelper.CurrentPrincipal.OrgId));
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            var questionList = reportManageService.GetQuestionList(feeNo, 4);

            if (questionList.Count == 0)
            {
                InitData(typeof(Question), doc);
                InitValue(31, 40, doc);
                return;
            }
            List <Dictionary <string, string> > list = new List <Dictionary <string, string> >();

            foreach (var question in questionList)
            {
                var dict = new Dictionary <string, string>();
                BindData(question, doc, dict);
                var answers = reportManageService.GetAnswers(question.Id).ToList();
                for (var i = 31; i <= 40; i++)
                {
                    var answer = answers.Find(o => o.Id == i);
                    dict.Add("Value" + i, answer != null ? answer.Value : "未填");
                }
                list.Add(dict);
            }
            doc.FillTable(0, list);
        }
Beispiel #4
0
        /// <summary>
        /// P17护理计划
        /// </summary>
        /// <param name="doc"></param>
        private void P17Operation(WordDocument doc)
        {
            int seqNo = 6;
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            var nscpl = reportManageService.GetNSCPLReportView(seqNo);

            doc.ReplaceText("Org", nscpl.Org);
            doc.ReplaceText("SeqNo", nscpl.SeqNo.ToString());
            doc.ReplaceText("StartDate", nscpl.StartDate);
            doc.ReplaceText("EndDate", nscpl.EndDate);
            doc.ReplaceText("RegName", nscpl.RegName);
            doc.ReplaceText("FeeNo", nscpl.FeeNo.ToString());
            doc.ReplaceText("Sex", nscpl.Sex);
            doc.ReplaceText("Age", nscpl.Age);
            doc.ReplaceText("EmpName", nscpl.EmpName);
            doc.ReplaceText("CpLevel", nscpl.CpLevel);
            doc.ReplaceText("CpDiag", nscpl.CpDiag);
            doc.ReplaceText("CpReason", nscpl.CpReason);
            doc.ReplaceText("NsDesc", nscpl.NsDesc);
            doc.ReplaceText("CpResult", nscpl.CpResult);
            doc.ReplaceText("TotalDays", nscpl.TotalDays);
            doc.ReplaceText("NscplGoal", nscpl.NscplGoal);
            doc.ReplaceText("NscplActivity", nscpl.NscplActivity);
            doc.ReplaceText("AssessValue", nscpl.AssessValue);
        }
        public void DowdloadH10(string templateName, string startDateStr, string endDateStr, string feeNo, string floorId)
        {
            using (WordDocument doc = new WordDocument())
            {
                //加载模板
                doc.LoadModelDoc(templateName);
                var carelist = GetCareH10(startDateStr, endDateStr, feeNo, floorId);
                if (carelist != null && carelist.Count > 0)
                {
                    foreach (var item in carelist)
                    {
                        doc.NewPartDocument();

                        IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
                        var nscpl = reportManageService.GetNSCPLReportView(Convert.ToInt32(item.ID));
                        doc.BindReportData(nscpl);
                        doc.AddPartDocument();
                    }
                }
                if (!doc.IsDocNull())
                {
                    Util.DownloadFile(doc.SaveMarkDoc("护理计画"));
                }
            }
        }
        /// <summary>
        /// IADL表
        /// </summary>
        /// <param name="doc"></param>
        private void IADLOperation(WordDocument doc)
        {
            int feeNo = 7;
            IOrganizationManageService organizationManageService = IOCContainer.Instance.Resolve <IOrganizationManageService>();
            var org = organizationManageService.GetOrg(SecurityHelper.CurrentPrincipal.OrgId);

            doc.ReplaceText("Org", org.Data.OrgName);
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            var questionList = reportManageService.GetQuestionList(feeNo, 7);

            if (questionList.Count == 0)
            {
                InitData(typeof(Question), doc);
                InitValue(81, 88, doc);
                return;
            }
            List <Dictionary <string, string> > list = new List <Dictionary <string, string> >();

            foreach (var question in questionList)
            {
                var dict = new Dictionary <string, string>();
                BindData(question, doc, dict);
                var answers = reportManageService.GetAnswers(question.Id).ToList();
                for (var i = 81; i <= 88; i++)
                {
                    var answer = answers.Find(o => o.Id == i);
                    dict.Add("Value" + i, answer != null ? answer.Value : "未填");
                }
                list.Add(dict);
            }
            doc.FillTable(0, list);
        }
Beispiel #7
0
        protected override void Operation(WordDocument doc)
        {
            int id = (int)ParamId;
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            var caredemandevalprivew = reportManageService.GetCareDemandHis(id, SecurityHelper.CurrentPrincipal.OrgId);

            if (caredemandevalprivew == null)
            {
                InitData(typeof(CareDemandEvalPrivew), doc);
                return;
            }
            BindData(caredemandevalprivew, doc);
        }
Beispiel #8
0
        public IHttpActionResult DownloadExcel(string code, long feeNo = 0, DateTime?startDate = null, DateTime?endDate = null)
        {
            string mapPath = HttpContext.Current.Server.MapPath(VirtualPathUtility.GetDirectory("~"));
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            string path = string.Empty;

            switch (code)
            {
            case "View":
                this.View();
                break;
            }
            return(Ok());
        }
        /// <summary>
        /// 院内感染指标统计表
        /// </summary>
        /// <param name="doc"></param>
        private void Infectionperation(WordDocument doc)
        {
            DateTime date = DateTime.Parse("2016-05-01");
            IOrganizationManageService organizationManageService = IOCContainer.Instance.Resolve <IOrganizationManageService>();
            var org = organizationManageService.GetOrg(SecurityHelper.CurrentPrincipal.OrgId);

            doc.ReplaceText("Org", org.Data.OrgName);
            doc.ReplaceText("Year", date.Year.ToString());
            doc.ReplaceText("Month", date.Month.ToString());
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            var list = reportManageService.GetInfection(date);

            //doc.ReplaceText("totalB",list.Sum(o=>o.Total).ToString());
            //var keys = new[] { "001", "002", "003", "004", "005" };
            //for (int i = 0; i < keys.Length; i++)
            //{
            //    var obj = list.FirstOrDefault(o => o.Type == keys[i]);
            //    doc.ReplaceText(i.ToString(), obj == null ? "" : obj.Total.ToString());
            //}
            //doc.ReplaceText("totalC", list.Where(o=>o.Type==keys[0] || o.Type==keys[1]).Sum(o => o.Total).ToString());
            //doc.ReplaceText("totalD", list.Where(o => o.Type == keys[2] || o.Type == keys[3]).Sum(o => o.Total).ToString());
            //var constraintList = reportManageService.GetInfectionIndList(date);
            //string key = string.Empty;

            dynamic[] tags = new dynamic[] {
                new { Type = "totalB", Value = "001,002,003,004,005", Text = "总感染人次(b)" },
                new { Type = "totalC", Value = "001,002", Text = "呼吸道感染人次(c)" },
                new { Type = "001", Value = "001", Text = "上呼吸道感染人次(cl)" },
                new { Type = "002", Value = "002", Text = "下呼吸道感染人次(c2)" },
                new { Type = "totalD", Value = "003,004", Text = "泌尿道感染人次(d)" },
                new { Type = "003", Value = "003", Text = "当月使用存留导尿管泌尿道感染人次(dl)" },
                new { Type = "004", Value = "004", Text = "当月未使用存留导尿管泌尿道感染人次(d2)" },
                new { Type = "005", Value = "005", Text = "疥疮感染人次(g)" }
            };
            DataTable dt = new DataTable();

            dt.Columns.Add("name");
            dt.Columns.Add("total");
            foreach (dynamic item in tags)
            {
                var dr = dt.NewRow();
                dr["name"] = item.Text;
                string[] types = item.Value.Split(',');
                dr["total"] = list.Where(o => types.Contains(o.Type)).Sum(o => o.Total);
                dt.Rows.Add(dr);
                doc.ReplaceText(item.Type, dr["total"].ToString());
            }
            doc.FillChartData(0, dt, 10);
            dt.Dispose();
        }
Beispiel #10
0
        /// <summary>
        /// P18个护理记录
        /// </summary>
        /// <param name="doc"></param>
        private void P18Operation(WordDocument doc)
        {
            long feeNo = 8;
            IReportManageService       reportManageService       = IOCContainer.Instance.Resolve <IReportManageService>();
            INursingWorkstationService nursingWorkstationService = IOCContainer.Instance.Resolve <INursingWorkstationService>();
            IDictManageService         dictManageService         = IOCContainer.Instance.Resolve <IDictManageService>();
            var residentInfo = reportManageService.GetResidentInfo(feeNo);
            BaseRequest <NursingRecFilter> nursingRecFilter = new BaseRequest <NursingRecFilter>();

            nursingRecFilter.CurrentPage = 1;
            nursingRecFilter.PageSize    = 1000;
            nursingRecFilter.Data.FeeNo  = feeNo;
            var response = nursingWorkstationService.QueryNursingRec(nursingRecFilter);

            doc.ReplaceText("Org", residentInfo.Org);
            doc.ReplaceText("Name", residentInfo.Name);
            doc.ReplaceText("Sex", residentInfo.Sex);
            doc.ReplaceText("Age", residentInfo.Age.ToString());
            doc.ReplaceText("FeeNo", residentInfo.FeeNo.ToString());
            doc.ReplaceText("Floor", residentInfo.Floor);
            doc.ReplaceText("RoomNo", residentInfo.RoomNo);

            CodeFilter codeFilter = new CodeFilter();

            codeFilter.ItemTypes = new string[] { "J00.005" };
            var dict = (List <CodeValue>)dictManageService.QueryCode(codeFilter).Data;

            DataTable dt = new DataTable();

            dt.Columns.Add("c1");
            dt.Columns.Add("c2");
            dt.Columns.Add("c3");
            dt.Columns.Add("c4");
            if (response.Data != null)
            {
                foreach (var item in response.Data)
                {
                    var dr       = dt.NewRow();
                    var findItem = dict.Find(it => it.ItemType == "J00.005" && it.ItemCode == item.ClassType);
                    dr["c1"] = item.RecordDate.HasValue ? Util.ToTwDate(item.RecordDate.Value) : "";
                    dr["c2"] = string.Format("{0} {1}{2}", item.RecordDate.HasValue ? item.RecordDate.Value.ToString("HH:mm") : "", item.ClassType, findItem != null ? findItem.ItemName : "");
                    dr["c3"] = item.Content;
                    dr["c4"] = item.RecordNameBy;
                    dt.Rows.Add(dr);
                }
            }
            doc.FillTable(0, dt, "", "", 2);
            dt.Dispose();
        }
Beispiel #11
0
        protected override void Operation(WordDocument doc)
        {
            int seqNo = (int)ParamId;

            doc.ReplaceText("Org", GetOrgName(SecurityHelper.CurrentPrincipal.OrgId));
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            var nscpl = reportManageService.GetNSCPLReportView(seqNo);

            if (nscpl == null)
            {
                InitData(typeof(NSCPLReportView), doc);
                return;
            }
            BindData(nscpl, doc);
        }
        /// <summary>
        /// 柯氏评估
        /// </summary>
        /// <param name="doc"></param>
        private void ColeScaleOperation(WordDocument doc)
        {
            int recordId = 10;
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            var question = reportManageService.GetQuestion(recordId);

            if (question == null)
            {
                InitData(typeof(Question), doc);
                doc.ReplaceText("Value89", "");
                return;
            }
            BindData(question, doc);
            var answers = reportManageService.GetAnswers(question.Id).ToList();
            var answer  = answers.Find(o => o.Id == 89);

            doc.ReplaceText("Value89", answer != null ? answer.Value : "未填");
        }
        /// <summary>
        /// P21非计画性转至怠性医院住院月统计表
        /// </summary>
        /// <param name="doc"></param>
        private void P21Operation(WordDocument doc)
        {
            //入住72小时内肠胃道出血而非计划性转到急性医院住院人次
            //因肠胃道出血而非计划性转到急性医院住院人次
            DateTime now = DateTime.Now;

            doc.ReplaceText("year", now.Year.ToString());
            doc.ReplaceText("month", now.Month.ToString());
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            var dt72 = ToDataTable(reportManageService.GetUnPlanEdipd(now, true));

            doc.FillTable(0, dt72, "而非计划转至急性医院住院人数", "入住72小时内发生因");
            doc.FillChartData(0, dt72, 6);

            var dt = ToDataTable(reportManageService.GetUnPlanEdipd(now, false));

            doc.FillTable(1, dt, "而非计划转至急性医院住院人数");
            doc.FillChartData(1, dt, 6);
        }
Beispiel #14
0
        /// <summary>
        /// P10跌倒危险因子评估
        /// </summary>
        /// <param name="doc"></param>
        private void P10Operation(WordDocument doc)
        {
            int recordId = 9;
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            var question = reportManageService.GetQuestion(recordId);

            if (question == null)
            {
                return;
            }
            BindData(question, doc);
            var answers = reportManageService.GetAnswers(question.Id).ToList();

            for (var i = 129; i <= 139; i++)
            {
                var answer = answers.Find(o => o.Id == i);
                doc.ReplaceText("Value" + i, answer != null ? answer.Value : "未填");
            }
        }
Beispiel #15
0
        protected override void Operation(WordDocument doc)
        {
            //入住72小时内肠胃道出血而非计划性转到急性医院住院人次
            //因肠胃道出血而非计划性转到急性医院住院人次
            doc.ReplaceText("Org", GetOrgName(SecurityHelper.CurrentPrincipal.OrgId));
            DateTime now = StartDate;

            doc.ReplaceText("year", (now.Year).ToString());
            doc.ReplaceText("month", now.Month.ToString());
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            var dt72 = ToDataTable(reportManageService.GetUnPlanEdipd(now, true));

            doc.FillTable(0, dt72, "而非计划转至急性医院住院人数", "入住72小时内发生因");
            doc.FillChartData(0, dt72, 6);

            var dt = ToDataTable(reportManageService.GetUnPlanEdipd(now, false));

            doc.FillTable(1, dt, "而非计划转至急性医院住院人数");
            doc.FillChartData(1, dt, 6);
        }
Beispiel #16
0
        /// <summary>
        /// P12忧郁量表
        /// </summary>
        /// <param name="doc"></param>
        private void P12Operation(WordDocument doc)
        {
            int feeNo = 11;
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            var questionList = reportManageService.GetQuestionList(feeNo, 1);
            List <Dictionary <string, string> > list = new List <Dictionary <string, string> >();

            foreach (var question in questionList)
            {
                var dict = new Dictionary <string, string>();
                this.BindData(question, doc, dict);
                var answers = reportManageService.GetAnswers(question.Id).ToList();
                for (var i = 1; i <= 15; i++)
                {
                    var answer = answers.Find(o => o.Id == i);
                    dict.Add("Value" + i, answer != null ? answer.Value : "未填");
                }
                list.Add(dict);
            }
            doc.FillTable(0, list);
        }
Beispiel #17
0
        protected override void Operation(WordDocument doc)
        {
            int recordId = (int)ParamId;
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            var question = reportManageService.GetQuestion(recordId);

            if (question == null)
            {
                InitData(typeof(Question), doc);
                InitValue(41, 70, doc);
                return;
            }
            BindData(question, doc);
            var answers = reportManageService.GetAnswers(question.Id).ToList();

            for (var i = 41; i <= 70; i++)
            {
                var answer = answers.Find(o => o.Id == i);
                doc.ReplaceText("Value" + i, answer != null ? answer.Value : "未填");
            }
        }
Beispiel #18
0
        protected override void Operation(WordDocument doc)
        {
            int recordId = (int)ParamId;

            doc.ReplaceText("Org", GetOrgName(SecurityHelper.CurrentPrincipal.OrgId));
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            var question = reportManageService.GetQuestion(recordId);

            if (question == null)
            {
                InitData(typeof(Question), doc);
                InitValue(106, 116, doc);
                return;
            }
            BindData(question, doc);
            var answers = reportManageService.GetAnswers(question.Id).ToList();

            for (var i = 106; i <= 116; i++)
            {
                var answer = answers.Find(o => o.Id == i);
                doc.ReplaceText("Value" + i, answer != null ? answer.Value : "未填");
            }
        }
 public void DowdloadH35(string templateName, string startDateStr, string endDateStr, string feeNo, string floorId)
 {
     using (WordDocument doc = new WordDocument())
     {
         //加载模板
         doc.LoadModelDoc(templateName);
         var carelist = GetCareH35(startDateStr, endDateStr, feeNo, floorId);
         if (carelist != null && carelist.Count > 0)
         {
             foreach (var item in carelist)
             {
                 doc.NewPartDocument();
                 IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
                 var caredemandevalprivew = reportManageService.GetCareDemandHis(Convert.ToInt32(item.ID), SecurityHelper.CurrentPrincipal.OrgId);
                 doc.BindReportData(caredemandevalprivew);
                 doc.AddPartDocument();
             }
         }
         if (!doc.IsDocNull())
         {
             Util.DownloadFile(doc.SaveDoc("护理需求评估"));
         }
     }
 }
Beispiel #20
0
        protected override void Operation(WordDocument doc)
        {
            DateTime date = StartDate;

            doc.ReplaceText("Org", GetOrgName(SecurityHelper.CurrentPrincipal.OrgId));
            doc.ReplaceText("Year", (date.Year).ToString());
            doc.ReplaceText("Month", date.Month.ToString());
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            var list = reportManageService.GetInfection(date);

            dynamic[] tags = new dynamic[] {
                new { Type = "totalB", Value = "001,002,003,004,005", Text = "总感染人次(b)" },
                new { Type = "totalC", Value = "001,002", Text = "呼吸道感染人次(c)" },
                new { Type = "001", Value = "001", Text = "上呼吸道感染人次(cl)" },
                new { Type = "002", Value = "002", Text = "下呼吸道感染人次(c2)" },
                new { Type = "totalD", Value = "003,004", Text = "泌尿道感染人次(d)" },
                new { Type = "003", Value = "003", Text = "当月使用存留导尿管泌尿道感染人次(dl)" },
                new { Type = "004", Value = "004", Text = "当月未使用存留导尿管泌尿道感染人次(d2)" },
                new { Type = "005", Value = "005", Text = "疥疮感染人次(g)" }
            };
            DataTable dt = new DataTable();

            dt.Columns.Add("name");
            dt.Columns.Add("total");
            foreach (dynamic item in tags)
            {
                var dr = dt.NewRow();
                dr["name"] = item.Text;
                string[] types = item.Value.Split(',');
                dr["total"] = list.Where(o => types.Contains(o.Type)).Sum(o => o.Total);
                dt.Rows.Add(dr);
                doc.ReplaceText(item.Type, dr["total"].ToString());
            }
            doc.FillChartData(0, dt, 10);
            dt.Dispose();
        }
        protected void Operation(WordDocument doc, ReportRequest request)
        {
            long id       = request.id;
            var  codeType = request.type;

            doc.ReplaceText("Org", GetOrgName(SecurityHelper.CurrentPrincipal.OrgId));
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            var question = reportManageService.GetQuestion(id);

            if (question.Id == 0)
            {
                InitData(typeof(Question), doc);
                switch (codeType)
                {
                case "ADLReport":
                    InitValue(31, 40, doc);
                    break;

                case "MMSEReport":
                    InitValue(41, 47, doc);
                    break;

                case "SPMSQReport":
                    InitValue(48, 57, doc);
                    break;

                case "IADLReport":
                    InitValue(58, 65, doc);
                    break;

                case "ColeScaleReport":
                    InitValue(66, 66, doc);
                    break;

                case "PrsSoreReport":
                    InitValue(100, 105, doc);
                    break;
                }

                return;
            }
            List <Dictionary <string, string> > list = new List <Dictionary <string, string> >();
            var dict = new Dictionary <string, string>();

            BindData(question, doc, dict);
            var answers = reportManageService.GetAnswers(question.Id).ToList();

            switch (codeType)
            {
            case "ADLReport":
                for (var i = 31; i <= 40; i++)
                {
                    var answer = answers.Find(o => o.Id == i);
                    dict.Add("Value" + i, answer != null ? answer.Value : "未填");
                }
                break;

            case "MMSEReport":
                for (var i = 41; i <= 51; i++)
                {
                    var answer = answers.Find(o => o.Id == i);
                    doc.ReplaceText("Value" + i, answer != null ? answer.Value : "未填");
                }
                break;

            case "SPMSQReport":
                for (var i = 52; i <= 61; i++)
                {
                    var answer = answers.Find(o => o.Id == i);
                    dict.Add("Value" + i, answer != null ? answer.Value : "未填");
                }
                break;

            case "IADLReport":
                for (var i = 62; i <= 69; i++)
                {
                    var answer = answers.Find(o => o.Id == i);
                    dict.Add("Value" + i, answer != null ? answer.Value : "未填");
                }
                break;

            case "ColeScaleReport":
                for (var i = 70; i <= 70; i++)
                {
                    var answer = answers.Find(o => o.Id == i);
                    dict.Add("Value" + i, answer != null ? answer.Value : "未填");
                }
                break;

            case "PrsSoreReport":
                for (var i = 104; i <= 109; i++)
                {
                    var answer = answers.Find(o => o.Id == i);
                    dict.Add("Value" + i, answer != null ? answer.Value : "未填");
                }
                break;
            }


            list.Add(dict);
            doc.FillTable(0, list, doc, codeType);
        }
Beispiel #22
0
        protected override void Operation(WordDocument doc)
        {
            long Id = ParamId;
            IReportManageService           reportManageService       = IOCContainer.Instance.Resolve <IReportManageService>();
            INursingWorkstationService     nursingWorkstationService = IOCContainer.Instance.Resolve <INursingWorkstationService>();
            IDictManageService             dictManageService         = IOCContainer.Instance.Resolve <IDictManageService>();
            ICarePlanReportService         carePlanservice           = IOCContainer.Instance.Resolve <ICarePlanReportService>();
            BaseRequest <NursingRecFilter> nursingRecFilter          = new BaseRequest <NursingRecFilter>();

            nursingRecFilter.CurrentPage = 1;
            nursingRecFilter.PageSize    = 1000;
            // nursingRecFilter.Data.PrintFlag = true;
            nursingRecFilter.Data.Id = Id;
            var response     = nursingWorkstationService.QueryNursingRec(nursingRecFilter);
            var residentInfo = carePlanservice.GetExportResidentInfo(response.Data[0].FeeNo.Value);

            if (residentInfo != null)
            {
                doc.ReplaceText("Org", residentInfo.Org ?? "");
                doc.ReplaceText("Name", residentInfo.Name ?? "");
                doc.ReplaceText("Sex", residentInfo.Sex ?? "未填");
                doc.ReplaceText("Age", residentInfo.Age.HasValue ? residentInfo.Age.ToString() : "");
                doc.ReplaceText("FeeNo", residentInfo.ResidentNo);
                doc.ReplaceText("Floor", residentInfo.Floor ?? "");
                doc.ReplaceText("RoomNo", residentInfo.RoomNo ?? "");
            }
            else
            {
                doc.ReplaceText("Org", "");
                doc.ReplaceText("Name", "");
                doc.ReplaceText("Sex", "未填");
                doc.ReplaceText("Age", "");
                doc.ReplaceText("FeeNo", "");
                doc.ReplaceText("Floor", "");
                doc.ReplaceText("RoomNo", "");
            }
            CodeFilter codeFilter = new CodeFilter {
                ItemTypes = new string[] { "J00.005" }
            };
            var       dict = (List <CodeValue>)dictManageService.QueryCode(codeFilter).Data;
            DataTable dt   = new DataTable();

            dt.Columns.Add("c1");
            dt.Columns.Add("c2");
            dt.Columns.Add("c3");
            dt.Columns.Add("c4");
            if (response.Data != null)
            {
                foreach (var item in response.Data)
                {
                    var dr       = dt.NewRow();
                    var findItem = dict.Find(it => it.ItemType == "J00.005" && it.ItemCode == item.ClassType);
                    dr["c1"] = item.RecordDate.HasValue ? item.RecordDate.Value.ToString("yyyy-MM-dd") : "";
                    dr["c2"] = string.Format("{0} {1}{2}", item.RecordDate.HasValue ? item.RecordDate.Value.ToString("HH:mm") : "", item.ClassType, findItem != null ? findItem.ItemName : "");
                    dr["c3"] = item.Content;
                    dr["c4"] = item.RecordNameBy;
                    dt.Rows.Add(dr);
                }
            }
            doc.FillTable(0, dt, "", "", 1);
            dt.Dispose();
        }
Beispiel #23
0
        protected override void Operation(WordDocument doc)
        {
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();

            doc.ReplaceText("Org", GetOrgName(SecurityHelper.CurrentPrincipal.OrgId));
            DateTime now = StartDate;

            //doc.ReplaceText("year", (now.Year - 1911).ToString());
            doc.ReplaceText("year", now.Year.ToString());
            doc.ReplaceText("month", now.Month.ToString());

            decimal total = reportManageService.GetResidentTotal(now);

            if (total == 0)
            {
                doc.ReplaceText("New", "0");
                doc.ReplaceText("N72", "0");
                doc.ReplaceText("R72", "0");
                doc.ReplaceText("CTotal", "0");
                doc.ReplaceText("NTotal", "0");
                doc.ReplaceText("RTotal", "0");
                doc.ReplaceText("N0", "0");
                doc.ReplaceText("N1", "0");
                doc.ReplaceText("N2", "0");
                doc.ReplaceText("N3", "0");
                doc.ReplaceText("N4", "0");
                doc.ReplaceText("R0", "0");
                doc.ReplaceText("R1", "0");
                doc.ReplaceText("R2", "0");
                doc.ReplaceText("R3", "0");
                doc.ReplaceText("R4", "0");
                doc.ReplaceText("CompareNum", "");
                doc.ReplaceText("ReasonInfo", "");
                return;
            }
            doc.ReplaceText("CTotal", total.ToString("#0"));
            decimal newTotal = reportManageService.GetNewResidentTotal(now);

            if (newTotal == 0)
            {
                doc.ReplaceText("New", "0");
                doc.ReplaceText("R72", "0");
                doc.ReplaceText("N72", "0");
            }
            else
            {
                doc.ReplaceText("New", newTotal.ToString("#0"));
                decimal n72 = reportManageService.GetUnPlanEdipdH72Total(now);
                if (n72 != 0)
                {
                    doc.ReplaceText("R72", (n72 / newTotal * 100).ToString("#0.0"));
                    doc.ReplaceText("N72", n72.ToString("#0"));
                }
                else
                {
                    doc.ReplaceText("N72", "0");
                    doc.ReplaceText("R72", "0");
                }
            }
            var     list   = reportManageService.GetUnPlanEdipd(now, false);
            decimal nTotal = list.Sum(o => o.Total);

            var     lastList   = reportManageService.GetUnPlanEdipd(now.AddMonths(-1), false);
            decimal lastNTotal = lastList.Sum(o => o.Total);

            if (nTotal == 0)
            {
                doc.ReplaceText("NTotal", "0");
                doc.ReplaceText("RTotal", "0");
            }
            else
            {
                doc.ReplaceText("NTotal", nTotal.ToString("#0"));
                doc.ReplaceText("RTotal", (nTotal / total * 100).ToString("#0.0"));
            }

            if (nTotal < lastNTotal)
            {
                doc.ReplaceText("CompareNum", "较上月减少" + (lastNTotal - nTotal).ToString("#0") + ",");
            }
            else if (nTotal == lastNTotal)
            {
                doc.ReplaceText("CompareNum", "较上月相同,");
            }
            else if (nTotal > lastNTotal)
            {
                doc.ReplaceText("CompareNum", "较上月增加" + (nTotal - lastNTotal).ToString("#0") + "人,");
            }


            var keys    = new[] { "心血管代偿机能减退", "骨折之治疗或评估", "肠胃道出血", "感染", "其他内外科原因" };
            var msgInfo = string.Empty;

            for (int i = 0; i < 5; i++)
            {
                if (nTotal == 0)
                {
                    doc.ReplaceText("N" + i, "0");
                    doc.ReplaceText("R" + i, "0");
                    msgInfo += "";
                    continue;
                }
                var obj = list.FirstOrDefault(o => o.Type == keys[i]);
                if (obj != null)
                {
                    doc.ReplaceText("N" + i, obj.Total.ToString());
                    doc.ReplaceText("R" + i, (obj.Total / nTotal * 100).ToString("#0.0"));
                    msgInfo += obj.Total == 0 ? "" : (",因" + keys[i] + "住院" + obj.Total.ToString() + "位");
                }
                else
                {
                    doc.ReplaceText("N" + i, "0");
                    doc.ReplaceText("R" + i, "0");
                    msgInfo += "";
                }
            }
            doc.ReplaceText("ReasonInfo", msgInfo);
        }
Beispiel #24
0
        protected override void Operation(WordDocument doc)
        {
            doc.ReplaceText("Org", GetOrgName(SecurityHelper.CurrentPrincipal.OrgId));
            DateTime now = StartDate;

            doc.ReplaceText("year", now.Year.ToString());
            doc.ReplaceText("month", now.Month.ToString());
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            decimal total         = reportManageService.GetResidentTotal(now);
            decimal ipdRegInTotal = total * DateTime.DaysInMonth(now.Year, now.Month);                                          //当月在院住民总人日数

            decimal ipdRegOutTotal = OutLeaveUnPlanTotal(now.Year, now.Month, reportManageService.GetIpdOutTotal(now.Year));    //当月结案的人日次数
            decimal leaveHospTotal = OutLeaveUnPlanTotal(now.Year, now.Month, reportManageService.GetLeaveHospTotal(now.Year)); // 当月请假的人日次数
            decimal unPlanIpdTotal = OutLeaveUnPlanTotal(now.Year, now.Month, reportManageService.GetUnPlanIpdTotal(now.Year)); //当月非计划住院人日次数
            decimal ipdRegCount    = ipdRegInTotal + ipdRegOutTotal - leaveHospTotal - unPlanIpdTotal;                          //当月住民总人日数

            if (ipdRegCount == 0)
            {
                doc.ReplaceText("UTotal", "0");
                doc.ReplaceText("STotal", "0");
                doc.ReplaceText("CTotal", "0");
                doc.ReplaceText("NTotal", "0");
                doc.ReplaceText("RTotal", "0");
                doc.ReplaceText("N0", "0");
                doc.ReplaceText("N1", "0");
                doc.ReplaceText("N2", "0");
                doc.ReplaceText("N3", "0");
                doc.ReplaceText("N4", "0");
                doc.ReplaceText("N5", "0");
                doc.ReplaceText("R0", "0");
                doc.ReplaceText("R1", "0");
                doc.ReplaceText("R2", "0");
                doc.ReplaceText("R3", "0");
                doc.ReplaceText("R4", "0");
                doc.ReplaceText("R5", "0");
                doc.ReplaceText("CompareNum", "");
                doc.ReplaceText("ReasonInfo", "");
                doc.ReplaceText("CompareState", "");
                return;
            }
            doc.ReplaceText("CTotal", ipdRegCount.ToString("#0"));

            var     list       = reportManageService.GetInfection(now);
            var     lastList   = reportManageService.GetInfection(now.AddMonths(-1));
            decimal nTotal     = list.Sum(o => o.Total);
            decimal lastnTotal = lastList.Sum(o => o.Total);

            if (nTotal == 0)
            {
                doc.ReplaceText("NTotal", "0");
                doc.ReplaceText("RTotal", "0");
            }
            else
            {
                doc.ReplaceText("NTotal", nTotal.ToString("#0"));
                doc.ReplaceText("RTotal", (nTotal / ipdRegCount * 100).ToString("#0.0"));
            }

            if (nTotal < lastnTotal)
            {
                doc.ReplaceText("CompareNum", "较上月有所减少,");
            }
            else if (nTotal == lastnTotal)
            {
                doc.ReplaceText("CompareNum", "较上月相同,");
            }
            else if (nTotal > lastnTotal)
            {
                doc.ReplaceText("CompareNum", "较上月有所增加,");
            }

            // 使用导尿管(膀胱)人日数
            decimal blTotal = OutLeaveUnPlanTotal(now.Year, now.Month, reportManageService.GetUsedPipeDaysTotal(now.Year, "002"));
            // 使用导尿管(尿道)人日数
            decimal urTotal = OutLeaveUnPlanTotal(now.Year, now.Month, reportManageService.GetUsedPipeDaysTotal(now.Year, "003"));

            decimal sTotal = blTotal + urTotal;   //使用导尿管人日数

            decimal uTotal = ipdRegCount - sTotal;

            doc.ReplaceText("STotal", sTotal.ToString("#0"));
            doc.ReplaceText("UTotal", uTotal.ToString("#0"));
            var keys    = new[] { "001", "002", "003", "004", "005" };
            var msgInfo = string.Empty;

            for (int i = 0; i < 5; i++)
            {
                if (nTotal == 0)
                {
                    doc.ReplaceText("N" + i, "0");
                    doc.ReplaceText("R" + i, "0");
                    msgInfo += "";
                    continue;
                }
                var obj = list.FirstOrDefault(o => o.Type == keys[i]);
                if (obj != null)
                {
                    if (i == 2)
                    {
                        doc.ReplaceText("N" + i, obj.Total.ToString());
                        doc.ReplaceText("R" + i, sTotal != 0 ? (obj.Total / sTotal * 100).ToString("#0.0") : "0");
                        msgInfo += obj.Total == 0 ? "" : (",当月使用存留导尿管泌尿道感染人次" + obj.Total.ToString() + "位");
                    }
                    else if (i == 3)
                    {
                        doc.ReplaceText("N" + i, obj.Total.ToString());
                        doc.ReplaceText("R" + i, uTotal != 0 ? (obj.Total / uTotal * 100).ToString("#0.0") : "0");
                        msgInfo += obj.Total == 0 ? "" : (",当月未使用存留导尿管泌尿道感染人次" + obj.Total.ToString() + "位");
                    }
                    else
                    {
                        doc.ReplaceText("N" + i, obj.Total.ToString());
                        doc.ReplaceText("R" + i, (obj.Total / ipdRegCount * 100).ToString("#0.0"));
                    }
                }
                else
                {
                    doc.ReplaceText("N" + i, "0");
                    doc.ReplaceText("R" + i, "0");
                    msgInfo += "";
                }
            }

            var non1 = list.Where(o => o.Type == "001" || o.Type == "002").Sum(o => o.Total);

            msgInfo += non1 == 0 ? "" : (",当月呼吸道感染人次" + non1.ToString() + "位");

            var n5 = list.Where(o => o.Type == "003" || o.Type == "004").Sum(o => o.Total);

            doc.ReplaceText("N5", n5.ToString());
            doc.ReplaceText("R5", n5 != 0 ? (n5 / ipdRegCount * 100).ToString("#0.0") : "0");
            msgInfo += n5 == 0 ? "" : (",当月泌尿道感染人次" + non1.ToString() + "位");

            var n4 = list.Where(o => o.Type == "005").Sum(o => o.Total);

            msgInfo += n4 == 0 ? "" : (",当月皮肤感染人次" + n4.ToString() + "位");

            doc.ReplaceText("ReasonInfo", msgInfo);
        }
        /// <summary>
        /// P22非计画性转至怠性医院住院月统计表
        /// </summary>
        /// <param name="doc"></param>
        private void P22Operation(WordDocument doc)
        {
            DateTime now = DateTime.Now;

            doc.ReplaceText("year", now.Year.ToString());
            doc.ReplaceText("month", now.Month.ToString());
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            decimal total = reportManageService.GetResidentTotal(now);

            if (total == 0)
            {
                doc.ReplaceText("New", "0");
                doc.ReplaceText("N72", "0");
                doc.ReplaceText("R72", "0");
                doc.ReplaceText("CTotal", "0");
                doc.ReplaceText("NTotal", "0");
                doc.ReplaceText("RTotal", "0");
                doc.ReplaceText("N0", "0");
                doc.ReplaceText("N1", "0");
                doc.ReplaceText("N2", "0");
                doc.ReplaceText("N3", "0");
                doc.ReplaceText("N4", "0");
                doc.ReplaceText("R0", "0");
                doc.ReplaceText("R1", "0");
                doc.ReplaceText("R2", "0");
                doc.ReplaceText("R3", "0");
                doc.ReplaceText("R4", "0");
                return;
            }
            doc.ReplaceText("CTotal", total.ToString("#0"));
            decimal newTotal = reportManageService.GetNewResidentTotal(now);

            if (newTotal == 0)
            {
                doc.ReplaceText("New", "0");
                doc.ReplaceText("R72", "0");
                doc.ReplaceText("N72", "0");
            }
            else
            {
                decimal n72 = reportManageService.GetUnPlanEdipdH72Total(now);
                if (n72 != 0)
                {
                    doc.ReplaceText("R72", (n72 / newTotal * 100).ToString("#0.0"));
                    doc.ReplaceText("N72", n72.ToString("#0"));
                }
                else
                {
                    doc.ReplaceText("N72", "0");
                }
            }
            var     list   = reportManageService.GetUnPlanEdipd(now, false);
            decimal nTotal = list.Sum(o => o.Total);

            if (nTotal == 0)
            {
                doc.ReplaceText("NTotal", "0");
                doc.ReplaceText("RTotal", "0");
            }
            else
            {
                doc.ReplaceText("NTotal", nTotal.ToString("#0"));
                doc.ReplaceText("RTotal", (nTotal / total * 100).ToString("#0.0"));
            }
            var keys = new[] { "心血管代偿机能减退", "骨折之治疗或评估", "肠胃道出血", "感染", "其他内外科原因" };

            for (int i = 0; i < 5; i++)
            {
                if (nTotal == 0)
                {
                    doc.ReplaceText("N" + i, "0");
                    doc.ReplaceText("R" + i, "0");
                    continue;
                }
                var obj = list.FirstOrDefault(o => o.Type == keys[i]);
                if (obj != null)
                {
                    doc.ReplaceText("N" + i, obj.Total.ToString());
                    doc.ReplaceText("R" + i, (obj.Total / nTotal * 100).ToString("#0.0"));
                }
                else
                {
                    doc.ReplaceText("N" + i, "0");
                    doc.ReplaceText("R" + i, "0");
                }
            }
        }
        /// <summary>
        /// 护理记录
        /// </summary>
        /// <param name="templateName"></param>
        /// <param name="startDateStr"></param>
        /// <param name="endDateStr"></param>
        /// <param name="feeNo"></param>
        /// <param name="classType"></param>
        public void DowdloadP18(string templateName, string startDateStr, string endDateStr, string feeNo, string classType, string floorId, string printOrder)
        {
            using (WordDocument doc = new WordDocument())
            {
                //加载模板
                doc.LoadModelDoc(templateName);
                var carelist = GetCareP18(startDateStr, endDateStr, feeNo, classType, floorId);
                if (carelist != null && carelist.Count > 0)
                {
                    List <string> list = new List <string>();
                    foreach (var item in carelist)
                    {
                        list.Add(item.FEENO.ToString());
                    }

                    var feenolist = list.Distinct().ToList();

                    if (feenolist != null && feenolist.Count > 0)
                    {
                        foreach (var item in feenolist)
                        {
                            doc.NewPartDocument();
                            IReportManageService       reportManageService       = IOCContainer.Instance.Resolve <IReportManageService>();
                            INursingWorkstationService nursingWorkstationService = IOCContainer.Instance.Resolve <INursingWorkstationService>();
                            IDictManageService         dictManageService         = IOCContainer.Instance.Resolve <IDictManageService>();
                            var residentInfo = carePlanservice.GetExportResidentInfo(Convert.ToInt64(item));
                            if (residentInfo != null)
                            {
                                doc.ReplacePartText("Org", residentInfo.Org ?? "");
                                doc.ReplacePartText("Name", residentInfo.Name ?? "");
                                doc.ReplacePartText("Sex", residentInfo.Sex ?? "未填");
                                doc.ReplacePartText("Age", residentInfo.Age.HasValue ? residentInfo.Age.ToString() : "");
                                doc.ReplacePartText("FeeNo", residentInfo.ResidentNo);
                                doc.ReplacePartText("Floor", residentInfo.Floor ?? "");
                                doc.ReplacePartText("RoomNo", residentInfo.RoomNo ?? "");
                            }
                            else
                            {
                                doc.ReplacePartText("Org", "");
                                doc.ReplacePartText("Name", "");
                                doc.ReplacePartText("Sex", "未填");
                                doc.ReplacePartText("Age", "");
                                doc.ReplacePartText("FeeNo", "");
                                doc.ReplacePartText("Floor", "");
                                doc.ReplacePartText("RoomNo", "");
                            }

                            BaseRequest <NursingRecFilter> nursingRecFilter = new BaseRequest <NursingRecFilter>();
                            nursingRecFilter.CurrentPage    = 1;
                            nursingRecFilter.PageSize       = 1000;
                            nursingRecFilter.Data.PrintFlag = true;
                            nursingRecFilter.Data.FeeNo     = (Convert.ToInt64(item));
                            nursingRecFilter.Data.Order     = printOrder;
                            var response = nursingWorkstationService.QueryNursingRec(nursingRecFilter);
                            response.Data = response.Data.Where(o => o.ClassType == classType).ToList();
                            DateTime?startDate = null;
                            DateTime?endDate   = null;
                            if (startDateStr != "")
                            {
                                startDate = Convert.ToDateTime(startDateStr);
                            }
                            if (endDateStr != "")
                            {
                                endDate = Convert.ToDateTime(endDateStr).AddDays(1).AddMilliseconds(-1);
                            }

                            if (startDate.HasValue && response.Data != null)
                            {
                                response.Data = response.Data.Where(m => m.RecordDate >= startDate.Value).ToList();
                            }
                            if (endDate.HasValue && response.Data != null)
                            {
                                response.Data = response.Data.Where(m => m.RecordDate <= endDate.Value).ToList();
                            }
                            CodeFilter codeFilter = new CodeFilter {
                                ItemTypes = new string[] { "J00.005" }
                            };
                            var dict = (List <CodeValue>)dictManageService.QueryCode(codeFilter).Data;

                            DataTable dt = new DataTable();
                            dt.Columns.Add("c1");
                            dt.Columns.Add("c2");
                            dt.Columns.Add("c3");
                            dt.Columns.Add("c4");
                            if (response.Data != null)
                            {
                                foreach (var careitem in response.Data)
                                {
                                    var dr       = dt.NewRow();
                                    var findItem = dict.Find(it => it.ItemType == "J00.005" && it.ItemCode == careitem.ClassType);
                                    dr["c1"] = careitem.RecordDate.HasValue ?Convert.ToDateTime(careitem.RecordDate.Value).ToString("yyyy-MM-dd") : "";
                                    dr["c2"] = string.Format("{0} {1}{2}", careitem.RecordDate.HasValue ? careitem.RecordDate.Value.ToString("HH:mm") : "", careitem.ClassType, findItem != null ? findItem.ItemName : "");
                                    dr["c3"] = careitem.Content;
                                    dr["c4"] = careitem.RecordNameBy;
                                    dt.Rows.Add(dr);
                                }
                            }

                            doc.MultiFillTable(0, dt, "", "", 1);
                            doc.AddPartDocument();
                            dt.Dispose();
                        }

                        if (!doc.IsDocNull())
                        {
                            Util.DownloadFile(doc.SaveMarkDoc("护理记录"));
                        }
                    }
                }
            }
        }
        /// <summary>
        /// P23医疗照顾相关感染指标月统计表
        /// </summary>
        /// <param name="doc"></param>
        private void P23Operation(WordDocument doc)
        {
            DateTime now = DateTime.Now;

            doc.ReplaceText("year", now.Year.ToString());
            doc.ReplaceText("month", now.Month.ToString());
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            decimal total = reportManageService.GetResidentTotal(now);

            if (total == 0)
            {
                doc.ReplaceText("UTotal", "0");
                doc.ReplaceText("STotal", "0");
                doc.ReplaceText("CTotal", "0");
                doc.ReplaceText("NTotal", "0");
                doc.ReplaceText("RTotal", "0");
                doc.ReplaceText("N0", "0");
                doc.ReplaceText("N1", "0");
                doc.ReplaceText("N2", "0");
                doc.ReplaceText("N3", "0");
                doc.ReplaceText("N4", "0");
                doc.ReplaceText("N5", "0");
                doc.ReplaceText("R0", "0");
                doc.ReplaceText("R1", "0");
                doc.ReplaceText("R2", "0");
                doc.ReplaceText("R3", "0");
                doc.ReplaceText("R4", "0");
                doc.ReplaceText("R5", "0");
                return;
            }
            doc.ReplaceText("CTotal", total.ToString("#0"));

            var     list   = reportManageService.GetInfection(now);
            decimal nTotal = list.Sum(o => o.Total);

            if (nTotal == 0)
            {
                doc.ReplaceText("NTotal", "0");
                doc.ReplaceText("RTotal", "0");
            }
            else
            {
                doc.ReplaceText("NTotal", nTotal.ToString("#0"));
                doc.ReplaceText("RTotal", (nTotal / total * 100).ToString("#0.0"));
            }
            decimal sTotal = reportManageService.GetUsedPipeTotal(now);
            decimal uTotal = total - sTotal;

            doc.ReplaceText("STotal", sTotal.ToString("#0"));
            doc.ReplaceText("UTotal", uTotal.ToString("#0"));
            var keys = new[] { "001", "002", "003", "004", "005" };

            for (int i = 0; i < 5; i++)
            {
                if (nTotal == 0)
                {
                    doc.ReplaceText("N" + i, "0");
                    doc.ReplaceText("R" + i, "0");
                    continue;
                }
                var obj = list.FirstOrDefault(o => o.Type == keys[i]);
                if (obj != null)
                {
                    if (i == 2)
                    {
                        doc.ReplaceText("N" + i, obj.Total.ToString());
                        doc.ReplaceText("R" + i, sTotal != 0 ? (obj.Total / sTotal * 100).ToString("#0.0") : "0");
                    }
                    else if (i == 3)
                    {
                        doc.ReplaceText("N" + i, obj.Total.ToString());
                        doc.ReplaceText("R" + i, uTotal != 0 ? (obj.Total / uTotal * 100).ToString("#0.0") : "0");
                    }
                    else
                    {
                        doc.ReplaceText("N" + i, obj.Total.ToString());
                        doc.ReplaceText("R" + i, (obj.Total / total * 100).ToString("#0.0"));
                    }
                }
                else
                {
                    doc.ReplaceText("N" + i, "0");
                    doc.ReplaceText("R" + i, "0");
                }
            }

            var n5 = list.Where(o => o.Type == "003" || o.Type == "004").Sum(o => o.Total);

            doc.ReplaceText("N5", n5.ToString());
            doc.ReplaceText("R5", n5 != 0 ? (n5 / total * 100).ToString("#0.0") : "0");
        }
        public void DownloadInfectionStatisticsFile(int year, string templateFile)
        {
            var response = this.GetInfectionStatisticsData(year);
            SheetParameterContainer sheetParameterContainer = new SheetParameterContainer()
            {
                SheetName = "统计总表"
            };

            dynamic[] categorys = new dynamic[] {
                new { category = "001", rowIndex = 7 },     //上呼吸道感染人次
                new { category = "002", rowIndex = 9 },     //下呼吸道感染人次
                new { category = "003", rowIndex = 14 },    //使用导尿管感染人次
                new { category = "004", rowIndex = 17 },    //未使用导尿管感染人次
                new { category = "005", rowIndex = 19 },    //疥疮感染人次
                // new { category = "usedPipe", rowIndex = 13 },   //使用导尿管人日数
            };
            List <ElementFormatter> elementFormatters = new List <ElementFormatter>();

            // 生成年份参数
            sheetParameterContainer.ParameterList.Add(new Parameter()
            {
                Name = "year", RowIndex = 0, ColumnIndex = 1
            });
            elementFormatters.Add(new CellFormatter(sheetParameterContainer["year"], year));

            for (int i = 0; i < categorys.Length; i++)
            {
                var item = categorys[i];
                elementFormatters.Add(NewTableFormatter(response, sheetParameterContainer, item.rowIndex, item.category));
            }

            #region 住民总人日数
            int row = 2, col = 0;
            int queryMonth = 0;
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();

            var dbSet = unitOfWork.GetRepository <LTC_IPDREG>().dbSet.Where(o => o.ORGID == orgId && (o.IPDFLAG == "I") && o.INDATE.HasValue && ((DateTime)o.INDATE).Year == year).AsQueryable();
            var ipd   = (from a in dbSet
                         let Year = SqlFunctions.DatePart("Year", (DateTime)a.INDATE)
                                    let Month = SqlFunctions.DatePart("Month", (DateTime)a.INDATE)
                                                group a by new { Year, Month } into g
                         where g.Key.Year == year
                         select new StatisticItem {
                Year = g.Key.Year, Month = g.Key.Month, Total = g.Count()
            });
            var ipdRegList = ipd.ToList();
            int maxMonth   = 0;
            if (ipdRegList != null && ipdRegList.Count > 0)
            {
                maxMonth = ipdRegList.OrderByDescending(s => s.Month).FirstOrDefault().Month;
            }

            for (int j = 1; j <= 12; j++)
            {
                decimal leaveHospTotal = 0;
                decimal unPlanIpdTotal = 0;
                col = j;
                if (col > maxMonth)
                {
                    queryMonth = 0;
                }
                else
                {
                    queryMonth = col;
                }

                decimal total =
                    unitOfWork.GetRepository <LTC_IPDREG>()
                    .dbSet.Count(
                        o =>
                        o.ORGID == orgId && (o.IPDFLAG == "I") && o.INDATE.HasValue &&
                        ((DateTime)o.INDATE).Year == year && ((DateTime)o.INDATE).Month <= queryMonth);

                decimal ipdRegInTotal = total * DateTime.DaysInMonth(year, j);                                                         //当月在院住民总人日数

                decimal ipdRegOutTotal = reportManageService.OutLeaveUnPlanTotal(year, col, reportManageService.GetIpdOutTotal(year)); //当月结案的人日次数

                if (ipdRegInTotal == 0 && ipdRegOutTotal == 0)
                {
                    leaveHospTotal = 0;
                    unPlanIpdTotal = 0;
                }
                else
                {
                    leaveHospTotal = reportManageService.OutLeaveUnPlanTotal(year, col, reportManageService.GetLeaveHospTotal(year)); // 当月请假的人日次数
                    unPlanIpdTotal = reportManageService.OutLeaveUnPlanTotal(year, col, reportManageService.GetUnPlanIpdTotal(year)); //当月非计划住院人日次数
                }
                decimal ipdRegCount = ipdRegInTotal + ipdRegOutTotal - leaveHospTotal - unPlanIpdTotal;                               //当月住民总人日数
                elementFormatters.Add(new CellFormatter(new Parameter()
                {
                    Name = string.Format("{0}_{1}", row, col), RowIndex = row, ColumnIndex = col
                }, ipdRegCount));
            }
            #endregion

            #region 使用导尿管人日数

            row = 13;
            for (int j = 1; j <= 12; j++)
            {
                decimal sTotal = 0;
                col = j;
                if (col <= maxMonth)
                {
                    sTotal = reportManageService.OutLeaveUnPlanTotal(year, col, reportManageService.GetUsedPipeDaysTotal(year));
                }
                else
                {
                    sTotal = 0;
                }

                elementFormatters.Add(new CellFormatter(new Parameter()
                {
                    Name = string.Format("{0}_{1}", row, col), RowIndex = row, ColumnIndex = col
                }, sTotal));
            }
            #endregion
            ExportHelper.ExportToWeb(templateFile, Path.GetFileName(templateFile), new SheetFormatter("统计总表", elementFormatters.Where(it => it != null).ToArray()));
        }
Beispiel #29
0
        public IHttpActionResult DownloadExcel(string code, long feeNo = 0, DateTime?startDate = null, DateTime?endDate = null)
        {
            string mapPath = HttpContext.Current.Server.MapPath(VirtualPathUtility.GetDirectory("~"));
            IReportManageService reportManageService = IOCContainer.Instance.Resolve <IReportManageService>();
            string path = string.Empty;

            switch (code)
            {
            case "H20":
                if (startDate.HasValue)
                {
                    path = string.Format(@"{0}Templates\{1}.xls", mapPath, "H20");
                    reportManageService.DownloadUnPlanedIpdStatisticsFile(startDate.Value.Year, path);
                }
                break;

            case "H49":
                if (startDate.HasValue)
                {
                    path = string.Format(@"{0}Templates\{1}.xls", mapPath, "H49");
                    reportManageService.DownloadInfectionStatisticsFile(startDate.Value.Year, path);
                }
                break;

            case "H50":
                if (startDate.HasValue)
                {
                    path = string.Format(@"{0}Templates\{1}.xls", mapPath, "H50");
                    reportManageService.DownloadH50(startDate.Value.Year, path);
                }
                break;

            case "H76":
                if (startDate.HasValue && endDate.HasValue)
                {
                    path = string.Format(@"{0}Templates\{1}.xls", mapPath, "H76");
                    reportManageService.DownloadPrsSoreRisk(path, feeNo, startDate, endDate);
                }
                break;

            case "H77":
                path = string.Format(@"{0}Templates\{1}.xls", mapPath, "H77");
                reportManageService.DownloadH77(feeNo, path, startDate, endDate);
                break;

            case "H79":
                path = string.Format(@"{0}Templates\{1}.xls", mapPath, "H79");
                reportManageService.DownloadH79(feeNo, path);
                break;

            case "P19":
                path = string.Format(@"{0}Templates\{1}.xls", mapPath, "P19");
                int seqNo = 0;
                if (int.TryParse(HttpContext.Current.Request["seqNo"], out seqNo))
                {
                    reportManageService.DownloadP19(seqNo, path);
                }
                break;

            case "View":
                this.View();
                break;
            }
            //HttpContext.Current.Response.AddHeader("Content-type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
            //HttpContext.Current.Response.AddHeader("Accept-Ranges", "bytes");
            //HttpContext.Current.Response.AddHeader("Content-Length", new System.IO.FileInfo(swfFilePath).Length.ToString());
            //HttpContext.Current.Response.WriteFile(swfFilePath);

            //HttpContext.Current.Response.End();
            return(Ok());
        }
Beispiel #30
0
        protected override void Operation(WordDocument doc)
        {
            ISocialWorkerManageService     socialWorkerService       = IOCContainer.Instance.Resolve <ISocialWorkerManageService>();
            IOrganizationManageService     organizationManageService = IOCContainer.Instance.Resolve <IOrganizationManageService>();
            IDictManageService             dictManageService         = IOCContainer.Instance.Resolve <IDictManageService>();
            IReportManageService           reportManageService       = IOCContainer.Instance.Resolve <IReportManageService>();
            BaseRequest <LifeRecordFilter> lifeRecordFilter          = new BaseRequest <LifeRecordFilter>();

            lifeRecordFilter.CurrentPage    = 1;
            lifeRecordFilter.PageSize       = 1000;
            lifeRecordFilter.Data.FeeNo     = ParamId;
            lifeRecordFilter.Data.StartDate = StartDate;
            lifeRecordFilter.Data.EndDate   = EndDate.AddDays(1);
            var org      = organizationManageService.GetOrg(SecurityHelper.CurrentPrincipal.OrgId);
            var response = socialWorkerService.QueryLifeRecord(lifeRecordFilter);

            doc.ReplaceText("Org", org.Data.OrgName);

            CodeFilter codeFilter = new CodeFilter();

            codeFilter.ItemTypes = new string[] { "A00.400", "A00.401", "A00.402" };
            var dict = (List <CodeValue>)dictManageService.QueryCode(codeFilter).Data;

            DataTable dt = new DataTable();

            dt.Columns.Add("c1");
            dt.Columns.Add("c2");
            dt.Columns.Add("c3");
            dt.Columns.Add("c4");
            dt.Columns.Add("c5");
            dt.Columns.Add("c6");
            dt.Columns.Add("c7");
            dt.Columns.Add("c8");
            dt.Columns.Add("c9");
            dt.Columns.Add("c10");
            dt.Columns.Add("c11");
            dt.Columns.Add("c12");
            if (response.Data != null)
            {
                if (response.Data.Count == 0)
                {
                    response.Data.Add(new LifeRecordModel());
                }
                CodeValue findItem;

                foreach (var item in response.Data)
                {
                    var dr = dt.NewRow();
                    dr["c1"] = item.Name;
                    dr["c2"] = item.ResidentsNo;
                    //dr["c3"] = item.Floor + " " + item.RoomNo;
                    if (organizationManageService.GetOrgFloor(item.Floor).Data != null &&
                        organizationManageService.GetOrgRoom(item.RoomNo).Data != null)
                    {
                        dr["c3"] = organizationManageService.GetOrgFloor(item.Floor).Data.FloorName + " " + organizationManageService.GetOrgRoom(item.RoomNo).Data.RoomName;
                    }
                    if (item.RecordDate.HasValue)
                    {
                        var data = item.RecordDate.Value;
                        //dr["c4"] = string.Format("{0}/{1}/{2}", data.Year - 1911, data.Month, data.Day);
                        dr["c4"] = string.Format("{0}/{1}/{2}", data.Year, data.Month, data.Day);
                    }
                    dr["c5"] = item.BodyTemp.HasValue ? item.BodyTemp.Value.ToString("N1") : "";

                    dr["c10"] = string.IsNullOrEmpty(item.AmActivity) ? "" : item.AmActivity.ToString();
                    dr["c11"] = string.IsNullOrEmpty(item.PmActivity) ? "" : item.PmActivity.ToString();

                    findItem  = dict.Find(it => it.ItemType == "A00.402" && it.ItemCode == item.Comments);
                    dr["c12"] = findItem != null ? findItem.ItemName : "";
                    //dr["c1"] = item.Name;RecordByName
                    dt.Rows.Add(dr);
                }
            }
            doc.FillTable(0, dt, "", "", 1);
            dt.Dispose();
        }