diff --git a/src/Shentun.WebPeis.Application.Contracts/AppointSchedules/AppointScheduleDto.cs b/src/Shentun.WebPeis.Application.Contracts/AppointSchedules/AppointScheduleDto.cs
index 4679f39..6a22f0f 100644
--- a/src/Shentun.WebPeis.Application.Contracts/AppointSchedules/AppointScheduleDto.cs
+++ b/src/Shentun.WebPeis.Application.Contracts/AppointSchedules/AppointScheduleDto.cs
@@ -18,6 +18,11 @@ namespace Shentun.WebPeis.AppointSchedules
public int SingleNumberLimit { get; set; }
+ ///
+ /// 当天总限制数量
+ ///
+ public int SumNumberLimit { get; set; }
+
///
/// 体检中心ID
///
diff --git a/src/Shentun.WebPeis.Application.Contracts/Persons/MedicalHealthReportDto.cs b/src/Shentun.WebPeis.Application.Contracts/Persons/MedicalHealthReportDto.cs
new file mode 100644
index 0000000..ec39a9a
--- /dev/null
+++ b/src/Shentun.WebPeis.Application.Contracts/Persons/MedicalHealthReportDto.cs
@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.WebPeis.Persons
+{
+ public class MedicalHealthReportListInputDto
+ {
+ public int Page { get; set; }
+
+ public int Size { get; set; }
+
+ public string RecordNo { get; set; }
+ }
+
+ public class MedicalHealthReportListDto
+ {
+ public int State { get; set; }
+ public int Code { get; set; }
+ public string Message { get; set; }
+
+ public int Page { get; set; }
+
+ public int Size { get; set; }
+
+ public int Total { get; set; }
+
+ public List Data { get; set; }
+ }
+
+ public class MedicalHealthReportListDetailDto
+ {
+ public string ResultId { get; set; }
+ public string RecordNo { get; set; }
+ public string PhysicalTime { get; set; }
+ public string ReportStatus { get; set; }
+
+ public string CreateTime { get; set; }
+ }
+
+ public class MedicalHealthReportDto
+ {
+ public int State { get; set; }
+ public int Code { get; set; }
+ public string Message { get; set; }
+
+ public string Remark { get; set; }
+
+ public string Data { get; set; }
+
+
+ }
+}
diff --git a/src/Shentun.WebPeis.Application/AppointSchedules/AppointScheduleAppService.cs b/src/Shentun.WebPeis.Application/AppointSchedules/AppointScheduleAppService.cs
index 7b445d6..22acc58 100644
--- a/src/Shentun.WebPeis.Application/AppointSchedules/AppointScheduleAppService.cs
+++ b/src/Shentun.WebPeis.Application/AppointSchedules/AppointScheduleAppService.cs
@@ -266,33 +266,46 @@ namespace Shentun.WebPeis.AppointSchedules
[HttpPost("api/app/AppointSchedule/GetAppointScheduleList")]
public async Task> GetAppointScheduleListAsync(GetAppointScheduleListInputDto input)
{
- var entList = (await _appointScheduleRepository.GetQueryableAsync()).Where(m => m.MedicalCenterId == input.MedicalCenterId);
+ //var entList = (await _appointScheduleRepository.GetQueryableAsync())
+ // .Where(m => m.MedicalCenterId == input.MedicalCenterId);
+
+ var entList = from appointSchedule in await _appointScheduleRepository.GetQueryableAsync()
+ join appointScheduleTime in await _appointScheduleTimeRepository.GetQueryableAsync()
+ on appointSchedule.AppointScheduleId equals appointScheduleTime.AppointScheduleId into appointScheduleTimeTemp
+ from appointScheduleTimeHaveEmpty in appointScheduleTimeTemp.DefaultIfEmpty()
+ where appointSchedule.MedicalCenterId == input.MedicalCenterId
+ select new
+ {
+ appointSchedule,
+ NumberLimit = appointScheduleTimeHaveEmpty != null ? appointScheduleTimeHaveEmpty.NumberLimit : 0
+ };
if (!string.IsNullOrWhiteSpace(input.StartDate))
{
if (!string.IsNullOrWhiteSpace(input.EndDate))
{
- entList = entList.Where(m => m.AppointDate.Date >= DateTime.Parse(input.StartDate)
- && m.AppointDate.Date <= DateTime.Parse(input.EndDate));
+ entList = entList.Where(m => m.appointSchedule.AppointDate.Date >= DateTime.Parse(input.StartDate)
+ && m.appointSchedule.AppointDate.Date <= DateTime.Parse(input.EndDate));
}
else
{
- entList = entList.Where(m => m.AppointDate.Date >= DateTime.Parse(input.StartDate));
+ entList = entList.Where(m => m.appointSchedule.AppointDate.Date >= DateTime.Parse(input.StartDate));
}
}
- var entListDto = entList.ToList().Select(s => new AppointScheduleDto
+ var entListDto = entList.ToList().GroupBy(g => g.appointSchedule).Select(s => new AppointScheduleDto
{
- AppointDate = DataHelper.ConversionDateShortToString(s.AppointDate),
- AppointScheduleId = s.AppointScheduleId,
- CreationTime = s.CreationTime,
- CreatorId = s.CreatorId,
- LastModificationTime = s.LastModificationTime,
- LastModifierId = s.LastModifierId,
- CreatorName = _cacheService.GetSurnameAsync(s.CreatorId).Result,
- LastModifierName = _cacheService.GetSurnameAsync(s.LastModifierId).Result,
- SingleNumberLimit = s.SingleNumberLimit,
- IsWork = s.IsWork,
- MedicalCenterId = s.MedicalCenterId
+ AppointDate = DataHelper.ConversionDateShortToString(s.Key.AppointDate),
+ AppointScheduleId = s.Key.AppointScheduleId,
+ CreationTime = s.Key.CreationTime,
+ CreatorId = s.Key.CreatorId,
+ LastModificationTime = s.Key.LastModificationTime,
+ LastModifierId = s.Key.LastModifierId,
+ CreatorName = _cacheService.GetSurnameAsync(s.Key.CreatorId).Result,
+ LastModifierName = _cacheService.GetSurnameAsync(s.Key.LastModifierId).Result,
+ SingleNumberLimit = s.Key.SingleNumberLimit,
+ IsWork = s.Key.IsWork,
+ MedicalCenterId = s.Key.MedicalCenterId,
+ SumNumberLimit = s.Sum(m => m.NumberLimit)
}).OrderBy(o => o.AppointDate).ToList();
return entListDto;
}
diff --git a/src/Shentun.WebPeis.Application/DiseaseRiskLevels/DiseaseRiskLevelAppService.cs b/src/Shentun.WebPeis.Application/DiseaseRiskLevels/DiseaseRiskLevelAppService.cs
index b0ee610..93d0368 100644
--- a/src/Shentun.WebPeis.Application/DiseaseRiskLevels/DiseaseRiskLevelAppService.cs
+++ b/src/Shentun.WebPeis.Application/DiseaseRiskLevels/DiseaseRiskLevelAppService.cs
@@ -1,6 +1,7 @@
using AutoMapper.Internal.Mappers;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
+using Shentun.WebPeis.DiseaseRisks;
using Shentun.WebPeis.Models;
using System;
using System.Collections.Generic;
@@ -78,6 +79,39 @@ namespace Shentun.WebPeis.DiseaseRiskLevels
return entdto;
+ }
+
+
+ ///
+ /// 获取列表 根据疾病风险ID
+ ///
+ ///
+ [HttpPost("api/app/DiseaseRiskLevel/GetDiseaseRiskLevelByDiseaseRiskId")]
+ public async Task> GetDiseaseRiskLevelByDiseaseRiskIdAsync(DiseaseRiskIdInputDto input)
+ {
+ var entlist = (await _diseaseRiskLevelRepository.GetQueryableAsync()).Where(m => m.DiseaseRiskId == input.DiseaseRiskId);
+
+ var entdto = entlist.Select(s => new DiseaseRiskLevelDto
+ {
+ CreationTime = s.CreationTime,
+ CreatorId = s.CreatorId,
+ DisplayOrder = s.DisplayOrder,
+ LastModificationTime = s.LastModificationTime,
+ LastModifierId = s.LastModifierId,
+ SimpleCode = s.SimpleCode,
+ DiagnosisFunction = s.DiagnosisFunction,
+ DiseaseRiskId = s.DiseaseRiskId,
+ DiseaseRiskLevelId = s.DiseaseRiskLevelId,
+ DiseaseRiskLevelName = s.DiseaseRiskLevelName,
+ Explain = s.Explain,
+ Suggestion = s.Suggestion,
+ CreatorName = _cacheService.GetSurnameAsync(s.CreatorId).Result,
+ LastModifierName = _cacheService.GetSurnameAsync(s.LastModifierId).Result
+ }).OrderBy(o => o.DisplayOrder).ToList();
+
+ return entdto;
+
+
}
///
@@ -88,7 +122,7 @@ namespace Shentun.WebPeis.DiseaseRiskLevels
public async Task CreateAsync(CreateDiseaseRiskLevelDto input)
{
var createEntity = ObjectMapper.Map(input);
- createEntity.DiseaseRiskId = GuidGenerator.Create();
+ createEntity.DiseaseRiskLevelId = GuidGenerator.Create();
var entity = await _diseaseRiskLevelManager.CreateAsync(createEntity);
entity = await _diseaseRiskLevelRepository.InsertAsync(entity);
var dto = ObjectMapper.Map(entity);
diff --git a/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs b/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs
index 32d1ebe..802f5c5 100644
--- a/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs
+++ b/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs
@@ -214,7 +214,7 @@ namespace Shentun.WebPeis.Persons
(await _userManager.AddPasswordAsync(userWithPerson.User, Shentun.Utilities.
Encrypt.RandomHelper.CreateRandom(Utilities.Enums.RandomType.NumAndChar, 10) + "0Cz*")).CheckErrors();
-
+
}
await unitOfWork.CompleteAsync();
@@ -358,7 +358,7 @@ namespace Shentun.WebPeis.Persons
on user.Id equals person.PersonId
join questionRegister in await _questionRegisterRepository.GetQueryableAsync()
on person.PersonId equals questionRegister.PersonId into emptyQuestionRegister
- from haveQuestionRegister in emptyQuestionRegister.DefaultIfEmpty()
+ from haveQuestionRegister in emptyQuestionRegister.DefaultIfEmpty()
where personKinshipIds.Contains(user.Id)
orderby user.CreationTime
select new PersonDto
@@ -371,7 +371,7 @@ namespace Shentun.WebPeis.Persons
MaritalStatusName = _cacheService.GetMaritalStatusNameAsync(person.MaritalStatusId).Result,
IdNo = person.IdNo,
MobileTelephone = user.PhoneNumber,
- IsHaveQuestionRegister = haveQuestionRegister == null ? 'N':'Y'
+ IsHaveQuestionRegister = haveQuestionRegister == null ? 'N' : 'Y'
}).Distinct().ToList();
@@ -409,6 +409,62 @@ namespace Shentun.WebPeis.Persons
return returnValue;
}
+
+
+ ///
+ /// 获取健康评估报告
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("api/app/Person/GetMedicalHealthReportByPatientRegisterId")]
+ public async Task GetMedicalHealthReportByPatientRegisterIdAsync(PatientRegisterIdInputDto input)
+ {
+ var entity = await _patientRegisterRepository.GetAsync(o => o.PatientRegisterId == input.PatientRegisterId);
+ string baseAddress = _configuration.GetSection("MedicalHealthReport").GetSection("BaseAddress").Value;
+ string reportListApiUrl = _configuration.GetSection("MedicalHealthReport").GetSection("ReportListApiUrl").Value;
+ string reportApiUrl = _configuration.GetSection("MedicalHealthReport").GetSection("ReportApiUrl").Value;
+
+ var medicalHealthReportListInputDto = new MedicalHealthReportListInputDto
+ {
+ Page = 1,
+ Size = 10,
+ RecordNo = entity.PatientRegisterNo
+ };
+
+ var medicalHealthReportListResult = await CallAppServiceAsync(baseAddress, reportListApiUrl, medicalHealthReportListInputDto, "post");
+
+ if (medicalHealthReportListResult.Code == 200
+ || medicalHealthReportListResult.Data.FirstOrDefault() == null
+ || medicalHealthReportListResult.Data.FirstOrDefault().ReportStatus != "1")
+ {
+ throw new UserFriendlyException("没有报告单");
+ }
+
+ //报告单ID
+ var resultId = medicalHealthReportListResult.Data.FirstOrDefault().ResultId;
+
+ reportApiUrl = reportApiUrl + $"?resultId={resultId}"; //获取报告apiurl
+
+ var medicalHealthReportResult = await CallAppServiceAsync(baseAddress, reportApiUrl, null, "get");
+ if (medicalHealthReportResult.Code == 200
+ || string.IsNullOrWhiteSpace(medicalHealthReportResult.Data)
+ )
+ {
+ throw new UserFriendlyException("没有报告单");
+ }
+
+ string reportUrl= medicalHealthReportResult.Data;
+
+ var returnValue = new MedicalReportDto()
+ {
+ FilePath = reportUrl,
+ FileBase64 = Shentun.Utilities.FileHelper.ToBase64(reportUrl)
+ };
+ return returnValue;
+
+ }
+
///
/// 获取校验码
///
@@ -591,7 +647,55 @@ namespace Shentun.WebPeis.Persons
}
+ private async static Task CallAppServiceAsync(string baseAddress, string url, TInput? data, string method = "post")
+ {
+
+ using (var httpClientHandler = new HttpClientHandler())
+ {
+ using (var httpClient = new HttpClient(httpClientHandler))
+ {
+ httpClient.BaseAddress = new Uri(baseAddress);
+
+ httpClient.DefaultRequestHeaders.Accept.Add(
+ new MediaTypeWithQualityHeaderValue("application/json"));//设置accept标头,告诉JSON是可接受的响应类型
+ var jsonOptions = new JsonSerializerOptions
+ {
+ WriteIndented = true, // 设置为true以便于可读性更好的JSON输出
+ PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
+ // 如果你想要对日期进行格式化,可以使用JsonConverter
+ Converters = { new JsonDateTimeConverter("yyyy-MM-dd HH:mm:ss") }
+ };
+ var sendData = System.Text.Json.JsonSerializer.Serialize(data, jsonOptions);
+ using (HttpContent httpContent = new StringContent(sendData))
+ {
+ httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
+ HttpResponseMessage response = null;
+ if (method == "post")
+ {
+ response = await httpClient.PostAsync(url, httpContent);
+ }
+ else
+ {
+ response = await httpClient.GetAsync(url);
+ }
+
+ string result;
+ if (!response.IsSuccessStatusCode)
+ {
+ result = response.Content.ReadAsStringAsync().Result;
+ throw new Exception("http通信错误:" + response.StatusCode + ",结果:" + result);
+ }
+ result = await response.Content.ReadAsStringAsync();
+
+ var resultDto = System.Text.Json.JsonSerializer.Deserialize(result, jsonOptions);
+
+ return resultDto;
+ }
+
+ }
+ }
+ }
}
}
diff --git a/src/Shentun.WebPeis.HttpApi.Host/appsettings.json b/src/Shentun.WebPeis.HttpApi.Host/appsettings.json
index ae494be..08e0546 100644
--- a/src/Shentun.WebPeis.HttpApi.Host/appsettings.json
+++ b/src/Shentun.WebPeis.HttpApi.Host/appsettings.json
@@ -59,5 +59,10 @@
"Redis": {
"IsEnabled": "true",
"Configuration": "62.156.10.86"
+ },
+ "MedicalHealthReport": {
+ "BaseAddress": "http://10.1.13.31",
+ "ReportListApiUrl": "http://10.1.13.31/api/report/page",
+ "ReportApiUrl": "http://10.1.13.31/api/report/download"
}
}