fix(#Bug#708): guanyu (文件合入)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# Web Layer - API Controllers
|
# Web Layer - API Controllers
|
||||||
|
|
||||||
**Module**: `openhis-application/web`
|
**Module**: `healthlink-his-application/web`
|
||||||
**Role**: API endpoint layer - all REST controllers for frontend communication
|
**Role**: API endpoint layer - all REST controllers for frontend communication
|
||||||
|
|
||||||
## OVERVIEW
|
## OVERVIEW
|
||||||
|
|||||||
@@ -74,13 +74,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"),
|
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"),
|
||||||
DateTimeFormatter.ofPattern("yyyy-MM-dd H:mm:ss"));
|
DateTimeFormatter.ofPattern("yyyy-MM-dd H:mm:ss"));
|
||||||
|
|
||||||
/** Date → "yyyy-MM-dd HH:mm:ss",与前端 formatDateStr 输出格式一致 */
|
|
||||||
private static String formatOccurrenceTime(Date date) {
|
|
||||||
if (date == null) return "";
|
|
||||||
LocalDateTime ldt = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
||||||
return ldt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
AssignSeqUtil assignSeqUtil;
|
AssignSeqUtil assignSeqUtil;
|
||||||
|
|
||||||
@@ -184,33 +177,22 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
// 初始化查询参数
|
// 初始化查询参数
|
||||||
String encounterIds = inpatientAdviceParam.getEncounterIds();
|
String encounterIds = inpatientAdviceParam.getEncounterIds();
|
||||||
inpatientAdviceParam.setEncounterIds(null);
|
inpatientAdviceParam.setEncounterIds(null);
|
||||||
// Bug #715: 提取therapyEnum手动处理,避免自动条件排除therapy_enum为NULL的耗材医嘱
|
|
||||||
Integer therapyEnum = inpatientAdviceParam.getTherapyEnum();
|
|
||||||
inpatientAdviceParam.setTherapyEnum(null);
|
|
||||||
Integer exeStatus = inpatientAdviceParam.getExeStatus();
|
Integer exeStatus = inpatientAdviceParam.getExeStatus();
|
||||||
inpatientAdviceParam.setExeStatus(null);
|
inpatientAdviceParam.setExeStatus(null);
|
||||||
// 提取requestStatus手动处理,支持COMPLETED(3)和CHECK_VERIFIED(10)同时查询
|
// 提取requestStatus手动处理,支持COMPLETED(3)和CHECK_VERIFIED(10)同时查询
|
||||||
Integer requestStatus = inpatientAdviceParam.getRequestStatus();
|
Integer requestStatus = inpatientAdviceParam.getRequestStatus();
|
||||||
inpatientAdviceParam.setRequestStatus(null);
|
inpatientAdviceParam.setRequestStatus(null);
|
||||||
// Bug #714: 提取deadline手动处理,UNION子查询列名为end_time
|
|
||||||
String deadline = inpatientAdviceParam.getDeadline();
|
|
||||||
inpatientAdviceParam.setDeadline(null);
|
|
||||||
// 构建查询条件
|
// 构建查询条件
|
||||||
QueryWrapper<InpatientAdviceParam> queryWrapper
|
QueryWrapper<InpatientAdviceParam> queryWrapper
|
||||||
= HisQueryUtils.buildQueryWrapper(inpatientAdviceParam, null, null, null);
|
= HisQueryUtils.buildQueryWrapper(inpatientAdviceParam, null, null, null);
|
||||||
|
|
||||||
// 手动拼接requestStatus条件
|
// 手动拼接requestStatus条件:COMPLETED(3)时同时包含CHECK_VERIFIED(10)和PENDING_RECEIVE(11)
|
||||||
// COMPLETED(3)时同时包含CHECK_VERIFIED(10)和PENDING_RECEIVE(11)
|
|
||||||
// ACTIVE(2)时同时包含PENDING_STOP(13),以便护士核对停嘱医嘱
|
|
||||||
// UNION查询外层列名为request_status(T1.status_enum AS request_status),不是status_enum
|
// UNION查询外层列名为request_status(T1.status_enum AS request_status),不是status_enum
|
||||||
if (requestStatus != null) {
|
if (requestStatus != null) {
|
||||||
if (RequestStatus.COMPLETED.getValue().equals(requestStatus)) {
|
if (RequestStatus.COMPLETED.getValue().equals(requestStatus)) {
|
||||||
queryWrapper.in("request_status",
|
queryWrapper.in("request_status",
|
||||||
RequestStatus.COMPLETED.getValue(), RequestStatus.CHECK_VERIFIED.getValue(),
|
RequestStatus.COMPLETED.getValue(), RequestStatus.CHECK_VERIFIED.getValue(),
|
||||||
RequestStatus.PENDING_RECEIVE.getValue());
|
RequestStatus.PENDING_RECEIVE.getValue());
|
||||||
} else if (RequestStatus.ACTIVE.getValue().equals(requestStatus)) {
|
|
||||||
queryWrapper.in("request_status",
|
|
||||||
RequestStatus.ACTIVE.getValue(), RequestStatus.PENDING_STOP.getValue());
|
|
||||||
} else {
|
} else {
|
||||||
queryWrapper.eq("request_status", requestStatus);
|
queryWrapper.eq("request_status", requestStatus);
|
||||||
}
|
}
|
||||||
@@ -222,24 +204,11 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
= Arrays.stream(encounterIds.split(CommonConstants.Common.COMMA)).map(Long::parseLong).toList();
|
= Arrays.stream(encounterIds.split(CommonConstants.Common.COMMA)).map(Long::parseLong).toList();
|
||||||
queryWrapper.in(CommonConstants.FieldName.EncounterId, encounterIdList);
|
queryWrapper.in(CommonConstants.FieldName.EncounterId, encounterIdList);
|
||||||
}
|
}
|
||||||
// Bug #715: 手动拼接therapyEnum条件,耗材医嘱(DeviceRequest)无therapy_enum(NULL),需兼容
|
|
||||||
if (therapyEnum != null) {
|
|
||||||
queryWrapper.and(w -> w.eq("therapy_enum", therapyEnum).or().isNull("therapy_enum"));
|
|
||||||
}
|
|
||||||
// Bug #714: 手动拼接deadline条件,按医嘱截止时间筛选
|
|
||||||
if (deadline != null && !deadline.isEmpty()) {
|
|
||||||
try {
|
|
||||||
LocalDateTime deadlineTime = LocalDateTime.parse(deadline,
|
|
||||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
||||||
queryWrapper.le("end_time", deadlineTime);
|
|
||||||
} catch (DateTimeParseException e) {
|
|
||||||
// 忽略无效的日期格式
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 患者医嘱分页列表
|
// 患者医嘱分页列表
|
||||||
Page<InpatientAdviceDto> inpatientAdvicePage
|
Page<InpatientAdviceDto> inpatientAdvicePage
|
||||||
= adviceProcessAppMapper.selectInpatientAdvicePage(new Page<>(pageNo, pageSize), queryWrapper,
|
= adviceProcessAppMapper.selectInpatientAdvicePage(new Page<>(pageNo, pageSize), queryWrapper,
|
||||||
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_SERVICE_REQUEST,
|
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_SERVICE_REQUEST,
|
||||||
|
CommonConstants.TableName.WOR_DEVICE_REQUEST,
|
||||||
RequestStatus.DRAFT.getValue(), EncounterActivityStatus.ACTIVE.getValue(), LocationForm.BED.getValue(),
|
RequestStatus.DRAFT.getValue(), EncounterActivityStatus.ACTIVE.getValue(), LocationForm.BED.getValue(),
|
||||||
ParticipantType.ADMITTING_DOCTOR.getCode(), AccountType.PERSONAL_CASH_ACCOUNT.getCode(),
|
ParticipantType.ADMITTING_DOCTOR.getCode(), AccountType.PERSONAL_CASH_ACCOUNT.getCode(),
|
||||||
ChargeItemStatus.BILLABLE.getValue(), ChargeItemStatus.BILLED.getValue(),
|
ChargeItemStatus.BILLABLE.getValue(), ChargeItemStatus.BILLED.getValue(),
|
||||||
@@ -283,16 +252,14 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
e.setTotalAmount(e.getQuantity() + unitStr);
|
e.setTotalAmount(e.getQuantity() + unitStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 频次/用法组合(直接使用DictUtils翻译,避免DictAspect延迟导致_dictText为空)
|
// 频次/用法组合
|
||||||
String rateLabel = e.getRateCode() != null ? DictUtils.getDictLabel("rate_code", e.getRateCode()) : null;
|
|
||||||
String methodLabel = e.getMethodCode() != null ? DictUtils.getDictLabel("method_code", e.getMethodCode()) : null;
|
|
||||||
StringBuilder freqBuilder = new StringBuilder();
|
StringBuilder freqBuilder = new StringBuilder();
|
||||||
if (rateLabel != null && !rateLabel.isEmpty()) {
|
if (e.getRateCode_dictText() != null && !e.getRateCode_dictText().isEmpty()) {
|
||||||
freqBuilder.append(rateLabel);
|
freqBuilder.append(e.getRateCode_dictText());
|
||||||
}
|
}
|
||||||
if (methodLabel != null && !methodLabel.isEmpty()) {
|
if (e.getMethodCode_dictText() != null && !e.getMethodCode_dictText().isEmpty()) {
|
||||||
if (freqBuilder.length() > 0) freqBuilder.append(" ");
|
if (freqBuilder.length() > 0) freqBuilder.append(" ");
|
||||||
freqBuilder.append(methodLabel);
|
freqBuilder.append(e.getMethodCode_dictText());
|
||||||
}
|
}
|
||||||
e.setFrequencyUsage(freqBuilder.length() > 0 ? freqBuilder.toString() : null);
|
e.setFrequencyUsage(freqBuilder.length() > 0 ? freqBuilder.toString() : null);
|
||||||
|
|
||||||
@@ -354,7 +321,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
if (performRecordList != null && !performRecordList.isEmpty()) {
|
if (performRecordList != null && !performRecordList.isEmpty()) {
|
||||||
// 按时间分组,处理每个时间点的多条记录
|
// 按时间分组,处理每个时间点的多条记录
|
||||||
Map<String, List<PerformRecordDto>> recordsByTime = performRecordList.stream()
|
Map<String, List<PerformRecordDto>> recordsByTime = performRecordList.stream()
|
||||||
.collect(Collectors.groupingBy(record -> formatOccurrenceTime(record.getOccurrenceTime())));
|
.collect(Collectors.groupingBy(record -> record.getOccurrenceTime().toString()));
|
||||||
for (Map.Entry<String, List<PerformRecordDto>> entry : recordsByTime.entrySet()) {
|
for (Map.Entry<String, List<PerformRecordDto>> entry : recordsByTime.entrySet()) {
|
||||||
List<PerformRecordDto> records = entry.getValue();
|
List<PerformRecordDto> records = entry.getValue();
|
||||||
// 按操作顺序排序
|
// 按操作顺序排序
|
||||||
@@ -413,14 +380,17 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public R<?> adviceVerify(List<PerformInfoDto> performInfoList) {
|
public R<?> adviceVerify(List<PerformInfoDto> performInfoList) {
|
||||||
// 分别创建两个列表来存储不同类型的请求
|
// 分别创建列表来存储不同类型的请求
|
||||||
List<PerformInfoDto> serviceRequestList = new ArrayList<>();
|
List<PerformInfoDto> serviceRequestList = new ArrayList<>();
|
||||||
List<PerformInfoDto> medRequestList = new ArrayList<>();
|
List<PerformInfoDto> medRequestList = new ArrayList<>();
|
||||||
|
List<PerformInfoDto> deviceRequestList = new ArrayList<>();
|
||||||
for (PerformInfoDto item : performInfoList) {
|
for (PerformInfoDto item : performInfoList) {
|
||||||
if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(item.getRequestTable())) {
|
if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(item.getRequestTable())) {
|
||||||
serviceRequestList.add(item);
|
serviceRequestList.add(item);
|
||||||
} else if (CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(item.getRequestTable())) {
|
} else if (CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(item.getRequestTable())) {
|
||||||
medRequestList.add(item);
|
medRequestList.add(item);
|
||||||
|
} else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(item.getRequestTable())) {
|
||||||
|
deviceRequestList.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||||
@@ -429,29 +399,10 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
List<Long> serviceReqIds = serviceRequestList.stream().map(PerformInfoDto::getRequestId).toList();
|
List<Long> serviceReqIds = serviceRequestList.stream().map(PerformInfoDto::getRequestId).toList();
|
||||||
// 先查询服务请求,按 categoryEnum 分流:检查类(23)走 CHECK_VERIFIED,其余走 COMPLETED
|
// 先查询服务请求,按 categoryEnum 分流:检查类(23)走 CHECK_VERIFIED,其余走 COMPLETED
|
||||||
List<ServiceRequest> allServiceRequests = serviceRequestService.listByIds(serviceReqIds);
|
List<ServiceRequest> allServiceRequests = serviceRequestService.listByIds(serviceReqIds);
|
||||||
|
List<Long> checkReqIds = allServiceRequests.stream()
|
||||||
// 分离已停嘱(PENDING_STOP)的订单,护士核对后变为已停止(STOPPED)
|
|
||||||
List<ServiceRequest> pendingStopRequests = allServiceRequests.stream()
|
|
||||||
.filter(sr -> RequestStatus.PENDING_STOP.getValue().equals(sr.getStatusEnum()))
|
|
||||||
.toList();
|
|
||||||
List<ServiceRequest> normalRequests = allServiceRequests.stream()
|
|
||||||
.filter(sr -> !RequestStatus.PENDING_STOP.getValue().equals(sr.getStatusEnum()))
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
// 已停嘱订单 → 已停止(STOPPED)
|
|
||||||
if (!pendingStopRequests.isEmpty()) {
|
|
||||||
List<Long> pendingStopIds = pendingStopRequests.stream().map(ServiceRequest::getId).toList();
|
|
||||||
serviceRequestService.update(new LambdaUpdateWrapper<ServiceRequest>()
|
|
||||||
.in(ServiceRequest::getId, pendingStopIds)
|
|
||||||
.set(ServiceRequest::getStatusEnum, RequestStatus.STOPPED.getValue())
|
|
||||||
.set(ServiceRequest::getUpdateBy, SecurityUtils.getNickName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 正常订单:检查类 → 已校对(CHECK_VERIFIED=10),其余 → 已完成(COMPLETED=3)
|
|
||||||
List<Long> checkReqIds = normalRequests.stream()
|
|
||||||
.filter(sr -> ActivityDefCategory.TEST.getValue().equals(sr.getCategoryEnum()))
|
.filter(sr -> ActivityDefCategory.TEST.getValue().equals(sr.getCategoryEnum()))
|
||||||
.map(ServiceRequest::getId).toList();
|
.map(ServiceRequest::getId).toList();
|
||||||
List<Long> otherReqIds = normalRequests.stream()
|
List<Long> otherReqIds = allServiceRequests.stream()
|
||||||
.filter(sr -> !ActivityDefCategory.TEST.getValue().equals(sr.getCategoryEnum()))
|
.filter(sr -> !ActivityDefCategory.TEST.getValue().equals(sr.getCategoryEnum()))
|
||||||
.map(ServiceRequest::getId).toList();
|
.map(ServiceRequest::getId).toList();
|
||||||
// 检查类 → 已校对(CHECK_VERIFIED=10)
|
// 检查类 → 已校对(CHECK_VERIFIED=10)
|
||||||
@@ -463,7 +414,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
serviceRequestService.updateCompleteRequestStatus(otherReqIds, practitionerId, checkDate);
|
serviceRequestService.updateCompleteRequestStatus(otherReqIds, practitionerId, checkDate);
|
||||||
}
|
}
|
||||||
// 处理转科/出院等特殊医嘱
|
// 处理转科/出院等特殊医嘱
|
||||||
for (ServiceRequest serviceRequest : normalRequests) {
|
for (ServiceRequest serviceRequest : allServiceRequests) {
|
||||||
if (ActivityDefCategory.TRANSFER.getValue().equals(serviceRequest.getCategoryEnum())) {
|
if (ActivityDefCategory.TRANSFER.getValue().equals(serviceRequest.getCategoryEnum())) {
|
||||||
encounterService.updateEncounterStatus(serviceRequest.getEncounterId(),
|
encounterService.updateEncounterStatus(serviceRequest.getEncounterId(),
|
||||||
EncounterZyStatus.PENDING_TRANSFER.getValue());
|
EncounterZyStatus.PENDING_TRANSFER.getValue());
|
||||||
@@ -474,30 +425,14 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!medRequestList.isEmpty()) {
|
if (!medRequestList.isEmpty()) {
|
||||||
List<Long> medReqIds = medRequestList.stream().map(PerformInfoDto::getRequestId).toList();
|
// 更新药品请求状态已完成
|
||||||
// 查询药品请求,分离已停嘱(PENDING_STOP)的订单
|
medicationRequestService.updateCompletedStatusBatch(
|
||||||
List<MedicationRequest> allMedRequests = medicationRequestService.list(
|
medRequestList.stream().map(PerformInfoDto::getRequestId).toList(), practitionerId, checkDate);
|
||||||
new LambdaQueryWrapper<MedicationRequest>()
|
}
|
||||||
.select(MedicationRequest::getId, MedicationRequest::getStatusEnum)
|
if (!deviceRequestList.isEmpty()) {
|
||||||
.in(MedicationRequest::getId, medReqIds));
|
// 更新耗材请求状态已完成
|
||||||
List<Long> pendingStopMedIds = allMedRequests.stream()
|
deviceRequestService.updateCompletedStatusBatch(
|
||||||
.filter(mr -> RequestStatus.PENDING_STOP.getValue().equals(mr.getStatusEnum()))
|
deviceRequestList.stream().map(PerformInfoDto::getRequestId).toList());
|
||||||
.map(MedicationRequest::getId).toList();
|
|
||||||
List<Long> normalMedIds = allMedRequests.stream()
|
|
||||||
.filter(mr -> !RequestStatus.PENDING_STOP.getValue().equals(mr.getStatusEnum()))
|
|
||||||
.map(MedicationRequest::getId).toList();
|
|
||||||
|
|
||||||
// 已停嘱订单 → 已停止(STOPPED)
|
|
||||||
if (!pendingStopMedIds.isEmpty()) {
|
|
||||||
medicationRequestService.update(new LambdaUpdateWrapper<MedicationRequest>()
|
|
||||||
.in(MedicationRequest::getId, pendingStopMedIds)
|
|
||||||
.set(MedicationRequest::getStatusEnum, RequestStatus.STOPPED.getValue())
|
|
||||||
.set(MedicationRequest::getUpdateBy, SecurityUtils.getNickName()));
|
|
||||||
}
|
|
||||||
// 正常订单 → 已完成(COMPLETED)
|
|
||||||
if (!normalMedIds.isEmpty()) {
|
|
||||||
medicationRequestService.updateCompletedStatusBatch(normalMedIds, practitionerId, checkDate);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return R.ok(null, "校对成功");
|
return R.ok(null, "校对成功");
|
||||||
}
|
}
|
||||||
@@ -510,14 +445,17 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public R<?> adviceReject(List<PerformInfoDto> performInfoList) {
|
public R<?> adviceReject(List<PerformInfoDto> performInfoList) {
|
||||||
// 分别创建两个列表来存储不同类型的请求
|
// 分别创建列表来存储不同类型的请求
|
||||||
List<PerformInfoDto> serviceRequestList = new ArrayList<>();
|
List<PerformInfoDto> serviceRequestList = new ArrayList<>();
|
||||||
List<PerformInfoDto> medRequestList = new ArrayList<>();
|
List<PerformInfoDto> medRequestList = new ArrayList<>();
|
||||||
|
List<PerformInfoDto> deviceRequestList = new ArrayList<>();
|
||||||
for (PerformInfoDto item : performInfoList) {
|
for (PerformInfoDto item : performInfoList) {
|
||||||
if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(item.getRequestTable())) {
|
if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(item.getRequestTable())) {
|
||||||
serviceRequestList.add(item);
|
serviceRequestList.add(item);
|
||||||
} else if (CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(item.getRequestTable())) {
|
} else if (CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(item.getRequestTable())) {
|
||||||
medRequestList.add(item);
|
medRequestList.add(item);
|
||||||
|
} else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(item.getRequestTable())) {
|
||||||
|
deviceRequestList.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 校验医嘱是否已执行,已执行的医嘱需要先取消执行后才能退回
|
// 校验医嘱是否已执行,已执行的医嘱需要先取消执行后才能退回
|
||||||
@@ -567,6 +505,11 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
medicationRequestService.updateDraftStatusBatch(
|
medicationRequestService.updateDraftStatusBatch(
|
||||||
medRequestList.stream().map(PerformInfoDto::getRequestId).toList(), practitionerId, checkDate, backReason);
|
medRequestList.stream().map(PerformInfoDto::getRequestId).toList(), practitionerId, checkDate, backReason);
|
||||||
}
|
}
|
||||||
|
if (!deviceRequestList.isEmpty()) {
|
||||||
|
// 更新耗材请求状态待发送
|
||||||
|
deviceRequestService.updateDraftStatusBatch(
|
||||||
|
deviceRequestList.stream().map(PerformInfoDto::getRequestId).toList());
|
||||||
|
}
|
||||||
return R.ok(null, "退回成功");
|
return R.ok(null, "退回成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -583,25 +526,12 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
Date exeDate = adviceExecuteParam.getExeDate();
|
Date exeDate = adviceExecuteParam.getExeDate();
|
||||||
// 医嘱集合
|
// 医嘱集合
|
||||||
List<AdviceExecuteDetailParam> adviceExecuteDetailList = adviceExecuteParam.getAdviceExecuteDetailList();
|
List<AdviceExecuteDetailParam> adviceExecuteDetailList = adviceExecuteParam.getAdviceExecuteDetailList();
|
||||||
|
|
||||||
// 前置校验:确保有待执行的医嘱且 executeTimes 不为空
|
|
||||||
if (adviceExecuteDetailList == null || adviceExecuteDetailList.isEmpty()) {
|
|
||||||
return R.fail("未选择需要执行的医嘱");
|
|
||||||
}
|
|
||||||
adviceExecuteDetailList.removeIf(item -> item.getExecuteTimes() == null || item.getExecuteTimes().isEmpty());
|
|
||||||
if (adviceExecuteDetailList.isEmpty()) {
|
|
||||||
return R.fail("所选医嘱没有可执行的时间点,请勾选预计执行时间后再操作");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 药品
|
// 药品
|
||||||
List<AdviceExecuteDetailParam> medicineList = adviceExecuteDetailList.stream()
|
List<AdviceExecuteDetailParam> medicineList = adviceExecuteDetailList.stream()
|
||||||
.filter(e -> CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(e.getAdviceTable())).toList();
|
.filter(e -> CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(e.getAdviceTable())).toList();
|
||||||
// 诊疗
|
// 诊疗
|
||||||
List<AdviceExecuteDetailParam> activityList = adviceExecuteDetailList.stream()
|
List<AdviceExecuteDetailParam> activityList = adviceExecuteDetailList.stream()
|
||||||
.filter(e -> CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(e.getAdviceTable())).toList();
|
.filter(e -> CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(e.getAdviceTable())).toList();
|
||||||
|
|
||||||
int totalCreatedCount = 0;
|
|
||||||
|
|
||||||
// -------------------------------------------药品
|
// -------------------------------------------药品
|
||||||
if (!medicineList.isEmpty()) {
|
if (!medicineList.isEmpty()) {
|
||||||
// 组装药品请求用于执行的数据结构
|
// 组装药品请求用于执行的数据结构
|
||||||
@@ -614,14 +544,14 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 处理药品执行
|
// 处理药品执行
|
||||||
totalCreatedCount += this.exeMedication(medUseExeList, exeDate);
|
this.exeMedication(medUseExeList, exeDate);
|
||||||
}
|
}
|
||||||
// -------------------------------------------诊疗
|
// -------------------------------------------诊疗
|
||||||
if (!activityList.isEmpty()) {
|
if (!activityList.isEmpty()) {
|
||||||
// 组装诊疗请求用于执行的数据结构
|
// 组装诊疗请求用于执行的数据结构
|
||||||
List<ServiceRequestUseExe> actUseExeList = this.assemblyActivity(activityList);
|
List<ServiceRequestUseExe> actUseExeList = this.assemblyActivity(activityList);
|
||||||
// 处理诊疗执行
|
// 处理诊疗执行
|
||||||
totalCreatedCount += this.exeActivity(actUseExeList, exeDate);
|
this.exeActivity(actUseExeList, exeDate);
|
||||||
// 检查类医嘱执行后,状态改为"待接收"(PENDING_RECEIVE=11)
|
// 检查类医嘱执行后,状态改为"待接收"(PENDING_RECEIVE=11)
|
||||||
List<Long> actReqIds = activityList.stream().map(AdviceExecuteDetailParam::getRequestId).toList();
|
List<Long> actReqIds = activityList.stream().map(AdviceExecuteDetailParam::getRequestId).toList();
|
||||||
List<ServiceRequest> executedReqs = serviceRequestService.listByIds(actReqIds);
|
List<ServiceRequest> executedReqs = serviceRequestService.listByIds(actReqIds);
|
||||||
@@ -640,11 +570,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 后置校验:确认有执行记录被实际创建
|
|
||||||
if (totalCreatedCount == 0) {
|
|
||||||
return R.fail("执行失败,未生成任何执行记录,请检查医嘱状态后重试");
|
|
||||||
}
|
|
||||||
|
|
||||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"医嘱执行"}));
|
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"医嘱执行"}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -655,7 +580,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
* @return 操作结果
|
* @return 操作结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public R<?> adviceCancel(AdviceExecuteParam adviceExecuteParam) {
|
public R<?> adviceCancel(AdviceExecuteParam adviceExecuteParam) {
|
||||||
// 获取当前执行时间
|
// 获取当前执行时间
|
||||||
Date exeDate = DateUtils.getNowDate();
|
Date exeDate = DateUtils.getNowDate();
|
||||||
@@ -702,7 +626,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
longMedDispensedList.add(medicationDispense);
|
longMedDispensedList.add(medicationDispense);
|
||||||
} else if (DispenseStatus.EXECUTED.getValue().equals(medicationDispense.getStatusEnum())
|
} else if (DispenseStatus.EXECUTED.getValue().equals(medicationDispense.getStatusEnum())
|
||||||
|| DispenseStatus.SUBMITTED.getValue().equals(medicationDispense.getStatusEnum())) {
|
|| DispenseStatus.SUBMITTED.getValue().equals(medicationDispense.getStatusEnum())) {
|
||||||
longMedDispensedList.add(medicationDispense);
|
|
||||||
longMedUndispenseList.add(medicationDispense);
|
longMedUndispenseList.add(medicationDispense);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -731,7 +654,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
tempMedDispensedList.add(medicationDispense);
|
tempMedDispensedList.add(medicationDispense);
|
||||||
} else if (DispenseStatus.EXECUTED.getValue().equals(medicationDispense.getStatusEnum())
|
} else if (DispenseStatus.EXECUTED.getValue().equals(medicationDispense.getStatusEnum())
|
||||||
|| DispenseStatus.SUBMITTED.getValue().equals(medicationDispense.getStatusEnum())) {
|
|| DispenseStatus.SUBMITTED.getValue().equals(medicationDispense.getStatusEnum())) {
|
||||||
tempMedDispensedList.add(medicationDispense);
|
|
||||||
tempMedUndispenseList.add(medicationDispense);
|
tempMedUndispenseList.add(medicationDispense);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -879,7 +801,7 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
if (!longMedUndispenseList.isEmpty()) {
|
if (!longMedUndispenseList.isEmpty()) {
|
||||||
// 排除已汇总的药品
|
// 排除已汇总的药品
|
||||||
List<MedicationDispense> medicationDispenseList
|
List<MedicationDispense> medicationDispenseList
|
||||||
= longMedUndispenseList.stream().filter(x -> x.getSummaryNo() == null).toList();
|
= tempMedUndispenseList.stream().filter(x -> x.getSummaryNo() == null).toList();
|
||||||
medicationDispenseService
|
medicationDispenseService
|
||||||
.removeByIds(medicationDispenseList.stream().map(MedicationDispense::getId).toList());
|
.removeByIds(medicationDispenseList.stream().map(MedicationDispense::getId).toList());
|
||||||
}
|
}
|
||||||
@@ -949,10 +871,8 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
*
|
*
|
||||||
* @param medUseExeList 药品医嘱
|
* @param medUseExeList 药品医嘱
|
||||||
* @param exeDate 实际执行时间
|
* @param exeDate 实际执行时间
|
||||||
* @return 实际创建的执行记录数
|
|
||||||
*/
|
*/
|
||||||
private int exeMedication(List<MedicationRequestUseExe> medUseExeList, Date exeDate) {
|
private void exeMedication(List<MedicationRequestUseExe> medUseExeList, Date exeDate) {
|
||||||
int createdCount = 0;
|
|
||||||
// 长期医嘱
|
// 长期医嘱
|
||||||
List<MedicationRequestUseExe> longMedication = medUseExeList.stream()
|
List<MedicationRequestUseExe> longMedication = medUseExeList.stream()
|
||||||
.filter(e -> TherapyTimeType.LONG_TERM.getValue().equals(e.getTherapyEnum())).toList();
|
.filter(e -> TherapyTimeType.LONG_TERM.getValue().equals(e.getTherapyEnum())).toList();
|
||||||
@@ -975,7 +895,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
MedicationRequest longMedicationRequest;
|
MedicationRequest longMedicationRequest;
|
||||||
ChargeItem chargeItem;
|
ChargeItem chargeItem;
|
||||||
for (MedicationRequestUseExe medicationRequestUseExe : longMedication) {
|
for (MedicationRequestUseExe medicationRequestUseExe : longMedication) {
|
||||||
if (medicationRequestUseExe.getExecuteTimes() == null) continue;
|
|
||||||
for (String executeTime : medicationRequestUseExe.getExecuteTimes()) {
|
for (String executeTime : medicationRequestUseExe.getExecuteTimes()) {
|
||||||
longMedicationRequest = new MedicationRequest();
|
longMedicationRequest = new MedicationRequest();
|
||||||
BeanUtils.copyProperties(medicationRequestUseExe, longMedicationRequest);
|
BeanUtils.copyProperties(medicationRequestUseExe, longMedicationRequest);
|
||||||
@@ -1005,7 +924,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
CommonConstants.TableName.MED_MEDICATION_REQUEST, EventStatus.COMPLETED,
|
CommonConstants.TableName.MED_MEDICATION_REQUEST, EventStatus.COMPLETED,
|
||||||
ProcedureCategory.INPATIENT_ADVICE, null, expectedDate, exeDate, longMedicationRequest.getGroupId(),
|
ProcedureCategory.INPATIENT_ADVICE, null, expectedDate, exeDate, longMedicationRequest.getGroupId(),
|
||||||
null);
|
null);
|
||||||
createdCount++;
|
|
||||||
|
|
||||||
// 医嘱定价来源
|
// 医嘱定价来源
|
||||||
String orderPricingSource = TenantOptionUtil.getOptionContent(TenantOptionDict.ORDER_PRICING_SOURCE);
|
String orderPricingSource = TenantOptionUtil.getOptionContent(TenantOptionDict.ORDER_PRICING_SOURCE);
|
||||||
@@ -1206,7 +1124,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
// 临时
|
// 临时
|
||||||
MedicationRequest tempMedicationRequest;
|
MedicationRequest tempMedicationRequest;
|
||||||
for (MedicationRequestUseExe medicationRequestUseExe : tempMedication) {
|
for (MedicationRequestUseExe medicationRequestUseExe : tempMedication) {
|
||||||
if (medicationRequestUseExe.getExecuteTimes() == null) continue;
|
|
||||||
for (String executeTime : medicationRequestUseExe.getExecuteTimes()) {
|
for (String executeTime : medicationRequestUseExe.getExecuteTimes()) {
|
||||||
tempMedicationRequest = new MedicationRequest();
|
tempMedicationRequest = new MedicationRequest();
|
||||||
BeanUtils.copyProperties(medicationRequestUseExe, tempMedicationRequest);
|
BeanUtils.copyProperties(medicationRequestUseExe, tempMedicationRequest);
|
||||||
@@ -1219,7 +1136,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
CommonConstants.TableName.MED_MEDICATION_REQUEST, EventStatus.COMPLETED,
|
CommonConstants.TableName.MED_MEDICATION_REQUEST, EventStatus.COMPLETED,
|
||||||
ProcedureCategory.INPATIENT_ADVICE, null, expectedDate, exeDate, tempMedicationRequest.getGroupId(),
|
ProcedureCategory.INPATIENT_ADVICE, null, expectedDate, exeDate, tempMedicationRequest.getGroupId(),
|
||||||
null);
|
null);
|
||||||
createdCount++;
|
|
||||||
|
|
||||||
// 更新药品放发状态
|
// 更新药品放发状态
|
||||||
medicationDispenseService.update(new LambdaUpdateWrapper<MedicationDispense>()
|
medicationDispenseService.update(new LambdaUpdateWrapper<MedicationDispense>()
|
||||||
@@ -1236,7 +1152,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return createdCount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1244,10 +1159,8 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
*
|
*
|
||||||
* @param actUseExeList 诊疗医嘱
|
* @param actUseExeList 诊疗医嘱
|
||||||
* @param exeDate 实际执行时间
|
* @param exeDate 实际执行时间
|
||||||
* @return 实际创建的执行记录数
|
|
||||||
*/
|
*/
|
||||||
private int exeActivity(List<ServiceRequestUseExe> actUseExeList, Date exeDate) {
|
private void exeActivity(List<ServiceRequestUseExe> actUseExeList, Date exeDate) {
|
||||||
int createdCount = 0;
|
|
||||||
// 长期医嘱
|
// 长期医嘱
|
||||||
List<ServiceRequestUseExe> longActivity = actUseExeList.stream()
|
List<ServiceRequestUseExe> longActivity = actUseExeList.stream()
|
||||||
.filter(e -> TherapyTimeType.LONG_TERM.getValue().equals(e.getTherapyEnum())).toList();
|
.filter(e -> TherapyTimeType.LONG_TERM.getValue().equals(e.getTherapyEnum())).toList();
|
||||||
@@ -1272,7 +1185,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
ServiceRequest longServiceRequest;
|
ServiceRequest longServiceRequest;
|
||||||
ChargeItem chargeItem;
|
ChargeItem chargeItem;
|
||||||
for (ServiceRequestUseExe serviceRequestUseExe : longActivity) {
|
for (ServiceRequestUseExe serviceRequestUseExe : longActivity) {
|
||||||
if (serviceRequestUseExe.getExecuteTimes() == null) continue;
|
|
||||||
// 查询耗材的取药科室
|
// 查询耗材的取药科室
|
||||||
Long takeDeviceLocationId = doctorStationAdviceAppMapper
|
Long takeDeviceLocationId = doctorStationAdviceAppMapper
|
||||||
.getTakeDeviceLocationId(serviceRequestUseExe.getEncounterId(), ItemCategoryCode.DEVICE.getCode());
|
.getTakeDeviceLocationId(serviceRequestUseExe.getEncounterId(), ItemCategoryCode.DEVICE.getCode());
|
||||||
@@ -1287,7 +1199,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
longServiceRequest.getPatientId(), longServiceRequest.getId(),
|
longServiceRequest.getPatientId(), longServiceRequest.getId(),
|
||||||
CommonConstants.TableName.WOR_SERVICE_REQUEST, EventStatus.COMPLETED,
|
CommonConstants.TableName.WOR_SERVICE_REQUEST, EventStatus.COMPLETED,
|
||||||
ProcedureCategory.INPATIENT_ADVICE, null, expectedDate, exeDate, null, null);
|
ProcedureCategory.INPATIENT_ADVICE, null, expectedDate, exeDate, null, null);
|
||||||
createdCount++;
|
|
||||||
|
|
||||||
// 生成账单
|
// 生成账单
|
||||||
chargeItem = new ChargeItem();
|
chargeItem = new ChargeItem();
|
||||||
@@ -1345,7 +1256,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
// 临时
|
// 临时
|
||||||
ServiceRequest tempServiceRequest;
|
ServiceRequest tempServiceRequest;
|
||||||
for (ServiceRequestUseExe serviceRequestUseExe : tempActivity) {
|
for (ServiceRequestUseExe serviceRequestUseExe : tempActivity) {
|
||||||
if (serviceRequestUseExe.getExecuteTimes() == null) continue;
|
|
||||||
// 查询耗材的取药科室
|
// 查询耗材的取药科室
|
||||||
Long takeDeviceLocationId = doctorStationAdviceAppMapper
|
Long takeDeviceLocationId = doctorStationAdviceAppMapper
|
||||||
.getTakeDeviceLocationId(serviceRequestUseExe.getEncounterId(), ItemCategoryCode.DEVICE.getCode());
|
.getTakeDeviceLocationId(serviceRequestUseExe.getEncounterId(), ItemCategoryCode.DEVICE.getCode());
|
||||||
@@ -1360,7 +1270,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
tempServiceRequest.getPatientId(), tempServiceRequest.getId(),
|
tempServiceRequest.getPatientId(), tempServiceRequest.getId(),
|
||||||
CommonConstants.TableName.WOR_SERVICE_REQUEST, EventStatus.COMPLETED,
|
CommonConstants.TableName.WOR_SERVICE_REQUEST, EventStatus.COMPLETED,
|
||||||
ProcedureCategory.INPATIENT_ADVICE, null, expectedDate, exeDate, null, null);
|
ProcedureCategory.INPATIENT_ADVICE, null, expectedDate, exeDate, null, null);
|
||||||
createdCount++;
|
|
||||||
|
|
||||||
// 更新账单状态
|
// 更新账单状态
|
||||||
chargeItemService.update(
|
chargeItemService.update(
|
||||||
@@ -1378,7 +1287,6 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return createdCount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -65,7 +65,8 @@ public interface AdviceProcessAppMapper {
|
|||||||
Page<InpatientAdviceDto> selectInpatientAdvicePage(@Param("page") Page<InpatientAdviceDto> page,
|
Page<InpatientAdviceDto> selectInpatientAdvicePage(@Param("page") Page<InpatientAdviceDto> page,
|
||||||
@Param(Constants.WRAPPER) QueryWrapper<InpatientAdviceParam> queryWrapper,
|
@Param(Constants.WRAPPER) QueryWrapper<InpatientAdviceParam> queryWrapper,
|
||||||
@Param("medMedicationRequest") String medMedicationRequest,
|
@Param("medMedicationRequest") String medMedicationRequest,
|
||||||
@Param("worServiceRequest") String worServiceRequest, @Param("draft") Integer draft,
|
@Param("worServiceRequest") String worServiceRequest,
|
||||||
|
@Param("worDeviceRequest") String worDeviceRequest, @Param("draft") Integer draft,
|
||||||
@Param("active") Integer active, @Param("bed") Integer bed, @Param("admittingDoctor") String admittingDoctor,
|
@Param("active") Integer active, @Param("bed") Integer bed, @Param("admittingDoctor") String admittingDoctor,
|
||||||
@Param("personalCashAccount") String personalCashAccount, @Param("billable") Integer billable,
|
@Param("personalCashAccount") String personalCashAccount, @Param("billable") Integer billable,
|
||||||
@Param("billed") Integer billed, @Param("refunded") Integer refunded, @Param("imp") Integer imp,
|
@Param("billed") Integer billed, @Param("refunded") Integer refunded, @Param("imp") Integer imp,
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ import java.math.BigDecimal;
|
|||||||
public class RequestFormDetailQueryDto {
|
public class RequestFormDetailQueryDto {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 诊疗活动定义ID(wor_service_request.activity_id,与开立检验时项目字典的 id / adviceDefinitionId 一致,用于编辑回显)
|
* 诊疗活动定义ID(wor_service_request.id,与开立检验时项目字典的 id / adviceDefinitionId 一致,用于编辑回显)
|
||||||
*/
|
*/
|
||||||
private Long activityId;
|
private Long adviceDefinitionId;
|
||||||
|
|
||||||
/** 医嘱名称 */
|
/** 医嘱名称 */
|
||||||
private String adviceName;
|
private String adviceName;
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
-- Fix Bug #748: clinical_pathway_execution 缺少 HisBaseEntity 列
|
||||||
|
-- V43 迁移因版本号低于已执行的 V2026_0608 而被 Flyway 跳过,此处重新添加缺失列
|
||||||
|
ALTER TABLE clinical_pathway_execution ADD COLUMN IF NOT EXISTS create_by VARCHAR(64) DEFAULT '';
|
||||||
|
ALTER TABLE clinical_pathway_execution ADD COLUMN IF NOT EXISTS update_by VARCHAR(64) DEFAULT '';
|
||||||
|
ALTER TABLE clinical_pathway_execution ADD COLUMN IF NOT EXISTS update_time TIMESTAMP;
|
||||||
@@ -207,7 +207,7 @@
|
|||||||
NULL::numeric AS unit_price,
|
NULL::numeric AS unit_price,
|
||||||
NULL::numeric AS total_price,
|
NULL::numeric AS total_price,
|
||||||
NULL::bigint AS stopper_id,
|
NULL::bigint AS stopper_id,
|
||||||
T1.update_by AS stopper_name
|
NULL::varchar AS stopper_name
|
||||||
FROM med_medication_request AS T1
|
FROM med_medication_request AS T1
|
||||||
LEFT JOIN med_medication_definition AS T2
|
LEFT JOIN med_medication_definition AS T2
|
||||||
ON T2.id = T1.medication_id
|
ON T2.id = T1.medication_id
|
||||||
@@ -353,7 +353,7 @@
|
|||||||
NULL::numeric AS unit_price,
|
NULL::numeric AS unit_price,
|
||||||
NULL::numeric AS total_price,
|
NULL::numeric AS total_price,
|
||||||
NULL::bigint AS stopper_id,
|
NULL::bigint AS stopper_id,
|
||||||
T1.update_by AS stopper_name
|
NULL::varchar AS stopper_name
|
||||||
FROM wor_service_request AS T1
|
FROM wor_service_request AS T1
|
||||||
LEFT JOIN wor_activity_definition AS T2
|
LEFT JOIN wor_activity_definition AS T2
|
||||||
ON T2.id = T1.activity_id
|
ON T2.id = T1.activity_id
|
||||||
@@ -439,6 +439,139 @@
|
|||||||
ELSE 1=1 END
|
ELSE 1=1 END
|
||||||
AND T1.refund_service_id IS NULL
|
AND T1.refund_service_id IS NULL
|
||||||
ORDER BY T1.status_enum )
|
ORDER BY T1.status_enum )
|
||||||
|
UNION
|
||||||
|
( SELECT DISTINCT T1.encounter_id,
|
||||||
|
T1.tenant_id,
|
||||||
|
#{worDeviceRequest} AS advice_table,
|
||||||
|
T1.id AS request_id,
|
||||||
|
T1.req_authored_time AS start_time,
|
||||||
|
NULL::timestamp AS end_time,
|
||||||
|
T1.requester_id AS requester_id,
|
||||||
|
T1.create_time AS request_time,
|
||||||
|
NULL::integer AS skin_test_flag,
|
||||||
|
NULL::integer AS inject_flag,
|
||||||
|
NULL::bigint AS group_id,
|
||||||
|
T1.performer_check_id,
|
||||||
|
T2."name" AS advice_name,
|
||||||
|
T2.id AS item_id,
|
||||||
|
NULL::varchar AS volume,
|
||||||
|
T1.lot_number AS lot_number,
|
||||||
|
T1.quantity AS quantity,
|
||||||
|
T1.unit_code AS unit_code,
|
||||||
|
T1.status_enum AS request_status,
|
||||||
|
NULL::varchar AS method_code,
|
||||||
|
T1.rate_code AS rate_code,
|
||||||
|
NULL::numeric AS dose,
|
||||||
|
NULL::varchar AS dose_unit_code,
|
||||||
|
ao1.id AS position_id,
|
||||||
|
ao1."name" AS position_name,
|
||||||
|
NULL::integer AS dispense_per_duration,
|
||||||
|
1::numeric AS part_percent,
|
||||||
|
ccd."name" AS condition_definition_name,
|
||||||
|
NULL::integer AS therapy_enum,
|
||||||
|
NULL::integer AS sort_number,
|
||||||
|
T1.quantity AS execute_num,
|
||||||
|
af.day_times,
|
||||||
|
ae.bus_no,
|
||||||
|
ap."name" AS patient_name,
|
||||||
|
al2."name" AS bed_name,
|
||||||
|
ap.gender_enum,
|
||||||
|
ap.birth_date,
|
||||||
|
ap.id AS patient_id,
|
||||||
|
fc.contract_name,
|
||||||
|
diagnosis.condition_names,
|
||||||
|
pra."name" AS admitting_doctor_name,
|
||||||
|
personal_account.balance_amount,
|
||||||
|
personal_account.id AS account_id,
|
||||||
|
T2.category_code,
|
||||||
|
NULL::integer AS dispense_status,
|
||||||
|
NULL::numeric AS unit_price,
|
||||||
|
NULL::numeric AS total_price,
|
||||||
|
NULL::bigint AS stopper_id,
|
||||||
|
NULL::varchar AS stopper_name
|
||||||
|
FROM wor_device_request AS T1
|
||||||
|
LEFT JOIN adm_device_definition AS T2
|
||||||
|
ON T2.id = T1.device_def_id
|
||||||
|
AND T2.delete_flag = '0'
|
||||||
|
LEFT JOIN adm_organization AS ao1
|
||||||
|
ON ao1.id = T1.org_id
|
||||||
|
AND ao1.delete_flag = '0'
|
||||||
|
LEFT JOIN cli_condition AS cc
|
||||||
|
ON cc.id = T1.condition_id
|
||||||
|
AND cc.delete_flag = '0'
|
||||||
|
LEFT JOIN cli_condition_definition AS ccd
|
||||||
|
ON ccd.id = cc.definition_id
|
||||||
|
AND ccd.delete_flag = '0'
|
||||||
|
LEFT JOIN adm_encounter ae
|
||||||
|
ON ae.id = T1.encounter_id
|
||||||
|
AND ae.class_enum = #{imp}
|
||||||
|
AND ae.delete_flag = '0'
|
||||||
|
LEFT JOIN adm_patient ap
|
||||||
|
ON ae.patient_id = ap.id
|
||||||
|
AND ap.delete_flag = '0'
|
||||||
|
LEFT JOIN adm_encounter_location ael
|
||||||
|
ON ae.id = ael.encounter_id
|
||||||
|
AND ael.delete_flag = '0'
|
||||||
|
AND ael.status_enum = #{active}
|
||||||
|
AND ael.form_enum = #{bed}
|
||||||
|
LEFT JOIN adm_location al2
|
||||||
|
ON ael.location_id = al2.id
|
||||||
|
AND al2.delete_flag = '0'
|
||||||
|
LEFT JOIN adm_account aa
|
||||||
|
ON ae.id = aa.encounter_id
|
||||||
|
AND aa.encounter_flag = 1
|
||||||
|
AND aa.delete_flag = '0'
|
||||||
|
LEFT JOIN fin_contract fc
|
||||||
|
ON aa.contract_no = fc.bus_no
|
||||||
|
AND fc.delete_flag = '0'
|
||||||
|
LEFT JOIN ( SELECT aed.encounter_id,
|
||||||
|
STRING_AGG(ccd.name, ', ') AS condition_names
|
||||||
|
FROM adm_encounter_diagnosis aed
|
||||||
|
INNER JOIN cli_condition cc
|
||||||
|
ON cc.id = aed.condition_id
|
||||||
|
AND cc.delete_flag = '0'
|
||||||
|
INNER JOIN cli_condition_definition ccd
|
||||||
|
ON ccd.id = cc.definition_id
|
||||||
|
AND ccd.delete_flag = '0'
|
||||||
|
WHERE aed.delete_flag = '0'
|
||||||
|
GROUP BY aed.encounter_id
|
||||||
|
) AS diagnosis
|
||||||
|
ON ae.id = diagnosis.encounter_id
|
||||||
|
LEFT JOIN adm_encounter_participant aep
|
||||||
|
ON ae.id = aep.encounter_id
|
||||||
|
AND aep.delete_flag = '0'
|
||||||
|
AND aep.status_enum = #{active}
|
||||||
|
AND aep.type_code = #{admittingDoctor}
|
||||||
|
LEFT JOIN adm_practitioner pra
|
||||||
|
ON aep.practitioner_id = pra.id
|
||||||
|
AND pra.delete_flag = '0'
|
||||||
|
LEFT JOIN ( SELECT aa.id,
|
||||||
|
aa.encounter_id,
|
||||||
|
(aa.balance_amount -
|
||||||
|
COALESCE(SUM(CASE WHEN aci.status_enum IN (#{billed}, #{billable})
|
||||||
|
THEN aci.total_price ELSE 0 END), 0) +
|
||||||
|
COALESCE(SUM(CASE WHEN aci.status_enum = #{refunded}
|
||||||
|
THEN aci.total_price ELSE 0 END), 0)) AS balance_amount
|
||||||
|
FROM adm_account aa
|
||||||
|
LEFT JOIN adm_charge_item aci
|
||||||
|
ON aa.encounter_id = aci.encounter_id
|
||||||
|
AND aa.delete_flag = '0'
|
||||||
|
WHERE aa.type_code = #{personalCashAccount}
|
||||||
|
AND aa.delete_flag = '0'
|
||||||
|
GROUP BY aa.id,
|
||||||
|
aa.encounter_id,
|
||||||
|
aa.balance_amount
|
||||||
|
) AS personal_account
|
||||||
|
ON personal_account.encounter_id = ae.id
|
||||||
|
LEFT JOIN adm_frequency af
|
||||||
|
ON af.rate_code = T1.rate_code
|
||||||
|
AND af.delete_flag = '0'
|
||||||
|
WHERE T1.delete_flag = '0'
|
||||||
|
AND T1.generate_source_enum = #{doctorPrescription}
|
||||||
|
AND CASE WHEN T1.status_enum = #{draft}
|
||||||
|
THEN FALSE
|
||||||
|
ELSE TRUE END
|
||||||
|
ORDER BY T1.status_enum )
|
||||||
) AS ii
|
) AS ii
|
||||||
${ew.customSqlSegment}
|
${ew.customSqlSegment}
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -140,7 +140,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getRequestFormDetail" resultType="com.healthlink.his.web.regdoctorstation.dto.RequestFormDetailQueryDto">
|
<select id="getRequestFormDetail" resultType="com.healthlink.his.web.regdoctorstation.dto.RequestFormDetailQueryDto">
|
||||||
SELECT wsr.activity_id AS activity_id,
|
SELECT wsr.activity_id AS advice_definition_id,
|
||||||
wsr.quantity,
|
wsr.quantity,
|
||||||
wsr.unit_code,
|
wsr.unit_code,
|
||||||
COALESCE(wad.NAME, wsr.content_json::jsonb->>'surgeryName') AS advice_name,
|
COALESCE(wad.NAME, wsr.content_json::jsonb->>'surgeryName') AS advice_name,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ rem 设置项目根目录
|
|||||||
set PROJECT_ROOT=%~dp0
|
set PROJECT_ROOT=%~dp0
|
||||||
|
|
||||||
rem 设置classpath
|
rem 设置classpath
|
||||||
set CLASSPATH=%PROJECT_ROOT%openhis-application\target\classes;%PROJECT_ROOT%openhis-domain\target\classes;%PROJECT_ROOT%openhis-common\target\classes;%PROJECT_ROOT%core-admin\target\classes;%PROJECT_ROOT%core-framework\target\classes;%PROJECT_ROOT%core-system\target\classes;%PROJECT_ROOT%core-quartz\target\classes;%PROJECT_ROOT%core-generator\target\classes;%PROJECT_ROOT%core-flowable\target\classes;%PROJECT_ROOT%core-common\target\classes
|
set CLASSPATH=%PROJECT_ROOT%healthlink-his-application\target\classes;%PROJECT_ROOT%healthlink-his-domain\target\classes;%PROJECT_ROOT%healthlink-his-common\target\classes;%PROJECT_ROOT%core-admin\target\classes;%PROJECT_ROOT%core-framework\target\classes;%PROJECT_ROOT%core-system\target\classes;%PROJECT_ROOT%core-quartz\target\classes;%PROJECT_ROOT%core-generator\target\classes;%PROJECT_ROOT%core-flowable\target\classes;%PROJECT_ROOT%core-common\target\classes
|
||||||
|
|
||||||
rem 启动应用
|
rem 启动应用
|
||||||
java -cp "%CLASSPATH%" com.openhis.OpenHisApplication
|
java -cp "%CLASSPATH%" com.healthlink.his.HealthLinkHisApplication
|
||||||
@@ -4,10 +4,10 @@
|
|||||||
PROJECT_ROOT=$(pwd)
|
PROJECT_ROOT=$(pwd)
|
||||||
|
|
||||||
# 设置classpath
|
# 设置classpath
|
||||||
CLASSPATH="$PROJECT_ROOT/openhis-application/target/classes:$PROJECT_ROOT/openhis-domain/target/classes:$PROJECT_ROOT/openhis-common/target/classes:$PROJECT_ROOT/core-admin/target/classes:$PROJECT_ROOT/core-framework/target/classes:$PROJECT_ROOT/core-system/target/classes:$PROJECT_ROOT/core-quartz/target/classes:$PROJECT_ROOT/core-generator/target/classes:$PROJECT_ROOT/core-flowable/target/classes:$PROJECT_ROOT/core-common/target/classes"
|
CLASSPATH="$PROJECT_ROOT/healthlink-his-application/target/classes:$PROJECT_ROOT/healthlink-his-domain/target/classes:$PROJECT_ROOT/healthlink-his-common/target/classes:$PROJECT_ROOT/core-admin/target/classes:$PROJECT_ROOT/core-framework/target/classes:$PROJECT_ROOT/core-system/target/classes:$PROJECT_ROOT/core-quartz/target/classes:$PROJECT_ROOT/core-generator/target/classes:$PROJECT_ROOT/core-flowable/target/classes:$PROJECT_ROOT/core-common/target/classes"
|
||||||
|
|
||||||
# 添加所有依赖jar包
|
# 添加所有依赖jar包
|
||||||
export CLASSPATH="$CLASSPATH:$(find $PROJECT_ROOT/openhis-application/target/dependency -name '*.jar' | tr '\n' ':')"
|
export CLASSPATH="$CLASSPATH:$(find $PROJECT_ROOT/healthlink-his-application/target/dependency -name '*.jar' | tr '\n' ':')"
|
||||||
|
|
||||||
# 启动应用
|
# 启动应用
|
||||||
java -cp "$CLASSPATH" com.openhis.OpenHisApplication
|
java -cp "$CLASSPATH" com.healthlink.his.HealthLinkHisApplication
|
||||||
@@ -277,7 +277,7 @@
|
|||||||
currentDetail.createTime || '-'
|
currentDetail.createTime || '-'
|
||||||
}}
|
}}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="手术单号">
|
<el-descriptions-item label="处方号">
|
||||||
{{
|
{{
|
||||||
currentDetail.prescriptionNo || '-'
|
currentDetail.prescriptionNo || '-'
|
||||||
}}
|
}}
|
||||||
@@ -574,7 +574,14 @@ const handleEdit = async (row) => {
|
|||||||
editFormRef.value?.getLocationInfo?.();
|
editFormRef.value?.getLocationInfo?.();
|
||||||
editFormRef.value?.getDiagnosisList?.();
|
editFormRef.value?.getDiagnosisList?.();
|
||||||
editFormRef.value?.loadDoctorOptions?.();
|
editFormRef.value?.loadDoctorOptions?.();
|
||||||
// fillForm 由 SurgeryForm 内部 editData watcher 在 getList 完成后自动调用
|
await editFormRef.value?.getList?.();
|
||||||
|
if (row.requestFormDetailList?.length > 0) {
|
||||||
|
editFormRef.value?.fillForm?.(
|
||||||
|
JSON.parse(row.descJson || '{}'),
|
||||||
|
row.requestFormDetailList,
|
||||||
|
row.requestFormId
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleEditSubmitOk = async () => {
|
const handleEditSubmitOk = async () => {
|
||||||
|
|||||||
@@ -356,7 +356,6 @@ let surgeryRecordsCache = null; // 原始 API 记录
|
|||||||
let surgeryMappedCache = null; // 映射后的 el-transfer 数据
|
let surgeryMappedCache = null; // 映射后的 el-transfer 数据
|
||||||
let doctorCache = null; // 医生列表(含默认主刀医生 ID)
|
let doctorCache = null; // 医生列表(含默认主刀医生 ID)
|
||||||
const transferRef = ref(null);
|
const transferRef = ref(null);
|
||||||
const listLoaded = ref(false); // 手术项目列表是否已加载完成
|
|
||||||
const dbTotal = ref(0); // 数据库中的手术项目总数
|
const dbTotal = ref(0); // 数据库中的手术项目总数
|
||||||
const checkedCount = computed(() => transferValue.value.length);
|
const checkedCount = computed(() => transferValue.value.length);
|
||||||
const leftPanelFormat = computed(() => ({
|
const leftPanelFormat = computed(() => ({
|
||||||
@@ -418,11 +417,10 @@ const getList = async (key) => {
|
|||||||
applicationList.value = surgeryMappedCache;
|
applicationList.value = surgeryMappedCache;
|
||||||
applicationListAll.value = surgeryRecordsCache;
|
applicationListAll.value = surgeryRecordsCache;
|
||||||
dbTotal.value = surgeryRecordsCache.length;
|
dbTotal.value = surgeryRecordsCache.length;
|
||||||
listLoaded.value = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
getSurgeryPage({
|
return getSurgeryPage({
|
||||||
pageSize: 1000,
|
pageSize: 1000,
|
||||||
keyword: key || undefined,
|
keyword: key || undefined,
|
||||||
})
|
})
|
||||||
@@ -438,14 +436,12 @@ const getList = async (key) => {
|
|||||||
surgeryMappedCache = applicationList.value;
|
surgeryMappedCache = applicationList.value;
|
||||||
}
|
}
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
listLoaded.value = true;
|
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.error('手术项目加载失败:', e);
|
console.error('手术项目加载失败:', e);
|
||||||
applicationList.value = [];
|
applicationList.value = [];
|
||||||
dbTotal.value = 0;
|
dbTotal.value = 0;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
listLoaded.value = true;
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -475,7 +471,7 @@ const mapToTransferItem = (item) => ({
|
|||||||
const fillForm = (descJson, details, formId) => {
|
const fillForm = (descJson, details, formId) => {
|
||||||
editingRequestFormId.value = formId || '';
|
editingRequestFormId.value = formId || '';
|
||||||
// 回填已选手术项目到穿梭框
|
// 回填已选手术项目到穿梭框
|
||||||
const ids = (details || []).map((d) => String(d.activityId));
|
const ids = (details || []).map((d) => String(d.adviceDefinitionId));
|
||||||
transferValue.value = ids;
|
transferValue.value = ids;
|
||||||
// 回填表单字段
|
// 回填表单字段
|
||||||
if (descJson) {
|
if (descJson) {
|
||||||
@@ -540,27 +536,6 @@ onMounted(() => {
|
|||||||
loadDoctorOptions();
|
loadDoctorOptions();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 编辑模式:等手术项目列表加载完成后回填穿梭框
|
|
||||||
watch(() => props.editData, (val) => {
|
|
||||||
if (!val) return;
|
|
||||||
const doFill = () => {
|
|
||||||
if (val.requestFormDetailList?.length > 0) {
|
|
||||||
fillForm(
|
|
||||||
JSON.parse(val.descJson || '{}'),
|
|
||||||
val.requestFormDetailList,
|
|
||||||
val.requestFormId
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if (listLoaded.value) {
|
|
||||||
doFill();
|
|
||||||
} else {
|
|
||||||
const unwatch = watch(listLoaded, (loaded) => {
|
|
||||||
if (loaded) { unwatch(); doFill(); }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, { immediate: true });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载字典选项
|
* 加载字典选项
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user