feat(techstation): 新增医技工作站控制器实现检查检验功能
- 实现医技执行功能,提供待执行列表查询接口支持检查和检验申请单 - 添加检查申请单执行确认功能,更新状态为已完成 - 添加检验申请单执行确认功能,更新状态为已执行 - 实现医技退费审批功能,提供待退费审批列表查询 - 添加检查申请单退费审批通过和驳回功能 - 添加检验申请单退费审批通过和驳回功能 - 集成检查和检验服务,统一管理申请单状态流转 - 支持多条件筛选查询,包括申请类型、患者姓名、申请单号等参数
This commit is contained in:
@@ -0,0 +1,337 @@
|
|||||||
|
package com.openhis.web.techstation.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.core.common.core.controller.BaseController;
|
||||||
|
import com.core.common.core.domain.AjaxResult;
|
||||||
|
import com.core.common.core.page.TableDataInfo;
|
||||||
|
import com.openhis.check.domain.ExamApply;
|
||||||
|
import com.openhis.check.domain.ExamApplyItem;
|
||||||
|
import com.openhis.check.service.IExamApplyItemService;
|
||||||
|
import com.openhis.check.service.IExamApplyService;
|
||||||
|
import com.openhis.lab.domain.InspectionLabApply;
|
||||||
|
import com.openhis.lab.service.IInspectionLabApplyService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 医技工作站 Controller
|
||||||
|
* <p>
|
||||||
|
* 职责:
|
||||||
|
* 1. 医技执行 — 查询待执行的检查/检验申请单,执行确认
|
||||||
|
* 2. 医技退费审批 — 查询待退费审批的申请单,审批通过/驳回
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/tech-station")
|
||||||
|
public class TechStationController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IExamApplyService examApplyService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IExamApplyItemService examApplyItemService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IInspectionLabApplyService inspectionLabApplyService;
|
||||||
|
|
||||||
|
// ========== 医技执行 ==========
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待执行列表(检查 + 检验)
|
||||||
|
* 查询已收费但未执行的申请单
|
||||||
|
*/
|
||||||
|
@GetMapping("/execute/list")
|
||||||
|
public TableDataInfo executeList(
|
||||||
|
@RequestParam(value = "applyType", required = false) String applyType,
|
||||||
|
@RequestParam(value = "patientName", required = false) String patientName,
|
||||||
|
@RequestParam(value = "applyNo", required = false) String applyNo,
|
||||||
|
@RequestParam(value = "startTime", required = false) String startTime,
|
||||||
|
@RequestParam(value = "endTime", required = false) String endTime) {
|
||||||
|
|
||||||
|
startPage();
|
||||||
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||||
|
|
||||||
|
// 查询检查申请单(exam_apply)
|
||||||
|
// applyStatus: 1=已收费, 2=已预约, 3=已签到 → 待执行
|
||||||
|
if (applyType == null || "exam".equals(applyType)) {
|
||||||
|
LambdaQueryWrapper<ExamApply> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(ExamApply::getIsCharged, 1)
|
||||||
|
.eq(ExamApply::getIsExecuted, 0)
|
||||||
|
.ne(ExamApply::getApplyStatus, 6); // 排除作废
|
||||||
|
if (patientName != null && !patientName.isEmpty()) {
|
||||||
|
wrapper.like(ExamApply::getPatientId, patientName);
|
||||||
|
}
|
||||||
|
if (applyNo != null && !applyNo.isEmpty()) {
|
||||||
|
wrapper.like(ExamApply::getApplyNo, applyNo);
|
||||||
|
}
|
||||||
|
wrapper.orderByDesc(ExamApply::getApplyTime);
|
||||||
|
List<ExamApply> examList = examApplyService.list(wrapper);
|
||||||
|
for (ExamApply exam : examList) {
|
||||||
|
Map<String, Object> item = new HashMap<>();
|
||||||
|
item.put("applyNo", exam.getApplyNo());
|
||||||
|
item.put("applyType", "exam");
|
||||||
|
item.put("applyTypeName", "检查");
|
||||||
|
item.put("patientId", exam.getPatientId());
|
||||||
|
item.put("visitNo", exam.getVisitNo());
|
||||||
|
item.put("applyDeptCode", exam.getApplyDeptCode());
|
||||||
|
item.put("applyDocCode", exam.getApplyDocCode());
|
||||||
|
item.put("applyTime", exam.getApplyTime());
|
||||||
|
item.put("clinicDesc", exam.getClinicDesc());
|
||||||
|
item.put("examTypeCode", exam.getExamTypeCode());
|
||||||
|
item.put("inspectionArea", exam.getInspectionArea());
|
||||||
|
item.put("inspectionMethod", exam.getInspectionMethod());
|
||||||
|
item.put("applyStatus", exam.getApplyStatus());
|
||||||
|
item.put("isUrgent", exam.getIsUrgent());
|
||||||
|
item.put("applyRemark", exam.getApplyRemark());
|
||||||
|
resultList.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询检验申请单(lab_apply)
|
||||||
|
// applyStatus: 2=已收费 → 待执行
|
||||||
|
if (applyType == null || "lab".equals(applyType)) {
|
||||||
|
LambdaQueryWrapper<InspectionLabApply> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(InspectionLabApply::getApplyStatus, 2L);
|
||||||
|
if (patientName != null && !patientName.isEmpty()) {
|
||||||
|
wrapper.like(InspectionLabApply::getPatientName, patientName);
|
||||||
|
}
|
||||||
|
if (applyNo != null && !applyNo.isEmpty()) {
|
||||||
|
wrapper.like(InspectionLabApply::getApplyNo, applyNo);
|
||||||
|
}
|
||||||
|
wrapper.orderByDesc(InspectionLabApply::getApplyTime);
|
||||||
|
List<InspectionLabApply> labList = inspectionLabApplyService.list(wrapper);
|
||||||
|
for (InspectionLabApply lab : labList) {
|
||||||
|
Map<String, Object> item = new HashMap<>();
|
||||||
|
item.put("applyNo", lab.getApplyNo());
|
||||||
|
item.put("applyType", "lab");
|
||||||
|
item.put("applyTypeName", "检验");
|
||||||
|
item.put("patientId", lab.getPatientId());
|
||||||
|
item.put("patientName", lab.getPatientName());
|
||||||
|
item.put("medicalrecordNumber", lab.getMedicalrecordNumber());
|
||||||
|
item.put("applyDeptCode", lab.getApplyDeptCode());
|
||||||
|
item.put("applyDepartment", lab.getApplyDepartment());
|
||||||
|
item.put("applyDocCode", lab.getApplyDocCode());
|
||||||
|
item.put("applyDocName", lab.getApplyDocName());
|
||||||
|
item.put("applyTime", lab.getApplyTime());
|
||||||
|
item.put("clinicDiag", lab.getClinicDiag());
|
||||||
|
item.put("inspectionItem", lab.getInspectionItem());
|
||||||
|
item.put("specimenName", lab.getSpecimenName());
|
||||||
|
item.put("priorityCode", lab.getPriorityCode());
|
||||||
|
item.put("applyStatus", lab.getApplyStatus());
|
||||||
|
item.put("applyRemark", lab.getApplyRemark());
|
||||||
|
resultList.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 按申请时间倒序排序
|
||||||
|
resultList.sort((a, b) -> {
|
||||||
|
Object timeA = a.get("applyTime");
|
||||||
|
Object timeB = b.get("applyTime");
|
||||||
|
if (timeA == null && timeB == null) return 0;
|
||||||
|
if (timeA == null) return 1;
|
||||||
|
if (timeB == null) return -1;
|
||||||
|
if (timeA instanceof LocalDateTime && timeB instanceof LocalDateTime) {
|
||||||
|
return ((LocalDateTime) timeB).compareTo((LocalDateTime) timeA);
|
||||||
|
}
|
||||||
|
if (timeA instanceof Date && timeB instanceof Date) {
|
||||||
|
return ((Date) timeB).compareTo((Date) timeA);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
return getDataTable(resultList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行确认(检查申请单)
|
||||||
|
*/
|
||||||
|
@PutMapping("/execute/exam/{applyNo}")
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult executeExam(@PathVariable String applyNo) {
|
||||||
|
ExamApply examApply = examApplyService.getById(applyNo);
|
||||||
|
if (examApply == null) {
|
||||||
|
return AjaxResult.error("申请单不存在");
|
||||||
|
}
|
||||||
|
if (examApply.getIsExecuted() == 1) {
|
||||||
|
return AjaxResult.error("该申请单已执行");
|
||||||
|
}
|
||||||
|
examApply.setIsExecuted(1);
|
||||||
|
examApply.setApplyStatus(5); // 已完成
|
||||||
|
examApplyService.updateById(examApply);
|
||||||
|
return AjaxResult.success("执行成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行确认(检验申请单)
|
||||||
|
*/
|
||||||
|
@PutMapping("/execute/lab/{applyNo}")
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult executeLab(@PathVariable String applyNo) {
|
||||||
|
LambdaQueryWrapper<InspectionLabApply> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(InspectionLabApply::getApplyNo, applyNo);
|
||||||
|
InspectionLabApply labApply = inspectionLabApplyService.getOne(wrapper);
|
||||||
|
if (labApply == null) {
|
||||||
|
return AjaxResult.error("申请单不存在");
|
||||||
|
}
|
||||||
|
if (labApply.getApplyStatus() == 3L) {
|
||||||
|
return AjaxResult.error("该申请单已执行");
|
||||||
|
}
|
||||||
|
labApply.setApplyStatus(3L); // 已执行/已完成
|
||||||
|
inspectionLabApplyService.updateById(labApply);
|
||||||
|
return AjaxResult.success("执行成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========== 医技退费审批 ==========
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待退费审批列表
|
||||||
|
* 查询 isRefunded=1(已申请退费)且需要审批的申请单
|
||||||
|
*/
|
||||||
|
@GetMapping("/refund-approve/list")
|
||||||
|
public TableDataInfo refundApproveList(
|
||||||
|
@RequestParam(value = "applyType", required = false) String applyType,
|
||||||
|
@RequestParam(value = "patientName", required = false) String patientName,
|
||||||
|
@RequestParam(value = "applyNo", required = false) String applyNo,
|
||||||
|
@RequestParam(value = "approveStatus", required = false) Integer approveStatus) {
|
||||||
|
|
||||||
|
startPage();
|
||||||
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||||
|
|
||||||
|
// 查询已申请退费的检查申请单
|
||||||
|
if (applyType == null || "exam".equals(applyType)) {
|
||||||
|
LambdaQueryWrapper<ExamApply> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(ExamApply::getIsRefunded, 1);
|
||||||
|
// applyStatus=6 表示作废(退费申请)
|
||||||
|
if (approveStatus != null) {
|
||||||
|
wrapper.eq(ExamApply::getApplyStatus, approveStatus);
|
||||||
|
}
|
||||||
|
if (patientName != null && !patientName.isEmpty()) {
|
||||||
|
wrapper.like(ExamApply::getPatientId, patientName);
|
||||||
|
}
|
||||||
|
if (applyNo != null && !applyNo.isEmpty()) {
|
||||||
|
wrapper.like(ExamApply::getApplyNo, applyNo);
|
||||||
|
}
|
||||||
|
wrapper.orderByDesc(ExamApply::getApplyTime);
|
||||||
|
List<ExamApply> examList = examApplyService.list(wrapper);
|
||||||
|
for (ExamApply exam : examList) {
|
||||||
|
Map<String, Object> item = new HashMap<>();
|
||||||
|
item.put("applyNo", exam.getApplyNo());
|
||||||
|
item.put("applyType", "exam");
|
||||||
|
item.put("applyTypeName", "检查");
|
||||||
|
item.put("patientId", exam.getPatientId());
|
||||||
|
item.put("visitNo", exam.getVisitNo());
|
||||||
|
item.put("applyDeptCode", exam.getApplyDeptCode());
|
||||||
|
item.put("applyDocCode", exam.getApplyDocCode());
|
||||||
|
item.put("applyTime", exam.getApplyTime());
|
||||||
|
item.put("clinicDesc", exam.getClinicDesc());
|
||||||
|
item.put("applyStatus", exam.getApplyStatus());
|
||||||
|
item.put("isRefunded", exam.getIsRefunded());
|
||||||
|
item.put("applyRemark", exam.getApplyRemark());
|
||||||
|
resultList.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询已申请退费的检验申请单(applyStatus=5 表示待退)
|
||||||
|
if (applyType == null || "lab".equals(applyType)) {
|
||||||
|
LambdaQueryWrapper<InspectionLabApply> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(InspectionLabApply::getApplyStatus, 5L);
|
||||||
|
if (patientName != null && !patientName.isEmpty()) {
|
||||||
|
wrapper.like(InspectionLabApply::getPatientName, patientName);
|
||||||
|
}
|
||||||
|
if (applyNo != null && !applyNo.isEmpty()) {
|
||||||
|
wrapper.like(InspectionLabApply::getApplyNo, applyNo);
|
||||||
|
}
|
||||||
|
wrapper.orderByDesc(InspectionLabApply::getApplyTime);
|
||||||
|
List<InspectionLabApply> labList = inspectionLabApplyService.list(wrapper);
|
||||||
|
for (InspectionLabApply lab : labList) {
|
||||||
|
Map<String, Object> item = new HashMap<>();
|
||||||
|
item.put("applyNo", lab.getApplyNo());
|
||||||
|
item.put("applyType", "lab");
|
||||||
|
item.put("applyTypeName", "检验");
|
||||||
|
item.put("patientId", lab.getPatientId());
|
||||||
|
item.put("patientName", lab.getPatientName());
|
||||||
|
item.put("medicalrecordNumber", lab.getMedicalrecordNumber());
|
||||||
|
item.put("applyDeptCode", lab.getApplyDeptCode());
|
||||||
|
item.put("applyDepartment", lab.getApplyDepartment());
|
||||||
|
item.put("applyDocCode", lab.getApplyDocCode());
|
||||||
|
item.put("applyDocName", lab.getApplyDocName());
|
||||||
|
item.put("applyTime", lab.getApplyTime());
|
||||||
|
item.put("clinicDiag", lab.getClinicDiag());
|
||||||
|
item.put("applyStatus", lab.getApplyStatus());
|
||||||
|
item.put("applyRemark", lab.getApplyRemark());
|
||||||
|
resultList.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return getDataTable(resultList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退费审批通过(检查)
|
||||||
|
*/
|
||||||
|
@PutMapping("/refund-approve/approve/exam/{applyNo}")
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult approveExamRefund(@PathVariable String applyNo) {
|
||||||
|
ExamApply examApply = examApplyService.getById(applyNo);
|
||||||
|
if (examApply == null) {
|
||||||
|
return AjaxResult.error("申请单不存在");
|
||||||
|
}
|
||||||
|
examApply.setApplyStatus(6); // 作废(退费完成)
|
||||||
|
examApplyService.updateById(examApply);
|
||||||
|
return AjaxResult.success("审批通过");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退费审批驳回(检查)
|
||||||
|
*/
|
||||||
|
@PutMapping("/refund-approve/reject/exam/{applyNo}")
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult rejectExamRefund(@PathVariable String applyNo) {
|
||||||
|
ExamApply examApply = examApplyService.getById(applyNo);
|
||||||
|
if (examApply == null) {
|
||||||
|
return AjaxResult.error("申请单不存在");
|
||||||
|
}
|
||||||
|
examApply.setIsRefunded(0); // 恢复为未退费
|
||||||
|
examApplyService.updateById(examApply);
|
||||||
|
return AjaxResult.success("已驳回");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退费审批通过(检验)
|
||||||
|
*/
|
||||||
|
@PutMapping("/refund-approve/approve/lab/{applyNo}")
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult approveLabRefund(@PathVariable String applyNo) {
|
||||||
|
LambdaQueryWrapper<InspectionLabApply> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(InspectionLabApply::getApplyNo, applyNo);
|
||||||
|
InspectionLabApply labApply = inspectionLabApplyService.getOne(wrapper);
|
||||||
|
if (labApply == null) {
|
||||||
|
return AjaxResult.error("申请单不存在");
|
||||||
|
}
|
||||||
|
labApply.setApplyStatus(6L); // 作废(退费完成)
|
||||||
|
inspectionLabApplyService.updateById(labApply);
|
||||||
|
return AjaxResult.success("审批通过");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退费审批驳回(检验)
|
||||||
|
*/
|
||||||
|
@PutMapping("/refund-approve/reject/lab/{applyNo}")
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult rejectLabRefund(@PathVariable String applyNo) {
|
||||||
|
LambdaQueryWrapper<InspectionLabApply> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(InspectionLabApply::getApplyNo, applyNo);
|
||||||
|
InspectionLabApply labApply = inspectionLabApplyService.getOne(wrapper);
|
||||||
|
if (labApply == null) {
|
||||||
|
return AjaxResult.error("申请单不存在");
|
||||||
|
}
|
||||||
|
labApply.setApplyStatus(2L); // 恢复为已收费
|
||||||
|
inspectionLabApplyService.updateById(labApply);
|
||||||
|
return AjaxResult.success("已驳回");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user