Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
2026-03-19 10:25:59 +08:00
30 changed files with 3170 additions and 294 deletions

View File

@@ -118,6 +118,7 @@ public class DoctorScheduleAppServiceImpl implements IDoctorScheduleAppService {
newSchedule.setIsStopped(doctorSchedule.getIsStopped() != null ? doctorSchedule.getIsStopped() : false); newSchedule.setIsStopped(doctorSchedule.getIsStopped() != null ? doctorSchedule.getIsStopped() : false);
newSchedule.setStopReason(doctorSchedule.getStopReason() != null ? doctorSchedule.getStopReason() : ""); newSchedule.setStopReason(doctorSchedule.getStopReason() != null ? doctorSchedule.getStopReason() : "");
newSchedule.setDeptId(doctorSchedule.getDeptId()); newSchedule.setDeptId(doctorSchedule.getDeptId());
newSchedule.setRegType(doctorSchedule.getRegType() != null ? doctorSchedule.getRegType() : 0);
newSchedule.setDoctorId(doctorSchedule.getDoctorId()); newSchedule.setDoctorId(doctorSchedule.getDoctorId());
// 不设置id字段让数据库自动生成 // 不设置id字段让数据库自动生成
@@ -183,6 +184,7 @@ public class DoctorScheduleAppServiceImpl implements IDoctorScheduleAppService {
newSchedule.setIsStopped(doctorSchedule.getIsStopped() != null ? doctorSchedule.getIsStopped() : false); newSchedule.setIsStopped(doctorSchedule.getIsStopped() != null ? doctorSchedule.getIsStopped() : false);
newSchedule.setStopReason(doctorSchedule.getStopReason() != null ? doctorSchedule.getStopReason() : ""); newSchedule.setStopReason(doctorSchedule.getStopReason() != null ? doctorSchedule.getStopReason() : "");
newSchedule.setDeptId(doctorSchedule.getDeptId()); newSchedule.setDeptId(doctorSchedule.getDeptId());
newSchedule.setRegType(doctorSchedule.getRegType() != null ? doctorSchedule.getRegType() : 0);
newSchedule.setDoctorId(doctorSchedule.getDoctorId()); newSchedule.setDoctorId(doctorSchedule.getDoctorId());
// 不设置id字段让数据库自动生成 // 不设置id字段让数据库自动生成
@@ -213,14 +215,48 @@ public class DoctorScheduleAppServiceImpl implements IDoctorScheduleAppService {
} }
} }
@Transactional
@Override @Override
public R<?> updateDoctorSchedule(DoctorSchedule doctorSchedule) { public R<?> updateDoctorSchedule(DoctorSchedule doctorSchedule) {
if (ObjectUtil.isEmpty(doctorSchedule) || ObjectUtil.isEmpty(doctorSchedule.getId())) { if (ObjectUtil.isEmpty(doctorSchedule) || ObjectUtil.isEmpty(doctorSchedule.getId())) {
return R.fail("医生排班ID不能为空"); return R.fail("医生排班ID不能为空");
} }
// 注意:此为核心更新,暂未处理号源池和号源槽的同步更新
int result = doctorScheduleMapper.updateDoctorSchedule(doctorSchedule); int result = doctorScheduleMapper.updateDoctorSchedule(doctorSchedule);
return result > 0 ? R.ok(result) : R.fail("更新排班信息失败"); if (result <= 0) {
return R.fail("更新排班信息失败");
}
// 同步更新号源池,避免查询联表时医生/诊室等字段看起来“未更新”
boolean needSyncPool = doctorSchedule.getDoctorId() != null
|| doctorSchedule.getDoctor() != null
|| doctorSchedule.getClinic() != null
|| doctorSchedule.getStartTime() != null
|| doctorSchedule.getEndTime() != null
|| doctorSchedule.getLimitNumber() != null
|| doctorSchedule.getStopReason() != null
|| doctorSchedule.getRegType() != null
|| doctorSchedule.getRegisterFee() != null;
if (needSyncPool) {
schedulePoolService.lambdaUpdate()
.eq(SchedulePool::getScheduleId, doctorSchedule.getId())
.set(doctorSchedule.getDoctorId() != null, SchedulePool::getDoctorId, doctorSchedule.getDoctorId())
.set(doctorSchedule.getDoctor() != null, SchedulePool::getDoctorName, doctorSchedule.getDoctor())
.set(doctorSchedule.getClinic() != null, SchedulePool::getClinicRoom, doctorSchedule.getClinic())
.set(doctorSchedule.getStartTime() != null, SchedulePool::getStartTime, doctorSchedule.getStartTime())
.set(doctorSchedule.getEndTime() != null, SchedulePool::getEndTime, doctorSchedule.getEndTime())
.set(doctorSchedule.getLimitNumber() != null, SchedulePool::getTotalQuota,
doctorSchedule.getLimitNumber())
.set(doctorSchedule.getStopReason() != null, SchedulePool::getStopReason, doctorSchedule.getStopReason())
.set(doctorSchedule.getRegType() != null, SchedulePool::getRegType, String.valueOf(doctorSchedule.getRegType()))
.set(doctorSchedule.getRegisterFee() != null, SchedulePool::getFee, doctorSchedule.getRegisterFee() / 100.0)
.set(doctorSchedule.getRegisterFee() != null, SchedulePool::getInsurancePrice,
doctorSchedule.getRegisterFee() / 100.0)
.update();
}
return R.ok(result);
} }
/** /**

View File

@@ -53,7 +53,6 @@ public class DoctorScheduleController {
/* /*
* 新增医生排班(带具体日期) * 新增医生排班(带具体日期)
*
* */ * */
@PostMapping("/add-with-date") @PostMapping("/add-with-date")
public R<?> addDoctorScheduleWithDate(@RequestBody DoctorSchedule doctorSchedule) { public R<?> addDoctorScheduleWithDate(@RequestBody DoctorSchedule doctorSchedule) {
@@ -77,7 +76,7 @@ public class DoctorScheduleController {
* */ * */
@DeleteMapping("/delete/{doctorScheduleId}") @DeleteMapping("/delete/{doctorScheduleId}")
public R<?> removeDoctorSchedule(@PathVariable Integer doctorScheduleId){ public R<?> removeDoctorSchedule(@PathVariable Integer doctorScheduleId){
return R.ok(doctorScheduleAppService.removeDoctorSchedule(doctorScheduleId)); return doctorScheduleAppService.removeDoctorSchedule(doctorScheduleId);
} }
/* /*

View File

@@ -1,12 +1,14 @@
package com.openhis.web.basedatamanage.appservice.impl; package com.openhis.web.basedatamanage.appservice.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.core.domain.R; import com.core.common.core.domain.R;
import com.core.common.utils.AssignSeqUtil; import com.core.common.utils.AssignSeqUtil;
import com.core.common.utils.MessageUtils; import com.core.common.utils.MessageUtils;
import com.core.common.utils.StringUtils; import com.core.common.utils.StringUtils;
import com.openhis.administration.domain.Organization; import com.openhis.administration.domain.Organization;
import com.openhis.administration.mapper.OrganizationMapper;
import com.openhis.administration.service.IOrganizationService; import com.openhis.administration.service.IOrganizationService;
import com.openhis.common.constant.CommonConstants; import com.openhis.common.constant.CommonConstants;
import com.openhis.common.constant.PromptMsgConstant; import com.openhis.common.constant.PromptMsgConstant;
@@ -35,6 +37,9 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
@Resource @Resource
private AssignSeqUtil assignSeqUtil; private AssignSeqUtil assignSeqUtil;
@Resource
private OrganizationMapper organizationMapper;
@Override @Override
public Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, String name, Integer typeEnum, public Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, String name, Integer typeEnum,
List<String> classEnumList, List<String> classEnumList,
@@ -63,7 +68,7 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
wrapper.and(subWrapper -> { wrapper.and(subWrapper -> {
subWrapper.eq(Organization::getClassEnum, classEnum) // 精确匹配 subWrapper.eq(Organization::getClassEnum, classEnum) // 精确匹配
.or() // 或者 .or() // 或者
.likeRight(Organization::getClassEnum, classEnum + ",") // 以"值,"开头 .likeRight(Organization::getClassEnum, classEnum + ",") // 以"值"开头
.or() // 或者 .or() // 或者
.likeLeft(Organization::getClassEnum, "," + classEnum) // 以",值"结尾 .likeLeft(Organization::getClassEnum, "," + classEnum) // 以",值"结尾
.or() // 或者 .or() // 或者
@@ -74,7 +79,7 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
wrapper.or(subWrapper -> { wrapper.or(subWrapper -> {
subWrapper.eq(Organization::getClassEnum, classEnum) // 精确匹配 subWrapper.eq(Organization::getClassEnum, classEnum) // 精确匹配
.or() // 或者 .or() // 或者
.likeRight(Organization::getClassEnum, classEnum + ",") // 以"值,"开头 .likeRight(Organization::getClassEnum, classEnum + ",") // 以"值"开头
.or() // 或者 .or() // 或者
.likeLeft(Organization::getClassEnum, "," + classEnum) // 以",值"结尾 .likeLeft(Organization::getClassEnum, "," + classEnum) // 以",值"结尾
.or() // 或者 .or() // 或者
@@ -302,27 +307,14 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
// 使用 Page 对象进行分页查询 // 使用 Page 对象进行分页查询
Page<Organization> page = new Page<>(pageNo != null ? pageNo : 1, pageSize != null ? pageSize : 10); Page<Organization> page = new Page<>(pageNo != null ? pageNo : 1, pageSize != null ? pageSize : 10);
// 创建查询条件只查询register_flag为1的组织机构 // 使用 Mapper 方法关联查询 sys_tenant 表获取租户名称
LambdaQueryWrapper<Organization> queryWrapper = new LambdaQueryWrapper<>(); IPage<Organization> resultPage = organizationMapper.selectRegisterOrganizationsWithTenant(
queryWrapper.eq(Organization::getRegisterFlag, 1); // 只获取挂号科室 page,
queryWrapper.eq(Organization::getDeleteFlag, "0"); // 确保未删除 1, // register_flag = 1
"0", // delete_flag = '0'
// 添加名称过滤条件 name,
if (StringUtils.isNotEmpty(name)) { orgName
queryWrapper.like(Organization::getName, name); );
}
// 如果有机构名称筛选
if (StringUtils.isNotEmpty(orgName)) {
// 这里假设 orgName 是父机构名称,如果需要更复杂的关联查询可在此扩展
// 当前逻辑暂保持与原逻辑一致的过滤方式或根据需求调整
}
// 按编码排序
queryWrapper.orderByAsc(Organization::getBusNo);
// 执行分页查询
Page<Organization> resultPage = organizationService.page(page, queryWrapper);
// 转换为 DTO 对象并设置字典文本 // 转换为 DTO 对象并设置字典文本
List<OrganizationDto> organizationDtoList = resultPage.getRecords().stream().map(org -> { List<OrganizationDto> organizationDtoList = resultPage.getRecords().stream().map(org -> {
@@ -331,6 +323,8 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
dto.setTypeEnum_dictText(EnumUtils.getInfoByValue(OrganizationType.class, dto.getTypeEnum())); dto.setTypeEnum_dictText(EnumUtils.getInfoByValue(OrganizationType.class, dto.getTypeEnum()));
dto.setClassEnum_dictText(formatClassEnumDictText(dto.getClassEnum())); dto.setClassEnum_dictText(formatClassEnumDictText(dto.getClassEnum()));
dto.setActiveFlag_dictText(EnumUtils.getInfoByValue(AccountStatus.class, dto.getActiveFlag())); dto.setActiveFlag_dictText(EnumUtils.getInfoByValue(AccountStatus.class, dto.getActiveFlag()));
// 设置租户名称
dto.setOrgName(org.getTenantName());
return dto; return dto;
}).collect(Collectors.toList()); }).collect(Collectors.toList());

View File

@@ -8,7 +8,6 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import lombok.ToString;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -60,7 +59,6 @@ public class OrganizationDto {
private Integer displayOrder; private Integer displayOrder;
/** 子集合 */ /** 子集合 */
@ToString.Exclude
private List<OrganizationDto> children = new ArrayList<>(); private List<OrganizationDto> children = new ArrayList<>();
/** 挂号科室标记 */ /** 挂号科室标记 */
@@ -74,4 +72,7 @@ public class OrganizationDto {
/** 备注 */ /** 备注 */
private String remark; private String remark;
/** 租户名称 */
private String orgName;
} }

View File

@@ -294,24 +294,19 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
} }
/** /**
* 获取诊查项目列表医保类型为02 * 获取诊查项目列表医保类型为02,返回全量数据
* *
* @param orgId 科室ID * @param orgId 科室ID(兼容保留,不参与过滤)
* @return 诊查项目列表 * @return 诊查项目列表
*/ */
@Override @Override
public R<?> getClinicItems(Long orgId) { public R<?> getClinicItems(Long orgId) {
// 构建查询条件只查询医保类型为02费)的项目 // 构建查询条件只查询医保类型为02费)的项目,不按科室过滤
QueryWrapper<DiagnosisTreatmentDto> queryWrapper = new QueryWrapper<>(); QueryWrapper<DiagnosisTreatmentDto> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("T2.yb_type", "02"); // 使用T2表的yb_type字段避免歧义 queryWrapper.eq("T2.yb_type", "02"); // 使用T2表的yb_type字段避免歧义
queryWrapper.eq("T1.delete_flag", "0"); // 只查询未删除的记录 queryWrapper.eq("T1.delete_flag", "0"); // 只查询未删除的记录
queryWrapper.eq("T2.instance_table", "wor_activity_definition"); // 确保关联正确 queryWrapper.eq("T2.instance_table", "wor_activity_definition"); // 确保关联正确
// 如果提供了科室ID则过滤该科室的项目
if (orgId != null) {
queryWrapper.eq("T1.org_id", orgId); // 使用机构ID进行过滤
}
// 分页查询,设置一个较大的页大小以获取所有诊查项目 // 分页查询,设置一个较大的页大小以获取所有诊查项目
IPage<DiagnosisTreatmentDto> diseaseTreatmentPage IPage<DiagnosisTreatmentDto> diseaseTreatmentPage
= activityDefinitionManageMapper.getDiseaseTreatmentPage(new Page<DiagnosisTreatmentDto>(1, 100), queryWrapper); = activityDefinitionManageMapper.getDiseaseTreatmentPage(new Page<DiagnosisTreatmentDto>(1, 100), queryWrapper);

View File

@@ -36,10 +36,11 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.time.LocalDate; import java.util.Date;
import java.util.*; import java.util.*;
import static com.openhis.common.constant.CommonConstants.FieldName.DeleteFlag; import static com.openhis.common.constant.CommonConstants.FieldName.DeleteFlag;
import static com.openhis.common.enums.ReportCardStatus.SUBMITTED;
import static java.time.LocalDateTime.now; import static java.time.LocalDateTime.now;
/** /**
@@ -603,15 +604,16 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
* 报告单位,报告医生,报告日期 * 报告单位,报告医生,报告日期
*/ */
infectiousDiseaseReport.setReportOrg(null); infectiousDiseaseReport.setReportOrg(null);
infectiousDiseaseReport.setReportDate(LocalDate.now()); infectiousDiseaseReport.setReportDate(new Date());
// 如果状态为空,设置为草稿状态 // 如果状态为空,设置为草稿状态
if (infectiousDiseaseReport.getStatus() == null) { if (infectiousDiseaseReport.getStatus() == null) {
infectiousDiseaseReport.setStatus(0); // 0-草稿 infectiousDiseaseReport.setStatus(SUBMITTED.getValue()); //已提交。草稿状态
} }
log.debug("保存传染病报告卡数据getReportOrg{}", infectiousDiseaseReport.getReportOrg()); log.debug("保存传染病报告卡数据getReportOrg{}", infectiousDiseaseReport.getReportOrg());
log.debug("保存传染病报告卡数据:{}", infectiousDiseaseReport.getDeleteFlag()); log.debug("保存传染病报告卡数据:{}", infectiousDiseaseReport.getDeleteFlag());
log.debug("保存传染病报告卡数据,更新日期:{}",infectiousDiseaseReport.getUpdateTime()); log.debug("保存传染病报告卡数据,更新日期:{}",infectiousDiseaseReport.getUpdateTime());
log.debug("保存传染病报告卡数据getStatus:{}",infectiousDiseaseReport.getStatus());
// 保存到数据库 // 保存到数据库
boolean success = iInfectiousDiseaseReportService.save(infectiousDiseaseReport); boolean success = iInfectiousDiseaseReportService.save(infectiousDiseaseReport);

View File

@@ -0,0 +1,98 @@
package com.openhis.web.reportManagement.appservice;
import com.core.common.core.domain.R;
import com.openhis.web.reportManagement.dto.InfectiousCardParam;
import javax.servlet.http.HttpServletResponse;
// import java.util.List; // 批量操作功能暂未实现
/**
* 传染病报卡 AppService 接口
*
* @author system
* @date 2026-03-17
*/
public interface IInfectiousCardAppService {
/**
* 分页查询传染病报卡列表
*
* @param param 查询参数
* @param pageNo 当前页码
* @param pageSize 每页数量
* @return 传染病报卡列表
*/
R<?> listPage(InfectiousCardParam param, Integer pageNo, Integer pageSize);
/**
* 根据 ID 查询传染病报卡详情
*
* @param id 报卡 ID
* @return 传染病报卡详情
*/
R<?> getById(Long id);
/**
* 根据卡号查询传染病报卡详情
*
* @param cardNo 报卡编号
* @return 传染病报卡详情
*/
R<?> getByCardNo(String cardNo);
/**
* 审核传染病报卡(功能暂未实现)
*
* @param cardNo 报卡编号
* @param auditOpinion 审核意见
* @param status 审核状态
* @return 结果
*/
// R<?> audit(String cardNo, String auditOpinion, String status);
/**
* 退回传染病报卡(功能暂未实现)
*
* @param cardNo 报卡编号
* @param returnReason 退回原因
* @param status 审核状态
* @return 结果
*/
// R<?> returnCard(String cardNo, String returnReason, String status);
/**
* 批量审核传染病报卡(功能暂未实现)
*
* @param cardNos 报卡编号列表
* @param auditOpinion 审核意见
* @param status 审核状态
* @return 结果
*/
// R<?> batchAudit(List<String> cardNos, String auditOpinion, String status);
/**
* 批量退回传染病报卡(功能暂未实现)
*
* @param cardNos 报卡编号列表
* @param returnReason 退回原因
* @param status 审核状态
* @return 结果
*/
// R<?> batchReturn(List<String> cardNos, String returnReason, String status);
/**
* 导出传染病报卡
*
* @param param 查询参数
* @param response 响应对象
*/
void export(InfectiousCardParam param, HttpServletResponse response);
/**
* 获取科室树
*
* @return 科室树数据
*/
R<?> getDeptTree();
}

View File

@@ -0,0 +1,269 @@
package com.openhis.web.reportManagement.appservice.impl;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.core.domain.R;
import com.openhis.administration.domain.InfectiousDiseaseReport;
import com.openhis.administration.domain.Organization;
import com.openhis.administration.mapper.InfectiousDiseaseReportMapper;
import com.openhis.administration.service.IOrganizationService;
import com.openhis.web.reportManagement.appservice.IInfectiousCardAppService;
import com.openhis.web.reportManagement.dto.InfectiousCardDto;
import com.openhis.web.reportManagement.dto.InfectiousCardParam;
import com.openhis.web.reportManagement.mapper.ReportManageCardMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 传染病报卡 AppService 实现
*
* @author system
* @date 2026-03-17
*/
@Service
@Slf4j
public class InfectiousCardAppServiceImpl implements IInfectiousCardAppService {
@Autowired
private ReportManageCardMapper reportManageCardMapper;
@Autowired
private InfectiousDiseaseReportMapper infectiousDiseaseReportMapper;
@Autowired
private IOrganizationService organizationService;
/**
* 分页查询传染病报卡列表
* @param param 查询参数
* @param pageNo 页码
* @param pageSize 每页条数
* @return 报卡列表
*/
@Override
public R<?> listPage(InfectiousCardParam param, Integer pageNo, Integer pageSize) {
try {
Page<InfectiousCardDto> page = new Page<>(pageNo, pageSize);
IPage<InfectiousCardDto> resultPage = reportManageCardMapper.selectCardPage(page, param);
JSONObject result = new JSONObject();
result.put("rows", resultPage.getRecords());
result.put("total", resultPage.getTotal());
return R.ok(result);
} catch (Exception e) {
log.error("查询传染病报卡列表失败", e);
return R.fail("查询失败:" + e.getMessage());
}
}
/**
* 根据 ID 查询传染病报卡详情
* @param id 报卡 ID实际为 cardNo
* @return 报卡详情
*/
@Override
public R<?> getById(Long id) {
try {
// 注id 参数实际是 cardNo需要转换为 String
InfectiousCardDto dto = reportManageCardMapper.selectCardByCardNo(String.valueOf(id));
if (dto == null) {
return R.fail("报卡不存在");
}
return R.ok(dto);
} catch (Exception e) {
log.error("根据 ID 查询传染病报卡失败", e);
return R.fail("查询失败:" + e.getMessage());
}
}
/**
* 根据卡号查询传染病报卡详情
* @param cardNo 卡号
* @return 报卡详情
*/
@Override
public R<?> getByCardNo(String cardNo) {
try {
InfectiousCardDto dto = reportManageCardMapper.selectCardByCardNo(cardNo);
if (dto == null) {
return R.fail("报卡不存在");
}
return R.ok(dto);
} catch (Exception e) {
log.error("根据卡号查询传染病报卡失败", e);
return R.fail("查询失败:" + e.getMessage());
}
}
/**
* 审核传染病报卡(功能暂未实现)
* @param cardNo 卡号
* @param auditOpinion 审核意见
* @param status 审核状态
* @return 审核结果
*/
// @Override
// public R<?> audit(String cardNo, String auditOpinion, String status) {
// try {
// InfectiousDiseaseReport report = infectiousDiseaseReportMapper.selectById(cardNo);
// if (report == null) {
// return R.fail("报卡不存在");
// }
// report.setStatus(Integer.parseInt(status));
// report.setUpdateTime(new Date());
// infectiousDiseaseReportMapper.updateById(report);
// return R.ok("审核成功");
// } catch (Exception e) {
// log.error("审核传染病报卡失败", e);
// return R.fail("审核失败:" + e.getMessage());
// }
// }
/**
* 退回传染病报卡(功能暂未实现)
* @param cardNo 卡号
* @param returnReason 退回原因
* @param status 退回状态
* @return 退回结果
*/
// @Override
// public R<?> returnCard(String cardNo, String returnReason, String status) {
// try {
// InfectiousDiseaseReport report = infectiousDiseaseReportMapper.selectById(cardNo);
// if (report == null) {
// return R.fail("报卡不存在");
// }
// report.setStatus(Integer.parseInt(status));
// report.setWithdrawReason(returnReason);
// report.setUpdateTime(new Date());
// infectiousDiseaseReportMapper.updateById(report);
// return R.ok("退回成功");
// } catch (Exception e) {
// log.error("退回传染病报卡失败", e);
// return R.fail("退回失败:" + e.getMessage());
// }
// }
/**
* 批量审核传染病报卡(功能暂未实现)
* @param cardNos 卡号列表
* @param auditOpinion 审核意见
* @param status 审核状态
* @return 批量审核结果
*/
// @Override
// public R<?> batchAudit(List<String> cardNos, String auditOpinion, String status) {
// try {
// for (String cardNo : cardNos) {
// InfectiousDiseaseReport report = infectiousDiseaseReportMapper.selectById(cardNo);
// if (report != null) {
// report.setStatus(Integer.parseInt(status));
// report.setUpdateTime(new Date());
// infectiousDiseaseReportMapper.updateById(report);
// }
// }
// return R.ok("批量审核成功");
// } catch (Exception e) {
// log.error("批量审核传染病报卡失败", e);
// return R.fail("批量审核失败:" + e.getMessage());
// }
// }
/**
* 批量退回传染病报卡(功能暂未实现)
* @param cardNos 卡号列表
* @param returnReason 退回原因
* @param status 退回状态
* @return 批量退回结果
*/
// @Override
// public R<?> batchReturn(List<String> cardNos, String returnReason, String status) {
// try {
// for (String cardNo : cardNos) {
// InfectiousDiseaseReport report = infectiousDiseaseReportMapper.selectById(cardNo);
// if (report != null) {
// report.setStatus(Integer.parseInt(status));
// report.setWithdrawReason(returnReason);
// report.setUpdateTime(new Date());
// infectiousDiseaseReportMapper.updateById(report);
// }
// }
// return R.ok("批量退回成功");
// } catch (Exception e) {
// log.error("批量退回传染病报卡失败", e);
// return R.fail("批量退回失败:" + e.getMessage());
// }
// }
/**
* 导出传染病报卡数据
* @param param 查询参数
* @param response HTTP 响应对象
*/
@Override
public void export(InfectiousCardParam param, HttpServletResponse response) {
log.warn("导出功能暂未实现");
}
/**
* 获取科室树
* @return 科室树数据
*/
@Override
public R<?> getDeptTree() {
try {
// 查询所有启用的机构/科室
List<Organization> organizations = organizationService.list();
List<TreeNode> tree = buildTree(organizations);
return R.ok(tree);
} catch (Exception e) {
log.error("获取科室树失败", e);
return R.fail("获取科室树失败:" + e.getMessage());
}
}
/**
* 构建树形结构
*/
private List<TreeNode> buildTree(List<Organization> list) {
List<TreeNode> tree = new ArrayList<>();
for (Organization org : list) {
TreeNode node = new TreeNode();
node.value = org.getId();
node.label = org.getName();
node.children = new ArrayList<>();
tree.add(node);
}
return tree;
}
/**
* 树形节点 DTO
*/
private static class TreeNode {
private Long value;
private String label;
private List<TreeNode> children;
public Long getValue() { return value; }
public void setValue(Long value) { this.value = value; }
public String getLabel() { return label; }
public void setLabel(String label) { this.label = label; }
public List<TreeNode> getChildren() { return children; }
public void setChildren(List<TreeNode> children) { this.children = children; }
}
}

View File

@@ -0,0 +1,145 @@
package com.openhis.web.reportManagement.controller;
import com.core.common.core.domain.R;
import com.openhis.web.reportManagement.appservice.IInfectiousCardAppService;
import com.openhis.web.reportManagement.dto.InfectiousCardParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
// import java.util.List; // 批量操作功能暂未实现
/**
* 传染病报卡管理 Controller
*
* @author wangjian963
* @date 2026-03-17
*/
@RestController
@RequestMapping("/report-manage/infectiousDiseaseReport")
@Slf4j
public class reportManagementController {
@Autowired
private IInfectiousCardAppService infectiousCardAppService;
/**
* 分页查询传染病报卡列表
*
* @param param 查询参数
* @param pageNo 当前页码
* @param pageSize 每页数量
* @return 传染病报卡列表
*/
@GetMapping("/list-page")
public R<?> listPage(InfectiousCardParam param,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
return infectiousCardAppService.listPage(param, pageNo, pageSize);
}
/**
* 根据 ID 查询传染病报卡详情
*
* @param id 报卡 ID
* @return 传染病报卡详情
*/
@GetMapping("/{id}")
public R<?> getById(@PathVariable Long id) {
return infectiousCardAppService.getById(id);
}
/**
* 根据卡号查询传染病报卡详情
*
* @param cardNo 报卡编号
* @return 传染病报卡详情
*/
@GetMapping("/detail/{cardNo}")
public R<?> getByCardNo(@PathVariable String cardNo) {
return infectiousCardAppService.getByCardNo(cardNo);
}
/**
* 审核传染病报卡(功能暂未实现)
*
* @param cardNo 报卡编号
* @param auditOpinion 审核意见
* @param status 审核状态
* @return 结果
*/
// @PostMapping("/audit")
// public R<?> audit(@RequestParam String cardNo,
// @RequestParam String auditOpinion,
// @RequestParam String status) {
// return infectiousCardAppService.audit(cardNo, auditOpinion, status);
// }
/**
* 退回传染病报卡(功能暂未实现)
*
* @param cardNo 报卡编号
* @param returnReason 退回原因
* @param status 审核状态
* @return 结果
*/
// @PostMapping("/return")
// public R<?> returnCard(@RequestParam String cardNo,
// @RequestParam String returnReason,
// @RequestParam String status) {
// return infectiousCardAppService.returnCard(cardNo, returnReason, status);
// }
/**
* 批量审核传染病报卡(功能暂未实现)
*
* @param cardNos 报卡编号列表
* @param auditOpinion 审核意见
* @param status 审核状态
* @return 结果
*/
// @PostMapping("/batchAudit")
// public R<?> batchAudit(@RequestBody List<String> cardNos,
// @RequestParam String auditOpinion,
// @RequestParam String status) {
// return infectiousCardAppService.batchAudit(cardNos, auditOpinion, status);
// }
/**
* 批量退回传染病报卡(功能暂未实现)
*
* @param cardNos 报卡编号列表
* @param returnReason 退回原因
* @param status 审核状态
* @return 结果
*/
// @PostMapping("/batchReturn")
// public R<?> batchReturn(@RequestBody List<String> cardNos,
// @RequestParam String returnReason,
// @RequestParam String status) {
// return infectiousCardAppService.batchReturn(cardNos, returnReason, status);
// }
/**
* 导出传染病报卡
*
* @param param 查询参数
* @param response 响应对象
*/
@PostMapping("/export")
public void export(InfectiousCardParam param, HttpServletResponse response) {
infectiousCardAppService.export(param, response);
}
/**
* 获取科室树
*
* @return 科室树数据
*/
@GetMapping("/dept-tree")
public R<?> getDeptTree() {
return infectiousCardAppService.getDeptTree();
}
}

View File

@@ -0,0 +1,142 @@
package com.openhis.web.reportManagement.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import java.util.Date;
/**
* 传染病报卡详情 DTO
*
* @author system
* @date 2026-03-17
*/
@Data
public class InfectiousCardDto {
/** 卡片编号(主键) */
private String cardNo;
/** 报卡名称 */
private String cardName;
/** 病种名称 */
private String diseaseName;
/** 疾病编码 */
private String diseaseCode;
/** 患者姓名 */
private String patientName;
/** 性别 (1 男/2 女/0 未知) */
private String sex;
/** 实足年龄 */
private Integer age;
/** 科室 ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long deptId;
/** 科室名称 */
private String deptName;
/** 登记来源 (1 门诊/2 住院/3 急诊/4 体检) */
private Integer registrationSource;
/** 报告日期 */
private Date reportDate;
/** 状态 (0 暂存/1 待审核/2 已审核/3 已上报/4 失败/5 退回) */
private Integer status;
/** 证件类型 */
private Integer idType;
/** 证件号码 */
private String idNo;
/** 家长姓名 */
private String parentName;
/** 出生日期 */
private Date birthday;
/** 年龄单位 (1 岁/2 月/3 天) */
private String ageUnit;
/** 工作单位 */
private String workplace;
/** 联系电话 */
private String phone;
/** 紧急联系人电话 */
private String contactPhone;
/** 现住址省 */
private String addressProv;
/** 现住址市 */
private String addressCity;
/** 现住址县 */
private String addressCounty;
/** 现住址街道 */
private String addressTown;
/** 现住址村/居委 */
private String addressVillage;
/** 现住址门牌号 */
private String addressHouse;
/** 病人属于 */
private Integer patientBelong;
/** 职业 */
private String occupation;
/** 疾病分型 */
private String diseaseType;
/** 病例分类 */
private Integer caseClass;
/** 发病日期 */
private Date onsetDate;
/** 诊断日期 */
private Date diagDate;
/** 死亡日期 */
private Date deathDate;
/** 报告单位 */
private String reportOrg;
/** 报告医生 */
private String reportDoc;
/** 备注 */
private String remark;
/** 审核意见 */
private String auditOpinion;
/** 退回原因 */
private String returnReason;
/** 订正病名 */
private String correctName;
/** 退卡原因 */
private String withdrawReason;
/** 其他传染病 */
private String otherDisease;
}

View File

@@ -0,0 +1,35 @@
package com.openhis.web.reportManagement.dto;
import lombok.Data;
/**
* 传染病报卡查询参数
*
* @author system
* @date 2026-03-17
*/
@Data
public class InfectiousCardParam {
/** 报卡编号 */
private String cardNo;
/** 患者姓名 */
private String patientName;
/** 审核状态 (0 暂存/1 待审核/2 已审核/3 已上报/4 失败/5 退回) */
private Integer status;
/** 登记来源 (1 门诊/2 住院/3 急诊/4 体检) */
private Integer registrationSource;
/** 科室 ID */
private Long deptId;
/** 开始日期 */
private String startDate;
/** 结束日期 */
private String endDate;
}

View File

@@ -0,0 +1,33 @@
package com.openhis.web.reportManagement.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.openhis.web.reportManagement.dto.InfectiousCardDto;
import com.openhis.web.reportManagement.dto.InfectiousCardParam;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* 传染病报卡 Mapper 接口
*
* @author system
* @date 2026-03-18
*/
@Repository
public interface ReportManageCardMapper {
/**
* 分页查询报卡列表(联查科室名称)
* @param page 分页对象
* @param param 查询参数
* @return 报卡列表
*/
IPage<InfectiousCardDto> selectCardPage(Page<InfectiousCardDto> page, @Param("param") InfectiousCardParam param);
/**
* 根据卡号查询报卡详情(联查科室名称)
* @param cardNo 卡号
* @return 报卡详情
*/
InfectiousCardDto selectCardByCardNo(@Param("cardNo") String cardNo);
}

View File

@@ -23,6 +23,7 @@
is_stopped, is_stopped,
stop_reason, stop_reason,
dept_id, dept_id,
reg_type,
doctor_id doctor_id
<if test="createTime != null">, create_time</if> <if test="createTime != null">, create_time</if>
<if test="updateTime != null">, update_time</if> <if test="updateTime != null">, update_time</if>
@@ -43,6 +44,7 @@
#{isStopped}, #{isStopped},
#{stopReason}, #{stopReason},
#{deptId}, #{deptId},
#{regType},
#{doctorId} #{doctorId}
<if test="createTime != null">, #{createTime}</if> <if test="createTime != null">, #{createTime}</if>
<if test="updateTime != null">, #{updateTime}</if> <if test="updateTime != null">, #{updateTime}</if>
@@ -68,6 +70,7 @@
<if test="isStopped != null">is_stopped = #{isStopped},</if> <if test="isStopped != null">is_stopped = #{isStopped},</if>
<if test="stopReason != null">stop_reason = #{stopReason},</if> <if test="stopReason != null">stop_reason = #{stopReason},</if>
<if test="deptId != null">dept_id = #{deptId},</if> <if test="deptId != null">dept_id = #{deptId},</if>
<if test="regType != null">reg_type = #{regType},</if>
<if test="doctorId != null">doctor_id = #{doctorId},</if> <if test="doctorId != null">doctor_id = #{doctorId},</if>
<if test="updateTime != null">update_time = #{updateTime}</if> <if test="updateTime != null">update_time = #{updateTime}</if>
</set> </set>
@@ -97,12 +100,16 @@
ds.is_stopped AS is_stopped, ds.is_stopped AS is_stopped,
ds.stop_reason AS stop_reason, ds.stop_reason AS stop_reason,
ds.dept_id AS dept_id, ds.dept_id AS dept_id,
ds.reg_type AS reg_type,
sp.doctor_id AS doctor_id, sp.doctor_id AS doctor_id,
sp.schedule_date AS schedule_date sp.schedule_date AS schedule_date
FROM adm_doctor_schedule ds FROM adm_doctor_schedule ds
LEFT JOIN adm_schedule_pool sp ON sp.schedule_id = ds.id LEFT JOIN adm_schedule_pool sp ON sp.schedule_id = ds.id
AND sp.delete_flag = '0'
LEFT JOIN adm_organization org ON ds.dept_id = org.id LEFT JOIN adm_organization org ON ds.dept_id = org.id
AND org.delete_flag = '0'
WHERE ds.dept_id = #{deptId} WHERE ds.dept_id = #{deptId}
AND ds.delete_flag = '0'
AND sp.schedule_date BETWEEN #{startDate}::date AND #{endDate}::date AND sp.schedule_date BETWEEN #{startDate}::date AND #{endDate}::date
ORDER BY sp.schedule_date, ds.time_period ORDER BY sp.schedule_date, ds.time_period
</select> </select>
@@ -129,12 +136,16 @@
ds.is_stopped AS is_stopped, ds.is_stopped AS is_stopped,
ds.stop_reason AS stop_reason, ds.stop_reason AS stop_reason,
ds.dept_id AS dept_id, ds.dept_id AS dept_id,
ds.reg_type AS reg_type,
sp.doctor_id AS doctor_id, sp.doctor_id AS doctor_id,
sp.schedule_date AS schedule_date sp.schedule_date AS schedule_date
FROM adm_doctor_schedule ds FROM adm_doctor_schedule ds
INNER JOIN adm_schedule_pool sp ON sp.schedule_id = ds.id INNER JOIN adm_schedule_pool sp ON sp.schedule_id = ds.id
AND sp.delete_flag = '0'
LEFT JOIN adm_organization org ON ds.dept_id = org.id LEFT JOIN adm_organization org ON ds.dept_id = org.id
AND org.delete_flag = '0'
WHERE sp.schedule_date = #{today}::date WHERE sp.schedule_date = #{today}::date
AND ds.delete_flag = '0'
AND (ds.is_stopped = false OR ds.is_stopped IS NULL) AND (ds.is_stopped = false OR ds.is_stopped IS NULL)
ORDER BY ds.time_period ORDER BY ds.time_period
</select> </select>
@@ -161,12 +172,16 @@
ds.is_stopped AS is_stopped, ds.is_stopped AS is_stopped,
ds.stop_reason AS stop_reason, ds.stop_reason AS stop_reason,
ds.dept_id AS dept_id, ds.dept_id AS dept_id,
ds.reg_type AS reg_type,
sp.doctor_id AS doctor_id, sp.doctor_id AS doctor_id,
sp.schedule_date AS schedule_date sp.schedule_date AS schedule_date
FROM adm_doctor_schedule ds FROM adm_doctor_schedule ds
INNER JOIN adm_schedule_pool sp ON sp.schedule_id = ds.id INNER JOIN adm_schedule_pool sp ON sp.schedule_id = ds.id
AND sp.delete_flag = '0'
LEFT JOIN adm_organization org ON ds.dept_id = org.id LEFT JOIN adm_organization org ON ds.dept_id = org.id
AND org.delete_flag = '0'
WHERE sp.schedule_date = #{today}::date WHERE sp.schedule_date = #{today}::date
AND ds.delete_flag = '0'
AND sp.doctor_id = #{doctorId} AND sp.doctor_id = #{doctorId}
AND (ds.is_stopped = false OR ds.is_stopped IS NULL) AND (ds.is_stopped = false OR ds.is_stopped IS NULL)
ORDER BY ds.time_period ORDER BY ds.time_period

View File

@@ -0,0 +1,153 @@
<?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.reportManagement.mapper.ReportManageCardMapper">
<!-- 分页查询报卡列表 -->
<select id="selectCardPage" resultType="com.openhis.web.reportManagement.dto.InfectiousCardDto">
SELECT
t1.card_no AS cardNo,
'传染病报告卡' AS cardName,
t1.disease_code AS diseaseCode,
CASE
WHEN t1.disease_code = '0101' THEN '鼠疫'
WHEN t1.disease_code = '0102' THEN '霍乱'
WHEN t1.disease_code = '0201' THEN '传染性非典型肺炎'
WHEN t1.disease_code = '0202' THEN '艾滋病'
WHEN t1.disease_code = '0203' THEN '病毒性肝炎'
WHEN t1.disease_code = '0211' THEN '炭疽'
WHEN t1.disease_code = '0213' THEN '肺结核'
WHEN t1.disease_code = '0222' THEN '梅毒'
WHEN t1.disease_code = '0224' THEN '血吸虫病'
WHEN t1.disease_code = '0225' THEN '疟疾'
WHEN t1.disease_code = '0301' THEN '流行性感冒'
WHEN t1.disease_code = '0302' THEN '流行性腮腺炎'
WHEN t1.disease_code = '0303' THEN '风疹'
WHEN t1.disease_code = '0310' THEN '其它感染性腹泻病'
WHEN t1.disease_code = '0311' THEN '手足口病'
ELSE t1.disease_code
END AS diseaseName,
t1.pat_name AS patientName,
t1.sex AS sex,
t1.age AS age,
t1.dept_id AS deptId,
t2.name AS deptName,
t1.registration_source AS registrationSource,
t1.report_date AS reportDate,
t1.status AS status,
t1.id_type AS idType,
t1.id_no AS idNo,
t1.parent_name AS parentName,
t1.birthday AS birthday,
t1.age_unit AS ageUnit,
t1.workplace AS workplace,
t1.phone AS phone,
t1.contact_phone AS contactPhone,
t1.address_prov AS addressProv,
t1.address_city AS addressCity,
t1.address_county AS addressCounty,
t1.address_town AS addressTown,
t1.address_village AS addressVillage,
t1.address_house AS addressHouse,
t1.patient_belong AS patientBelong,
t1.occupation AS occupation,
t1.disease_type AS diseaseType,
t1.case_class AS caseClass,
t1.onset_date AS onsetDate,
t1.diag_date AS diagDate,
t1.death_date AS deathDate,
t1.report_org AS reportOrg,
t1.report_doc AS reportDoc,
t1.withdraw_reason AS withdrawReason,
t1.correct_name AS correctName,
t1.other_disease AS otherDisease
FROM infectious_card t1
LEFT JOIN adm_organization t2 ON t1.dept_id = t2.id
WHERE t1.delete_flag = '0'
<if test="param.cardNo != null and param.cardNo != ''">
AND t1.card_no = #{param.cardNo}
</if>
<if test="param.patientName != null and param.patientName != ''">
AND t1.pat_name LIKE CONCAT('%', #{param.patientName}, '%')
</if>
<if test="param.status != null">
AND t1.status = #{param.status}
</if>
<if test="param.registrationSource != null">
AND t1.registration_source = #{param.registrationSource}
</if>
<if test="param.deptId != null">
AND t1.dept_id = #{param.deptId}
</if>
<if test="param.startDate != null and param.startDate != ''">
AND t1.report_date &gt;= TO_DATE(#{param.startDate}, 'YYYY-MM-DD')
</if>
<if test="param.endDate != null and param.endDate != ''">
AND t1.report_date &lt;= TO_DATE(#{param.endDate}, 'YYYY-MM-DD')
</if>
ORDER BY t1.report_date DESC
</select>
<!-- 根据卡号查询报卡详情 -->
<select id="selectCardByCardNo" resultType="com.openhis.web.reportManagement.dto.InfectiousCardDto">
SELECT
t1.card_no AS cardNo,
'传染病报告卡' AS cardName,
t1.disease_code AS diseaseCode,
CASE
WHEN t1.disease_code = '0101' THEN '鼠疫'
WHEN t1.disease_code = '0102' THEN '霍乱'
WHEN t1.disease_code = '0201' THEN '传染性非典型肺炎'
WHEN t1.disease_code = '0202' THEN '艾滋病'
WHEN t1.disease_code = '0203' THEN '病毒性肝炎'
WHEN t1.disease_code = '0211' THEN '炭疽'
WHEN t1.disease_code = '0213' THEN '肺结核'
WHEN t1.disease_code = '0222' THEN '梅毒'
WHEN t1.disease_code = '0224' THEN '血吸虫病'
WHEN t1.disease_code = '0225' THEN '疟疾'
WHEN t1.disease_code = '0301' THEN '流行性感冒'
WHEN t1.disease_code = '0302' THEN '流行性腮腺炎'
WHEN t1.disease_code = '0303' THEN '风疹'
WHEN t1.disease_code = '0310' THEN '其它感染性腹泻病'
WHEN t1.disease_code = '0311' THEN '手足口病'
ELSE t1.disease_code
END AS diseaseName,
t1.pat_name AS patientName,
t1.sex AS sex,
t1.age AS age,
t1.dept_id AS deptId,
t2.name AS deptName,
t1.registration_source AS registrationSource,
t1.report_date AS reportDate,
t1.status AS status,
t1.id_type AS idType,
t1.id_no AS idNo,
t1.parent_name AS parentName,
t1.birthday AS birthday,
t1.age_unit AS ageUnit,
t1.workplace AS workplace,
t1.phone AS phone,
t1.contact_phone AS contactPhone,
t1.address_prov AS addressProv,
t1.address_city AS addressCity,
t1.address_county AS addressCounty,
t1.address_town AS addressTown,
t1.address_village AS addressVillage,
t1.address_house AS addressHouse,
t1.patient_belong AS patientBelong,
t1.occupation AS occupation,
t1.disease_type AS diseaseType,
t1.case_class AS caseClass,
t1.onset_date AS onsetDate,
t1.diag_date AS diagDate,
t1.death_date AS deathDate,
t1.report_org AS reportOrg,
t1.report_doc AS reportDoc,
t1.withdraw_reason AS withdrawReason,
t1.correct_name AS correctName,
t1.other_disease AS otherDisease
FROM infectious_card t1
LEFT JOIN adm_organization t2 ON t1.dept_id = t2.id
WHERE t1.delete_flag = '0' AND t1.card_no = #{cardNo}
</select>
</mapper>

View File

@@ -0,0 +1,68 @@
package com.openhis.common.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 传染病报告卡状态枚举
* 0 暂存/1 已提交=待审核/2 已审核=审核通过/3 已上报/4 失败/5 退回=审核失败
*
* @author system
* @date 2026-03-18
*/
@Getter
@AllArgsConstructor
public enum ReportCardStatus implements HisEnumInterface {
DRAFT(0, "draft", "暂存"),
SUBMITTED(1, "submitted", "已提交"),
AUDITED(2, "audited", "已审核"),
REPORTED(3, "reported", "已上报"),
FAILED(4, "failed", "失败"),
RETURNED(5, "returned", "退回");
@EnumValue
private final Integer value;
private final String code;
private final String info;
/**
* 根据值获取枚举
* @param value 状态值
* @return 枚举对象
*/
public static ReportCardStatus getByValue(Integer value) {
if (value == null) {
return null;
}
for (ReportCardStatus val : values()) {
if (val.getValue().equals(value)) {
return val;
}
}
return null;
}
/**
* 根据编码获取枚举
* @param code 状态编码
* @return 枚举对象
*/
public static ReportCardStatus getByCode(String code) {
if (code == null) {
return null;
}
for (ReportCardStatus val : values()) {
if (val.getCode().equals(code)) {
return val;
}
}
return null;
}
}

View File

@@ -10,8 +10,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.time.LocalDate; import java.util.Date;
import java.time.LocalDateTime;
/** /**
* 传染病报告卡实体 * 传染病报告卡实体
@@ -30,15 +29,15 @@ public class InfectiousDiseaseReport extends HisBaseEntity {
private String cardNo; private String cardNo;
/** 本次就诊ID */ /** 本次就诊ID */
@JsonSerialize(using = ToStringSerializer.class) // removed
private Long visitId; private Long visitId;
/** 诊断记录唯一ID */ /** 诊断记录唯一ID */
@JsonSerialize(using = ToStringSerializer.class) // removed
private Long diagId; private Long diagId;
/** 患者主索引 */ /** 患者主索引 */
@JsonSerialize(using = ToStringSerializer.class) // removed
private Long patId; private Long patId;
/** 证件类型 */ /** 证件类型 */
@@ -47,25 +46,25 @@ public class InfectiousDiseaseReport extends HisBaseEntity {
/** 证件号码 */ /** 证件号码 */
private String idNo; private String idNo;
/** 患者姓*/ /** 患者姓<EFBFBD>?*/
private String patName; private String patName;
/** 家长姓名≤14岁必填 */ /** 家长姓名≤14岁必填 */
private String parentName; private String parentName;
/** 性别 1男 2女 0未知 */ /** 性别 1<EFBFBD>?2<>?0未知 */
private String sex; private String sex;
/** 出生日期 */ /** 出生日期 */
private LocalDate birthday; private Date birthday;
/** 实足年龄 */ /** 实足年龄 */
private Integer age; private Integer age;
/** 年龄单位 1岁 2月 3天 */ /** 年龄单位 1<EFBFBD>?2<>?3<>?*/
private String ageUnit; private String ageUnit;
/** 工作单位(学生填学校 */ /** 工作单位(学生填学校<EFBFBD>?*/
private String workplace; private String workplace;
/** 联系电话(患者本人电话) */ /** 联系电话(患者本人电话) */
@@ -74,58 +73,58 @@ public class InfectiousDiseaseReport extends HisBaseEntity {
/** 紧急联系人电话 */ /** 紧急联系人电话 */
private String contactPhone; private String contactPhone;
/** 现住址*/ /** 现住址<EFBFBD>?*/
private String addressProv; private String addressProv;
/** 现住址*/ /** 现住址<EFBFBD>?*/
private String addressCity; private String addressCity;
/** 现住址*/ /** 现住址<EFBFBD>?*/
private String addressCounty; private String addressCounty;
/** 现住址街道 */ /** 现住址街道 */
private String addressTown; private String addressTown;
/** 现住址村/居委 */ /** 现住址<EFBFBD>?居委 */
private String addressVillage; private String addressVillage;
/** 现住址门牌*/ /** 现住址门牌<EFBFBD>?*/
private String addressHouse; private String addressHouse;
/** 病人属于 1本县区/2本市其他/3本省其他/4外省/5港澳台/6外籍 */ /** 病人属于 1本县<EFBFBD>?2本市其他/3本省其他/4外省/5港澳<EFBFBD>?6外籍 */
private Integer patientBelong; private Integer patientBelong;
/** 职业 */ /** 职业 */
private String occupation; private String occupation;
/** 疾病名称WS 218-2020 */ /** 疾病名称WS 218-2020<EFBFBD>?*/
private String diseaseCode; private String diseaseCode;
/** 分型6类必分型疾病必填 */ /** 分型<EFBFBD>?类必分型疾病必填<EFBFBD>?*/
private String diseaseType; private String diseaseType;
/** 其他法定管理以及重点监测传染*/ /** 其他法定管理以及重点监测传染<EFBFBD>?*/
private String otherDisease; private String otherDisease;
/** 病例分类 1疑似病例/2临床诊断病例/3确诊病例/4病原携带/5阳性检测结*/ /** 病例分类 1疑似病例/2临床诊断病例/3确诊病例/4病原携带/5阳性检测结<EFBFBD>?*/
private Integer caseClass; private Integer caseClass;
/** 发病日期(默认诊断时间,病原携带者填初检日期 */ /** 发病日期(默认诊断时间,病原携带者填初检日期<EFBFBD>?*/
private LocalDate onsetDate; private Date onsetDate;
/** 诊断日期(精确到小时 */ /** 诊断日期(精确到小时<EFBFBD>?*/
private LocalDateTime diagDate; private Date diagDate;
/** 死亡日期(死亡病例必填) */ /** 死亡日期(死亡病例必填) */
private LocalDate deathDate; private Date deathDate;
/** 订正病名(订正报告必填) */ /** 订正病名(订正报告必填) */
private String correctName; private String correctName;
/** 退卡原因(退卡时必填 */ /** 退卡原因(退卡时必填<EFBFBD>?*/
private String withdrawReason; private String withdrawReason;
/** 报告单位(统一信用代码/医院名称 */ /** 报告单位(统一信用代码/医院名称<EFBFBD>?*/
private String reportOrg; private String reportOrg;
/** 报告单位联系电话 */ /** 报告单位联系电话 */
@@ -135,15 +134,15 @@ public class InfectiousDiseaseReport extends HisBaseEntity {
private String reportDoc; private String reportDoc;
/** 填卡日期 */ /** 填卡日期 */
private LocalDate reportDate; private Date reportDate;
/** 报卡名称代码 1-中华人民共和国传染病报告*/ /** 报卡名称代码 1-中华人民共和国传染病报告<EFBFBD>?*/
private Integer cardNameCode; private Integer cardNameCode;
/** 登记来源 1门诊/2住院 */ /** 登记来源 1门诊/2住院 */
private Integer registrationSource; private Integer registrationSource;
/** 状0暂存 1已提2已审3已上4失败 5作废 */ /** 状<EFBFBD>?0暂存 1已提<EFBFBD>?2已审<EFBFBD>?3已上<EFBFBD>?4失败 5作废 */
private Integer status; private Integer status;
/** 失败原因(国家平台返回) */ /** 失败原因(国家平台返回) */
@@ -153,10 +152,11 @@ public class InfectiousDiseaseReport extends HisBaseEntity {
private String xmlContent; private String xmlContent;
/** 科室ID */ /** 科室ID */
// removed
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long deptId; private Long deptId;
/** 医生ID */ /** 医生ID */
@JsonSerialize(using = ToStringSerializer.class) // removed
private Long doctorId; private Long doctorId;
} }

View File

@@ -1,6 +1,7 @@
package com.openhis.administration.domain; package com.openhis.administration.domain;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.core.common.core.domain.HisBaseEntity; import com.core.common.core.domain.HisBaseEntity;
@@ -91,4 +92,8 @@ public class Organization extends HisBaseEntity {
/** 备注 */ /** 备注 */
private String remark; private String remark;
/** 租户名称(从 sys_tenant 表关联查询,非数据库字段) */
@TableField(exist = false)
private String tenantName;
} }

View File

@@ -1,6 +1,8 @@
package com.openhis.administration.mapper; package com.openhis.administration.mapper;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.openhis.administration.domain.Organization; import com.openhis.administration.domain.Organization;
import com.openhis.administration.dto.OrgDataDto; import com.openhis.administration.dto.OrgDataDto;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -25,5 +27,21 @@ public interface OrganizationMapper extends BaseMapper<Organization> {
**/ **/
List<OrgDataDto> searchOrgDataByHealth(); List<OrgDataDto> searchOrgDataByHealth();
/**
* 分页查询挂号科室列表,关联租户表获取租户名称
* @param page 分页对象
* @param registerFlag 挂号标记
* @param deleteFlag 删除标记
* @param name 机构名称
* @param orgName 机构名称筛选
* @return 分页结果
*/
@InterceptorIgnore(tenantLine = "true")
IPage<Organization> selectRegisterOrganizationsWithTenant(
IPage<Organization> page,
@Param("registerFlag") Integer registerFlag,
@Param("deleteFlag") String deleteFlag,
@Param("name") String name,
@Param("orgName") String orgName
);
} }

View File

@@ -72,6 +72,9 @@ public class DoctorSchedule extends HisBaseEntity {
/** 关联科室id */ /** 关联科室id */
private Long deptId; private Long deptId;
/** 号别0=普通1=专家 */
private Integer regType;
/** 医生ID - 不映射到数据库表字段,仅作传输使用 */ /** 医生ID - 不映射到数据库表字段,仅作传输使用 */
private Long doctorId; private Long doctorId;

View File

@@ -61,6 +61,9 @@ public class DoctorScheduleWithDateDto {
/** 关联科室ID */ /** 关联科室ID */
private Long deptId; private Long deptId;
/** 号别0=普通1=专家 */
private Integer regType;
/** 医生姓名 */ /** 医生姓名 */
private String doctorName; private String doctorName;

View File

@@ -14,5 +14,54 @@
GROUP BY heal.offered_org_id) GROUP BY heal.offered_org_id)
</select> </select>
<!-- 分页查询挂号科室列表,关联租户表获取租户名称 -->
<select id="selectRegisterOrganizationsWithTenant" resultType="com.openhis.administration.domain.Organization">
SELECT
org.id,
org.bus_no,
org.name,
org.active_flag,
org.type_enum,
org.class_enum,
org.py_str,
org.wb_str,
org.yb_no,
org.yb_name,
org.caty,
org.display_order,
org.medins_id,
org.medins_admdvs,
org.medins_type,
org.medins_lv,
org.def_doctor_id,
org.register_flag,
org.location,
org.intro,
org.remark,
org.tenant_id,
org.delete_flag,
org.create_by,
org.create_time,
org.update_by,
org.update_time,
st.tenant_name AS tenantName
FROM adm_organization org
LEFT JOIN sys_tenant st ON org.tenant_id = st.id
<where>
<if test="registerFlag != null">
AND org.register_flag = #{registerFlag}
</if>
<if test="deleteFlag != null">
AND org.delete_flag = #{deleteFlag}
</if>
<if test="name != null and name != ''">
AND org.name LIKE CONCAT('%', #{name}, '%')
</if>
<if test="orgName != null and orgName != ''">
AND st.tenant_name = #{orgName}
</if>
</where>
ORDER BY org.bus_no ASC
</select>
</mapper> </mapper>

View File

@@ -331,7 +331,7 @@
type="danger" type="danger"
size="small" size="small"
@click="handleDeleteSchedule(scope.row)" @click="handleDeleteSchedule(scope.row)"
:disabled="!isEditMode" :disabled="!isEditMode || isLastDraftRowInSlot(scope.row)"
> >
删除 删除
</el-button> </el-button>
@@ -430,7 +430,7 @@ const currentDept = ref(null)
// 筛选参数 // 筛选参数
const filterParams = ref({ const filterParams = ref({
orgName: '演示医院', orgName: '',
deptName: '测试内科', deptName: '测试内科',
clinicRoomName: '', // 添加诊室名称过滤字段 clinicRoomName: '', // 添加诊室名称过滤字段
startDate: new Date(), startDate: new Date(),
@@ -505,9 +505,9 @@ const fetchDoctorList = async (orgId) => {
console.log('原始医生数据:', doctorList) console.log('原始医生数据:', doctorList)
// 医生数据按类型分组 // 医生下拉统一展示:普通/专家都显示同一批医生
const ordinaryDoctors = [] // 排班回显仍按 schedule.regType 过滤,不受这里影响
const expertDoctors = [] const allDoctors = []
doctorList.forEach(doctor => { doctorList.forEach(doctor => {
// 不再单独检查医生的org_id是否与当前科室匹配 // 不再单独检查医生的org_id是否与当前科室匹配
@@ -520,29 +520,26 @@ const fetchDoctorList = async (orgId) => {
orgId: doctor.orgId orgId: doctor.orgId
} }
ordinaryDoctors.push(doctorInfo) allDoctors.push(doctorInfo)
// 如果有专家类型的判断逻辑,可以在这里添加
// 示例:如果职称包含"主任"或"教授"等关键词,则归为专家
if (doctor.drProfttlCode && (doctor.drProfttlCode.includes('主任') || doctor.drProfttlCode.includes('教授'))) {
expertDoctors.push(doctorInfo)
}
}) })
// 更新医生选项 const uniqueDoctors = Array.from(
doctorOptions.value['普通'] = ordinaryDoctors new Map(allDoctors.map(doc => [doc.id, doc])).values()
doctorOptions.value['专家'] = expertDoctors.length > 0 ? expertDoctors : [...ordinaryDoctors] )
// 更新医生选项
doctorOptions.value['普通'] = uniqueDoctors
doctorOptions.value['专家'] = uniqueDoctors
console.log('最终的医生列表:', doctorOptions.value)
} else { } else {
console.error('获取医生列表失败:', response.msg)
doctorOptions.value = { doctorOptions.value = {
'普通': [], '普通': [],
'专家': [] '专家': []
} }
} }
} catch (error) { } catch (error) {
console.error('获取医生列表异常:', error)
doctorOptions.value = { doctorOptions.value = {
'普通': [], '普通': [],
'专家': [] '专家': []
@@ -693,7 +690,7 @@ const fetchClinicItems = async (deptId = null) => {
// 根据排班类型获取医生选项 // 根据排班类型获取医生选项
const getDoctorOptions = (appointmentType) => { const getDoctorOptions = (appointmentType) => {
return doctorOptions.value[appointmentType] || doctorOptions.value['普通'] return doctorOptions.value[appointmentType] || []
} }
// 排班列表数据 // 排班列表数据
@@ -772,10 +769,6 @@ const fetchOrganizationList = async () => {
} }
}); });
// 添加默认的机构选项(如"中联医院"、"演示医院"等)
const defaultOrgs = ['中联医院', '演示医院']; // 可以根据需要添加更多默认选项
defaultOrgs.forEach(org => uniqueOrgNames.add(org));
// 将机构名称转换为下拉选项格式 // 将机构名称转换为下拉选项格式
organizationOptions.value = Array.from(uniqueOrgNames).map((orgName, index) => ({ organizationOptions.value = Array.from(uniqueOrgNames).map((orgName, index) => ({
id: index, // 使用索引作为ID因为我们只需要名称 id: index, // 使用索引作为ID因为我们只需要名称
@@ -783,36 +776,27 @@ const fetchOrganizationList = async () => {
orgName: orgName orgName: orgName
})); }));
} else { } else {
console.error('获取卫生机构列表失败:', response.msg) organizationOptions.value = []
// 如果获取数据失败,至少显示默认选项
const defaultOrgs = ['中联医院', '演示医院'];
organizationOptions.value = defaultOrgs.map((orgName, index) => ({
id: index,
name: orgName,
orgName: orgName
}));
} }
} catch (error) { } catch (error) {
console.error('获取卫生机构列表失败:', error) organizationOptions.value = []
// 如果出现异常,至少显示默认选项
const defaultOrgs = ['中联医院', '演示医院'];
organizationOptions.value = defaultOrgs.map((orgName, index) => ({
id: index,
name: orgName,
orgName: orgName
}));
} }
} }
// 获取科室列表(通用方法) // 获取科室列表(通用方法)
const fetchDeptList = async (apiFunction) => { const fetchDeptList = async (apiFunction) => {
try { try {
// 复制查询参数 // 统一查询参数口径:后端使用 name 作为科室名称条件
const params = { const params = {
...queryParams.value, pageNum: pagination.value.currentPage,
pageNum: pagination.value.currentPage, // 修正为 pageNum
pageSize: pagination.value.pageSize pageSize: pagination.value.pageSize
}; };
if (queryParams.value.orgName) {
params.orgName = queryParams.value.orgName;
}
if (queryParams.value.deptName) {
params.name = queryParams.value.deptName;
}
// 同时获取配置数据,分页大小与主列表保持一致 // 同时获取配置数据,分页大小与主列表保持一致
// 这样既解决了 9999 导致的性能问题,又保证了当前显示行的数据完整性 // 这样既解决了 9999 导致的性能问题,又保证了当前显示行的数据完整性
@@ -899,9 +883,9 @@ const getDeptList = async () => {
} }
// 查询 // 查询
const handleQuery = () => { const handleQuery = async () => {
pagination.value.currentPage = 1; pagination.value.currentPage = 1;
fetchDeptList(getRegisterOrganizations); // 使用挂号科室API await fetchDeptList(getRegisterOrganizations); // 使用挂号科室API
} }
// 处理卫生机构选择变化 // 处理卫生机构选择变化
@@ -914,13 +898,14 @@ const handleOrgChange = async (orgName) => {
} }
// 重置 // 重置
const handleReset = () => { const handleReset = async () => {
queryParams.value = { queryParams.value = {
orgName: '', orgName: '',
deptName: '' deptName: ''
} }
pagination.value.currentPage = 1 pagination.value.currentPage = 1
getDeptList() await fetchDepartmentOptions()
await getDeptList()
} }
// 预约设置弹窗显示 // 预约设置弹窗显示
@@ -1015,85 +1000,104 @@ const reloadScheduleData = async () => {
const row = currentDept.value const row = currentDept.value
if (!row) return if (!row) return
// 使用组件级别的 workTimeConfig
const weekSchedule = generateWeekSchedule(filterParams.value.startDate, workTimeConfig.value) const weekSchedule = generateWeekSchedule(filterParams.value.startDate, workTimeConfig.value)
// 计算当前周的起止日期,用于联表查询
const startDateStr = formatDateStr(filterParams.value.startDate) const startDateStr = formatDateStr(filterParams.value.startDate)
const endDate = new Date(filterParams.value.startDate) const endDate = new Date(filterParams.value.startDate)
endDate.setDate(endDate.getDate() + 6) endDate.setDate(endDate.getDate() + 6)
const endDateStr = formatDateStr(endDate) const endDateStr = formatDateStr(endDate)
// 获取该科室在指定日期范围内的排班数据(联表查询 adm_schedule_pool 获取具体日期)
try { try {
const response = await getDoctorScheduleListByDeptIdAndDateRange(row.id, startDateStr, endDateStr) const response = await getDoctorScheduleListByDeptIdAndDateRange(row.id, startDateStr, endDateStr)
if (response.code === 200) { if (response.code === 200) {
const actualData = response.data const actualData = response.data
const deptSchedules = Array.isArray(actualData) ? actualData : (actualData && actualData.code === 200 ? actualData.data || [] : []) const deptSchedules = Array.isArray(actualData)
? actualData
: (actualData && actualData.code === 200 ? actualData.data || [] : [])
const selectedRegType = filterParams.value.appointmentType === '专家' ? 1 : 0
const filteredSchedules = deptSchedules.filter(schedule => Number(schedule.regType) === selectedRegType)
// 以 "具体日期-时段" 为 key 创建映射表,替代原来的 "星期-时段" // 日期时段可能存在多条排班,按 key 聚合成数组
const scheduleMap = {} const scheduleMap = {}
deptSchedules.forEach(schedule => { filteredSchedules.forEach(schedule => {
// scheduleDate 来自 adm_schedule_pool.schedule_date是具体的出诊日期
const key = `${schedule.scheduleDate}-${schedule.timePeriod}` const key = `${schedule.scheduleDate}-${schedule.timePeriod}`
scheduleMap[key] = schedule if (!scheduleMap[key]) {
scheduleMap[key] = []
}
scheduleMap[key].push(schedule)
}) })
// 将现有排班数据合并到周计划中(以具体日期匹配) const allAvailableDoctors = [...doctorOptions.value['普通'], ...doctorOptions.value['专家']]
weekSchedule.forEach(slot => { const mergedSchedule = []
// slot.date 是前端生成的具体日期yyyy-MM-dd与后端的 scheduleDate 一致
const key = `${slot.date}-${slot.timeSlot}`
const existingSchedule = scheduleMap[key]
if (existingSchedule) { const applyScheduleToSlot = (targetSlot, existingSchedule) => {
// 更新匹配的时段数据 targetSlot.doctorName = existingSchedule.doctorName || existingSchedule.doctor || ''
slot.doctorName = existingSchedule.doctor targetSlot.doctorId = existingSchedule.doctorId != null ? String(existingSchedule.doctorId) : null
slot.doctorId = String(existingSchedule.doctorId) // 确保为字符串
// --- 容错逻辑校验医生ID是否在当前医生列表中 --- const matchedDoctorById = allAvailableDoctors.find(doc => doc.id === targetSlot.doctorId)
const allAvailableDoctors = [...doctorOptions.value['普通'], ...doctorOptions.value['专家']]; if (!matchedDoctorById && targetSlot.doctorName) {
const matchedDoctorById = allAvailableDoctors.find(doc => doc.id === slot.doctorId); const matchedDoctorByName = allAvailableDoctors.find(doc => doc.label === targetSlot.doctorName)
if (!matchedDoctorById) {
// 尝试根据医生姓名进行匹配
const matchedDoctorByName = allAvailableDoctors.find(doc => doc.label === slot.doctorName);
if (matchedDoctorByName) { if (matchedDoctorByName) {
slot.doctorId = matchedDoctorByName.id; targetSlot.doctorId = matchedDoctorByName.id
console.warn(`【调试警告】排班记录doctorId ${existingSchedule.doctorId} (姓名: ${existingSchedule.doctor}) 与当前医生列表不匹配。已根据姓名修正为ID: ${matchedDoctorByName.id}`);
} else {
slot.doctorId = null;
slot.doctorName = '';
console.error(`【调试错误】排班记录doctorId ${existingSchedule.doctorId} 和医生姓名 "${existingSchedule.doctor}" 都未在当前医生列表中找到。`);
} }
} }
// --- 结束容错逻辑 ---
slot.room = existingSchedule.clinic targetSlot.room = existingSchedule.clinic || existingSchedule.clinicRoom || ''
slot.startTime = existingSchedule.startTime targetSlot.startTime = existingSchedule.startTime
slot.endTime = existingSchedule.endTime targetSlot.endTime = existingSchedule.endTime
slot.maxNumber = existingSchedule.limitNumber targetSlot.maxNumber = existingSchedule.limitNumber
slot.appointmentItem = existingSchedule.registerItem targetSlot.appointmentItem = existingSchedule.registerItem
slot.registrationFee = existingSchedule.registerFee targetSlot.registrationFee = existingSchedule.registerFee
slot.clinicItem = existingSchedule.diagnosisItem targetSlot.clinicItem = existingSchedule.diagnosisItem
slot.treatmentFee = existingSchedule.diagnosisFee targetSlot.treatmentFee = existingSchedule.diagnosisFee
slot.online = existingSchedule.isOnline targetSlot.online = existingSchedule.isOnline
slot.stopClinic = existingSchedule.isStopped targetSlot.stopClinic = existingSchedule.isStopped
slot.stopReason = existingSchedule.stopReason targetSlot.stopReason = existingSchedule.stopReason
slot.backendId = existingSchedule.id // 保存后端ID targetSlot.regType = existingSchedule.regType
targetSlot.backendId = existingSchedule.id
} }
weekSchedule.forEach(slot => {
const key = `${slot.date}-${slot.timeSlot}`
const existingSchedules = scheduleMap[key] || []
if (existingSchedules.length === 0) {
mergedSchedule.push(slot)
return
}
existingSchedules.forEach((existingSchedule, index) => {
const targetSlot = index === 0
? slot
: {
...slot,
id: `${slot.id}-dup-${existingSchedule.id || index}`,
doctorName: '',
doctorId: null,
room: '',
maxNumber: '',
appointmentItem: '',
registrationFee: 0,
clinicItem: '',
treatmentFee: 0,
online: true,
stopClinic: false,
stopReason: ''
}
applyScheduleToSlot(targetSlot, existingSchedule)
mergedSchedule.push(targetSlot)
}) })
})
scheduleList.value = mergedSchedule
return
} }
} catch (error) { } catch (error) {
console.error('获取科室排班数据失败:', error) console.error('获取科室排班数据失败:', error)
ElMessage.error('获取科室排班数据失败') ElMessage.error('获取科室排班数据失败')
} }
// 设置排班列表
console.log("【调试信息】即将渲染的排班数据:", JSON.parse(JSON.stringify(weekSchedule.filter(s => s.doctorId))));
scheduleList.value = weekSchedule scheduleList.value = weekSchedule
} }
// 编辑
const handleEdit = async (row) => { const handleEdit = async (row) => {
// 设置当前科室和模式 // 设置当前科室和模式
currentDept.value = row currentDept.value = row
@@ -1101,7 +1105,7 @@ const handleEdit = async (row) => {
scheduleDialogTitle.value = `编辑科室排班 - ${row.name || row.deptName}` scheduleDialogTitle.value = `编辑科室排班 - ${row.name || row.deptName}`
// 动态设置筛选参数 // 动态设置筛选参数
filterParams.value.orgName = row.orgName || '中联医院' filterParams.value.orgName = row.orgName || row.organizationName || row.org || ''
filterParams.value.deptName = row.name || row.deptName filterParams.value.deptName = row.name || row.deptName
// 首先获取科室工作时间配置 // 首先获取科室工作时间配置
@@ -1152,7 +1156,7 @@ const handleView = async (row) => {
scheduleDialogTitle.value = `查看科室排班 - ${row.name || row.deptName}` scheduleDialogTitle.value = `查看科室排班 - ${row.name || row.deptName}`
// 动态设置筛选参数 // 动态设置筛选参数
filterParams.value.orgName = row.orgName || '中联医院' filterParams.value.orgName = row.orgName || row.organizationName || row.org || ''
filterParams.value.deptName = row.name || row.deptName filterParams.value.deptName = row.name || row.deptName
// 首先获取科室工作时间配置 // 首先获取科室工作时间配置
@@ -1249,20 +1253,14 @@ const searchClinicRooms = async (query) => {
const doctorMapping = {} const doctorMapping = {}
// 排班类型变化处理 // 排班类型变化处理
const handleAppointmentTypeChange = () => { const handleAppointmentTypeChange = async () => {
// 当排班类型改变时,自动匹配对应的医生 if (currentDept.value) {
await reloadScheduleData()
return
}
scheduleList.value.forEach(item => { scheduleList.value.forEach(item => {
if (item.doctorName) { item.doctorId = null
// 获取新类型对应的医生列表
const newTypeDoctors = getDoctorOptions(filterParams.value.appointmentType)
// 检查当前医生是否在新类型列表中
const doctorExists = newTypeDoctors.some(doctor => doctor.value === item.doctorName)
if (!doctorExists) {
// 如果当前医生不在新类型列表中,则清空
item.doctorName = '' item.doctorName = ''
}
}
}) })
} }
@@ -1302,14 +1300,84 @@ const handleDoctorChange = (selectedId, row) => {
row.doctorName = ''; row.doctorName = '';
return; return;
} }
const allDoctors = [...doctorOptions.value['普通'], ...doctorOptions.value['专家']]; const typeDoctors = getDoctorOptions(filterParams.value.appointmentType)
const selectedDoctor = allDoctors.find(doc => doc.id === String(selectedId)); const selectedDoctor = typeDoctors.find(doc => doc.id === String(selectedId));
if (selectedDoctor) { if (selectedDoctor) {
row.doctorName = selectedDoctor.label; row.doctorName = selectedDoctor.label;
} }
} }
const resolveDoctorName = (row) => {
if (row.doctorName && row.doctorName.trim() !== '') {
return row.doctorName.trim()
}
if (!row.doctorId) {
return ''
}
const allDoctors = [...doctorOptions.value['普通'], ...doctorOptions.value['专家']]
const matched = allDoctors.find(doc => doc.id === String(row.doctorId))
return matched ? matched.label : ''
}
// 添加排班 // 添加排班
// 删除后兜底:当某天某时段被删空时,补一条重置行,保证可继续填写
const createResetScheduleRow = (row) => {
const regTypeValue = Number(row.regType)
return {
id: `reset-${Date.now()}-${Math.random()}`,
date: row.date,
weekday: row.weekday,
timeSlot: row.timeSlot,
startTime: row.startTime || '08:00',
endTime: row.endTime || '12:00',
doctorName: '',
doctorId: null,
room: '',
maxNumber: '',
appointmentItem: '',
registrationFee: 0,
clinicItem: '',
treatmentFee: 0,
online: true,
stopClinic: false,
stopReason: '',
regType: Number.isNaN(regTypeValue) ? 0 : regTypeValue,
isNew: true
}
}
const ensureResetRowAfterDelete = (row, insertIndex) => {
const hasSameSlot = scheduleList.value.some(item =>
item.date === row.date && item.timeSlot === row.timeSlot
)
if (hasSameSlot) {
return
}
const resetRow = createResetScheduleRow(row)
if (insertIndex >= 0 && insertIndex <= scheduleList.value.length) {
scheduleList.value.splice(insertIndex, 0, resetRow)
return
}
scheduleList.value.push(resetRow)
}
const isDraftScheduleRow = (row) => {
return !row.backendId || row.isNew
}
const isLastDraftRowInSlot = (row) => {
if (!isDraftScheduleRow(row)) {
return false
}
const sameSlotRows = scheduleList.value.filter(item =>
item.date === row.date && item.timeSlot === row.timeSlot
)
const draftRows = sameSlotRows.filter(item => isDraftScheduleRow(item))
return draftRows.length <= 1
}
const handleAddSchedule = (row) => { const handleAddSchedule = (row) => {
// 创建新的排班记录,基于当前行的日期和时段 // 创建新的排班记录,基于当前行的日期和时段
const newSchedule = { const newSchedule = {
@@ -1346,6 +1414,11 @@ const handleAddSchedule = (row) => {
// 删除排班 // 删除排班
const handleDeleteSchedule = (row) => { const handleDeleteSchedule = (row) => {
if (isLastDraftRowInSlot(row)) {
ElMessage.warning('当前时段需保留最后一条待填写记录,不能删除')
return
}
ElMessageBox.confirm('确定要删除这条排班记录吗?', '提示', { ElMessageBox.confirm('确定要删除这条排班记录吗?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
@@ -1354,15 +1427,17 @@ const handleDeleteSchedule = (row) => {
// 如果是已保存的记录有后端ID调用删除接口 // 如果是已保存的记录有后端ID调用删除接口
if (row.backendId && !row.isNew) { if (row.backendId && !row.isNew) {
deleteDoctorSchedule(row.backendId).then(res => { deleteDoctorSchedule(row.backendId).then(res => {
if (res.code === 200) { const removed = res?.data?.data === true || res?.data === true
if (res.code === 200 && removed) {
// 从列表中移除 // 从列表中移除
const index = scheduleList.value.findIndex(item => item.id === row.id) const index = scheduleList.value.findIndex(item => item.id === row.id)
if (index !== -1) { if (index !== -1) {
scheduleList.value.splice(index, 1) scheduleList.value.splice(index, 1)
ensureResetRowAfterDelete(row, index)
} }
ElMessage.success('删除成功') ElMessage.success('删除成功')
} else { } else {
ElMessage.error(res.msg || '删除失败') ElMessage.error(res.msg || '删除失败,记录可能未真正删除')
} }
}).catch(error => { }).catch(error => {
console.error('删除排班失败:', error) console.error('删除排班失败:', error)
@@ -1373,6 +1448,7 @@ const handleDeleteSchedule = (row) => {
const index = scheduleList.value.findIndex(item => item.id === row.id) const index = scheduleList.value.findIndex(item => item.id === row.id)
if (index !== -1) { if (index !== -1) {
scheduleList.value.splice(index, 1) scheduleList.value.splice(index, 1)
ensureResetRowAfterDelete(row, index)
ElMessage.success('删除成功') ElMessage.success('删除成功')
} }
} }
@@ -1445,7 +1521,7 @@ const handleEditSchedule = (row) => {
} }
// 设置科室信息 // 设置科室信息
filterParams.value.orgName = '中联医院' // 假设固定机构名称 filterParams.value.orgName = currentDept.value?.orgName || currentDept.value?.organizationName || currentDept.value?.org || ''
filterParams.value.deptName = '未知科室' // 这里可能需要根据实际情况设置 filterParams.value.deptName = '未知科室' // 这里可能需要根据实际情况设置
// 设置排班列表 // 设置排班列表
@@ -1505,12 +1581,12 @@ const handleSave = async () => {
try { try {
// 验证必填字段 - 只验证用户真正填写了信息的记录 // 验证必填字段 - 只验证用户真正填写了信息的记录
const filledSchedules = scheduleList.value.filter(item => { const filledSchedules = scheduleList.value.filter(item => {
// 只有当用户为某一行选择了医生,我们才认为他打算保存此条记录 // 已有排班可能只有 doctorId没有 doctorName二者任一存在都视为可保存记录
return item.doctorName && item.doctorName.trim() !== ''; return !!resolveDoctorName(item) || !!item.doctorId;
}); });
const incompleteSchedules = filledSchedules.filter(item => { const incompleteSchedules = filledSchedules.filter(item => {
const isDoctorValid = item.doctorName && item.doctorName.trim() !== ''; const isDoctorValid = !!resolveDoctorName(item) || !!item.doctorId;
const isRoomValid = item.room && item.room.trim() !== ''; const isRoomValid = item.room && item.room.trim() !== '';
const isStartTimeValid = item.startTime && typeof item.startTime === 'string'; const isStartTimeValid = item.startTime && typeof item.startTime === 'string';
const isEndTimeValid = item.endTime && typeof item.endTime === 'string'; const isEndTimeValid = item.endTime && typeof item.endTime === 'string';
@@ -1526,10 +1602,13 @@ const handleSave = async () => {
// 转换数据格式 // 转换数据格式
const schedulesToProcess = filledSchedules.map(item => { const schedulesToProcess = filledSchedules.map(item => {
const regTypeValue = Number(
item.regType ?? (filterParams.value.appointmentType === '专家' ? 1 : 0)
);
const scheduleData = { const scheduleData = {
weekday: item.weekday, weekday: item.weekday,
timePeriod: item.timeSlot, timePeriod: item.timeSlot,
doctor: item.doctorName, doctor: resolveDoctorName(item),
doctorId: item.doctorId, doctorId: item.doctorId,
clinic: item.room, clinic: item.room,
startTime: item.startTime, startTime: item.startTime,
@@ -1543,6 +1622,7 @@ const handleSave = async () => {
isStopped: item.stopClinic, isStopped: item.stopClinic,
stopReason: item.stopClinic ? (item.stopReason || '') : '', stopReason: item.stopClinic ? (item.stopReason || '') : '',
deptId: currentDept.value?.id || null, deptId: currentDept.value?.id || null,
regType: Number.isNaN(regTypeValue) ? 0 : regTypeValue,
scheduledDate: item.date // 添加具体日期字段 scheduledDate: item.date // 添加具体日期字段
}; };
if (item.backendId) { if (item.backendId) {

View File

@@ -135,6 +135,10 @@
<el-input v-model="formData.provisionalDiagnosis" type="textarea" :rows="2" disabled /> <el-input v-model="formData.provisionalDiagnosis" type="textarea" :rows="2" disabled />
</el-form-item> </el-form-item>
<el-form-item label="会诊确认参加医师">
<el-input v-model="formData.confirmingPhysician" type="textarea" disabled />
</el-form-item>
<el-form-item label="会诊意见" required> <el-form-item label="会诊意见" required>
<el-input <el-input
v-model="formData.consultationOpinion" v-model="formData.consultationOpinion"

View File

@@ -0,0 +1,151 @@
import request from '@/utils/request';
/**
* 查询传染病报卡列表
* @param {Object} params - 查询参数
* @param {string} params.cardNo - 报卡编号
* @param {string} params.patientName - 患者姓名
* @param {string} params.status - 审核状态
* @param {string} params.registrationSource - 登记来源
* @param {string} params.deptId - 科室 ID
* @param {string} params.startDate - 开始日期
* @param {string} params.endDate - 结束日期
* @param {number} params.pageNum - 页码
* @param {number} params.pageSize - 每页数量
*/
export function listInfectiousCards(params) {
return request({
url: '/report-manage/infectiousDiseaseReport/list-page',
method: 'get',
params,
});
}
/**
* 查询传染病报卡详情
* @param {string} cardNo - 报卡编号
*/
export function getInfectiousCard(cardNo) {
return request({
url: `/report-manage/infectiousDiseaseReport/detail/${cardNo}`,
method: 'get',
});
}
/**
* 保存传染病报卡
* @param {Object} data - 报卡数据
*/
export function saveInfectiousDiseaseReport(data) {
return request({
url: '/report-manage/infectiousDiseaseReport',
method: 'post',
data,
});
}
/**
* 修改传染病报卡
* @param {Object} data - 报卡数据
*/
export function updateInfectiousDiseaseReport(data) {
return request({
url: '/report-manage/infectiousDiseaseReport',
method: 'put',
data,
});
}
/**
* 删除传染病报卡
* @param {string} cardNo - 报卡编号
*/
export function deleteInfectiousCard(cardNo) {
return request({
url: `/report-manage/infectiousDiseaseReport/${cardNo}`,
method: 'delete',
});
}
/**
* 审核传染病报卡(功能暂未实现)
* @param {Object} data - 审核数据
* @param {string} data.cardNo - 报卡编号
* @param {string} data.auditOpinion - 审核意见
* @param {string} data.status - 审核状态2通过
*/
// export function auditInfectiousCard(data) {
// return request({
// url: '/report-manage/infectiousDiseaseReport/audit',
// method: 'post',
// data,
// });
// }
/**
* 退回传染病报卡(功能暂未实现)
* @param {Object} data - 退回数据
* @param {string} data.cardNo - 报卡编号
* @param {string} data.returnReason - 退回原因
* @param {string} data.status - 审核状态5审核失败
*/
// export function returnInfectiousCard(data) {
// return request({
// url: '/report-manage/infectiousDiseaseReport/return',
// method: 'post',
// data,
// });
// }
/**
* 批量审核传染病报卡(功能暂未实现)
* @param {Object} data - 批量审核数据
* @param {Array<string>} data.cardNos - 报卡编号数组
* @param {string} data.auditOpinion - 审核意见
* @param {string} data.status - 审核状态2通过
*/
// export function batchAuditCards(data) {
// return request({
// url: '/report-manage/infectiousDiseaseReport/batchAudit',
// method: 'post',
// data,
// });
// }
/**
* 批量退回传染病报卡(功能暂未实现)
* @param {Object} data - 批量退回数据
* @param {Array<string>} data.cardNos - 报卡编号数组
* @param {string} data.returnReason - 退回原因
* @param {string} data.status - 审核状态5审核失败
*/
// export function batchReturnCards(data) {
// return request({
// url: '/report-manage/infectiousDiseaseReport/batchReturn',
// method: 'post',
// data,
// });
// }
/**
* 获取科室树
* @param {string} deptId - 科室 ID可选
*/
export function getDeptTree(deptId) {
return request({
url: '/report-manage/infectiousDiseaseReport/dept-tree',
method: 'get',
params: { deptId },
});
}
/**
* 查询审核记录
* @param {string} cardNo - 报卡编号
*/
export function getAuditRecords(cardNo) {
return request({
url: `/report-manage/infectiousDiseaseReport/auditRecords/${cardNo}`,
method: 'get',
});
}

File diff suppressed because it is too large Load Diff

View File

@@ -1314,7 +1314,7 @@ async function buildSubmitData() {
reportDate: formData.reportDate || null, reportDate: formData.reportDate || null,
cardNameCode: 1, // 默认中华人民共和国传染病报告卡 cardNameCode: 1, // 默认中华人民共和国传染病报告卡
registrationSource: 1, // 默认门诊 registrationSource: 1, // 默认门诊
status: 0, status: '',
deptId: props.deptId || null, deptId: props.deptId || null,
doctorId: props.doctorId || null, doctorId: props.doctorId || null,
}; };

View File

@@ -245,18 +245,22 @@
<el-table-column label="检验类型" min-width="120" align="center"> <el-table-column label="检验类型" min-width="120" align="center">
<template #default="{ row }"> <template #default="{ row }">
<template v-if="editingRowId === row.id"> <template v-if="editingRowId === row.id">
<el-select v-model="row.inspectionTypeId" placeholder="选择检验类型" size="small" style="width: 100%;" @change="(val) => { const selected = testTypes.find(t => t.id === val); row.testType = selected ? selected.label : ''; }"> <el-select v-model="row.inspectionTypeId" placeholder="选择检验类型" size="small" style="width: 100%;" filterable
clearable
@change="(val) => handleParentChange(val, row)">
<el-option label="选择检验类型" value="" /> <el-option label="选择检验类型" value="" />
<!-- 使用 name 作为显示id 作为值 -->
<el-option <el-option
v-for="type in testTypes" v-for="item in parentTypeOptions"
:key="type.id" :key="item.id"
:label="type.label" :label="item.name"
:value="type.id" :value="item.id"
/> />
</el-select> </el-select>
</template> </template>
<template v-else> <template v-else>
{{ row.testType }} {{ row.testType || '-' }}
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
@@ -331,13 +335,32 @@
<el-table-column label="下级医技类型" min-width="100" align="center"> <el-table-column label="下级医技类型" min-width="100" align="center">
<template #default="{ row }"> <template #default="{ row }">
<template v-if="editingRowId === row.id"> <template v-if="editingRowId === row.id">
<el-input v-model="row.subType" size="small" /> <el-select
v-model="row.subItemId"
placeholder="请先选大类"
size="small"
style="width: 100%"
filterable
clearable
:disabled="!row.inspectionTypeId"
:loading="row.loadingSubItems"
@change="handleEditRow"
>
<!-- 数据源来自行内动态加载的 subItemOptions -->
<el-option
v-for="item in (row.subItemOptions || [])"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</template> </template>
<template v-else> <template v-else>
{{ row.sub医技Type || '-' }} {{ row.subItemName || '-' }}
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" min-width="100" align="center"> <el-table-column label="备注" min-width="100" align="center">
<template #default="{ row }"> <template #default="{ row }">
<template v-if="editingRowId === row.id"> <template v-if="editingRowId === row.id">
@@ -1041,6 +1064,121 @@ onMounted(() => {
}); });
// ==============================
// 【修复】级联下拉框逻辑 (包含直接请求代码)
// ==============================
// 1. 定义响应式数据
const parentTypeOptions = ref([]);
// 2. 【核心】直接发送请求的方法
// 这里直接使用 request 工具,不依赖外部 api 文件
const fetchInspectionTypesRequest = (params) => {
return request({
url: '/system/inspection-type/list', // 你的后端接口地址
method: 'get',
params: params
});
};
// 3. 加载所有顶级大类
const loadParentTypes = async () => {
try {
// 【发送请求】不传参数,获取所有数据
const res = await fetchInspectionTypesRequest({});
let allData = [];
// 兼容多种返回格式
if (res.code === 200) {
if(res.data && Array.isArray(res.data)) allData = res.data;
else if(res.data && res.data.rows) allData = res.data.rows;
else if(res.data && res.data.data && Array.isArray(res.data.data)) allData = res.data.data;
}
// 过滤:只保留 parentId 为 null/undefined 的记录作为“大类”
parentTypeOptions.value = allData.filter(item =>
item.parentId === null || item.parentId === undefined || item.parentId === ''
);
} catch (error) {
ElMessage.error('网络异常,加载大类失败');
}
};
// 4. 处理大类改变,联动加载子类
const handleParentChange = async (selectedId, row) => {
// A. 更新当前行的显示名称
const selected = parentTypeOptions.value.find(t => t.id === selectedId);
row.inspectionTypeName = selected ? selected.name : '';
// B. 【重要】重置下级数据
row.subItemId = '';
row.subItemName = '';
row.subItemOptions = [];
if (!selectedId) return;
// C. 设置加载状态
row.loadingSubItems = true;
try {
// 【发送请求】传入 parentId 参数获取子类
const res = await fetchInspectionTypesRequest({ parentId: selectedId });
let subData = [];
if (res.code === 200) {
if(res.data && Array.isArray(res.data)) subData = res.data;
else if(res.data && res.data.rows) subData = res.data.rows;
else if(res.data && res.data.data && Array.isArray(res.data.data)) subData = res.data.data;
row.subItemOptions = subData;
// 可选优化:如果子类只有一个,自动选中
if (subData.length === 1) {
row.subItemId = subData[0].id;
row.subItemName = subData[0].name;
}
} else {
ElMessage.info('该分类下暂无子项目');
}
} catch (error) {
ElMessage.error('加载子项目失败');
} finally {
row.loadingSubItems = false;
}
};
// 5. 点击编辑按钮时触发
const handleEditRow = (row) => {
if (editingRowId.value && editingRowId.value !== row.id) {
ElMessage.warning('请先保存或取消当前正在编辑的行');
return;
}
editingRowId.value = row.id;
// 初始化行内属性
if (!row.subItemOptions) row.subItemOptions = [];
row.loadingSubItems = false;
// 回显名称
if (row.inspectionTypeId && !row.inspectionTypeName) {
const p = parentTypeOptions.value.find(i => i.id === row.inspectionTypeId);
if (p) row.inspectionTypeName = p.name;
}
if (row.subItemId && row.subItemOptions.length > 0) {
const s = row.subItemOptions.find(i => i.id === row.subItemId);
if (s) row.subItemName = s.name;
}
};
onMounted(() => {
// ... 其他初始化代码
loadParentTypes(); // <--- 确保这一行存在
// ...
});
// 样本类型数据 // 样本类型数据
const sampleTypes = ref([ const sampleTypes = ref([
{ value: '血液', label: '血液' }, { value: '血液', label: '血液' },
@@ -1154,7 +1292,7 @@ const loadObservationItems = async (resetPage = false) => {
testType: item.inspectionTypeId_dictText || item.testType || '', // 优先使用字典翻译字段 testType: item.inspectionTypeId_dictText || item.testType || '', // 优先使用字典翻译字段
inspectionTypeId: item.inspectionTypeId || null, // 检验类型ID inspectionTypeId: item.inspectionTypeId || null, // 检验类型ID
package: '', package: '',
sampleType: item.specimenCode_dictText || '', sampleType: item.specimenCode || '',
amount: parseFloat(item.retailPrice || 0), amount: parseFloat(item.retailPrice || 0),
sortOrder: item.sortOrder || null, sortOrder: item.sortOrder || null,
serviceRange: item.serviceRange || '全部', serviceRange: item.serviceRange || '全部',
@@ -1782,7 +1920,7 @@ const saveItem = async (item) => {
return; return;
} }
if (!item.testType) { if (!item.inspectionTypeId) {
ElMessage.error('检验类型不能为空'); ElMessage.error('检验类型不能为空');
return; return;
} }

View File

@@ -54,7 +54,7 @@
v-for="dept in departments" v-for="dept in departments"
:key="dept.dictValue" :key="dept.dictValue"
:label="dept.dictLabel" :label="dept.dictLabel"
:value="dept.dictLabel" :value="dept.deptCode || dept.busNoPrefix || dept.rawOrg?.busNo || dept.dictLabel"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@@ -200,10 +200,57 @@ import {getDicts} from '@/api/system/dict/data'
import {listDept} from '@/api/system/dept' import {listDept} from '@/api/system/dept'
import {delCheckPackage, getCheckPackage, listCheckPackage} from '@/api/system/checkType' import {delCheckPackage, getCheckPackage, listCheckPackage} from '@/api/system/checkType'
import request from '@/utils/request' import request from '@/utils/request'
import useUserStore from '@/store/modules/user'
// 定义emit事件 // 定义emit事件
const emit = defineEmits(['switch-to-settings']) const emit = defineEmits(['switch-to-settings'])
const userStore = useUserStore()
//删除
function handleDelete(row) {
const currentUser = userStore.name
console.log('当前用户:', currentUser, '套餐创建者:', row.creator)
//只有创建者本人才能删除creator为空时不能删除
if(!row.creator){
ElMessage.warning('该套餐创建者未知,无法删除')
return
}
if(row.creator !== currentUser){
ElMessage.warning(`该套餐由"${row.creator}"创建,您没有权限删除`)
return
}
ElMessageBox.confirm(
`确认删除套餐ID:${row.id} - ${row.packageName} 吗?删除后将无法恢复`,
'确认删除',
{
confirmButtonText:'确定删除',
cancelButtonText:'取消',
type: 'warning',
buttonSize:'default'
}
).then(async () => {
try{const response = await delCheckPackage(row.id)
if(response && response.code === 200 || response.code === 0){
ElMessage.success('删除成功')
handleQuery()
}else{
ElMessage.error(response?.msg || response?.message || '删除失败')
}
}catch(error){
console.error('删除失败:',error)
const errorMsg = error?.response?.data?.msg || error?.message || ''
if(errorMsg.includes('foreign key') || errorMsg.includes('violates foreign key')){
ElMessage.warning('该套餐已被使用,无法删除')
}else{
ElMessage.error('删除失败:'+(error.message || '未知错误'))
}
}
}).catch(() => {})
}
// 查询参数 // 查询参数
const queryParams = reactive({ const queryParams = reactive({
pageNo: 1, pageNo: 1,
@@ -541,33 +588,7 @@ async function handleView(row) {
} }
} }
// 删除 // 查询参数
function handleDelete(row) {
ElMessageBox.confirm(
`确认删除套餐ID:${row.id} - ${row.packageName}吗?删除后将无法恢复!`,
'删除确认',
{
confirmButtonText: '确定删除',
cancelButtonText: '取消',
type: 'warning',
buttonSize: 'default'
}
).then(async () => {
try {
const response = await delCheckPackage(row.id)
if (response && (response.code === 200 || response.code === 0)) {
ElMessage.success('删除成功')
handleQuery()
} else {
ElMessage.error(response?.msg || response?.message || '删除失败')
}
} catch (error) {
console.error('删除失败:', error)
ElMessage.error('删除失败: ' + (error.message || '未知错误'))
}
}).catch(() => {})
}
</script> </script>
<style scoped> <style scoped>

View File

@@ -215,10 +215,13 @@
:label="(item.name || item.itemName || '未命名') + (item.busNo ? ' [' + item.busNo + ']' : '')" :label="(item.name || item.itemName || '未命名') + (item.busNo ? ' [' + item.busNo + ']' : '')"
:value="item.id" :value="item.id"
> >
<span style="float: left">{{ item.name || item.itemName }}</span> <div style="display: flex; justify-content: space-between; align-items: center; width: 100%;">
<span style="float: right; color: #8492a6; font-size: 13px"> <span>{{ item.name || item.itemName }}</span>
{{ item.busNo || item.code }} <span style="display: flex; align-items: center; gap: 8px;">
<span style="color: #8492a6; font-size: 13px;">{{ item.busNo || item.code }}</span>
<span style="color: #E6A23C; font-size: 13px; font-weight: 500;">¥{{ item.retailPrice || item.price || item.unitPrice || 0 }}</span>
</span> </span>
</div>
</el-option> </el-option>
<template #empty> <template #empty>
<div style="padding: 10px; text-align: center; color: #999;"> <div style="padding: 10px; text-align: center; color: #999;">
@@ -233,12 +236,6 @@
</div> </div>
</template> </template>
</el-select> </el-select>
<div style="font-size: 12px; color: #999; margin-top: 4px;">
共 {{ diagnosisTreatmentList.length }} 个可选项目
<span v-if="row.filteredList && row.filteredList.length < diagnosisTreatmentList.length">
(搜索结果: {{ row.filteredList.length }} 个)
</span>
</div>
</div> </div>
<span v-else>{{ row.itemName }}</span> <span v-else>{{ row.itemName }}</span>
</template> </template>
@@ -286,21 +283,21 @@
:precision="0" :precision="0"
placeholder="请输入数量" placeholder="请输入数量"
style="width: 100%" style="width: 100%"
:controls="false"
@change="calculateAmount(row)" @change="calculateAmount(row)"
/> />
<span v-else>{{ row.quantity }}</span> <span v-else>{{ row.quantity }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="unitPrice" label="单价" width="120" align="center"> <el-table-column prop="unitPrice" label="单价" width="150" align="center">
<template #default="{ row }"> <template #default="{ row }">
<el-input-number <el-input
v-if="row.editing" v-if="row.editing"
v-model="row.unitPrice" v-model="row.unitPrice"
:min="0" placeholder="自动获取"
:precision="6"
placeholder="请输入单价"
style="width: 100%" style="width: 100%"
@change="calculateAmount(row)" size="small"
disabled
/> />
<span v-else>{{ row.unitPrice?.toFixed(6) }}</span> <span v-else>{{ row.unitPrice?.toFixed(6) }}</span>
</template> </template>
@@ -319,6 +316,7 @@
:precision="2" :precision="2"
placeholder="服务费" placeholder="服务费"
style="width: 100%" style="width: 100%"
:controls="false"
@change="calculateTotal(row)" @change="calculateTotal(row)"
/> />
<span v-else>{{ row.serviceCharge?.toFixed(2) || '0.00' }}</span> <span v-else>{{ row.serviceCharge?.toFixed(2) || '0.00' }}</span>
@@ -524,8 +522,8 @@ function loadPackageData(data) {
}) })
// 填充明细数据 // 填充明细数据
if (data.details && Array.isArray(data.details)) { if (data.items && Array.isArray(data.items)) {
detailData.value = data.details.map(item => ({ detailData.value = data.items.map(item => ({
code: item.itemCode || '', code: item.itemCode || '',
itemId: item.checkItemId, itemId: item.checkItemId,
itemName: item.itemName || '', itemName: item.itemName || '',
@@ -687,10 +685,13 @@ onMounted(async () => {
} }
// 加载诊疗项目列表(优先使用缓存) // 加载诊疗项目列表(优先使用缓存)
await loadDiagnosisTreatmentList(false) await loadDiagnosisTreatmentList(true)
// 初始化一行空数据 // 初始化一行空数据
if(props.mode === 'add'){
handleAddRow() handleAddRow()
}
} catch (error) { } catch (error) {
console.error('✗ 初始化数据失败:', error) console.error('✗ 初始化数据失败:', error)
} }
@@ -824,6 +825,10 @@ function handlePackageLevelChange(value) {
// 个人套餐,用户必填 // 个人套餐,用户必填
formRules.user = [{ required: true, message: '请选择用户', trigger: 'change' }] formRules.user = [{ required: true, message: '请选择用户', trigger: 'change' }]
formRules.department = [] formRules.department = []
// 自动获取当前登录账号名称赋值给用户选择字段
if (!formData.user && userStore.name) {
formData.user = userStore.name
}
} else { } else {
// 全院套餐,都不必填 // 全院套餐,都不必填
formRules.department = [] formRules.department = []
@@ -936,7 +941,6 @@ function initializeSearchList(row) {
// 项目搜索处理(支持首字母和模糊搜索) // 项目搜索处理(支持首字母和模糊搜索)
function handleProjectSearch(query, row) { function handleProjectSearch(query, row) {
console.log('搜索关键字:', query)
if (!query || query.trim() === '') { if (!query || query.trim() === '') {
row.filteredList = diagnosisTreatmentList.value row.filteredList = diagnosisTreatmentList.value
@@ -1185,6 +1189,7 @@ async function handleSave() {
if (response && (response.code === 200 || response.code === 0)) { if (response && (response.code === 200 || response.code === 0)) {
ElMessage.success('套餐数据已保存') ElMessage.success('套餐数据已保存')
emit('save-success')
// 如果有返回ID更新formData.id以便后续更新 // 如果有返回ID更新formData.id以便后续更新
if (response.data && !formData.id) { if (response.data && !formData.id) {
formData.id = response.data formData.id = response.data

View File

@@ -536,17 +536,17 @@
</td> </td>
<td> <td>
<template v-if="item.editing"> <template v-if="item.editing">
<el-select v-model="item.checkType" placeholder="选择检查类型" style="width: 100%"> <el-select v-model="item.serviceScope" placeholder="选择服务范围" style="width: 100%">
<el-option <el-option
v-for="opt in checkTypeOptionsForMethodPart" v-for="opt in serviceScopeDicts"
:key="opt.value" :key="opt.dictValue"
:label="opt.label" :label="opt.dictLabel"
:value="opt.value" :value="opt.dictValue"
/> />
</el-select> </el-select>
</template> </template>
<template v-else> <template v-else>
{{ getCheckTypeLabelForMethodPart(item.checkType) || '' }} {{ getServiceScopeLabel(item.serviceScope) || '' }}
</template> </template>
</td> </td>
<td> <td>
@@ -667,6 +667,8 @@ const checkTypeOptions = ref([]);
const inspectionTypeDicts = ref([]); const inspectionTypeDicts = ref([]);
// 完整的服务范围字典数据 // 完整的服务范围字典数据
const serviceScopeDicts = ref([]); const serviceScopeDicts = ref([]);
// 服务范围下拉选项
const serviceScopeOptions = ref([]);
const checkMethods = ref([]); const checkMethods = ref([]);
// 根据字典值获取检查类型标签 // 根据字典值获取检查类型标签
@@ -926,6 +928,11 @@ onMounted(async () => {
inspectionTypeDicts.value = []; inspectionTypeDicts.value = [];
} }
// 获取服务范围字典
const scopeRes = await getDicts('scope_of_services');
serviceScopeDicts.value = scopeRes?.data || [];
// 从检查类型维护页面获取检查类型数据,用于检查方法和检查部位的下拉选项 // 从检查类型维护页面获取检查类型数据,用于检查方法和检查部位的下拉选项
await loadCheckTypeOptionsForMethodPart(); await loadCheckTypeOptionsForMethodPart();
@@ -1013,10 +1020,21 @@ function handleSwitchToSettings(params) {
} }
// 保存成功后保持在套餐设置界面 // 保存成功后保持在套餐设置界面
function handleSaveSuccess() { async function handleSaveSuccess() {
console.log('保存成功') console.log('保存成功')
// 保存成功后保持在套餐设置界面,可以继续编辑或返回管理界面 // 保存成功后保持在套餐设置界面,可以继续编辑或返回管理界面
ElMessage.success('保存成功') ElMessage.success('保存成功')
// 刷新套餐列表数据
try {
const packageResponse = await listCheckPackage();
if (packageResponse && packageResponse.data) {
checkPackages.value = Array.isArray(packageResponse.data) ? packageResponse.data : [];
filteredPackageOptions.value = checkPackages.value;
}
} catch (error) {
console.error('刷新套餐列表失败:', error);
}
} }
// 根据菜单加载对应数据 // 根据菜单加载对应数据