Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -78,7 +78,6 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
|
||||
private IOperationRecordService operationRecordService;
|
||||
@Resource
|
||||
private IServiceRequestService serviceRequestService;
|
||||
|
||||
/**
|
||||
* 诊疗目录初期查询
|
||||
*
|
||||
@@ -240,9 +239,8 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
|
||||
DiagnosisTreatmentSelParam.setPricingFlag(pricingFlagValue);
|
||||
}
|
||||
|
||||
// 分页查询
|
||||
IPage<DiagnosisTreatmentDto> diseaseTreatmentPage
|
||||
= activityDefinitionManageMapper.getDiseaseTreatmentPage(new Page<DiagnosisTreatmentDto>(pageNo, pageSize), queryWrapper);
|
||||
= activityDefinitionManageMapper.getDiseaseTreatmentPage(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
|
||||
diseaseTreatmentPage.getRecords().forEach(e -> {
|
||||
// 医保标记枚举类回显赋值
|
||||
@@ -447,24 +445,17 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
|
||||
*/
|
||||
@Override
|
||||
public R<?> editDiseaseTreatmentStop(List<Long> ids) {
|
||||
|
||||
List<ActivityDefinition> ActivityDefinitionList = new CopyOnWriteArrayList<>();
|
||||
|
||||
// 取得更新值
|
||||
for (Long detail : ids) {
|
||||
ActivityDefinition ActivityDefinition = new ActivityDefinition();
|
||||
ActivityDefinition.setId(detail);
|
||||
ActivityDefinition.setStatusEnum(PublicationStatus.RETIRED.getValue());
|
||||
ActivityDefinitionList.add(ActivityDefinition);
|
||||
List<ActivityDefinition> actList = new CopyOnWriteArrayList<>();
|
||||
for (Long id : ids) {
|
||||
ActivityDefinition act = new ActivityDefinition();
|
||||
act.setId(id);
|
||||
act.setStatusEnum(PublicationStatus.RETIRED.getValue());
|
||||
actList.add(act);
|
||||
}
|
||||
// 插入操作记录
|
||||
operationRecordService.addIdsOperationRecord(DbOpType.STOP.getCode(),
|
||||
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, ids);
|
||||
// 更新诊疗信息
|
||||
return activityDefinitionService.updateBatchById(ActivityDefinitionList)
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"诊疗目录"}))
|
||||
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
|
||||
activityDefinitionService.updateBatchById(actList);
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"\u8bca\u7597\u76ee\u5f55"}));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -475,24 +466,17 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
|
||||
*/
|
||||
@Override
|
||||
public R<?> editDiseaseTreatmentStart(List<Long> ids) {
|
||||
|
||||
List<ActivityDefinition> ActivityDefinitionList = new CopyOnWriteArrayList<>();
|
||||
|
||||
// 取得更新值
|
||||
for (Long detail : ids) {
|
||||
ActivityDefinition ActivityDefinition = new ActivityDefinition();
|
||||
ActivityDefinition.setId(detail);
|
||||
ActivityDefinition.setStatusEnum(PublicationStatus.ACTIVE.getValue());
|
||||
ActivityDefinitionList.add(ActivityDefinition);
|
||||
List<ActivityDefinition> actList = new CopyOnWriteArrayList<>();
|
||||
for (Long id : ids) {
|
||||
ActivityDefinition act = new ActivityDefinition();
|
||||
act.setId(id);
|
||||
act.setStatusEnum(PublicationStatus.ACTIVE.getValue());
|
||||
actList.add(act);
|
||||
}
|
||||
// 插入操作记录
|
||||
operationRecordService.addIdsOperationRecord(DbOpType.START.getCode(),
|
||||
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, ids);
|
||||
// 更新诊疗信息
|
||||
return activityDefinitionService.updateBatchById(ActivityDefinitionList)
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"诊疗目录"}))
|
||||
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
|
||||
activityDefinitionService.updateBatchById(actList);
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"诊疗目录"}));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.openhis.web.datadictionary.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.openhis.web.datadictionary.dto.DiagnosisTreatmentDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检验项目定义管理 Mapper(操作 lab_activity_definition 表)
|
||||
*/
|
||||
@Repository
|
||||
public interface LabActivityDefinitionManageMapper {
|
||||
|
||||
/**
|
||||
* 检验项目分页查询
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 分页结果
|
||||
*/
|
||||
IPage<DiagnosisTreatmentDto> getLabActivityDefinitionPage(
|
||||
@Param("page") Page<DiagnosisTreatmentDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<DiagnosisTreatmentDto> queryWrapper);
|
||||
|
||||
/**
|
||||
* 检验项目详情
|
||||
*
|
||||
* @param id 项目ID
|
||||
* @param tenantId 租户ID
|
||||
* @return 详情
|
||||
*/
|
||||
DiagnosisTreatmentDto getLabActivityDefinitionOne(@Param("id") Long id, @Param("tenantId") Integer tenantId);
|
||||
|
||||
/**
|
||||
* 检验项目下拉列表(轻量级)
|
||||
*
|
||||
* @param statusEnum 状态
|
||||
* @param tenantId 租户ID
|
||||
* @param searchKey 搜索关键词(可选)
|
||||
* @return 列表
|
||||
*/
|
||||
List<DiagnosisTreatmentDto> getLabActivityDefinitionSimpleList(
|
||||
@Param("statusEnum") Integer statusEnum,
|
||||
@Param("tenantId") Integer tenantId,
|
||||
@Param("searchKey") String searchKey);
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.openhis.web.doctorstation.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@@ -73,12 +74,16 @@ public class SaveDiagnosisChildParam {
|
||||
|
||||
/**
|
||||
* 诊断时间
|
||||
* 添加 pattern 以支持前端传来的 "yyyy/M/d HH:mm:ss" 格式
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy/M/d HH:mm:ss", timezone = "GMT+8")
|
||||
private Date diagnosisTime;
|
||||
|
||||
/**
|
||||
* 发病时间
|
||||
* 同样添加 pattern 以防前端传来相同格式的发病时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy/M/d HH:mm:ss", timezone = "GMT+8")
|
||||
private Date onsetDate;
|
||||
|
||||
/** 患者疾病诊断类型代码 */
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.openhis.web.lab.appservice;
|
||||
|
||||
import com.openhis.web.datadictionary.dto.DiagnosisTreatmentSelParam;
|
||||
import com.openhis.web.datadictionary.dto.DiagnosisTreatmentUpDto;
|
||||
import com.core.common.core.domain.R;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检验项目 AppService 接口(独立操作 lab_activity_definition 表)
|
||||
*/
|
||||
public interface ILabActivityDefinitionAppService {
|
||||
|
||||
/**
|
||||
* 分页查询检验项目列表
|
||||
*/
|
||||
R<?> getLabActivityDefinitionPage(DiagnosisTreatmentSelParam selParam, String searchKey,
|
||||
Integer pageNo, Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 根据id查询检验项目详情
|
||||
*/
|
||||
R<?> getLabActivityDefinitionOne(Long id);
|
||||
|
||||
/**
|
||||
* 新增检验项目
|
||||
*/
|
||||
R<?> addLabActivityDefinition(DiagnosisTreatmentUpDto dto);
|
||||
|
||||
/**
|
||||
* 编辑检验项目
|
||||
*/
|
||||
R<?> editLabActivityDefinition(DiagnosisTreatmentUpDto dto);
|
||||
|
||||
/**
|
||||
* 停用检验项目
|
||||
*/
|
||||
R<?> stopLabActivityDefinition(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 启用检验项目
|
||||
*/
|
||||
R<?> startLabActivityDefinition(List<Long> ids);
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
package com.openhis.web.lab.appservice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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.*;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.ActivityType;
|
||||
import com.openhis.common.enums.PublicationStatus;
|
||||
import com.openhis.common.enums.Whether;
|
||||
import com.core.common.utils.ChineseConvertUtils;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.common.enums.AssignSeqEnum;
|
||||
import com.openhis.lab.domain.LabActivityDefinition;
|
||||
import com.openhis.lab.service.ILabActivityDefinitionService;
|
||||
import com.openhis.web.datadictionary.dto.DiagnosisTreatmentDto;
|
||||
import com.openhis.web.datadictionary.dto.DiagnosisTreatmentSelParam;
|
||||
import com.openhis.web.datadictionary.dto.DiagnosisTreatmentUpDto;
|
||||
import com.openhis.web.lab.appservice.ILabActivityDefinitionAppService;
|
||||
import com.openhis.web.datadictionary.mapper.LabActivityDefinitionManageMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/**
|
||||
* 检验项目 AppService 实现(独立操作 lab_activity_definition 表)
|
||||
*/
|
||||
@Service
|
||||
public class LabActivityDefinitionAppServiceImpl implements ILabActivityDefinitionAppService {
|
||||
|
||||
@Resource
|
||||
private ILabActivityDefinitionService labActivityDefinitionService;
|
||||
|
||||
@Resource
|
||||
private LabActivityDefinitionManageMapper labActivityDefinitionManageMapper;
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
|
||||
@Override
|
||||
public R<?> getLabActivityDefinitionPage(DiagnosisTreatmentSelParam selParam, String searchKey,
|
||||
Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
if (selParam == null) {
|
||||
selParam = new DiagnosisTreatmentSelParam();
|
||||
}
|
||||
if (selParam.getStatusEnum() == null) {
|
||||
selParam.setStatusEnum(PublicationStatus.ACTIVE.getValue());
|
||||
}
|
||||
|
||||
// 临时移除需要手动拼别名条件的字段
|
||||
Long inspectionTypeIdValue = null;
|
||||
if (selParam.getInspectionTypeId() != null) {
|
||||
inspectionTypeIdValue = selParam.getInspectionTypeId();
|
||||
selParam.setInspectionTypeId(null);
|
||||
}
|
||||
Integer pricingFlagValue = null;
|
||||
if (selParam.getPricingFlag() != null) {
|
||||
pricingFlagValue = selParam.getPricingFlag();
|
||||
selParam.setPricingFlag(null);
|
||||
}
|
||||
|
||||
QueryWrapper<DiagnosisTreatmentDto> queryWrapper = HisQueryUtils.buildQueryWrapper(selParam,
|
||||
searchKey, new HashSet<>(Arrays.asList("T1.bus_no", "T1.name", "T1.py_str", "T1.wb_str")), request);
|
||||
|
||||
if (inspectionTypeIdValue != null) {
|
||||
queryWrapper.eq("T1.inspection_type_id", inspectionTypeIdValue);
|
||||
selParam.setInspectionTypeId(inspectionTypeIdValue);
|
||||
}
|
||||
if (pricingFlagValue != null) {
|
||||
queryWrapper.eq("T1.pricing_flag", pricingFlagValue);
|
||||
selParam.setPricingFlag(pricingFlagValue);
|
||||
}
|
||||
|
||||
IPage<DiagnosisTreatmentDto> page = labActivityDefinitionManageMapper
|
||||
.getLabActivityDefinitionPage(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
|
||||
page.getRecords().forEach(e -> {
|
||||
e.setYbFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbFlag()));
|
||||
e.setYbMatchFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbMatchFlag()));
|
||||
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(ActivityType.class, e.getTypeEnum()));
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(PublicationStatus.class, e.getStatusEnum()));
|
||||
e.setPricingFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getPricingFlag()));
|
||||
});
|
||||
|
||||
return R.ok(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> getLabActivityDefinitionOne(Long id) {
|
||||
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
|
||||
DiagnosisTreatmentDto dto = labActivityDefinitionManageMapper.getLabActivityDefinitionOne(id, tenantId);
|
||||
return R.ok(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> addLabActivityDefinition(DiagnosisTreatmentUpDto dto) {
|
||||
if (dto.getOrgId() == null) {
|
||||
dto.setOrgId(SecurityUtils.getLoginUser().getHospitalId());
|
||||
}
|
||||
|
||||
LabActivityDefinition lab = new LabActivityDefinition();
|
||||
BeanUtils.copyProperties(dto, lab);
|
||||
lab.setSortOrder(dto.getSortOrder())
|
||||
.setServiceRange(dto.getServiceRange())
|
||||
.setInspectionTypeId(dto.getInspectionTypeId())
|
||||
.setFeePackageId(dto.getFeePackageId())
|
||||
.setSubItemId(dto.getSubItemId());
|
||||
|
||||
if (StringUtils.isEmpty(lab.getBusNo())) {
|
||||
lab.setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.ACTIVITY_DEFINITION_NUM.getPrefix(), 10));
|
||||
}
|
||||
lab.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(lab.getName()));
|
||||
lab.setWbStr(ChineseConvertUtils.toWBFirstLetter(lab.getName()));
|
||||
lab.setStatusEnum(PublicationStatus.ACTIVE.getValue());
|
||||
|
||||
// 设置创建者和租户ID
|
||||
String createBy = "system";
|
||||
Integer tenantId = null;
|
||||
try {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null) {
|
||||
createBy = loginUser.getUsername();
|
||||
tenantId = loginUser.getTenantId();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 使用默认值
|
||||
}
|
||||
lab.setCreateBy(createBy);
|
||||
lab.setTenantId(tenantId != null ? tenantId : 1);
|
||||
if (lab.getCreateTime() == null) {
|
||||
lab.setCreateTime(new java.util.Date());
|
||||
}
|
||||
|
||||
return labActivityDefinitionService.addLabActivityDefinition(lab)
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"检验项目"}))
|
||||
: R.fail(null, "检验编码已存在:" + lab.getBusNo());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> editLabActivityDefinition(DiagnosisTreatmentUpDto dto) {
|
||||
LabActivityDefinition lab = new LabActivityDefinition();
|
||||
BeanUtils.copyProperties(dto, lab);
|
||||
lab.setSortOrder(dto.getSortOrder())
|
||||
.setServiceRange(dto.getServiceRange())
|
||||
.setInspectionTypeId(dto.getInspectionTypeId())
|
||||
.setFeePackageId(dto.getFeePackageId())
|
||||
.setSubItemId(dto.getSubItemId())
|
||||
.setPricingFlag(dto.getPricingFlag());
|
||||
lab.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(lab.getName()));
|
||||
lab.setWbStr(ChineseConvertUtils.toWBFirstLetter(lab.getName()));
|
||||
|
||||
return labActivityDefinitionService.updateById(lab)
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"检验项目"}))
|
||||
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> stopLabActivityDefinition(List<Long> ids) {
|
||||
List<LabActivityDefinition> labList = new CopyOnWriteArrayList<>();
|
||||
for (Long id : ids) {
|
||||
LabActivityDefinition lab = new LabActivityDefinition();
|
||||
lab.setId(id).setStatusEnum(PublicationStatus.RETIRED.getValue());
|
||||
labList.add(lab);
|
||||
}
|
||||
labActivityDefinitionService.updateBatchById(labList);
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"检验项目"}));
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> startLabActivityDefinition(List<Long> ids) {
|
||||
List<LabActivityDefinition> labList = new CopyOnWriteArrayList<>();
|
||||
for (Long id : ids) {
|
||||
LabActivityDefinition lab = new LabActivityDefinition();
|
||||
lab.setId(id).setStatusEnum(PublicationStatus.ACTIVE.getValue());
|
||||
labList.add(lab);
|
||||
}
|
||||
labActivityDefinitionService.updateBatchById(labList);
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"检验项目"}));
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,6 @@ public class InspectionTypeController extends BaseController {
|
||||
|
||||
// 查询是否存在相同编码的记录
|
||||
List<InspectionType> existingRecords = inspectionTypeService.list(queryWrapper);
|
||||
log.debug("检查编码唯一性:code={}, 数据库中存在记录数={}", inspectionType.getCode(), existingRecords.size());
|
||||
|
||||
if (!existingRecords.isEmpty()) {
|
||||
return AjaxResult.error("检验类型编码已存在");
|
||||
@@ -119,8 +118,6 @@ public class InspectionTypeController extends BaseController {
|
||||
return toAjax(result);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.error("新增检验类型失败:code={}, 错误信息:{}", inspectionType.getCode(), e.getMessage(), e);
|
||||
|
||||
// 捕获唯一性约束冲突异常
|
||||
if (e.getMessage().contains("uk_inspection_type_code") ||
|
||||
e.getMessage().contains("duplicate key value") ||
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.openhis.web.lab.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.datadictionary.dto.DiagnosisTreatmentSelParam;
|
||||
import com.openhis.web.datadictionary.dto.DiagnosisTreatmentUpDto;
|
||||
import com.openhis.web.lab.appservice.ILabActivityDefinitionAppService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检验项目维护 Controller(独立操作 lab_activity_definition 表)
|
||||
* 路径前缀:/lab/activity-definition
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/lab/activity-definition")
|
||||
@Slf4j
|
||||
public class LabActivityDefinitionController {
|
||||
|
||||
@Resource
|
||||
private ILabActivityDefinitionAppService labActivityDefinitionAppService;
|
||||
|
||||
/**
|
||||
* 分页查询检验项目列表
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<?> getPage(DiagnosisTreatmentSelParam selParam,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest request) {
|
||||
return labActivityDefinitionAppService.getLabActivityDefinitionPage(selParam, searchKey, pageNo, pageSize, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询检验项目详情
|
||||
*/
|
||||
@GetMapping("/one")
|
||||
public R<?> getOne(@RequestParam Long id) {
|
||||
return labActivityDefinitionAppService.getLabActivityDefinitionOne(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增检验项目
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public R<?> add(@Validated @RequestBody DiagnosisTreatmentUpDto dto) {
|
||||
return labActivityDefinitionAppService.addLabActivityDefinition(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑检验项目
|
||||
*/
|
||||
@PutMapping("/edit")
|
||||
public R<?> edit(@RequestBody DiagnosisTreatmentUpDto dto) {
|
||||
return labActivityDefinitionAppService.editLabActivityDefinition(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 停用检验项目
|
||||
*/
|
||||
@PutMapping("/stop")
|
||||
public R<?> stop(@RequestBody List<Long> ids) {
|
||||
return labActivityDefinitionAppService.stopLabActivityDefinition(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用检验项目
|
||||
*/
|
||||
@PutMapping("/start")
|
||||
public R<?> start(@RequestBody List<Long> ids) {
|
||||
return labActivityDefinitionAppService.startLabActivityDefinition(ids);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
<?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.datadictionary.mapper.LabActivityDefinitionManageMapper">
|
||||
|
||||
<!-- 检验项目分页查询(操作 lab_activity_definition 表,无物理外键) -->
|
||||
<select id="getLabActivityDefinitionPage" parameterType="java.util.Map"
|
||||
resultType="com.openhis.web.datadictionary.dto.DiagnosisTreatmentDto">
|
||||
SELECT
|
||||
T1.id,
|
||||
T1.category_code,
|
||||
T1.bus_no,
|
||||
T1.name,
|
||||
T1.py_str,
|
||||
T1.wb_str,
|
||||
T1.type_enum,
|
||||
T1.permitted_unit_code,
|
||||
T1.org_id,
|
||||
T1.location_id,
|
||||
T1.yb_flag,
|
||||
T1.yb_no,
|
||||
T1.yb_match_flag,
|
||||
T1.status_enum,
|
||||
T1.body_site_code,
|
||||
T1.specimen_code,
|
||||
T1.description_text,
|
||||
T1.rule_id,
|
||||
T1.tenant_id,
|
||||
T1.chrgitm_lv,
|
||||
T1.children_json,
|
||||
T1.pricing_flag,
|
||||
T1.sort_order,
|
||||
T1.service_range,
|
||||
T1.inspection_type_id,
|
||||
T1.fee_package_id,
|
||||
T1.sub_item_id,
|
||||
T3.name AS test_type,
|
||||
T5.package_name,
|
||||
T6.name AS sub_item_name
|
||||
FROM lab_activity_definition T1
|
||||
/* 检验类型关联(逻辑关联,无外键) */
|
||||
LEFT JOIN inspection_type T3
|
||||
ON T1.inspection_type_id = T3.id
|
||||
AND T3.valid_flag = 1
|
||||
/* 费用套餐关联(逻辑关联,无外键) */
|
||||
LEFT JOIN inspection_basic_information T5
|
||||
ON T1.fee_package_id = T5.basic_information_id
|
||||
AND T5.del_flag = false
|
||||
/* 下级医技类型关联(逻辑关联,无外键) */
|
||||
LEFT JOIN inspection_type T6
|
||||
ON T1.sub_item_id = T6.id
|
||||
AND T6.valid_flag = 1
|
||||
<where>
|
||||
T1.delete_flag = '0'
|
||||
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||
<choose>
|
||||
<when test="ew.customSqlSegment.contains('tenant_id')">
|
||||
${ew.customSqlSegment.replaceFirst('tenant_id', 'T1.tenant_id').replaceFirst('status_enum', 'T1.status_enum').replaceFirst('WHERE', 'AND')}
|
||||
</when>
|
||||
<otherwise>
|
||||
${ew.customSqlSegment.replaceFirst('status_enum', 'T1.status_enum').replaceFirst('WHERE', 'AND')}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY T1.id DESC
|
||||
</select>
|
||||
|
||||
<!-- 检验项目详情 -->
|
||||
<select id="getLabActivityDefinitionOne" resultType="com.openhis.web.datadictionary.dto.DiagnosisTreatmentDto">
|
||||
SELECT
|
||||
T1.id,
|
||||
T1.category_code,
|
||||
T1.bus_no,
|
||||
T1.name,
|
||||
T1.py_str,
|
||||
T1.wb_str,
|
||||
T1.type_enum,
|
||||
T1.permitted_unit_code,
|
||||
T1.org_id,
|
||||
T1.location_id,
|
||||
T1.yb_flag,
|
||||
T1.yb_no,
|
||||
T1.yb_match_flag,
|
||||
T1.status_enum,
|
||||
T1.body_site_code,
|
||||
T1.specimen_code,
|
||||
T1.description_text,
|
||||
T1.rule_id,
|
||||
T1.tenant_id,
|
||||
T1.chrgitm_lv,
|
||||
T1.children_json,
|
||||
T1.pricing_flag,
|
||||
T1.sort_order,
|
||||
T1.service_range,
|
||||
T1.inspection_type_id,
|
||||
T1.fee_package_id,
|
||||
T1.sub_item_id,
|
||||
T3.name AS test_type,
|
||||
T5.package_name,
|
||||
T6.name AS sub_item_name
|
||||
FROM lab_activity_definition T1
|
||||
LEFT JOIN inspection_type T3
|
||||
ON T1.inspection_type_id = T3.id
|
||||
AND T3.valid_flag = 1
|
||||
LEFT JOIN inspection_basic_information T5
|
||||
ON T1.fee_package_id = T5.basic_information_id
|
||||
AND T5.del_flag = false
|
||||
LEFT JOIN inspection_type T6
|
||||
ON T1.sub_item_id = T6.id
|
||||
AND T6.valid_flag = 1
|
||||
<where>
|
||||
T1.delete_flag = '0'
|
||||
<if test="id != null">
|
||||
AND T1.id = #{id}
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
AND T1.tenant_id = #{tenantId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 检验项目下拉列表(轻量级) -->
|
||||
<select id="getLabActivityDefinitionSimpleList" resultType="com.openhis.web.datadictionary.dto.DiagnosisTreatmentDto">
|
||||
SELECT
|
||||
T1.id,
|
||||
T1.bus_no,
|
||||
T1.name,
|
||||
T1.permitted_unit_code
|
||||
FROM lab_activity_definition T1
|
||||
WHERE T1.delete_flag = '0'
|
||||
AND T1.status_enum = #{statusEnum}
|
||||
AND T1.tenant_id = #{tenantId}
|
||||
<if test="searchKey != null and searchKey != ''">
|
||||
AND (
|
||||
T1.name LIKE CONCAT('%', #{searchKey}, '%')
|
||||
OR T1.bus_no LIKE CONCAT('%', #{searchKey}, '%')
|
||||
OR T1.py_str LIKE CONCAT('%', #{searchKey}, '%')
|
||||
)
|
||||
</if>
|
||||
ORDER BY T1.id DESC
|
||||
<if test="searchKey != null and searchKey != ''">
|
||||
LIMIT 1500
|
||||
</if>
|
||||
<if test="searchKey == null or searchKey == ''">
|
||||
LIMIT 500
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -55,7 +55,10 @@ public class InspectionPackageDetail {
|
||||
/** 单位 */
|
||||
private String unit;
|
||||
|
||||
/** 单价 */
|
||||
/** 原始单价(未折扣前的价格,用于折扣变更时恢复原价) */
|
||||
private BigDecimal originalPrice;
|
||||
|
||||
/** 单价(折后单价 = 原始单价 × 折扣比例) */
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
/** 金额 */
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.openhis.lab.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.core.common.core.domain.HisBaseEntity;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 检验项目定义实体(独立表 lab_activity_definition,不依赖 wor_activity_definition)
|
||||
*/
|
||||
@Data
|
||||
@TableName("lab_activity_definition")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class LabActivityDefinition extends HisBaseEntity {
|
||||
|
||||
/** 主键ID */
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 目录类别 */
|
||||
private String categoryCode;
|
||||
|
||||
/** 编码 */
|
||||
private String busNo;
|
||||
|
||||
/** 项目名称 */
|
||||
private String name;
|
||||
|
||||
/** 项目名称拼音 */
|
||||
private String pyStr;
|
||||
|
||||
/** 五笔拼音 */
|
||||
private String wbStr;
|
||||
|
||||
/** 类型 */
|
||||
private Integer typeEnum;
|
||||
|
||||
/** 使用单位 */
|
||||
private String permittedUnitCode;
|
||||
|
||||
/** 所属科室 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long orgId;
|
||||
|
||||
/** 所在位置 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
|
||||
/** 医保标记 */
|
||||
private Integer ybFlag;
|
||||
|
||||
/** 医保编码 */
|
||||
private String ybNo;
|
||||
|
||||
/** 医保对码标记 */
|
||||
private Integer ybMatchFlag;
|
||||
|
||||
/** 状态 */
|
||||
private Integer statusEnum;
|
||||
|
||||
/** 身体部位 */
|
||||
private String bodySiteCode;
|
||||
|
||||
/** 所需标本 */
|
||||
private String specimenCode;
|
||||
|
||||
/** 说明 */
|
||||
private String descriptionText;
|
||||
|
||||
/** 规则id */
|
||||
private Integer ruleId;
|
||||
|
||||
/** 医保等级 */
|
||||
private Integer chrgitmLv;
|
||||
|
||||
/** 子项json */
|
||||
private String childrenJson;
|
||||
|
||||
/** 划价标记 */
|
||||
private Integer pricingFlag;
|
||||
|
||||
/** 序号 */
|
||||
private Integer sortOrder;
|
||||
|
||||
/** 服务范围 */
|
||||
private String serviceRange;
|
||||
|
||||
/** 检验类型ID(关联 inspection_type 大类,逻辑关联无外键) */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long inspectionTypeId;
|
||||
|
||||
/** 费用套餐ID(关联 inspection_basic_information,逻辑关联无外键) */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long feePackageId;
|
||||
|
||||
/** 下级医技类型ID(关联 inspection_type 子类,逻辑关联无外键) */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long subItemId;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.openhis.lab.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.openhis.lab.domain.LabActivityDefinition;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 检验项目定义 Mapper 接口
|
||||
*/
|
||||
@Repository
|
||||
public interface LabActivityDefinitionMapper extends BaseMapper<LabActivityDefinition> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.openhis.lab.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.openhis.lab.domain.LabActivityDefinition;
|
||||
|
||||
/**
|
||||
* 检验项目定义 Service 接口
|
||||
*/
|
||||
public interface ILabActivityDefinitionService extends IService<LabActivityDefinition> {
|
||||
|
||||
/**
|
||||
* 新增检验项目
|
||||
*
|
||||
* @param labActivityDefinition 检验项目实体
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean addLabActivityDefinition(LabActivityDefinition labActivityDefinition);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.openhis.lab.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.common.core.domain.model.LoginUser;
|
||||
import com.openhis.lab.domain.LabActivityDefinition;
|
||||
import com.openhis.lab.mapper.LabActivityDefinitionMapper;
|
||||
import com.openhis.lab.service.ILabActivityDefinitionService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检验项目定义 Service 实现类
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class LabActivityDefinitionServiceImpl
|
||||
extends ServiceImpl<LabActivityDefinitionMapper, LabActivityDefinition>
|
||||
implements ILabActivityDefinitionService {
|
||||
|
||||
/**
|
||||
* 新增检验项目(检查编码唯一性)
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean addLabActivityDefinition(LabActivityDefinition labActivityDefinition) {
|
||||
// 根据编码判断是否已存在
|
||||
List<LabActivityDefinition> existing = baseMapper.selectList(
|
||||
new LambdaQueryWrapper<LabActivityDefinition>()
|
||||
.eq(LabActivityDefinition::getBusNo, labActivityDefinition.getBusNo()));
|
||||
if (!existing.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
setRequiredFields(labActivityDefinition);
|
||||
return baseMapper.insert(labActivityDefinition) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 补全必填字段(create_by、tenant_id、create_time)
|
||||
*/
|
||||
private void setRequiredFields(LabActivityDefinition entity) {
|
||||
String createBy = "system";
|
||||
Integer tenantId = 1;
|
||||
try {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null) {
|
||||
createBy = loginUser.getUsername();
|
||||
tenantId = loginUser.getTenantId() != null ? loginUser.getTenantId() : 1;
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
entity.setCreateBy(createBy);
|
||||
entity.setTenantId(tenantId);
|
||||
if (entity.getCreateTime() == null) {
|
||||
entity.setCreateTime(new Date());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?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.lab.mapper.LabActivityDefinitionMapper">
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user