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