|
|
@ -214,7 +214,7 @@ namespace Shentun.WebPeis.Persons |
|
|
(await _userManager.AddPasswordAsync(userWithPerson.User, Shentun.Utilities. |
|
|
(await _userManager.AddPasswordAsync(userWithPerson.User, Shentun.Utilities. |
|
|
Encrypt.RandomHelper.CreateRandom(Utilities.Enums.RandomType.NumAndChar, 10) + "0Cz*")).CheckErrors(); |
|
|
Encrypt.RandomHelper.CreateRandom(Utilities.Enums.RandomType.NumAndChar, 10) + "0Cz*")).CheckErrors(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
await unitOfWork.CompleteAsync(); |
|
|
await unitOfWork.CompleteAsync(); |
|
|
@ -358,7 +358,7 @@ namespace Shentun.WebPeis.Persons |
|
|
on user.Id equals person.PersonId |
|
|
on user.Id equals person.PersonId |
|
|
join questionRegister in await _questionRegisterRepository.GetQueryableAsync() |
|
|
join questionRegister in await _questionRegisterRepository.GetQueryableAsync() |
|
|
on person.PersonId equals questionRegister.PersonId into emptyQuestionRegister |
|
|
on person.PersonId equals questionRegister.PersonId into emptyQuestionRegister |
|
|
from haveQuestionRegister in emptyQuestionRegister.DefaultIfEmpty() |
|
|
|
|
|
|
|
|
from haveQuestionRegister in emptyQuestionRegister.DefaultIfEmpty() |
|
|
where personKinshipIds.Contains(user.Id) |
|
|
where personKinshipIds.Contains(user.Id) |
|
|
orderby user.CreationTime |
|
|
orderby user.CreationTime |
|
|
select new PersonDto |
|
|
select new PersonDto |
|
|
@ -371,7 +371,7 @@ namespace Shentun.WebPeis.Persons |
|
|
MaritalStatusName = _cacheService.GetMaritalStatusNameAsync(person.MaritalStatusId).Result, |
|
|
MaritalStatusName = _cacheService.GetMaritalStatusNameAsync(person.MaritalStatusId).Result, |
|
|
IdNo = person.IdNo, |
|
|
IdNo = person.IdNo, |
|
|
MobileTelephone = user.PhoneNumber, |
|
|
MobileTelephone = user.PhoneNumber, |
|
|
IsHaveQuestionRegister = haveQuestionRegister == null ? 'N':'Y' |
|
|
|
|
|
|
|
|
IsHaveQuestionRegister = haveQuestionRegister == null ? 'N' : 'Y' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).Distinct().ToList(); |
|
|
}).Distinct().ToList(); |
|
|
@ -409,6 +409,62 @@ namespace Shentun.WebPeis.Persons |
|
|
return returnValue; |
|
|
return returnValue; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取健康评估报告
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="input"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
|
|
|
|
[HttpPost("api/app/Person/GetMedicalHealthReportByPatientRegisterId")] |
|
|
|
|
|
public async Task<MedicalReportDto> 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<MedicalHealthReportListInputDto, MedicalHealthReportListDto>(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<MedicalHealthReportDto, MedicalHealthReportDto>(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; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 获取校验码
|
|
|
/// 获取校验码
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
@ -591,7 +647,55 @@ namespace Shentun.WebPeis.Persons |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async static Task<TOut> CallAppServiceAsync<TInput, TOut>(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<TOut>(result, jsonOptions); |
|
|
|
|
|
|
|
|
|
|
|
return resultDto; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |