|
|
|
@ -90,7 +90,12 @@ namespace Shentun.WebPeis.AppointPatientRegisters |
|
|
|
_registerCheckRepository = registerCheckRepository; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 预约,小程序使用
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
|
|
[HttpPost("api/app/AppointPatientRegister/Create")] |
|
|
|
public async Task<AppointPatientRegisterDto> CreateAsync(CreateAppointPatientRegisterDto input) |
|
|
|
{ |
|
|
|
@ -120,6 +125,12 @@ namespace Shentun.WebPeis.AppointPatientRegisters |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 通过手机号等获取预约列表信息,体检程序前台登记使用
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
|
|
[HttpPost("api/app/AppointPatientRegister/GetListByFilter")] |
|
|
|
public async Task<List<AppointPatientRegisterDto>> GetListByFilterAsync(AppointPatientRegisterInputDto input) |
|
|
|
{ |
|
|
|
@ -234,6 +245,7 @@ namespace Shentun.WebPeis.AppointPatientRegisters |
|
|
|
MedicalPackageName = o.FirstOrDefault().haveMedicalPackage == null ? "" : o.FirstOrDefault().haveMedicalPackage.MedicalPackageName, |
|
|
|
MedicalCenterId = o.FirstOrDefault().appointPatientRegister.MedicalCenterId, |
|
|
|
CompleteFlag = o.FirstOrDefault().appointPatientRegister.CompleteFlag, |
|
|
|
IsCharge = o.FirstOrDefault().appointPatientRegister.IsCharge, |
|
|
|
AppointDate = o.FirstOrDefault().appointPatientRegister.AppointDate, |
|
|
|
Remark = o.FirstOrDefault().appointPatientRegister.Remark, |
|
|
|
PregnantFlag = o.FirstOrDefault().appointPatientRegister.PregnantFlag, |
|
|
|
@ -251,7 +263,112 @@ namespace Shentun.WebPeis.AppointPatientRegisters |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
/// <summary>
|
|
|
|
/// 获取某人的预约列表,小程序使用
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
|
|
[HttpPost("api/app/AppointPatientRegister/GetListByPersonId")] |
|
|
|
public async Task<List<AppointPatientRegisterDto>> GetListByPersonIdAsync(PersonIdInputDto input) |
|
|
|
{ |
|
|
|
if (input == null) throw new UserFriendlyException("参数不能为空"); |
|
|
|
|
|
|
|
|
|
|
|
var query = (from user in await _identityUserRepository.GetQueryableAsync() |
|
|
|
join person in await _personRepository.GetQueryableAsync() |
|
|
|
on user.Id equals person.PersonId |
|
|
|
join appointPatientRegister in await _repository.GetQueryableAsync() |
|
|
|
on person.PersonId equals appointPatientRegister.PersonId |
|
|
|
join medicalPackage in await _medicalPackageRepository.GetQueryableAsync() |
|
|
|
on appointPatientRegister.MedicalPackageId equals medicalPackage.MedicalPackageId into canEmptyMedicalPackage |
|
|
|
from haveMedicalPackage in canEmptyMedicalPackage.DefaultIfEmpty() |
|
|
|
join customerOrgGroup in await _customerOrgGroupRepository.GetQueryableAsync() |
|
|
|
on appointPatientRegister.CustomerOrgGroupId equals customerOrgGroup.CustomerOrgGroupId into canEmptyCustomerOrgGroup |
|
|
|
from haveCustomerOrgGroup in canEmptyCustomerOrgGroup.DefaultIfEmpty() |
|
|
|
join appointRegisterAsbitem in await _appointRegisterAsbitemRepository.GetQueryableAsync() |
|
|
|
on appointPatientRegister.AppointPatientRegisterId equals appointRegisterAsbitem.AppointPatientRegisterId |
|
|
|
join asbitem in await _asbitemRepository.GetQueryableAsync() |
|
|
|
on appointRegisterAsbitem.AsbitemId equals asbitem.AsbitemId |
|
|
|
join customerOrg in await _customerOrgRepository.GetQueryableAsync() |
|
|
|
on appointPatientRegister.CustomerOrgId equals customerOrg.CustomerOrgId |
|
|
|
where appointPatientRegister.PersonId == input.PersonId |
|
|
|
orderby appointPatientRegister.AppointDate |
|
|
|
select new |
|
|
|
{ |
|
|
|
user, |
|
|
|
person, |
|
|
|
appointPatientRegister, |
|
|
|
appointRegisterAsbitem, |
|
|
|
asbitem, |
|
|
|
haveMedicalPackage, |
|
|
|
haveCustomerOrgGroup, |
|
|
|
customerOrg |
|
|
|
} |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
var appointPatientRegisterDtos = query.ToList(); |
|
|
|
|
|
|
|
var list = appointPatientRegisterDtos.GroupBy(o => o.appointPatientRegister) |
|
|
|
.Select(o => new AppointPatientRegisterDto() |
|
|
|
{ |
|
|
|
AppointPatientRegisterId = o.FirstOrDefault().appointPatientRegister.AppointPatientRegisterId, |
|
|
|
PersonId = o.FirstOrDefault().appointPatientRegister.PersonId, |
|
|
|
PersonName = o.FirstOrDefault().user.Name, |
|
|
|
IdNo = o.FirstOrDefault().person.IdNo, |
|
|
|
SexId = o.FirstOrDefault().person.SexId, |
|
|
|
MaritalStatusId = o.FirstOrDefault().person.MaritalStatusId, |
|
|
|
CustomerOrgId = o.FirstOrDefault().appointPatientRegister.CustomerOrgId, |
|
|
|
ChildCustomerOrgName = o.FirstOrDefault().customerOrg.PathCode.Length == 5 ? "" : o.FirstOrDefault().customerOrg.CustomerOrgName, |
|
|
|
CustomerOrgGroupId = o.FirstOrDefault().appointPatientRegister.CustomerOrgGroupId, |
|
|
|
CustomerOrgGroupName = o.FirstOrDefault().haveCustomerOrgGroup == null ? "" : o.FirstOrDefault().haveCustomerOrgGroup.CustomerOrgGroupName, |
|
|
|
CustomerOrgRegisterId = o.FirstOrDefault().appointPatientRegister.CustomerOrgRegisterId, |
|
|
|
MedicalPackageId = o.FirstOrDefault().appointPatientRegister.MedicalPackageId, |
|
|
|
MedicalPackageName = o.FirstOrDefault().haveMedicalPackage == null ? "" : o.FirstOrDefault().haveMedicalPackage.MedicalPackageName, |
|
|
|
MedicalCenterId = o.FirstOrDefault().appointPatientRegister.MedicalCenterId, |
|
|
|
CompleteFlag = o.FirstOrDefault().appointPatientRegister.CompleteFlag, |
|
|
|
|
|
|
|
AppointDate = o.FirstOrDefault().appointPatientRegister.AppointDate, |
|
|
|
Remark = o.FirstOrDefault().appointPatientRegister.Remark, |
|
|
|
PregnantFlag = o.FirstOrDefault().appointPatientRegister.PregnantFlag, |
|
|
|
Height = o.FirstOrDefault().appointPatientRegister.Height, |
|
|
|
Weight = o.FirstOrDefault().appointPatientRegister.Weight, |
|
|
|
SexName = _cacheService.GetSexNameAsync(o.FirstOrDefault().person.SexId).Result, |
|
|
|
MaritalStatusName = _cacheService.GetMaritalStatusNameAsync(o.FirstOrDefault().person.MaritalStatusId).Result, |
|
|
|
CustomerOrgName = _customerOrgManager.GetTopCustomerOrgAsync(o.FirstOrDefault().appointPatientRegister.CustomerOrgId).Result.CustomerOrgName |
|
|
|
|
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 取消预约
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
|
|
public async Task CancelAppoint(AppointPatientRegisterIdInputDto input) |
|
|
|
{ |
|
|
|
var appointPatientRegister = await _repository.GetAsync(o => o.AppointPatientRegisterId == input.AppointPatientRegisterId); |
|
|
|
if(appointPatientRegister.IsCharge == 'Y') |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("已收费不能取消"); |
|
|
|
} |
|
|
|
if (appointPatientRegister.CompleteFlag == AppointPatientRegisterCompleteFlag.Check) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("已到检不能取消"); |
|
|
|
} |
|
|
|
if (appointPatientRegister.CompleteFlag == AppointPatientRegisterCompleteFlag.CancelAppoint) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("已取消预约不能重复取消"); |
|
|
|
} |
|
|
|
appointPatientRegister.CompleteFlag = AppointPatientRegisterCompleteFlag.CancelAppoint; |
|
|
|
await _repository.UpdateAsync(appointPatientRegister); |
|
|
|
|
|
|
|
} |
|
|
|
[HttpPost("api/app/AppointPatientRegister/GetAppointRegisterAsbitemListById")] |
|
|
|
public async Task<List<AppointRegisterAsbitemDto>> GetAppointRegisterAsbitemListByIdAsync(AppointPatientRegisterIdInputDto input) |
|
|
|
{ |
|
|
|
|