|
|
|
@ -97,7 +97,7 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
private readonly RegisterCheckAsbitemManager _registerAsbitemManager; |
|
|
|
private readonly SumSummaryHeaderManager _sumSummaryHeaderManager; |
|
|
|
private readonly SumSummaryContentManager _sumSummaryContentManager; |
|
|
|
private readonly SumSuggestionHeaderManager _sumSuggestionHeaderManager; |
|
|
|
private readonly SumSuggestionHeaderManager _sumSuggestionHeaderManager; |
|
|
|
private readonly SumSuggestionContentManager _sumSuggestionContentManager; |
|
|
|
//private readonly IRepository<CustomerOrg, Guid> _customerOrgRepository;
|
|
|
|
//private readonly IRepository<PrimarykeyBuilder> _primarykeyBuilderRepository;
|
|
|
|
@ -109,7 +109,7 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
public PatientRegisterAppService( |
|
|
|
IRepository<PatientRegister, Guid> repository, |
|
|
|
IRepository<Patient, Guid> patientRepository, |
|
|
|
IRepository<PatientRegister,Guid> patientRegisterRepository, |
|
|
|
IRepository<PatientRegister, Guid> patientRegisterRepository, |
|
|
|
IRepository<IdentityUser, Guid> userRepository, |
|
|
|
IRepository<Sex> sexRepository, |
|
|
|
IRepository<BirthPlace, Guid> birthPlaceRepository, |
|
|
|
@ -306,7 +306,7 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
public async Task<string> GetHaveSumData(PatientRegisterIdInputDto input) |
|
|
|
{ |
|
|
|
var sumSummaryHeader = await _sumSummaryHeaderRepository.GetListAsync(o => o.PatientRegisterId == input.PatientRegisterId); |
|
|
|
if(sumSummaryHeader.Any()) |
|
|
|
if (sumSummaryHeader.Any()) |
|
|
|
{ |
|
|
|
return "Y"; |
|
|
|
} |
|
|
|
@ -1458,31 +1458,32 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
[HttpPost("api/app/patientregister/CancelSumCheck")] |
|
|
|
public async Task<PatientRegisterDto> CancelSumCheckAsync(PatientRegisterIdInputDto input) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
if (input == null || input.PatientRegisterId == Guid.Empty) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("请求参数有误"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var entity = await _repository.GetAsync(input.PatientRegisterId); |
|
|
|
if(entity.CompleteFlag != PatientRegisterCompleteFlag.SumCheck) |
|
|
|
if (entity.CompleteFlag != PatientRegisterCompleteFlag.SumCheck) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("没有总检,无需取消总检"); |
|
|
|
} |
|
|
|
if(entity.IsAudit == 'Y') |
|
|
|
if (entity.IsAudit == 'Y') |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("已审核,请先取消审核"); |
|
|
|
} |
|
|
|
var isSummaryCheckOnlySelfCanCancel = await _sysParmValueManager.GetSysParmValueInMedicalCenterId(entity.MedicalCenterId, "summary_check_only_self_can_cancel"); |
|
|
|
if(isSummaryCheckOnlySelfCanCancel == "Y") |
|
|
|
var isSummaryCheckOnlySelfCanCancel = await _sysParmValueManager.GetSysParmValue(entity.MedicalCenterId, "summary_check_only_self_can_cancel"); |
|
|
|
if (isSummaryCheckOnlySelfCanCancel == "Y") |
|
|
|
{ |
|
|
|
if(entity.SummaryDoctorId != CurrentUser.Id) |
|
|
|
if (entity.SummaryDoctorId != CurrentUser.Id) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("只有本人才能取消总检"); |
|
|
|
} |
|
|
|
} |
|
|
|
var newentity = await _patientRegisterRepository.UpdateAsync(entity); |
|
|
|
entity.CompleteFlag = PatientRegisterCompleteFlag.PartCheck; |
|
|
|
var newentity = await _patientRegisterRepository.UpdateAsync(entity); |
|
|
|
return ObjectMapper.Map<PatientRegister, PatientRegisterDto>(newentity); |
|
|
|
} |
|
|
|
/// <summary>
|
|
|
|
@ -1509,7 +1510,7 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
//删除对应的诊断数据
|
|
|
|
await _sumDiagnosisRepository.DeleteAsync(m => m.PatientRegisterId == input.PatientRegisterId, true); |
|
|
|
//更新综述
|
|
|
|
if (input.SumSummarys.Any()) |
|
|
|
if (input.SumSummarys != null && input.SumSummarys.Any()) |
|
|
|
{ |
|
|
|
foreach (var item in input.SumSummarys) |
|
|
|
{ |
|
|
|
@ -1518,7 +1519,7 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
summaryTitle: item.SummaryTitle, |
|
|
|
summaryFlag: null, |
|
|
|
displayOrder: input.SumSummarys.IndexOf(item) + 1); |
|
|
|
|
|
|
|
|
|
|
|
var sumSummaryHeaderEnt_New = await _sumSummaryHeaderRepository.InsertAsync(sumSummaryHeaderEnt, true); |
|
|
|
|
|
|
|
if (sumSummaryHeaderEnt_New != null) |
|
|
|
@ -1530,7 +1531,7 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
SumSummaryContent sumSummaryContentEnt = _sumSummaryContentManager.CreateAsync(sumSummaryHeaderId: sumSummaryHeaderEnt_New.Id, |
|
|
|
summaryContent: item2.SummaryContent, |
|
|
|
displayOrder: item.Details.IndexOf(item2) + 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sumSummaryContentList.Add(sumSummaryContentEnt); |
|
|
|
} |
|
|
|
@ -1541,15 +1542,19 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
} |
|
|
|
} |
|
|
|
//更新建议和诊断
|
|
|
|
if (input.SumSuggestions.Any()) |
|
|
|
if (input.SumSuggestions != null && input.SumSuggestions.Any()) |
|
|
|
{ |
|
|
|
//判断有没有重复诊断
|
|
|
|
List<Guid> diagnosisList = new List<Guid>(); |
|
|
|
foreach (var item in input.SumSuggestions) |
|
|
|
{ |
|
|
|
diagnosisList.AddRange(item.DiagnosisIds); |
|
|
|
if (item.DiagnosisIds != null) |
|
|
|
{ |
|
|
|
diagnosisList.AddRange(item.DiagnosisIds); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if(diagnosisList.Count() != diagnosisList.Distinct().Count()) |
|
|
|
if (diagnosisList.Count() != diagnosisList.Distinct().Count()) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("不允许有重复诊断"); |
|
|
|
} |
|
|
|
@ -1567,11 +1572,11 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
{ |
|
|
|
|
|
|
|
#region 插入SumDiagnosis
|
|
|
|
if(item.DiagnosisIds.Any()) |
|
|
|
if (item.DiagnosisIds != null && item.DiagnosisIds.Any()) |
|
|
|
{ |
|
|
|
foreach(var diagnosisId in item.DiagnosisIds) |
|
|
|
foreach (var diagnosisId in item.DiagnosisIds) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
SumDiagnosis sumDiagnosis = new SumDiagnosis |
|
|
|
{ |
|
|
|
DiagnosisId = diagnosisId, |
|
|
|
@ -1583,38 +1588,48 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 插入SumSuggestionContent
|
|
|
|
List<SumSuggestionContent> sumSuggestionContentList = new List<SumSuggestionContent>(); |
|
|
|
foreach (var item2 in item.MedicalInterpretations) |
|
|
|
if (item.MedicalInterpretations != null) |
|
|
|
{ |
|
|
|
SumSuggestionContent sumSuggestionContentEnt = _sumSuggestionContentManager.CreateAsync(sumSuggestionHeaderId: sumSuggestionHeaderEnt_New.Id, |
|
|
|
suggestionContent: item2.SuggestionContent, |
|
|
|
suggestionType: SuggestionTypeFlag.MedicalInterpretation, |
|
|
|
displayOrder: item.MedicalInterpretations.IndexOf(item2) + 1); |
|
|
|
foreach (var item2 in item.MedicalInterpretations) |
|
|
|
{ |
|
|
|
SumSuggestionContent sumSuggestionContentEnt = _sumSuggestionContentManager.CreateAsync(sumSuggestionHeaderId: sumSuggestionHeaderEnt_New.Id, |
|
|
|
suggestionContent: item2.SuggestionContent, |
|
|
|
suggestionType: SuggestionTypeFlag.MedicalInterpretation, |
|
|
|
displayOrder: item.MedicalInterpretations.IndexOf(item2) + 1); |
|
|
|
|
|
|
|
sumSuggestionContentList.Add(sumSuggestionContentEnt); |
|
|
|
sumSuggestionContentList.Add(sumSuggestionContentEnt); |
|
|
|
} |
|
|
|
} |
|
|
|
foreach (var item2 in item.CommonReasons) |
|
|
|
if (item.CommonReasons != null) |
|
|
|
{ |
|
|
|
SumSuggestionContent sumSuggestionContentEnt = _sumSuggestionContentManager.CreateAsync(sumSuggestionHeaderId: sumSuggestionHeaderEnt_New.Id, |
|
|
|
suggestionContent: item2.SuggestionContent, |
|
|
|
suggestionType: SuggestionTypeFlag.CommonReasons, |
|
|
|
displayOrder: item.CommonReasons.IndexOf(item2) + 1); |
|
|
|
foreach (var item2 in item.CommonReasons) |
|
|
|
{ |
|
|
|
SumSuggestionContent sumSuggestionContentEnt = _sumSuggestionContentManager.CreateAsync(sumSuggestionHeaderId: sumSuggestionHeaderEnt_New.Id, |
|
|
|
suggestionContent: item2.SuggestionContent, |
|
|
|
suggestionType: SuggestionTypeFlag.CommonReasons, |
|
|
|
displayOrder: item.CommonReasons.IndexOf(item2) + 1); |
|
|
|
|
|
|
|
sumSuggestionContentList.Add(sumSuggestionContentEnt); |
|
|
|
sumSuggestionContentList.Add(sumSuggestionContentEnt); |
|
|
|
} |
|
|
|
} |
|
|
|
foreach (var item2 in item.HealthGuidances) |
|
|
|
if (item.HealthGuidances != null) |
|
|
|
{ |
|
|
|
SumSuggestionContent sumSuggestionContentEnt = _sumSuggestionContentManager.CreateAsync(sumSuggestionHeaderId: sumSuggestionHeaderEnt_New.Id, |
|
|
|
suggestionContent: item2.SuggestionContent, |
|
|
|
suggestionType: SuggestionTypeFlag.HealthGuidance, |
|
|
|
displayOrder: item.HealthGuidances.IndexOf(item2) + 1); |
|
|
|
foreach (var item2 in item.HealthGuidances) |
|
|
|
{ |
|
|
|
SumSuggestionContent sumSuggestionContentEnt = _sumSuggestionContentManager.CreateAsync(sumSuggestionHeaderId: sumSuggestionHeaderEnt_New.Id, |
|
|
|
suggestionContent: item2.SuggestionContent, |
|
|
|
suggestionType: SuggestionTypeFlag.HealthGuidance, |
|
|
|
displayOrder: item.HealthGuidances.IndexOf(item2) + 1); |
|
|
|
|
|
|
|
sumSuggestionContentList.Add(sumSuggestionContentEnt); |
|
|
|
sumSuggestionContentList.Add(sumSuggestionContentEnt); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
await _sumSuggestionContentRepository.InsertManyAsync(sumSuggestionContentList); |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
@ -1622,7 +1637,7 @@ namespace Shentun.Peis.PatientRegisters |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return ObjectMapper.Map<PatientRegister, PatientRegisterDto>(newentity); |
|
|
|
return ObjectMapper.Map<PatientRegister, PatientRegisterDto>(newentity); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|