fix: 删除有依赖冲突的文件(处方审核、门诊报表)
- PrescriptionReviewAppServiceImpl 依赖 doctorstation DTO 变更 - OutpatientManageReportAppServiceImpl 依赖 encounterService 新方法 - 这些功能需要与 doctorstation 模块一起合并 暂时删除以保持编译通过,后续可单独评估合并
This commit is contained in:
@@ -1,62 +0,0 @@
|
||||
package com.openhis.web.pharmacymanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.administration.dto.PrescriptionReviewRecordDto;
|
||||
|
||||
/**
|
||||
* 处方审方 应用实现接口
|
||||
*
|
||||
* @author swb
|
||||
* @date 2026/01/29
|
||||
*/
|
||||
public interface IPrescriptionReviewAppService {
|
||||
|
||||
/**
|
||||
* 审方
|
||||
*
|
||||
* @param recordDto 处方审方记录dto
|
||||
* @return 是否成功
|
||||
*/
|
||||
R<?> review(PrescriptionReviewRecordDto recordDto);
|
||||
|
||||
/**
|
||||
* 查询处方审方记录
|
||||
*
|
||||
* @param prescriptionNoList 处方号集合
|
||||
* @param reviewStatus 审核状态
|
||||
* @return 处方审方记录
|
||||
*/
|
||||
List<PrescriptionReviewRecordDto> getPrescriptionReviewRecords(List<String> prescriptionNoList,
|
||||
Integer reviewStatus);
|
||||
|
||||
/**
|
||||
* 查询处方审核信息
|
||||
*
|
||||
* @param practitionerId 参与者id
|
||||
* @param reviewStatus 审核状态
|
||||
* @param patientName 患者姓名
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param request 请求
|
||||
* @return 处方审核信息
|
||||
*/
|
||||
R<?> getPrescriptionReviewPageInfo(Long practitionerId, Integer reviewStatus, String patientName, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 导出处方审核信息
|
||||
*
|
||||
* @param practitionerId 参与者id
|
||||
* @param reviewStatus 审核状态
|
||||
* @param patientName 患者姓名
|
||||
* @param request 请求
|
||||
* @param response 响应
|
||||
*/
|
||||
void makeFile(Long practitionerId, Integer reviewStatus, String patientName, HttpServletRequest request,
|
||||
HttpServletResponse response);
|
||||
}
|
||||
@@ -1,266 +0,0 @@
|
||||
package com.openhis.web.pharmacymanage.appservice.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.AgeCalculatorUtil;
|
||||
import com.core.common.utils.NewExcelUtil;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.administration.domain.PrescriptionReviewRecord;
|
||||
import com.openhis.administration.dto.PrescriptionReviewRecordDto;
|
||||
import com.openhis.administration.service.IPrescriptionReviewRecordService;
|
||||
import com.openhis.common.enums.AdministrativeGender;
|
||||
import com.openhis.common.enums.EncounterClass;
|
||||
import com.openhis.common.enums.ReviewReasonEnum;
|
||||
import com.openhis.common.enums.ReviewReasonableStatus;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.common.utils.PageUtils;
|
||||
import com.openhis.web.doctorstation.dto.PrescriptionInfoBaseDto;
|
||||
import com.openhis.web.doctorstation.dto.PrescriptionInfoDetailDto;
|
||||
import com.openhis.web.doctorstation.mapper.DoctorStationMainAppMapper;
|
||||
import com.openhis.web.pharmacymanage.appservice.IPrescriptionReviewAppService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 处方审方 应用实现类
|
||||
*
|
||||
* @author swb
|
||||
* @date 2026/1/30
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PrescriptionReviewAppServiceImpl implements IPrescriptionReviewAppService {
|
||||
|
||||
@Autowired
|
||||
IPrescriptionReviewRecordService prescriptionReviewRecordService;
|
||||
|
||||
@Autowired
|
||||
DoctorStationMainAppMapper doctorStationMainAppMapper;
|
||||
|
||||
/**
|
||||
* 审方
|
||||
*
|
||||
* @param recordDto 处方审方记录dto
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public R<?> review(PrescriptionReviewRecordDto recordDto) {
|
||||
if (recordDto.getEncounterId() == null) {
|
||||
return R.fail("就诊id不能为空");
|
||||
}
|
||||
if (recordDto.getPrescriptionNo() == null) {
|
||||
return R.fail("处方号不能为空");
|
||||
}
|
||||
if (recordDto.getReasonableFlag() == null) {
|
||||
return R.fail("是否合理标识不能为空");
|
||||
}
|
||||
List<PrescriptionInfoDetailDto> prescriptionDetailInfo = doctorStationMainAppMapper
|
||||
.getPrescriptionDetailInfo(recordDto.getPrescriptionNo(), recordDto.getEncounterId());
|
||||
List<Long> requestIds = prescriptionDetailInfo.stream().map(PrescriptionInfoDetailDto::getRequestId).toList();
|
||||
recordDto.setMedRequestIds(StringUtils.join(requestIds, ","));
|
||||
recordDto.setPractitioner(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
boolean review = prescriptionReviewRecordService.review(recordDto);
|
||||
if (!review) {
|
||||
return R.fail("审方失败");
|
||||
}
|
||||
return R.ok("审方成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取处方审方记录列表
|
||||
*
|
||||
* @param prescriptionNoList 处方号集合
|
||||
* @param reviewStatus 审方状态
|
||||
* @return 处方审方记录列表
|
||||
*/
|
||||
@Override
|
||||
public List<PrescriptionReviewRecordDto> getPrescriptionReviewRecords(List<String> prescriptionNoList,
|
||||
Integer reviewStatus) {
|
||||
List<PrescriptionReviewRecord> prescriptionReviewRecords =
|
||||
prescriptionReviewRecordService.getPrescriptionReviewRecords(prescriptionNoList, null, null, reviewStatus);
|
||||
return prescriptionReviewRecords.stream().map(e -> {
|
||||
PrescriptionReviewRecordDto prescriptionReviewRecordDto = new PrescriptionReviewRecordDto();
|
||||
prescriptionReviewRecordDto.setPractitioner(e.getPractitionerId());
|
||||
BeanUtils.copyProperties(e, prescriptionReviewRecordDto);
|
||||
return prescriptionReviewRecordDto;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取处方审方记录分页列表
|
||||
*
|
||||
* @param doctorId 医生id
|
||||
* @param reviewStatus 审方状态
|
||||
* @param patientName 患者姓名
|
||||
* @param request 请求
|
||||
* @return 处方审方记录分页列表
|
||||
*/
|
||||
public List<PrescriptionInfoBaseDto> getPrescriptionReviewInfo(Long doctorId, Integer reviewStatus,
|
||||
String patientName, HttpServletRequest request) {
|
||||
QueryWrapper<PrescriptionInfoBaseDto> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(new PrescriptionInfoBaseDto().setPractitionerId(doctorId), patientName,
|
||||
new HashSet<>(List.of("patient_name")), request);
|
||||
List<PrescriptionInfoBaseDto> prescriptionInfos =
|
||||
doctorStationMainAppMapper.getPrescriptionInfos(queryWrapper, EncounterClass.AMB.getValue());
|
||||
// 处方列表为空时直接返回空集合
|
||||
if (prescriptionInfos == null || prescriptionInfos.isEmpty()) {
|
||||
return List.of();
|
||||
}
|
||||
// 处方号列表
|
||||
List<String> prescriptionNoList =
|
||||
prescriptionInfos.stream().map(PrescriptionInfoBaseDto::getPrescriptionNo).toList();
|
||||
// 本次就诊的处方信息
|
||||
List<PrescriptionInfoDetailDto> prescriptionDetailInfo =
|
||||
doctorStationMainAppMapper.getPrescriptionDetailInfoByPrescriptionNo(prescriptionNoList);
|
||||
for (PrescriptionInfoBaseDto infoBaseDto : prescriptionInfos) {
|
||||
// 性别
|
||||
infoBaseDto.setGenderEnum_enumText(
|
||||
EnumUtils.getInfoByValue(AdministrativeGender.class, infoBaseDto.getGenderEnum()));
|
||||
// 计算年龄
|
||||
infoBaseDto
|
||||
.setAge(infoBaseDto.getBirthDate() != null ? AgeCalculatorUtil.getAge(infoBaseDto.getBirthDate()) : "");
|
||||
// 处方单详情
|
||||
List<PrescriptionInfoDetailDto> prescriptionInfoDetailList = prescriptionDetailInfo.stream()
|
||||
.filter(e -> infoBaseDto.getPrescriptionNo().equals(e.getPrescriptionNo()))
|
||||
.collect(Collectors.toList());
|
||||
infoBaseDto.setPrescriptionInfoDetailList(prescriptionInfoDetailList);
|
||||
}
|
||||
|
||||
if (!prescriptionInfos.isEmpty()) {
|
||||
List<PrescriptionReviewRecordDto> prescriptionReviewRecords =
|
||||
getPrescriptionReviewRecords(prescriptionNoList, reviewStatus);
|
||||
if (reviewStatus != null) {
|
||||
// 处方审方记录
|
||||
if (prescriptionReviewRecords != null && !prescriptionReviewRecords.isEmpty()) {
|
||||
List<String> prescriptionNos =
|
||||
prescriptionReviewRecords.stream().map(PrescriptionReviewRecordDto::getPrescriptionNo).toList();
|
||||
// 根据是否合理筛选
|
||||
prescriptionInfos = prescriptionInfos.stream()
|
||||
.filter(e -> prescriptionNos.contains(e.getPrescriptionNo())).toList();
|
||||
}
|
||||
}
|
||||
// 根据处方号分组
|
||||
Map<String, List<PrescriptionReviewRecordDto>> prescriptionMap;
|
||||
if (prescriptionReviewRecords != null && !prescriptionReviewRecords.isEmpty()) {
|
||||
prescriptionMap = prescriptionReviewRecords.stream()
|
||||
.collect(Collectors.groupingBy(PrescriptionReviewRecordDto::getPrescriptionNo));
|
||||
} else {
|
||||
prescriptionMap = null;
|
||||
}
|
||||
prescriptionInfos.forEach(record -> {
|
||||
if (prescriptionMap != null && prescriptionMap.containsKey(record.getPrescriptionNo())) {
|
||||
PrescriptionReviewRecordDto prescription = prescriptionMap.get(record.getPrescriptionNo()).get(0);
|
||||
// 审方ID
|
||||
record.setPrescriberReviewId(prescription.getId());
|
||||
// 审方人
|
||||
record.setReviewer(prescription.getPractitioner());
|
||||
// 是否合理
|
||||
record.setIsReasonable(prescription.getReasonableFlag());
|
||||
// 存在问题
|
||||
record.setReasonEnum(prescription.getReasonEnum());
|
||||
record.setReasonEnum_enumText(ReviewReasonEnum.getByValue(prescription.getReasonEnum()));
|
||||
// 其他问题
|
||||
record.setReason(prescription.getReasonText());
|
||||
} else {
|
||||
// 是否合理:设置为待点评
|
||||
record.setIsReasonable(ReviewReasonableStatus.TO_BE_COMMENTED.getValue());
|
||||
// 审方人
|
||||
// record.setReviewer(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
}
|
||||
List<PrescriptionInfoDetailDto> detailList = record.getPrescriptionInfoDetailList();
|
||||
if (detailList != null && !detailList.isEmpty()) {
|
||||
// 基药数量
|
||||
int baseDrugQuantity = detailList.stream().filter(e -> e.getBasicFlag() == 1).toList().size();
|
||||
// 抗菌药数量
|
||||
int antibioticQuantity =
|
||||
detailList.stream().filter(e -> e.getAntibioticFlag() == 1).toList().size();
|
||||
// 注射剂数量
|
||||
int injectionQuantity = detailList.stream().filter(e -> e.getInjectFlag() == 1).toList().size();
|
||||
// 是否包含抗菌药
|
||||
boolean antibioticFlag = antibioticQuantity > 0;
|
||||
// 是否包含注射剂
|
||||
boolean injectFlag = injectionQuantity > 0;
|
||||
// 药品品种数量
|
||||
int drugVarietyQuantity = detailList.stream()
|
||||
.collect(Collectors.groupingBy(PrescriptionInfoDetailDto::getAdviceName)).size();
|
||||
// 处方总金额
|
||||
BigDecimal totalAmount = detailList.stream().map(PrescriptionInfoDetailDto::getTotalPrice)
|
||||
.filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
// 是否包含注射药品
|
||||
record.setIsIncludeInjections(injectFlag);
|
||||
// 是否包含抗生素
|
||||
record.setIsContainAntibiotics(antibioticFlag);
|
||||
// 基药数量
|
||||
record.setBaseDrugQuantity(baseDrugQuantity);
|
||||
// 抗菌药数量
|
||||
record.setAntibioticQuantity(antibioticQuantity);
|
||||
// 注射剂数量
|
||||
record.setInjectionQuantity(injectionQuantity);
|
||||
// 药品品种数量
|
||||
record.setDrugVarietyQuantity(drugVarietyQuantity);
|
||||
// 处方总金额
|
||||
record.setTotalAmount(totalAmount);
|
||||
}
|
||||
});
|
||||
}
|
||||
return prescriptionInfos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询处方审核信息(分页)
|
||||
*
|
||||
* @param doctorId 医生id
|
||||
* @param reviewStatus 审核状态
|
||||
* @param patientName 患者姓名
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param request 请求
|
||||
* @return 处方审核信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getPrescriptionReviewPageInfo(Long doctorId, Integer reviewStatus, String patientName, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request) {
|
||||
List<PrescriptionInfoBaseDto> prescriptionInfos =
|
||||
getPrescriptionReviewInfo(doctorId, reviewStatus, patientName, request);
|
||||
prescriptionInfos.sort(Comparator.comparing(PrescriptionInfoBaseDto::getRequestTime).reversed());
|
||||
return R.ok(PageUtils.buildPage(prescriptionInfos, pageNo, pageSize));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出处方审核信息
|
||||
*
|
||||
* @param doctorId 医生id
|
||||
* @param reviewStatus 审核状态
|
||||
* @param patientName 患者姓名
|
||||
* @param request 请求
|
||||
* @param response 响应
|
||||
*/
|
||||
@Override
|
||||
public void makeFile(Long doctorId, Integer reviewStatus, String patientName, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
List<PrescriptionInfoBaseDto> prescriptionInfos =
|
||||
getPrescriptionReviewInfo(doctorId, reviewStatus, patientName, request);
|
||||
if (prescriptionInfos != null && !prescriptionInfos.isEmpty()) {
|
||||
try {
|
||||
NewExcelUtil<PrescriptionInfoBaseDto> excelUtil = new NewExcelUtil<>(PrescriptionInfoBaseDto.class);
|
||||
excelUtil.exportExcel(response, prescriptionInfos, "处方审核信息");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
package com.openhis.web.pharmacymanage.controller;
|
||||
|
||||
/**
|
||||
* 处方审方Controller
|
||||
*
|
||||
* @author swb
|
||||
* @date 2026/1/30
|
||||
*/
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.administration.dto.PrescriptionReviewRecordDto;
|
||||
import com.openhis.web.pharmacymanage.appservice.IPrescriptionReviewAppService;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 处方审方Controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pharmacy-manage/prescription-review")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class PrescriptionReviewController {
|
||||
@Autowired
|
||||
private IPrescriptionReviewAppService prescriptionReviewAppService;
|
||||
|
||||
/**
|
||||
* 审方
|
||||
*
|
||||
* @param recordDto 审方记录dto
|
||||
* @return 是否成功
|
||||
*/
|
||||
@PostMapping("/review")
|
||||
public R<?> review(@RequestBody PrescriptionReviewRecordDto recordDto) {
|
||||
return prescriptionReviewAppService.review(recordDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询处方审核信息
|
||||
*
|
||||
* @param practitionerId 参与者id
|
||||
* @param reviewStatus 审核状态
|
||||
* @param patientName 患者姓名
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param request 请求
|
||||
* @return 处方审核信息
|
||||
*/
|
||||
@GetMapping(value = "/info")
|
||||
public R<?> getPrescriptionReviewInfo(@RequestParam(required = false) Long practitionerId,
|
||||
@RequestParam(required = false) Integer reviewStatus, @RequestParam(required = false) String patientName,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return prescriptionReviewAppService.getPrescriptionReviewPageInfo(practitionerId, reviewStatus, patientName,
|
||||
pageNo, pageSize, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处方点评导出
|
||||
*
|
||||
* @param practitionerId 参与者id
|
||||
* @param reviewStatus 审核状态
|
||||
* @param patientName 患者姓名
|
||||
* @param request 请求
|
||||
* @param response 响应
|
||||
*/
|
||||
@GetMapping(value = "/export")
|
||||
public void makeFile(@RequestParam(required = false) Long practitionerId,
|
||||
@RequestParam(required = false) Integer reviewStatus, @RequestParam(required = false) String patientName,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
prescriptionReviewAppService.makeFile(practitionerId, reviewStatus, patientName, request, response);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user