fix: 删除有依赖冲突的文件(处方审核、门诊报表)
- PrescriptionReviewAppServiceImpl 依赖 doctorstation DTO 变更 - OutpatientManageReportAppServiceImpl 依赖 encounterService 新方法 - 这些功能需要与 doctorstation 模块一起合并 暂时删除以保持编译通过,后续可单独评估合并
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
# Web Layer - API Controllers
|
||||
|
||||
**Module**: `openhis-application/web`
|
||||
**Role**: API endpoint layer - all REST controllers for frontend communication
|
||||
|
||||
## OVERVIEW
|
||||
46 web modules serving REST APIs for all business functionality.
|
||||
|
||||
## STRUCTURE
|
||||
```
|
||||
web/
|
||||
├── [module-name]/
|
||||
│ ├── controller/ # REST endpoints (@RestController)
|
||||
│ ├── dto/ # Data transfer objects
|
||||
│ ├── mapper/ # MyBatis mappers (if module-specific)
|
||||
│ └── appservice/ # Application service layer
|
||||
│ └── impl/
|
||||
```
|
||||
|
||||
## WHERE TO LOOK
|
||||
| Task | Location |
|
||||
|------|----------|
|
||||
| API endpoints | `*/controller/*Controller.java` |
|
||||
| Request/Response schemas | `*/dto/*.java` |
|
||||
| Business logic orchestration | `*/appservice/*.java` |
|
||||
|
||||
## CONVENTIONS
|
||||
- Controllers: `@RestController`, `@RequestMapping("/module-name")`
|
||||
- Standard response: `AjaxResult` from core-common
|
||||
- DTO naming: `XxxRequest`, `XxxResponse`, `XxxDTO`
|
||||
- Service pattern: interface in `appservice/`, impl in `appservice/impl/`
|
||||
- API naming: `listXxx()`, `getXxx()`, `addXxx()`, `updateXxx()`, `deleteXxx()`
|
||||
|
||||
## ANTI-PATTERNS
|
||||
- Never put business logic in controllers - delegate to appservice
|
||||
- Never return raw entities - use DTOs
|
||||
- Never bypass `AjaxResult` wrapper
|
||||
- Never create module-specific mappers without justification
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.openhis.web.reportmanage.appservice;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.reportmanage.dto.OutpatientManageParam;
|
||||
|
||||
/**
|
||||
* 门诊记录相关报表 appservice
|
||||
*
|
||||
* @author swb
|
||||
* @date 2026/2/27
|
||||
*/
|
||||
public interface IOutpatientManageReportAppService {
|
||||
/**
|
||||
* 门诊就诊记录初始化
|
||||
*
|
||||
* @return 门诊就诊记录数据
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 获取门诊就诊记录分页数据
|
||||
*
|
||||
* @param outpatientManageParam 查询参数
|
||||
* @param searchKey 模糊查询条件
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 每页数量
|
||||
* @param request 请求
|
||||
* @return 门诊就诊记录分页数据
|
||||
*/
|
||||
R<?> getOutpatientRecordPage(OutpatientManageParam outpatientManageParam, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request);
|
||||
|
||||
void ExportExcel(OutpatientManageParam outpatientManageParam, String searchKey, HttpServletRequest request, HttpServletResponse response);
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
package com.openhis.web.reportmanage.appservice.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.core.common.exception.NonCaptureException;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.NewExcelUtil;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.core.common.utils.poi.ExcelUtil;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.web.document.util.EnumUtil;
|
||||
import com.openhis.web.inventorymanage.dto.ProductDetailPageDto;
|
||||
import com.openhis.web.reportmanage.dto.InboundReportPageDto;
|
||||
import com.openhis.web.reportmanage.dto.InboundReportSearchParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.administration.dto.OutpatientManageDto;
|
||||
import com.openhis.administration.service.IEncounterService;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.common.utils.PageUtils;
|
||||
import com.openhis.web.reportmanage.appservice.IOutpatientManageReportAppService;
|
||||
import com.openhis.web.reportmanage.dto.OutpatientManageParam;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
/**
|
||||
* 门诊记录相关报表 应用实现类
|
||||
*
|
||||
* @author swb
|
||||
* @date 2026/2/27
|
||||
*/
|
||||
@Service
|
||||
public class OutpatientManageReportAppServiceImpl implements IOutpatientManageReportAppService {
|
||||
@Autowired
|
||||
IEncounterService encounterService;
|
||||
|
||||
/**
|
||||
* 门诊就诊记录初始化
|
||||
*
|
||||
* @return 门诊就诊记录
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
List<OutpatientManageDto> medicalRecord =
|
||||
encounterService.getMedicalRecord(HisQueryUtils.buildQueryWrapper(null, null, null, null));
|
||||
Page<OutpatientManageDto> page = PageUtils.buildPage(medicalRecord, 1, 10);
|
||||
return R.ok(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询门诊就诊记录
|
||||
*
|
||||
* @param outpatientManageParam 查询参数
|
||||
* @param searchKey 模糊查询条件
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 每页数量
|
||||
* @param request 请求
|
||||
* @return 门诊就诊记录
|
||||
*/
|
||||
@Override
|
||||
public R<?> getOutpatientRecordPage(OutpatientManageParam outpatientManageParam, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request) {
|
||||
QueryWrapper<OutpatientManageDto> wrapper = HisQueryUtils.buildQueryWrapper(outpatientManageParam, searchKey,
|
||||
new HashSet<>(Arrays.asList("encounterStatus","id_card", "patient_bus_no", "encounter_bus_no", "name")), request);
|
||||
// 查询挂号记录
|
||||
List<OutpatientManageDto> medicalRecords = encounterService.getMedicalRecord(wrapper);
|
||||
Page<OutpatientManageDto> page = PageUtils.buildPage(medicalRecords, pageNo, pageSize);
|
||||
return R.ok(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 就诊记录导出
|
||||
*
|
||||
* @param outpatientManageParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @param response 响应数据
|
||||
*/
|
||||
@Override
|
||||
public void ExportExcel(OutpatientManageParam outpatientManageParam, String searchKey, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<OutpatientManageDto> wrapper = HisQueryUtils.buildQueryWrapper(outpatientManageParam, searchKey,
|
||||
new HashSet<>(Arrays.asList("encounterStatus","id_card", "patient_bus_no", "encounter_bus_no", "name")), request);
|
||||
|
||||
// 查询门诊记录数据
|
||||
List<OutpatientManageDto> medicalRecords = encounterService.getMedicalRecord(wrapper);
|
||||
List<OutpatientManageDto> receiptDetailList = medicalRecords;
|
||||
|
||||
// 记录为空的情况下,直接通过响应返回提示
|
||||
if (receiptDetailList.isEmpty()) {
|
||||
try {
|
||||
// 设置响应为JSON格式,返回无数据提示
|
||||
response.setContentType("application/json;charset=utf-8");
|
||||
response.getWriter().write("{\"code\":500,\"msg\":\"导出Excel失败,无数据。\",\"data\":null}");
|
||||
return;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// 执行Excel导出(ExcelUtil需正确设置响应头为Excel格式)
|
||||
String excelName = CommonConstants.SheetName.OUTPATIENT_MEDICAL_RECORD;
|
||||
ExcelUtil<OutpatientManageDto> util = new ExcelUtil<>(OutpatientManageDto.class);
|
||||
util.exportExcel(response, receiptDetailList, excelName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
// 异常时返回JSON格式的错误提示
|
||||
response.setContentType("application/json;charset=utf-8");
|
||||
response.getWriter().write("{\"code\":500,\"msg\":\"导出Excel失败:" + e.getMessage() + "\",\"data\":null}");
|
||||
} catch (IOException ioException) {
|
||||
throw new NonCaptureException(StringUtils.format("导出excel失败"), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
package com.openhis.web.reportmanage.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.openhis.common.enums.EncounterStatus;
|
||||
import com.openhis.web.document.util.EnumUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.reportmanage.appservice.IOutpatientManageReportAppService;
|
||||
import com.openhis.web.reportmanage.dto.OutpatientManageParam;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 门诊记录相关报表 controller
|
||||
*
|
||||
* @author swb
|
||||
* @date 2026/2/27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/patient-manage/records")
|
||||
@Slf4j
|
||||
public class OutpatientManageReportController {
|
||||
|
||||
@Autowired
|
||||
IOutpatientManageReportAppService outpatientManageReportAppService;
|
||||
|
||||
/**
|
||||
* 门诊就诊记录初始化
|
||||
*
|
||||
* @return 门诊就诊记录
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
return outpatientManageReportAppService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取就诊状态枚举
|
||||
*
|
||||
* @return 就诊状态
|
||||
*/
|
||||
|
||||
@GetMapping("/encounterStatusInit")
|
||||
public R<?> encounterStatusInit() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// 获取就诊状态枚举列表
|
||||
map.put("encounterStatus", EnumUtil.toMapList(EncounterStatus.class));
|
||||
return R.ok(map);
|
||||
}
|
||||
/**
|
||||
* 查询门诊就诊记录
|
||||
*
|
||||
* @param outpatientManageParam 查询参数
|
||||
* @param searchKey 模糊查询条件
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 每页数量
|
||||
* @param request 请求
|
||||
* @return 门诊就诊记录
|
||||
*/
|
||||
@GetMapping(value = "/outpatient-record-page")
|
||||
public R<?> getOutpatientRecordPage(OutpatientManageParam outpatientManageParam,
|
||||
@RequestParam(value = "searchKey", required = false) String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return outpatientManageReportAppService.getOutpatientRecordPage(outpatientManageParam, searchKey, pageNo,
|
||||
pageSize, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 就诊记录导出
|
||||
*
|
||||
* @param outpatientManageParam 搜索条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @param response 响应数据
|
||||
*/
|
||||
@GetMapping(value = "/export-excel")
|
||||
public void ExportExcel(OutpatientManageParam outpatientManageParam,
|
||||
@RequestParam(value = "searchKey", required = false) String searchKey,
|
||||
HttpServletRequest request, HttpServletResponse response){
|
||||
outpatientManageReportAppService.ExportExcel(outpatientManageParam, searchKey, request, response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.openhis.administration.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import com.openhis.common.enums.ReviewReasonableStatus;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 处方点评信息Dto
|
||||
*
|
||||
* @author swb
|
||||
* @date 2026/1/29
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PrescriptionReviewRecordDto {
|
||||
/**
|
||||
* 审方记录ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 就诊id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/**
|
||||
* 处方号
|
||||
*/
|
||||
private String prescriptionNo;
|
||||
|
||||
/**
|
||||
* 药品请求ids
|
||||
*/
|
||||
private String medRequestIds;
|
||||
|
||||
/**
|
||||
* 是否合理标识(0:不合理,1:合理,2:待点评)
|
||||
*/
|
||||
private Integer reasonableFlag;
|
||||
|
||||
/**
|
||||
* 存在问题
|
||||
*/
|
||||
private String reasonEnum;
|
||||
|
||||
/**
|
||||
* 其他问题
|
||||
*/
|
||||
private String reasonText;
|
||||
|
||||
/**
|
||||
* 审方人
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@Dict(dictTable = "ad_practitioner", dictCode = "id", dictText = "name")
|
||||
private Long practitioner;
|
||||
private String practitioner_dictText;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.openhis.administration.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.openhis.administration.domain.PrescriptionReviewRecord;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 处方点评记录Mapper接口
|
||||
*
|
||||
* @author swb
|
||||
* @date 2026/1/29
|
||||
*/
|
||||
@Repository
|
||||
public interface PrescriptionReviewRecordMapper extends BaseMapper<PrescriptionReviewRecord> {}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.openhis.administration.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.openhis.administration.domain.PrescriptionReviewRecord;
|
||||
import com.openhis.administration.dto.PrescriptionReviewRecordDto;
|
||||
|
||||
/**
|
||||
* 处方审方记录 服务类
|
||||
*
|
||||
* @author swb
|
||||
* @date 2026-01-29
|
||||
*/
|
||||
public interface IPrescriptionReviewRecordService extends IService<PrescriptionReviewRecord> {
|
||||
/**
|
||||
* 查询处方点评记录
|
||||
*
|
||||
* @param prescriptionNoList 处方号集合
|
||||
* @param encounterId 就诊id
|
||||
* @param practitionerId 审方人id
|
||||
* @param reasonableFlag 是否合理标识
|
||||
* @return 处方点评记录集合
|
||||
*/
|
||||
List<PrescriptionReviewRecord> getPrescriptionReviewRecords(List<String> prescriptionNoList, Long encounterId,
|
||||
Long practitionerId, Integer reasonableFlag);
|
||||
|
||||
/**
|
||||
* 审方
|
||||
*
|
||||
* @param recordDto 处方审方记录dto
|
||||
* @return 结果
|
||||
*/
|
||||
boolean review(PrescriptionReviewRecordDto recordDto);
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.openhis.administration.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.core.common.enums.DelFlag;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.administration.domain.PrescriptionReviewRecord;
|
||||
import com.openhis.administration.dto.PrescriptionReviewRecordDto;
|
||||
import com.openhis.administration.mapper.PrescriptionReviewRecordMapper;
|
||||
import com.openhis.administration.service.IPrescriptionReviewRecordService;
|
||||
|
||||
/**
|
||||
* 处方点评记录Service业务层处理
|
||||
*
|
||||
* @author swb
|
||||
* @date 2026/1/29
|
||||
*/
|
||||
@Service
|
||||
public class PrescriptionReviewRecordServiceImpl extends
|
||||
ServiceImpl<PrescriptionReviewRecordMapper, PrescriptionReviewRecord> implements IPrescriptionReviewRecordService {
|
||||
/**
|
||||
* 查询处方点评记录
|
||||
*
|
||||
* @param prescriptionNoList 处方号集合
|
||||
* @param encounterId 就诊id
|
||||
* @param practitionerId 审方人id
|
||||
* @param reasonableFlag 是否合理标识
|
||||
* @return 处方点评记录集合
|
||||
*/
|
||||
@Override
|
||||
public List<PrescriptionReviewRecord> getPrescriptionReviewRecords(List<String> prescriptionNoList,
|
||||
Long encounterId, Long practitionerId, Integer reasonableFlag) {
|
||||
LambdaQueryWrapper<PrescriptionReviewRecord> wrapper = new LambdaQueryWrapper<>();
|
||||
// 处方号
|
||||
wrapper.in(prescriptionNoList != null && !prescriptionNoList.isEmpty(),
|
||||
PrescriptionReviewRecord::getPrescriptionNo, prescriptionNoList);
|
||||
// 就诊id
|
||||
wrapper.eq(encounterId != null, PrescriptionReviewRecord::getEncounterId, encounterId);
|
||||
// 审方人id
|
||||
wrapper.eq(practitionerId != null, PrescriptionReviewRecord::getPractitionerId, practitionerId);
|
||||
// 是否合理标识
|
||||
wrapper.eq(reasonableFlag != null, PrescriptionReviewRecord::getReasonableFlag, reasonableFlag);
|
||||
// 未删除
|
||||
wrapper.eq(PrescriptionReviewRecord::getDeleteFlag, DelFlag.NO.getCode());
|
||||
// 查询处方点评记录
|
||||
return baseMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 审方
|
||||
*
|
||||
* @param recordDto 处方审方记录dto
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean review(PrescriptionReviewRecordDto recordDto) {
|
||||
PrescriptionReviewRecord prescriptionReviewRecord = new PrescriptionReviewRecord();
|
||||
BeanUtils.copyProperties(recordDto, prescriptionReviewRecord);
|
||||
prescriptionReviewRecord.setPractitionerId(recordDto.getPractitioner());
|
||||
if (recordDto.getId() != null) {
|
||||
return baseMapper.updateById(prescriptionReviewRecord) > 0;
|
||||
} else {
|
||||
return baseMapper.insert(prescriptionReviewRecord) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user