/// <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(); }
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 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> /// 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"); }