Browse Source

单位报表

master
wxd 1 year ago
parent
commit
4da7126ee3
  1. 66
      src/Shentun.Peis.Application.Contracts/OccupationalDiseaseReports/GetCompanyOccupationalDiseaseDataExcelDto.cs
  2. 21
      src/Shentun.Peis.Application.Contracts/OccupationalDiseaseReports/GetCompanyOccupationalDiseaseDetailReportDto.cs
  3. 122
      src/Shentun.Peis.Application/OccupationalDiseaseReports/OccupationalDiseaseReportAppService.cs

66
src/Shentun.Peis.Application.Contracts/OccupationalDiseaseReports/GetCompanyOccupationalDiseaseDataExcelDto.cs

@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.OccupationalDiseaseReports
{
public class GetCompanyOccupationalDiseaseDataExcelDto
{
/// <summary>
/// 人员条码号
/// </summary>
public string PatientRegisterNo { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string PatientName { get; set; }
/// <summary>
/// 工种
/// </summary>
public string JobType { get; set; }
/// <summary>
/// 接害工龄
/// </summary>
public string PoisonWorkTime { get; set; }
/// <summary>
/// 毒害因素 A、B格式
/// </summary>
public string PoisonNames { get; set; }
/// <summary>
/// 异常指标
/// </summary>
public string AnomalyIndex { get; set; }
/// <summary>
/// 处理意见
/// </summary>
public string HandlingSuggestions { get; set; }
/// <summary>
/// 体检结论
/// </summary>
public string MedicalConclusion { get; set; }
/// <summary>
/// 职业病检查类别
/// </summary>
public string OcCheckTypeName { get; set; }
/// <summary>
/// 体检日期
/// </summary>
public string MedicalStartDate { get; set; }
/// <summary>
/// 总检医生
/// </summary>
public string SummaryDoctorName { get; set; }
}
}

21
src/Shentun.Peis.Application.Contracts/OccupationalDiseaseReports/GetCompanyOccupationalDiseaseDetailReportDto.cs

@ -181,6 +181,27 @@ namespace Shentun.Peis.OccupationalDiseaseReports
/// </summary> /// </summary>
public string HandlingSuggestions { get; set; } public string HandlingSuggestions { get; set; }
///// <summary>
///// 体检结论
///// </summary>
//public string MedicalConclusion { get; set; }
///// <summary>
///// 职业病检查类别
///// </summary>
//public string OcCheckTypeName { get; set; }
///// <summary>
///// 体检日期
///// </summary>
//public string MedicalStartDate { get; set; }
///// <summary>
///// 总检医生
///// </summary>
//public string SummaryDoctorName { get; set; }
/// <summary> /// <summary>
/// 排序 /// 排序
/// </summary> /// </summary>

122
src/Shentun.Peis.Application/OccupationalDiseaseReports/OccupationalDiseaseReportAppService.cs

@ -454,7 +454,7 @@ namespace Shentun.Peis.OccupationalDiseaseReports
PatientName = s.FirstOrDefault().patientRegister.PatientName, PatientName = s.FirstOrDefault().patientRegister.PatientName,
PatientRegisterNo = s.FirstOrDefault().patientRegister.PatientRegisterNo, PatientRegisterNo = s.FirstOrDefault().patientRegister.PatientRegisterNo,
PoisonNames = string.Join(",", s.Select(ss => ss.posionHaveEmpty.DisplayName).Distinct()), PoisonNames = string.Join(",", s.Select(ss => ss.posionHaveEmpty.DisplayName).Distinct()),
PoisonWorkTime = s.Key.PoisonWorkTime
PoisonWorkTime = s.Key.PoisonWorkTime,
}).ToList(); }).ToList();
msg.MedicalResultDetails = medicalResultDetails; msg.MedicalResultDetails = medicalResultDetails;
#endregion #endregion
@ -658,6 +658,126 @@ namespace Shentun.Peis.OccupationalDiseaseReports
return msg;
}
/// <summary>
/// 获取单位职业病结果Excel数据
/// </summary>
/// <returns></returns>
[HttpPost("api/app/OccupationalDiseaseReport/GetCompanyOccupationalDiseaseDataExcel")]
public async Task<List<GetCompanyOccupationalDiseaseDataExcelDto>> GetCompanyOccupationalDiseaseDataExcelAsync(GetCompanyOccupationalDiseaseDetailReportInputDto input)
{
if (!input.CustomerOrgs.Any())
throw new UserFriendlyException("单位信息不能为空");
var customerOrgPara = input.CustomerOrgs.First();
if (customerOrgPara.CustomerOrgId == null || customerOrgPara.CustomerOrgId == Guid.Empty)
throw new UserFriendlyException("单位不能为空");
if (customerOrgPara.CustomerOrgRegisterId == null || customerOrgPara.CustomerOrgRegisterId == Guid.Empty)
throw new UserFriendlyException("单位体检次数不能为空");
#region 人员信息
var query = from patientRegister in await _patientRegisterRepository.GetQueryableAsync()
join patientOccupationalDisease in await _patientOccupationalDiseaseRepository.GetQueryableAsync() on patientRegister.Id equals patientOccupationalDisease.PatientRegisterId
join patientPoison in await _patientPoisonRepository.GetQueryableAsync() on patientRegister.Id equals patientPoison.PatientRegisterId into patientPoisonTemp
from patientPoisonHaveEmpty in patientPoisonTemp.DefaultIfEmpty()
join poison in await _poisonRepository.GetQueryableAsync() on patientPoisonHaveEmpty.PoisonId equals poison.Id into poisonTemp
from posionHaveEmpty in poisonTemp.DefaultIfEmpty()
join occupationalAbnormal in await _occupationalAbnormalRepository.GetQueryableAsync() on patientPoisonHaveEmpty.OccupationalAbnormalId equals occupationalAbnormal.Id into occupationalAbnormalTemp
from occupationalAbnormalHaveEmpty in occupationalAbnormalTemp.DefaultIfEmpty()
join ocCheckType in await _ocCheckTypeRepository.GetQueryableAsync() on patientOccupationalDisease.OcCheckTypeId equals ocCheckType.Id into ocCheckTypeTemp
from ocCheckTypeHaveEmpty in ocCheckTypeTemp.DefaultIfEmpty()
join sumSummaryHeader in (await _sumSummaryHeaderRepository.GetQueryableAsync()).Include(x => x.SumSummaryContents) on patientRegister.Id equals sumSummaryHeader.PatientRegisterId into sumSummaryHeaderTemp
from sumSummaryHeaderHaveEmpty in sumSummaryHeaderTemp.DefaultIfEmpty()
where patientRegister.CustomerOrgRegisterId == customerOrgPara.CustomerOrgRegisterId
&& patientRegister.CompleteFlag != PatientRegisterCompleteFlag.PreRegistration
select new
{
patientRegister,
patientOccupationalDisease,
posionHaveEmpty,
patientPoisonHaveEmpty,
occupationalAbnormalHaveEmpty,
ocCheckTypeHaveEmpty,
sumSummaryHeaderHaveEmpty
};
if (!string.IsNullOrEmpty(customerOrgPara.StartDate) && !string.IsNullOrEmpty(customerOrgPara.EndDate))
{
if (customerOrgPara.DateType == '1')
{
query = query.Where(m => m.patientRegister.CreationTime >= Convert.ToDateTime(customerOrgPara.StartDate) &&
m.patientRegister.CreationTime < Convert.ToDateTime(customerOrgPara.EndDate).AddDays(1));
}
else if (customerOrgPara.DateType == '2')
{
query = query.Where(m => m.patientRegister.MedicalStartDate != null && m.patientRegister.MedicalStartDate.Value >= Convert.ToDateTime(customerOrgPara.StartDate) &&
m.patientRegister.MedicalStartDate.Value < Convert.ToDateTime(customerOrgPara.EndDate).AddDays(1));
}
else if (customerOrgPara.DateType == '3')
{
query = query.Where(m => m.patientRegister.SummaryDate != null && m.patientRegister.SummaryDate.Value >= Convert.ToDateTime(customerOrgPara.StartDate) &&
m.patientRegister.SummaryDate.Value < Convert.ToDateTime(customerOrgPara.EndDate).AddDays(1));
}
}
if (customerOrgPara.CustomerOrgGroupId.Any())
{
query = query.Where(m => m.patientRegister.CustomerOrgGroupId != null && customerOrgPara.CustomerOrgGroupId.Contains(m.patientRegister.CustomerOrgGroupId.Value));
}
#endregion
var patientRegisterList = query.ToList();
var msg = new List<GetCompanyOccupationalDiseaseDataExcelDto>();
if (patientRegisterList.Any())
{
////人员
//var patientRegisters = patientRegisterList.Select(m => m.patientRegister).Distinct().ToList();
//var patientRegisterfisrt = patientRegisterList.First();
#region 体检结果一览表
var medicalResultDetails = patientRegisterList.GroupBy(g => g.patientOccupationalDisease)
.Select((s, index) => new GetCompanyOccupationalDiseaseDataExcelDto
{
AnomalyIndex = $"{SetSumSummarys(s.Select(ss => ss.sumSummaryHeaderHaveEmpty).Distinct().ToList())}",
MedicalConclusion = s.Key.OccupationalAbnormal,
OcCheckTypeName = s.FirstOrDefault().ocCheckTypeHaveEmpty != null ? s.FirstOrDefault().ocCheckTypeHaveEmpty.DisplayName : "",
HandlingSuggestions = s.Key.OccupationalAbSuggestion,
JobType = s.Key.JobType,
PatientName = s.FirstOrDefault().patientRegister.PatientName,
PatientRegisterNo = s.FirstOrDefault().patientRegister.PatientRegisterNo,
PoisonNames = string.Join(",", s.Select(ss => ss.posionHaveEmpty.DisplayName).Distinct()),
PoisonWorkTime = s.Key.PoisonWorkTime,
MedicalStartDate = DataHelper.ConversionDateShortToString(s.FirstOrDefault().patientRegister.MedicalStartDate),
SummaryDoctorName = _cacheService.GetSurnameAsync(s.FirstOrDefault().patientRegister.SummaryDoctorId).GetAwaiter().GetResult()
}).OrderBy(o => o.MedicalConclusion).ToList();
msg = medicalResultDetails;
#endregion
}
return msg; return msg;
} }

Loading…
Cancel
Save