完成93需求
This commit is contained in:
@@ -21,9 +21,11 @@ public interface ISurgeryAppService {
|
||||
* @param surgeryDto 查询条件
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页条数
|
||||
* @param plannedTimeStart 计划开始时间
|
||||
* @param plannedTimeEnd 计划结束时间
|
||||
* @return 手术列表
|
||||
*/
|
||||
IPage<SurgeryDto> getSurgeryPage(SurgeryDto surgeryDto, Integer pageNo, Integer pageSize);
|
||||
IPage<SurgeryDto> getSurgeryPage(SurgeryDto surgeryDto, Integer pageNo, Integer pageSize, String plannedTimeStart, String plannedTimeEnd);
|
||||
|
||||
/**
|
||||
* 根据ID查询手术详情
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.openhis.web.clinicalmanage.appservice;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.clinicalmanage.dto.OpCreateScheduleDto;
|
||||
import com.openhis.web.clinicalmanage.dto.OpScheduleDto;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 手术安排业务层接口
|
||||
*
|
||||
* @author system
|
||||
* @date 2026-01-28
|
||||
*/
|
||||
public interface ISurgicalScheduleAppService {
|
||||
|
||||
/**
|
||||
* 分页查询手术安排列表
|
||||
*
|
||||
* @param opScheduleDto 查询条件
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页条数
|
||||
* @return 手术安排列表
|
||||
*/
|
||||
IPage<OpScheduleDto> getSurgerySchedulePage(OpScheduleDto opScheduleDto, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 根据ID查询手术安排详情
|
||||
*
|
||||
* @param scheduleId 手术安排ID
|
||||
* @return 手术安排详情
|
||||
*/
|
||||
R<OpScheduleDto> getSurgeryScheduleDetail(Long scheduleId);
|
||||
|
||||
/**
|
||||
* 新增手术安排
|
||||
*
|
||||
* @param opCreateScheduleDto 手术安排信息
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> addSurgerySchedule(OpCreateScheduleDto opCreateScheduleDto);
|
||||
|
||||
/**
|
||||
* 修改手术安排
|
||||
*
|
||||
* @param opScheduleDto 手术安排信息
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> updateSurgerySchedule(OpScheduleDto opScheduleDto);
|
||||
|
||||
/**
|
||||
* 删除手术安排
|
||||
*
|
||||
* @param scheduleId 手术安排ID
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> deleteSurgerySchedule(Long scheduleId);
|
||||
|
||||
/**
|
||||
* 导出手术安排列表
|
||||
*
|
||||
* @param opScheduleDto 查询条件
|
||||
* @param response 响应对象
|
||||
* @throws IOException 异常
|
||||
*/
|
||||
void exportSurgerySchedule(OpScheduleDto opScheduleDto, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
@@ -47,8 +47,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.core.framework.datasource.DynamicDataSourceContextHolder.log;
|
||||
|
||||
@@ -102,10 +103,12 @@ public class SurgeryAppServiceImpl implements ISurgeryAppService {
|
||||
* @param surgeryDto 查询条件
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页条数
|
||||
* @param plannedTimeStart 计划开始时间
|
||||
* @param plannedTimeEnd 计划结束时间
|
||||
* @return 手术列表
|
||||
*/
|
||||
@Override
|
||||
public IPage<SurgeryDto> getSurgeryPage(SurgeryDto surgeryDto, Integer pageNo, Integer pageSize) {
|
||||
public IPage<SurgeryDto> getSurgeryPage(SurgeryDto surgeryDto, Integer pageNo, Integer pageSize, String plannedTimeStart, String plannedTimeEnd) {
|
||||
QueryWrapper<SurgeryDto> queryWrapper = HisQueryUtils.buildQueryWrapper(surgeryDto, null,
|
||||
new HashSet<String>() {{
|
||||
add("surgery_no");
|
||||
@@ -115,6 +118,37 @@ public class SurgeryAppServiceImpl implements ISurgeryAppService {
|
||||
add("anesthetist_name");
|
||||
add("org_name");
|
||||
}}, null);
|
||||
|
||||
// 添加计划时间范围查询
|
||||
if (plannedTimeStart != null && !plannedTimeStart.isEmpty()) {
|
||||
try {
|
||||
LocalDateTime startDateTime = LocalDateTime.parse(plannedTimeStart, DateTimeFormatter.ISO_DATE_TIME);
|
||||
queryWrapper.ge("planned_time", startDateTime);
|
||||
} catch (Exception e) {
|
||||
// 如果解析失败,尝试使用日期格式解析
|
||||
try {
|
||||
LocalDateTime startDateTime = LocalDateTime.parse(plannedTimeStart + "T00:00:00", DateTimeFormatter.ISO_DATE_TIME);
|
||||
queryWrapper.ge("planned_time", startDateTime);
|
||||
} catch (Exception ex) {
|
||||
log.error("解析计划开始时间失败: {}", plannedTimeStart, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (plannedTimeEnd != null && !plannedTimeEnd.isEmpty()) {
|
||||
try {
|
||||
LocalDateTime endDateTime = LocalDateTime.parse(plannedTimeEnd, DateTimeFormatter.ISO_DATE_TIME);
|
||||
queryWrapper.le("planned_time", endDateTime);
|
||||
} catch (Exception e) {
|
||||
// 如果解析失败,尝试使用日期格式解析
|
||||
try {
|
||||
LocalDateTime endDateTime = LocalDateTime.parse(plannedTimeEnd + "T23:59:59", DateTimeFormatter.ISO_DATE_TIME);
|
||||
queryWrapper.le("planned_time", endDateTime);
|
||||
} catch (Exception ex) {
|
||||
log.error("解析计划结束时间失败: {}", plannedTimeEnd, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
return surgeryAppMapper.getSurgeryPage(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,302 @@
|
||||
package com.openhis.web.clinicalmanage.appservice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.core.domain.model.LoginUser;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.administration.domain.Patient;
|
||||
import com.openhis.administration.service.IPatientService;
|
||||
import com.openhis.surgicalschedule.domain.OpSchedule;
|
||||
import com.openhis.surgicalschedule.service.IOpScheduleService;
|
||||
import com.openhis.web.clinicalmanage.appservice.ISurgicalScheduleAppService;
|
||||
import com.openhis.web.clinicalmanage.dto.OpCreateScheduleDto;
|
||||
import com.openhis.web.clinicalmanage.dto.OpScheduleDto;
|
||||
import com.openhis.web.clinicalmanage.mapper.SurgicalScheduleAppMapper;
|
||||
import com.openhis.web.regdoctorstation.mapper.RequestFormManageAppMapper;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 手术安排业务层实现类
|
||||
*
|
||||
* @author system
|
||||
* @date 2026-01-28
|
||||
*/
|
||||
@Service
|
||||
public class SurgicalScheduleAppServiceImpl implements ISurgicalScheduleAppService {
|
||||
|
||||
@Resource
|
||||
private IOpScheduleService opScheduleService;
|
||||
|
||||
@Resource
|
||||
private IPatientService patientService;
|
||||
|
||||
@Resource
|
||||
private SurgicalScheduleAppMapper surgicalScheduleAppMapper;
|
||||
|
||||
|
||||
@Resource
|
||||
private RequestFormManageAppMapper requestFormManageAppMapper;
|
||||
/**
|
||||
* 分页查询手术安排列表
|
||||
*
|
||||
* @param opScheduleDto 查询条件
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页条数
|
||||
* @return 手术安排列表
|
||||
*/
|
||||
@Override
|
||||
public IPage<OpScheduleDto> getSurgerySchedulePage(OpScheduleDto opScheduleDto, Integer pageNo, Integer pageSize) {
|
||||
return surgicalScheduleAppMapper.getSurgerySchedulePage(new Page<>(pageNo, pageSize), opScheduleDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询手术安排详情
|
||||
*
|
||||
* @param scheduleId 手术安排ID
|
||||
* @return 手术安排详情
|
||||
*/
|
||||
@Override
|
||||
public R<OpScheduleDto> getSurgeryScheduleDetail(Long scheduleId) {
|
||||
OpScheduleDto opScheduleDto = surgicalScheduleAppMapper.getSurgeryScheduleDetail(scheduleId);
|
||||
if (opScheduleDto == null) {
|
||||
return R.fail("手术安排信息不存在");
|
||||
}
|
||||
return R.ok(opScheduleDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增手术安排
|
||||
*
|
||||
* @param opCreateScheduleDto 手术安排信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R<?> addSurgerySchedule(OpCreateScheduleDto opCreateScheduleDto) {
|
||||
// 校验患者是否存在
|
||||
if (opCreateScheduleDto.getPatientId() != null) {
|
||||
Patient patient = patientService.getById(opCreateScheduleDto.getPatientId());
|
||||
if (patient == null) {
|
||||
return R.fail("患者信息不存在");
|
||||
}
|
||||
}
|
||||
//校验该时段内手术间是否被占用
|
||||
LocalDateTime scheduleDate = opCreateScheduleDto.getEntryTime();//入室时间
|
||||
String roomCode = opCreateScheduleDto.getRoomCode();//手术室编号
|
||||
LocalDateTime endTime = opCreateScheduleDto.getEndTime();//手术结束时间
|
||||
Boolean scheduleConflict = surgicalScheduleAppMapper.isScheduleConflict(scheduleDate, endTime, roomCode);
|
||||
if (scheduleConflict) {
|
||||
return R.fail("该时段内手术间被占用");
|
||||
}
|
||||
|
||||
LoginUser loginUser = new LoginUser();
|
||||
//获取当前登录用户信息
|
||||
loginUser = SecurityUtils.getLoginUser();
|
||||
// 当前登录用户ID
|
||||
Long userId = loginUser.getUserId();
|
||||
|
||||
// 转换为实体对象
|
||||
OpSchedule opSchedule = new OpSchedule();
|
||||
BeanUtils.copyProperties(opCreateScheduleDto, opSchedule);
|
||||
|
||||
// 设置创建者ID
|
||||
opSchedule.setCreatorId(userId);
|
||||
//设置创建人名称
|
||||
opSchedule.setCreateBy(loginUser.getUsername());
|
||||
//设置创建时间
|
||||
opSchedule.setCreateTime(new Date());
|
||||
// 设置租户ID
|
||||
opSchedule.setTenantId(loginUser.getTenantId());
|
||||
//设置手术状态
|
||||
opSchedule.setOperStatus(0);
|
||||
//修改申请表状态为已排期
|
||||
|
||||
// 保存手术安排
|
||||
boolean saved = opScheduleService.save(opSchedule);
|
||||
//修改申请单状态为已排期
|
||||
|
||||
if (!saved) {
|
||||
return R.fail("新增手术安排失败");
|
||||
}
|
||||
|
||||
return R.ok("新增手术安排成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改手术安排
|
||||
*
|
||||
* @param opScheduleDto 手术安排信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R<?> updateSurgerySchedule(OpScheduleDto opScheduleDto) {
|
||||
// 校验手术安排是否存在
|
||||
if (opScheduleDto.getScheduleId() == null) {
|
||||
return R.fail("排程号不能为空");
|
||||
}
|
||||
OpSchedule existSchedule = opScheduleService.getById(opScheduleDto.getScheduleId());
|
||||
if (existSchedule == null) {
|
||||
return R.fail("手术安排信息不存在");
|
||||
}
|
||||
|
||||
// 转换为实体对象
|
||||
OpSchedule opSchedule = new OpSchedule();
|
||||
BeanUtils.copyProperties(opScheduleDto, opSchedule);
|
||||
|
||||
// 更新时间
|
||||
opSchedule.setUpdateTime(new Date());
|
||||
|
||||
// 更新手术安排
|
||||
boolean updated = opScheduleService.updateById(opSchedule);
|
||||
if (!updated) {
|
||||
return R.fail("修改手术安排失败");
|
||||
}
|
||||
|
||||
return R.ok("修改手术安排成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除手术安排
|
||||
*
|
||||
* @param scheduleId 手术安排ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R<?> deleteSurgerySchedule(Long scheduleId) {
|
||||
// 校验手术安排是否存在
|
||||
OpSchedule existSchedule = opScheduleService.getById(scheduleId);
|
||||
if (existSchedule == null) {
|
||||
return R.fail("手术安排信息不存在");
|
||||
}
|
||||
|
||||
// 逻辑删除手术安排
|
||||
boolean deleted = opScheduleService.removeById(scheduleId);
|
||||
if (!deleted) {
|
||||
return R.fail("删除手术安排失败");
|
||||
}
|
||||
|
||||
return R.ok(null, "删除手术安排成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出手术安排列表
|
||||
*
|
||||
* @param opScheduleDto 查询条件
|
||||
* @param response 响应对象
|
||||
* @throws IOException 异常
|
||||
*/
|
||||
@Override
|
||||
public void exportSurgerySchedule(OpScheduleDto opScheduleDto, HttpServletResponse response) throws IOException {
|
||||
// 查询所有符合条件的手术安排
|
||||
List<OpScheduleDto> scheduleList = surgicalScheduleAppMapper.getSurgeryScheduleList(opScheduleDto);
|
||||
|
||||
// 设置响应头
|
||||
response.setContentType("text/csv; charset=utf-8");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("手术安排列表.csv", "UTF-8"));
|
||||
|
||||
// 写入CSV文件
|
||||
try (OutputStream outputStream = response.getOutputStream();
|
||||
PrintWriter writer = new PrintWriter(outputStream)) {
|
||||
|
||||
// 写入UTF-8 BOM,解决Excel乱码问题
|
||||
outputStream.write(0xEF);
|
||||
outputStream.write(0xBB);
|
||||
outputStream.write(0xBF);
|
||||
|
||||
// 写入表头(与前端表格完全一致)
|
||||
writer.println("ID,卫生机构,姓名,就诊卡号,手术单号,手术名称,申请科室,手术类型,手术性质,主刀医生,麻醉方法,安排时间,操作人");
|
||||
|
||||
// 写入数据
|
||||
int index = 0;
|
||||
for (OpScheduleDto schedule : scheduleList) {
|
||||
index++;
|
||||
|
||||
// 转换手术类型
|
||||
String surgeryType = convertSurgeryNature(schedule.getSurgeryNature());
|
||||
|
||||
// 转换麻醉方法
|
||||
String anesthesiaMethod = convertAnesMethod(schedule.getAnesMethod());
|
||||
|
||||
// 格式化安排时间
|
||||
String formattedDate = formatScheduleDate(schedule.getScheduleDate());
|
||||
|
||||
writer.printf("%d,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s\n",
|
||||
index, // 序号从1开始
|
||||
schedule.getOrgName() != null ? schedule.getOrgName() : "",
|
||||
schedule.getPatientName() != null ? schedule.getPatientName() : "",
|
||||
schedule.getVisitId() != null ? schedule.getVisitId().toString() : "",
|
||||
schedule.getOperCode() != null ? schedule.getOperCode() : "",
|
||||
schedule.getOperName() != null ? schedule.getOperName() : "",
|
||||
schedule.getApplyDeptName() != null ? schedule.getApplyDeptName() : "",
|
||||
surgeryType,
|
||||
surgeryType, // 手术性质和手术类型使用相同的转换
|
||||
schedule.getSurgeonName() != null ? schedule.getSurgeonName() : "",
|
||||
anesthesiaMethod,
|
||||
formattedDate,
|
||||
schedule.getCreateByName() != null ? schedule.getCreateByName() : ""
|
||||
);
|
||||
}
|
||||
|
||||
writer.flush();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换手术性质/类型
|
||||
*/
|
||||
private String convertSurgeryNature(String surgeryNature) {
|
||||
if (surgeryNature == null) return "";
|
||||
|
||||
switch (surgeryNature) {
|
||||
case "1": return "择期手术";
|
||||
case "2": return "急诊手术";
|
||||
case "3": return "限期手术";
|
||||
case "4": return "日间手术";
|
||||
default: return surgeryNature;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换麻醉方法
|
||||
*/
|
||||
private String convertAnesMethod(String anesMethod) {
|
||||
if (anesMethod == null) return "";
|
||||
|
||||
switch (anesMethod) {
|
||||
case "1": return "全身麻醉";
|
||||
case "2": return "椎管内麻醉";
|
||||
case "3": return "神经阻滞麻醉";
|
||||
case "4": return "局部浸润麻醉";
|
||||
case "5": return "表面麻醉";
|
||||
case "6": return "复合麻醉";
|
||||
case "7": return "基础麻醉";
|
||||
default: return anesMethod;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化安排时间
|
||||
*/
|
||||
private String formatScheduleDate(LocalDate scheduleDate) {
|
||||
if (scheduleDate == null) return "";
|
||||
|
||||
// 格式化为 yyyy-MM-dd
|
||||
return scheduleDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
}
|
||||
}
|
||||
@@ -31,13 +31,18 @@ public class SurgeryController {
|
||||
* @param surgeryDto 查询条件
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页条数
|
||||
* @param plannedTimeStart 计划开始时间
|
||||
* @param plannedTimeEnd 计划结束时间
|
||||
* @return 手术列表
|
||||
*/
|
||||
@GetMapping(value = "/surgery-page")
|
||||
public R<IPage<SurgeryDto>> getSurgeryPage(SurgeryDto surgeryDto,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
IPage<SurgeryDto> page = surgeryAppService.getSurgeryPage(surgeryDto, pageNo, pageSize);
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(value = "plannedTimeStart", required = false) String plannedTimeStart,
|
||||
@RequestParam(value = "plannedTimeEnd", required = false) String plannedTimeEnd) {
|
||||
// 将时间范围参数传递给服务层
|
||||
IPage<SurgeryDto> page = surgeryAppService.getSurgeryPage(surgeryDto, pageNo, pageSize, plannedTimeStart, plannedTimeEnd);
|
||||
return R.ok(page);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.openhis.web.clinicalmanage.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.clinicalmanage.appservice.ISurgicalScheduleAppService;
|
||||
import com.openhis.web.clinicalmanage.dto.OpCreateScheduleDto;
|
||||
import com.openhis.web.clinicalmanage.dto.OpScheduleDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 手术安排Controller
|
||||
*
|
||||
* @author system
|
||||
* @date 2026-01-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/clinical-manage/surgery-schedule")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class SurgicalScheduleController {
|
||||
|
||||
private final ISurgicalScheduleAppService surgicalScheduleAppService;
|
||||
|
||||
/**
|
||||
* 分页查询手术安排列表
|
||||
*
|
||||
* @param opScheduleDto 查询条件
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页条数
|
||||
* @return 手术安排列表
|
||||
*/
|
||||
@GetMapping(value = "/page")
|
||||
public R<IPage<OpScheduleDto>> getSurgerySchedulePage(OpScheduleDto opScheduleDto,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
IPage<OpScheduleDto> page = surgicalScheduleAppService.getSurgerySchedulePage(opScheduleDto, pageNo, pageSize);
|
||||
return R.ok(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询手术安排详情
|
||||
*
|
||||
* @param scheduleId 手术安排ID
|
||||
* @return 手术安排详情
|
||||
*/
|
||||
@GetMapping(value = "/{scheduleId}")
|
||||
public R<OpScheduleDto> getSurgeryScheduleDetail(@PathVariable Long scheduleId) {
|
||||
return surgicalScheduleAppService.getSurgeryScheduleDetail(scheduleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增手术安排
|
||||
*
|
||||
* @param opCreateScheduleDto 手术安排信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping(value = "/create")
|
||||
public R<?> addSurgerySchedule(@RequestBody OpCreateScheduleDto opCreateScheduleDto) {
|
||||
return surgicalScheduleAppService.addSurgerySchedule(opCreateScheduleDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改手术安排
|
||||
*
|
||||
* @param opScheduleDto 手术安排信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PutMapping(value = "/update")
|
||||
public R<?> updateSurgerySchedule(@RequestBody OpScheduleDto opScheduleDto) {
|
||||
return surgicalScheduleAppService.updateSurgerySchedule(opScheduleDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除手术安排
|
||||
*
|
||||
* @param scheduleId 手术安排ID
|
||||
* @return 结果
|
||||
*/
|
||||
@DeleteMapping(value = "/{scheduleId}")
|
||||
public R<?> deleteSurgerySchedule(@PathVariable Long scheduleId) {
|
||||
return surgicalScheduleAppService.deleteSurgerySchedule(scheduleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出手术安排列表
|
||||
*
|
||||
* @param opScheduleDto 查询条件
|
||||
* @param response 响应对象
|
||||
* @throws IOException 异常
|
||||
*/
|
||||
@GetMapping(value = "/export")
|
||||
public void exportSurgerySchedule(OpScheduleDto opScheduleDto, HttpServletResponse response) throws IOException {
|
||||
surgicalScheduleAppService.exportSurgerySchedule(opScheduleDto, response);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,268 @@
|
||||
package com.openhis.web.clinicalmanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class OpCreateScheduleDto {
|
||||
/**
|
||||
* 申请单ID
|
||||
*/
|
||||
private Long applyId;
|
||||
|
||||
/**
|
||||
* 患者ID
|
||||
*/
|
||||
private Long patientId;
|
||||
|
||||
/**
|
||||
* 就诊ID
|
||||
*/
|
||||
private Long visitId;
|
||||
|
||||
/**
|
||||
* 手术编码
|
||||
*/
|
||||
private String operCode;
|
||||
|
||||
/**
|
||||
* 手术名称
|
||||
*/
|
||||
private String operName;
|
||||
|
||||
/**
|
||||
* 术前诊断
|
||||
*/
|
||||
private String preoperativeDiagnosis;
|
||||
|
||||
/**
|
||||
* 术后诊断
|
||||
*/
|
||||
private String postoperativeDiagnosis;
|
||||
|
||||
/**
|
||||
* 手术安排日期
|
||||
*/
|
||||
private LocalDate scheduleDate;
|
||||
|
||||
/**
|
||||
* 手术台次序号
|
||||
*/
|
||||
private Integer sequenceNo;
|
||||
|
||||
/**
|
||||
* 是否首台手术 1-是 0-否
|
||||
*/
|
||||
private Integer isFirstSurgery;
|
||||
|
||||
/**
|
||||
* 是否有药物过敏 1-是 0-否
|
||||
*/
|
||||
private Integer isAllergyMedication;
|
||||
|
||||
/**
|
||||
* 过敏备注
|
||||
*/
|
||||
private String allergyRemark;
|
||||
|
||||
/**
|
||||
* 手术性质
|
||||
*/
|
||||
private String surgeryNature;
|
||||
|
||||
/**
|
||||
* 手术部位
|
||||
*/
|
||||
private String surgerySite;
|
||||
|
||||
/**
|
||||
* 入院时间
|
||||
*/
|
||||
private LocalDateTime admissionTime;
|
||||
|
||||
/**
|
||||
* 入手术室时间
|
||||
*/
|
||||
private LocalDateTime entryTime;
|
||||
|
||||
/**
|
||||
* 手术室编码
|
||||
*/
|
||||
private String roomCode;
|
||||
|
||||
/**
|
||||
* 手术台号
|
||||
*/
|
||||
private String tableNo;
|
||||
|
||||
/**
|
||||
* 麻醉方式
|
||||
*/
|
||||
private String anesMethod;
|
||||
|
||||
/**
|
||||
* 麻醉医生1编码
|
||||
*/
|
||||
private String anesDoctor1Code;
|
||||
|
||||
/**
|
||||
* 麻醉医生2编码
|
||||
*/
|
||||
private String anesDoctor2Code;
|
||||
|
||||
/**
|
||||
* 麻醉医生3编码
|
||||
*/
|
||||
private String anesDoctor3Code;
|
||||
|
||||
/**
|
||||
* 洗手护士编码
|
||||
*/
|
||||
private String scrubNurseCode;
|
||||
|
||||
/**
|
||||
* 巡回护士1编码
|
||||
*/
|
||||
private String circuNurse1Code;
|
||||
|
||||
/**
|
||||
* 巡回护士2编码
|
||||
*/
|
||||
private String circuNurse2Code;
|
||||
|
||||
/**
|
||||
* 洗手护士1编码
|
||||
*/
|
||||
private String scrubNurse1Code;
|
||||
|
||||
/**
|
||||
* 洗手护士2编码
|
||||
*/
|
||||
private String scrubNurse2Code;
|
||||
|
||||
/**
|
||||
* 主刀医生编码
|
||||
*/
|
||||
private String surgeonCode;
|
||||
|
||||
/**
|
||||
* 助手1编码
|
||||
*/
|
||||
private String assistant1Code;
|
||||
|
||||
/**
|
||||
* 助手2编码
|
||||
*/
|
||||
private String assistant2Code;
|
||||
|
||||
/**
|
||||
* 助手3编码
|
||||
*/
|
||||
private String assistant3Code;
|
||||
|
||||
/**
|
||||
* 手术开始时间
|
||||
*/
|
||||
private LocalDateTime startTime;
|
||||
|
||||
/**
|
||||
* 手术结束时间
|
||||
*/
|
||||
private LocalDateTime endTime;
|
||||
|
||||
/**
|
||||
* 麻醉开始时间
|
||||
*/
|
||||
private LocalDateTime anesStart;
|
||||
|
||||
/**
|
||||
* 麻醉结束时间
|
||||
*/
|
||||
private LocalDateTime anesEnd;
|
||||
|
||||
/**
|
||||
* 手术状态
|
||||
*/
|
||||
private Integer operStatus;
|
||||
|
||||
/**
|
||||
* 是否植入耗材 1-是 0-否
|
||||
*/
|
||||
private Integer implantFlag;
|
||||
|
||||
/**
|
||||
* 植入物序列号
|
||||
*/
|
||||
private String implantSerial;
|
||||
|
||||
/**
|
||||
* 失血量(ml)
|
||||
*/
|
||||
private Integer bloodLoss;
|
||||
|
||||
/**
|
||||
* 输血量(ml)
|
||||
*/
|
||||
private Integer bloodTrans;
|
||||
|
||||
/**
|
||||
* 感染诊断
|
||||
*/
|
||||
private String infectionDiagnosis;
|
||||
|
||||
/**
|
||||
* 隔离类型
|
||||
*/
|
||||
private String isolationType;
|
||||
|
||||
/**
|
||||
* 患者体重(kg)
|
||||
*/
|
||||
private BigDecimal patientWeight;
|
||||
|
||||
/**
|
||||
* 患者身高(cm)
|
||||
*/
|
||||
private BigDecimal patientHeight;
|
||||
|
||||
/**
|
||||
* 沟通信息
|
||||
*/
|
||||
private String communicationInfo;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private String creatorId;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
private Integer tenantId;
|
||||
|
||||
/**
|
||||
* 是否删除(默认为0,1表示删除)
|
||||
*/
|
||||
private Integer deleteFlag;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.openhis.web.clinicalmanage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -12,7 +13,7 @@ import org.springframework.stereotype.Repository;
|
||||
* 手术管理应用Mapper
|
||||
*/
|
||||
@Repository
|
||||
public interface SurgeryAppMapper {
|
||||
public interface SurgeryAppMapper extends BaseMapper<SurgeryDto> {
|
||||
|
||||
/**
|
||||
* 分页查询手术列表
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.openhis.web.clinicalmanage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.openhis.web.clinicalmanage.dto.OpScheduleDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 手术安排Mapper接口
|
||||
*
|
||||
* @author system
|
||||
* @date 2026-01-28
|
||||
*/
|
||||
public interface SurgicalScheduleAppMapper {
|
||||
|
||||
/**
|
||||
* 分页查询手术安排列表
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param opScheduleDto 查询条件
|
||||
* @return 手术安排列表
|
||||
*/
|
||||
IPage<OpScheduleDto> getSurgerySchedulePage(Page<OpScheduleDto> page, @Param("dto") OpScheduleDto opScheduleDto);
|
||||
|
||||
/**
|
||||
* 新增手术安排
|
||||
*
|
||||
* @param opScheduleDto 手术安排信息
|
||||
* @return 添加结果
|
||||
*/
|
||||
void addSurgerySchedule(@Param("opScheduleDto") OpScheduleDto opScheduleDto);
|
||||
/**
|
||||
* 根据ID查询手术安排详情
|
||||
*
|
||||
* @param scheduleId 手术安排ID
|
||||
* @return 手术安排详情
|
||||
*/
|
||||
OpScheduleDto getSurgeryScheduleDetail(Long scheduleId);
|
||||
|
||||
/**
|
||||
* 查询所有符合条件的手术安排列表(用于导出)
|
||||
*
|
||||
* @param opScheduleDto 查询条件
|
||||
* @return 手术安排列表
|
||||
*/
|
||||
List<OpScheduleDto> getSurgeryScheduleList(@Param("dto") OpScheduleDto opScheduleDto);
|
||||
|
||||
/**
|
||||
* 查询手术间在该时段是否被占用
|
||||
*
|
||||
* @param startTime 手术开始时间
|
||||
* @param endTime 手术结束时间
|
||||
* @param surgeryRoomId 手术间ID
|
||||
* @return 是否存在冲突的手术安排
|
||||
*/
|
||||
Boolean isScheduleConflict(LocalDateTime startTime, LocalDateTime endTime, String surgeryRoomId);
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.openhis.web.regdoctorstation.appservice;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.regdoctorstation.dto.RequestFormDto;
|
||||
import com.openhis.web.regdoctorstation.dto.RequestFormPageDto;
|
||||
import com.openhis.web.regdoctorstation.dto.RequestFormQueryDto;
|
||||
import com.openhis.web.regdoctorstation.dto.RequestFormSaveDto;
|
||||
|
||||
@@ -29,4 +32,11 @@ public interface IRequestFormManageAppService {
|
||||
*/
|
||||
List<RequestFormQueryDto> getRequestForm(Long encounterId, String typeCode);
|
||||
|
||||
/**
|
||||
* 分页查询申请单
|
||||
*
|
||||
* @param requestFormDto 查询条件
|
||||
* @return 申请单
|
||||
*/
|
||||
IPage<RequestFormPageDto> getRequestFormPage(RequestFormDto requestFormDto);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.openhis.web.regdoctorstation.appservice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.exception.ServiceException;
|
||||
import com.core.common.utils.AssignSeqUtil;
|
||||
@@ -236,4 +238,16 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
||||
return requestFormList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询申请单分页
|
||||
*
|
||||
* @param requestFormDto 查询参数
|
||||
* @return 申请单分页列表
|
||||
*/
|
||||
@Override
|
||||
public IPage<RequestFormPageDto> getRequestFormPage(RequestFormDto requestFormDto) {
|
||||
Page<RequestFormPageDto> page = new Page<>(requestFormDto.getPageNo(), requestFormDto.getPageSize());
|
||||
return requestFormManageAppMapper.getRequestFormPage(requestFormDto, page);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,14 +3,21 @@
|
||||
*/
|
||||
package com.openhis.web.regdoctorstation.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.common.enums.ActivityDefCategory;
|
||||
import com.openhis.document.domain.RequestForm;
|
||||
import com.openhis.web.inventorymanage.appservice.impl.ProductStocktakingAppServiceImpl;
|
||||
import com.openhis.web.regdoctorstation.appservice.IRequestFormManageAppService;
|
||||
import com.openhis.web.regdoctorstation.dto.RequestFormDto;
|
||||
import com.openhis.web.regdoctorstation.dto.RequestFormPageDto;
|
||||
import com.openhis.web.regdoctorstation.dto.RequestFormSaveDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 申请单管理 controller
|
||||
*/
|
||||
@@ -21,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
public class RequestFormManageController {
|
||||
|
||||
private final IRequestFormManageAppService iRequestFormManageAppService;
|
||||
private final ProductStocktakingAppServiceImpl productStocktakingAppServiceImpl;
|
||||
|
||||
/**
|
||||
* 保存检查申请单
|
||||
@@ -123,5 +131,12 @@ public class RequestFormManageController {
|
||||
}
|
||||
return R.ok(iRequestFormManageAppService.getRequestForm(encounterId, ActivityDefCategory.PROCEDURE.getCode()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询申请单
|
||||
* @return 申请单
|
||||
*/
|
||||
@RequestMapping(value = "/get-page")
|
||||
public R<IPage<RequestFormPageDto>> getRequestFormPage(@RequestBody RequestFormDto requestFormDto) {
|
||||
return R.ok(iRequestFormManageAppService.getRequestFormPage(requestFormDto));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.openhis.web.regdoctorstation.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class RequestFormDto {
|
||||
/**
|
||||
* 申请时间开始
|
||||
*/
|
||||
private LocalDate applyTimeStart;
|
||||
/**
|
||||
* 申请时间结束
|
||||
*/
|
||||
private LocalDate applyTimeEnd;
|
||||
/**
|
||||
* 主刀医生ID
|
||||
*/
|
||||
private Long mainDoctorId;
|
||||
/**
|
||||
* 申请科室ID
|
||||
*/
|
||||
private Long applyDeptId;
|
||||
/**
|
||||
* 当前页码
|
||||
*/
|
||||
private Integer pageNo;
|
||||
/**
|
||||
* 每页数量
|
||||
*/
|
||||
private Integer pageSize;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.openhis.web.regdoctorstation.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class RequestFormPageDto {
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String gender;
|
||||
/**
|
||||
* 病人id
|
||||
*/
|
||||
private String patientId;
|
||||
/**
|
||||
* 出生日期
|
||||
*/
|
||||
private String birthDay;
|
||||
/**
|
||||
* 就诊id
|
||||
*/
|
||||
private String encounterId;
|
||||
/**
|
||||
* 手术单号
|
||||
*/
|
||||
private String surgeryNo;
|
||||
/**
|
||||
* 描述JSON
|
||||
*/
|
||||
@TableField(value = "desc_json", typeHandler = JacksonTypeHandler.class)
|
||||
private Map<String,Object> descJson;
|
||||
/**
|
||||
* 申请单id
|
||||
*/
|
||||
private String applyId;
|
||||
/**
|
||||
* 申请科室
|
||||
*/
|
||||
private String applyDeptId;
|
||||
/**
|
||||
* 申请科室名称
|
||||
*/
|
||||
private String applyDeptName;
|
||||
/**
|
||||
* 申请医生ID
|
||||
*/
|
||||
private String applyDoctorId;
|
||||
/**
|
||||
* 申请医生名称
|
||||
*/
|
||||
private String applyDoctorName;
|
||||
/**
|
||||
* 手术类型
|
||||
*/
|
||||
private Integer surgeryType;
|
||||
/**
|
||||
* 主刀医生ID
|
||||
*/
|
||||
private String mainSurgeonId;
|
||||
/**
|
||||
* 主刀医生名称
|
||||
*/
|
||||
private String mainSurgeonName;
|
||||
/**
|
||||
* 手术类型
|
||||
*/
|
||||
private String surgeryTypeEnum;
|
||||
/**
|
||||
* 申请时间
|
||||
*/
|
||||
private String applyTime;
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.openhis.web.regdoctorstation.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.openhis.document.domain.RequestForm;
|
||||
import com.openhis.web.regdoctorstation.dto.ActivityOrganizationConfigDto;
|
||||
import com.openhis.web.regdoctorstation.dto.RequestFormDetailQueryDto;
|
||||
import com.openhis.web.regdoctorstation.dto.RequestFormDto;
|
||||
import com.openhis.web.regdoctorstation.dto.RequestFormPageDto;
|
||||
import com.openhis.web.regdoctorstation.dto.RequestFormQueryDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
@@ -41,4 +46,12 @@ public interface RequestFormManageAppMapper {
|
||||
List<ActivityOrganizationConfigDto>
|
||||
getActivityOrganizationConfig(@Param("activityCategoryCode") String activityCategoryCode);
|
||||
|
||||
/**
|
||||
* 获取申请单分页数据
|
||||
*
|
||||
* @param requestFormDto 申请单参数
|
||||
* @return 申请单分页列表
|
||||
*/
|
||||
IPage<RequestFormPageDto> getRequestFormPage(
|
||||
@Param("requestFormDto") RequestFormDto requestFormDto,@Param("page") IPage<RequestFormPageDto> page);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
s.surgery_no,
|
||||
s.patient_id,
|
||||
p.name as patient_name,
|
||||
CASE p.gender_enum WHEN 1 THEN '男' WHEN 2 THEN '女' ELSE '未知' END as patient_gender,
|
||||
CASE p.gender_enum WHEN 0 THEN '男' WHEN 1 THEN '女' ELSE '未知' END as patient_gender,
|
||||
EXTRACT(YEAR FROM AGE(p.birth_date)) as patient_age,
|
||||
s.encounter_id,
|
||||
e.bus_no as encounter_no,
|
||||
@@ -194,7 +194,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<where>
|
||||
s.delete_flag = '0'
|
||||
<if test="ew.sqlSegment != null and ew.sqlSegment != ''">
|
||||
AND ${ew.sqlSegment.replace('tenant_id', 's.tenant_id').replace('create_time', 's.create_time').replace('surgery_no', 's.surgery_no').replace('surgery_name', 's.surgery_name').replace('patient_name', 'p.name').replace('main_surgeon_name', 's.main_surgeon_name').replace('anesthetist_name', 's.anesthetist_name').replace('org_name', 'o.name')}
|
||||
<![CDATA[
|
||||
AND ${ew.sqlSegment.replace('tenant_id', 's.tenant_id').replace('create_time', 's.create_time').replace('surgery_no', 's.surgery_no').replace('surgery_name', 's.surgery_name').replace('patient_name', 'p.name').replace('main_surgeon_name', 's.main_surgeon_name').replace('anesthetist_name', 's.anesthetist_name').replace('org_name', 'o.name').replace('status_enum', 's.status_enum').replace('planned_time', 's.planned_time')}
|
||||
]]>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.openhis.web.clinicalmanage.mapper.SurgicalScheduleAppMapper">
|
||||
<!-- 分页查询手术安排-->
|
||||
<select id="getSurgerySchedulePage" resultType="com.openhis.web.clinicalmanage.dto.OpScheduleDto">
|
||||
SELECT
|
||||
os.schedule_id,
|
||||
os.tenant_id,
|
||||
st.tenant_name AS orgName,
|
||||
os.apply_id,
|
||||
os.patient_id,
|
||||
os.visit_id,
|
||||
os.oper_code,
|
||||
os.oper_name,
|
||||
os.surgery_nature,
|
||||
os.anes_method,
|
||||
os.schedule_date,
|
||||
os.sequence_no,
|
||||
os.room_code,
|
||||
os.table_no,
|
||||
su.nick_name AS createByName,
|
||||
os.create_time,
|
||||
os.update_time,
|
||||
ap.name AS patient_name,
|
||||
CASE ap.gender_enum WHEN 0 THEN '男' WHEN 1 THEN '女' ELSE '未知' END AS gender,
|
||||
EXTRACT(YEAR FROM AGE(ap.birth_date)) AS age,
|
||||
cs.apply_dept_id,
|
||||
cs.apply_dept_name,
|
||||
cs.org_id,
|
||||
o.name AS org_name,
|
||||
cs.main_surgeon_name AS surgeon_name
|
||||
FROM op_schedule os
|
||||
LEFT JOIN adm_patient ap ON os.patient_id = ap.id
|
||||
LEFT JOIN cli_surgery cs ON os.patient_id = cs.patient_id
|
||||
LEFT JOIN adm_organization o ON cs.org_id = o.id
|
||||
LEFT JOIN sys_tenant st ON st.id = os.tenant_id
|
||||
LEFT JOIN sys_user su ON su.user_id = os.creator_id
|
||||
<where>
|
||||
<if test="dto.tenantId != null">
|
||||
AND os.tenant_id = #{dto.tenantId}
|
||||
</if>
|
||||
<if test="dto.patientName != null and dto.patientName != ''">
|
||||
AND ap.name LIKE CONCAT('%', #{dto.patientName}, '%')
|
||||
</if>
|
||||
<if test="dto.applyDeptId != null and dto.applyDeptId != ''">
|
||||
AND cs.apply_dept_id = #{dto.applyDeptId}
|
||||
</if>
|
||||
<if test="dto.scheduleDate != null">
|
||||
AND os.schedule_date = #{dto.scheduleDate}
|
||||
</if>
|
||||
AND os.delete_flag = '0'
|
||||
</where>
|
||||
ORDER BY os.create_time DESC
|
||||
</select>
|
||||
<!-- 根据ID查询手术安排详情-->
|
||||
<select id="getSurgeryScheduleDetail" resultType="com.openhis.web.clinicalmanage.dto.OpScheduleDto">
|
||||
SELECT
|
||||
os.*,
|
||||
os.oper_code AS surgeryNo,
|
||||
ap.name AS patient_name,
|
||||
CASE ap.gender_enum WHEN 0 THEN '男' WHEN 1 THEN '女' ELSE '未知' END AS gender,
|
||||
EXTRACT(YEAR FROM AGE(ap.birth_date)) AS age,
|
||||
cs.apply_dept_id,
|
||||
cs.apply_dept_name,
|
||||
cs.org_id,
|
||||
o.name AS org_name,
|
||||
cs.main_surgeon_name AS surgeon_name,
|
||||
cs.apply_doctor_name AS apply_doctor_name,
|
||||
drf.create_time AS apply_time,
|
||||
os.surgery_nature AS surgeryType
|
||||
FROM op_schedule os
|
||||
LEFT JOIN adm_patient ap ON os.patient_id = ap.id
|
||||
LEFT JOIN cli_surgery cs ON os.patient_id = cs.patient_id
|
||||
LEFT JOIN adm_organization o ON cs.org_id = o.id
|
||||
LEFT JOIN doc_request_form drf ON drf.prescription_no=cs.surgery_no
|
||||
WHERE os.schedule_id = #{scheduleId}
|
||||
</select>
|
||||
<!-- 新增手术安排-->
|
||||
<insert id="addSurgerySchedule" useGeneratedKeys="true" keyProperty="scheduleId">
|
||||
insert into op_schedule(patient_id, doctor_id, schedule_time, schedule_status, create_time, update_time)
|
||||
values(#{patientId}, #{doctorId}, #{scheduleTime}, #{scheduleStatus}, #{createTime}, #{updateTime})
|
||||
</insert>
|
||||
<!-- 修改手术安排-->
|
||||
<update id="updateSurgerySchedule">
|
||||
update op_schedule set patient_id = #{patientId}, doctor_id = #{doctorId}, schedule_time = #{scheduleTime},
|
||||
schedule_status = #{scheduleStatus}, create_time = #{createTime}, update_time = #{updateTime}
|
||||
where schedule_id = #{scheduleId}
|
||||
</update>
|
||||
|
||||
<!-- 查询所有符合条件的手术安排列表(用于导出) -->
|
||||
<select id="getSurgeryScheduleList" resultType="com.openhis.web.clinicalmanage.dto.OpScheduleDto">
|
||||
SELECT
|
||||
os.schedule_id,
|
||||
os.tenant_id,
|
||||
st.tenant_name AS orgName,
|
||||
os.apply_id,
|
||||
os.patient_id,
|
||||
os.visit_id,
|
||||
os.oper_code,
|
||||
os.oper_name,
|
||||
os.surgery_nature,
|
||||
os.anes_method,
|
||||
os.schedule_date,
|
||||
os.sequence_no,
|
||||
os.room_code,
|
||||
os.table_no,
|
||||
su.nick_name AS createByName,
|
||||
os.create_time,
|
||||
os.update_time,
|
||||
ap.name AS patient_name,
|
||||
CASE ap.gender_enum WHEN 0 THEN '男' WHEN 1 THEN '女' ELSE '未知' END AS gender,
|
||||
EXTRACT(YEAR FROM AGE(ap.birth_date)) AS age,
|
||||
cs.apply_dept_id,
|
||||
cs.apply_dept_name,
|
||||
cs.org_id,
|
||||
o.name AS org_name,
|
||||
cs.main_surgeon_name AS surgeon_name
|
||||
FROM op_schedule os
|
||||
LEFT JOIN adm_patient ap ON os.patient_id = ap.id
|
||||
LEFT JOIN cli_surgery cs ON os.patient_id = cs.patient_id
|
||||
LEFT JOIN adm_organization o ON cs.org_id = o.id
|
||||
LEFT JOIN sys_tenant st ON st.id = os.tenant_id
|
||||
LEFT JOIN sys_user su ON su.user_id = os.creator_id
|
||||
<where>
|
||||
AND os.delete_flag = '0'
|
||||
<if test="dto.patientId != null"> AND os.patient_id = #{dto.patientId}</if>
|
||||
<if test="dto.visitId != null"> AND os.visit_id = #{dto.visitId}</if>
|
||||
<if test="dto.applyId != null"> AND os.apply_id = #{dto.applyId}</if>
|
||||
<if test="dto.operCode != null and dto.operCode != ''"> AND os.oper_code = #{dto.operCode}</if>
|
||||
<if test="dto.operName != null and dto.operName != ''"> AND os.oper_name LIKE CONCAT('%', #{dto.operName}, '%')</if>
|
||||
<if test="dto.scheduleDate != null"> AND os.schedule_date = #{dto.scheduleDate}</if>
|
||||
<if test="dto.orgId != null and dto.orgId != ''"> AND cs.org_id = #{dto.orgId}</if>
|
||||
<if test="dto.applyDeptId != null and dto.applyDeptId != ''"> AND cs.apply_dept_id = #{dto.applyDeptId}</if>
|
||||
<if test="dto.patientName != null and dto.patientName != ''"> AND ap.name LIKE CONCAT('%', #{dto.patientName}, '%')</if>
|
||||
</where>
|
||||
ORDER BY os.create_time DESC
|
||||
</select>
|
||||
<!-- 查询时间段内该手术室是否被占用-->
|
||||
<select id="isScheduleConflict" resultType="java.lang.Boolean">
|
||||
SELECT COUNT(*) > 0 FROM op_schedule WHERE room_code = #{surgeryRoomId}
|
||||
AND entry_time >= #{startTime}
|
||||
AND end_time < #{endTime}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -47,4 +47,62 @@
|
||||
AND activity_category_code = #{activityCategoryCode}
|
||||
</select>
|
||||
|
||||
<!-- 结果映射 -->
|
||||
<resultMap id="RequestFormPageDtoMap" type="com.openhis.web.regdoctorstation.dto.RequestFormPageDto">
|
||||
<result column="surgery_no" property="surgeryNo"/>
|
||||
<result column="desc_json" property="descJson" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="gender_enum" property="gender"/>
|
||||
<result column="birth_date" property="birthDay"/>
|
||||
<result column="main_surgeon_id" property="mainSurgeonId"/>
|
||||
<result column="main_surgeon_name" property="mainSurgeonName"/>
|
||||
<result column="surgery_type" property="surgeryType"/>
|
||||
<result column="apply_time" property="applyTime"/>
|
||||
<result column="apply_id" property="applyId"/>
|
||||
<result column="apply_dept_id" property="applyDeptId"/>
|
||||
<result column="apply_dept_name" property="applyDeptName"/>
|
||||
<result column="encounter_id" property="encounterId"/>
|
||||
<result column="surgery_type_enum" property="surgeryTypeEnum"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 分页查询申请单 -->
|
||||
<select id="getRequestFormPage" resultMap="RequestFormPageDtoMap">
|
||||
SELECT
|
||||
drf.prescription_no AS surgery_no,
|
||||
drf.desc_json,
|
||||
drf.create_by AS apply_doctor_name,
|
||||
drf.create_time AS apply_time,
|
||||
drf.id AS apply_id,
|
||||
ae.id AS encounter_id,
|
||||
ap.id AS patient_id,
|
||||
ap.name,
|
||||
ap.gender_enum,
|
||||
ap.birth_date,
|
||||
cs.main_surgeon_id,
|
||||
cs.surgery_type_enum AS surgery_type,
|
||||
cs.main_surgeon_name,
|
||||
cs.apply_dept_id,
|
||||
cs.apply_dept_name,
|
||||
cs.surgery_type_enum
|
||||
FROM doc_request_form drf
|
||||
LEFT JOIN cli_surgery cs ON cs.surgery_no = drf.prescription_no
|
||||
LEFT JOIN adm_patient ap ON ap.id = cs.patient_id
|
||||
LEFT JOIN adm_encounter ae ON ae.id = cs.encounter_id
|
||||
<where>
|
||||
<if test="requestFormDto.applyTimeStart != null">
|
||||
AND drf.create_time >= #{requestFormDto.applyTimeStart}
|
||||
</if>
|
||||
<if test="requestFormDto.applyTimeEnd != null">
|
||||
AND drf.create_time <= #{requestFormDto.applyTimeEnd}
|
||||
</if>
|
||||
<if test="requestFormDto.mainDoctorId != null">
|
||||
AND cs.main_surgeon_id = #{requestFormDto.mainDoctorId}
|
||||
</if>
|
||||
<if test="requestFormDto.applyDeptId != null">
|
||||
AND cs.apply_dept_id = #{requestFormDto.applyDeptId}
|
||||
</if>
|
||||
AND drf.delete_flag = '0'
|
||||
</where>
|
||||
ORDER BY drf.create_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user