```
docs(release-notes): 添加住院护士站划价功能说明和发版记录 - 新增住院护士站划价服务流程说明文档,详细描述了从参数预处理到结果响应的五大阶段流程 - 包含耗材类医嘱和诊疗活动类医嘱的差异化处理逻辑 - 添加完整的发版内容记录,涵盖新增菜单功能和各模块优化点 - 记录了住院相关功能的新增和门诊业务流程的修复 ```
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package com.openhis.web.Inspection.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.administration.domain.Device;
|
||||
import com.openhis.administration.domain.Instrument;
|
||||
import com.openhis.web.Inspection.dto.InstrumentSelParam;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author
|
||||
* @Date 2025/9/18 15:38
|
||||
*/
|
||||
public interface IInstrumentManageAppService {
|
||||
|
||||
|
||||
R<?> getManageInit();
|
||||
|
||||
|
||||
R<?> getInstrumentPage(InstrumentSelParam InstrumentSelParam, String searchKey, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request);
|
||||
|
||||
|
||||
R<?> updateOrAddInstrument(Instrument instrument);
|
||||
|
||||
R<?> getInstrumentOne(Long id);
|
||||
|
||||
R<?> editInstrumentStatus(List<Long> ids, Integer status);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.openhis.web.Inspection.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.Inspection.dto.ReportResultManageDto;
|
||||
import com.openhis.web.Inspection.dto.SampleCollectManageDto;
|
||||
import com.openhis.web.Inspection.dto.SampleCollectStatusRequest;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author
|
||||
* @Date 2025/10/16 15:36
|
||||
*/
|
||||
public interface ILaboratoryManageAppService {
|
||||
|
||||
R<?> getReportResultList(ReportResultManageDto reportResultManageDto, Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
|
||||
|
||||
|
||||
R<?> getReportById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.openhis.web.Inspection.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.Inspection.dto.LisConfigManageDto;
|
||||
import com.openhis.web.datadictionary.dto.DiagnosisTreatmentSelParam;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author
|
||||
* @Date 2025/9/29 16:00
|
||||
*/
|
||||
public interface ILisConfigManageAppService {
|
||||
|
||||
R<?> getDiseaseTreatmentPage(DiagnosisTreatmentSelParam DiagnosisTreatmentSelParam, String searchKey,
|
||||
Integer pageNo, Integer pageSize, HttpServletRequest request);
|
||||
|
||||
|
||||
R<?> getInfoList(String searchKey,String type);
|
||||
|
||||
R<?> getInfoDetail(Long id);
|
||||
|
||||
R<?> saveAll(LisConfigManageDto manageDto);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param patientId 患者id
|
||||
* @param ServiceId 服务id
|
||||
* @param itemId 检验项目id
|
||||
* @return
|
||||
*/
|
||||
R<?>createAll(Long patientId,Long ServiceId, Long itemId);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.openhis.web.Inspection.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.administration.domain.ObservationDefinition;
|
||||
import com.openhis.web.Inspection.dto.ObservationDefSelParam;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author
|
||||
* @Date 2025/9/23 16:32
|
||||
*/
|
||||
public interface IObservationManageAppService {
|
||||
|
||||
R<?> getManageInit();
|
||||
|
||||
|
||||
R<?> getObservationDefPage(ObservationDefSelParam ObservationDefSelParam, String searchKey, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request);
|
||||
|
||||
|
||||
R<?> updateOrAddObservationDef(ObservationDefinition Observation);
|
||||
|
||||
R<?> getObservationDefOne(Long id);
|
||||
|
||||
R<?> editObservationDefStatus(List<Long> ids, Integer status);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.openhis.web.Inspection.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.Inspection.dto.SampleCollectManageDto;
|
||||
import com.openhis.web.Inspection.dto.SampleCollectStatusRequest;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author
|
||||
* @Date 2025/10/16 15:36
|
||||
*/
|
||||
public interface ISampleCollectAppManageAppService {
|
||||
|
||||
R<?> getSampleCollectList(SampleCollectManageDto sampleCollectManageDto, Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
|
||||
|
||||
|
||||
R<?>updateSampleStatus(SampleCollectStatusRequest statusRequest);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.openhis.web.Inspection.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.administration.domain.SpecimenDefinition;
|
||||
import com.openhis.web.Inspection.dto.SpecimenDefSelParam;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author
|
||||
* @Date 2025/9/9 16:46
|
||||
*/
|
||||
public interface ISpecimenManageAppService {
|
||||
|
||||
|
||||
|
||||
R<?> getManageInit();
|
||||
|
||||
|
||||
R<?> getSpecimenPage(SpecimenDefSelParam specimenDefSelParam, String searchKey, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request);
|
||||
|
||||
|
||||
R<?> updateOrAddSpecimen(SpecimenDefinition specimenDefinition);
|
||||
|
||||
R<?> getSpecimenOne(Long id);
|
||||
|
||||
R<?> editSpecimenStatus(List<Long> ids,Integer status);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.openhis.web.Inspection.appservice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.openhis.administration.domain.Instrument;
|
||||
import com.openhis.administration.mapper.InstrumentMapper;
|
||||
import com.openhis.administration.service.IInstrumentService;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.InstrumentCategory;
|
||||
import com.openhis.common.enums.PublicationStatus;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisPageUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.Inspection.appservice.IInstrumentManageAppService;
|
||||
import com.openhis.web.Inspection.dto.InstrumentManageDto;
|
||||
import com.openhis.web.Inspection.dto.InstrumentManageInitDto;
|
||||
import com.openhis.web.Inspection.dto.InstrumentSelParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @Description 仪器信息
|
||||
* @Author
|
||||
* @Date 2025/9/18
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class InstrumentManageAppServiceImpl implements IInstrumentManageAppService {
|
||||
|
||||
private final IInstrumentService instrumentService ;
|
||||
private final InstrumentMapper instrumentMapper ;
|
||||
|
||||
|
||||
@Override
|
||||
public R<?> getManageInit() {
|
||||
InstrumentManageInitDto instrumentManageInitDto = new InstrumentManageInitDto();
|
||||
// 获取状态
|
||||
List<InstrumentManageInitDto.statusEnumOption> statusEnumOptions = Stream.of(PublicationStatus.values())
|
||||
.map(status -> new InstrumentManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
instrumentManageInitDto.setStatusFlagOptions(statusEnumOptions);
|
||||
// 获取仪器种类
|
||||
List<InstrumentManageInitDto.InstrumentType> typeList = Stream.of(com.openhis.common.enums.InstrumentCategory.values())
|
||||
.map(status -> new InstrumentManageInitDto.InstrumentType(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
instrumentManageInitDto.setInstrumentTypeList(typeList);
|
||||
// 获取仪器状态
|
||||
List<InstrumentManageInitDto.InstrumentStatusEnumOption> InstrumentStatusEnumOptions = Stream.of(com.openhis.common.enums.InstrumentStatus.values())
|
||||
.map(status -> new InstrumentManageInitDto.InstrumentStatusEnumOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
instrumentManageInitDto.setInstrumentStatusEnumList(InstrumentStatusEnumOptions);
|
||||
|
||||
return R.ok(instrumentManageInitDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> getInstrumentPage(InstrumentSelParam InstrumentSelParam, String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
QueryWrapper<Instrument> queryWrapper = HisQueryUtils.buildQueryWrapper(InstrumentSelParam,
|
||||
searchKey, new HashSet<>(Arrays.asList( "instrument_name", "instrument_name")), request);
|
||||
Page<InstrumentManageDto> instrumentPage = HisPageUtils.selectPage(instrumentMapper, queryWrapper, pageNo, pageSize,InstrumentManageDto.class);
|
||||
instrumentPage.getRecords().forEach(instrumentManageDto -> {
|
||||
instrumentManageDto.setInstrumentTypeEnumText(EnumUtils.getInfoByValue(InstrumentCategory.class, instrumentManageDto.getInstrumentTypeEnum())) ;
|
||||
});
|
||||
|
||||
return R.ok(instrumentPage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> updateOrAddInstrument(Instrument instrument) {
|
||||
instrumentService.saveOrUpdate( instrument);
|
||||
return R.ok();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> getInstrumentOne(Long id)
|
||||
{
|
||||
Instrument byId = instrumentService.getById(id);
|
||||
InstrumentManageDto dto = new InstrumentManageDto();
|
||||
BeanUtils.copyProperties(byId,dto);
|
||||
return R.ok(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> editInstrumentStatus(List<Long> ids, Integer status) {
|
||||
List<Instrument> instrumentList = new CopyOnWriteArrayList<>();
|
||||
for (Long detail : ids) {
|
||||
Instrument instrument = new Instrument();
|
||||
instrument.setId(detail);
|
||||
instrument.setUsageStatusEnum(status);
|
||||
instrumentList.add(instrument);
|
||||
}
|
||||
return instrumentService.updateBatchById(instrumentList) ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"仪器信息"})) : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.openhis.web.Inspection.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.openhis.common.enums.AdministrativeGender;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.Inspection.appservice.ILaboratoryManageAppService;
|
||||
import com.openhis.web.Inspection.dto.ReportResultManageDto;
|
||||
import com.openhis.web.Inspection.mapper.LisReportMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description 样本采集
|
||||
* @Author
|
||||
* @Date 2025/10/16
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class LaboratoryManageAppService implements ILaboratoryManageAppService {
|
||||
|
||||
private final LisReportMapper reportMapper;
|
||||
@Override
|
||||
public R<?> getReportResultList(ReportResultManageDto reportResultManageDto, Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
|
||||
QueryWrapper<ReportResultManageDto> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(reportResultManageDto,
|
||||
searchKey, new HashSet<>(Arrays.asList( "patient_name", "charge_name")), request);
|
||||
IPage<ReportResultManageDto> reportResultList = reportMapper.getReportResultList(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
Long total = reportMapper.getReportResultListTotal(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
reportResultList.getRecords().forEach(e -> {
|
||||
// 性别
|
||||
e.setGenderEnumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
||||
});
|
||||
if(total == null){
|
||||
//总条数为null
|
||||
total = 0L;
|
||||
}
|
||||
reportResultList.setTotal(total);
|
||||
return R.ok(reportResultList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> getReportById(Long id) {
|
||||
//根据id查询所有观测值
|
||||
List<ReportResultManageDto> list = reportMapper.getReportListById(new QueryWrapper<ReportResultManageDto>().eq("id", id));
|
||||
//打印组件配置
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package com.openhis.web.Inspection.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.utils.SecurityUtils;
|
||||
import com.openhis.administration.domain.Device;
|
||||
import com.openhis.administration.domain.DeviceDefinition;
|
||||
import com.openhis.administration.domain.ObservationDefinition;
|
||||
import com.openhis.administration.domain.SpecimenDefinition;
|
||||
import com.openhis.administration.service.IDeviceDefinitionService;
|
||||
import com.openhis.administration.service.IDeviceService;
|
||||
import com.openhis.administration.service.IObservationDefinitionService;
|
||||
import com.openhis.administration.service.ISpecimenDefinitionService;
|
||||
import com.openhis.common.enums.SpecCollectStatus;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.lab.domain.*;
|
||||
import com.openhis.lab.mapper.ActivityDefDeviceDefMapper;
|
||||
import com.openhis.lab.mapper.ActivityDefObservationDefMapper;
|
||||
import com.openhis.lab.mapper.ActivityDefSpecimenDefMapper;
|
||||
import com.openhis.lab.service.IObservationService;
|
||||
import com.openhis.lab.service.ISpecimenService;
|
||||
import com.openhis.web.Inspection.appservice.ILisConfigManageAppService;
|
||||
import com.openhis.web.Inspection.dto.LisConfigManageDto;
|
||||
import com.openhis.web.Inspection.dto.LisConfigManageInitDto;
|
||||
import com.openhis.web.datadictionary.dto.DiagnosisTreatmentDto;
|
||||
import com.openhis.web.datadictionary.dto.DiagnosisTreatmentSelParam;
|
||||
import com.openhis.web.datadictionary.mapper.ActivityDefinitionManageMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.val;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author
|
||||
* @Date 2025/9/29
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class LisConfigManageAppServiceImpl implements ILisConfigManageAppService {
|
||||
|
||||
@Resource
|
||||
private ActivityDefinitionManageMapper activityDefinitionManageMapper;
|
||||
@Resource
|
||||
private ActivityDefDeviceDefMapper activityDefDeviceDefMapper;
|
||||
@Resource
|
||||
private ActivityDefObservationDefMapper activityDefObservationDefMapper;
|
||||
@Resource
|
||||
private ActivityDefSpecimenDefMapper activityDefSpecimenDefMapper;
|
||||
@Resource
|
||||
private IDeviceDefinitionService deviceDefinitionService;
|
||||
@Resource
|
||||
private ISpecimenDefinitionService specimenDefinitionService;
|
||||
@Resource
|
||||
private IObservationDefinitionService observationDefinitionService;
|
||||
@Resource
|
||||
private IObservationService observationService;
|
||||
@Resource
|
||||
private ISpecimenService specimenService;
|
||||
@Resource
|
||||
private IDeviceService deviceService;
|
||||
|
||||
|
||||
@Override
|
||||
public R<?> getDiseaseTreatmentPage(DiagnosisTreatmentSelParam DiagnosisTreatmentSelParam, String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<DiagnosisTreatmentDto> queryWrapper = HisQueryUtils.buildQueryWrapper(DiagnosisTreatmentSelParam,
|
||||
searchKey, new HashSet<>(Arrays.asList("bus_no", "name", "py_str", "wb_str")), request);
|
||||
|
||||
// 分页查询
|
||||
IPage<DiagnosisTreatmentDto> diseaseTreatmentPage =
|
||||
activityDefinitionManageMapper.getDiseaseTreatmentPage(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
|
||||
|
||||
|
||||
return R.ok(diseaseTreatmentPage);
|
||||
}
|
||||
|
||||
public R<?> getInfoList(String searchKey, String type) {
|
||||
LisConfigManageInitDto initDto = new LisConfigManageInitDto();
|
||||
initDto.setDeviceDefs(deviceDefinitionService.list());
|
||||
initDto.setObservationDefs(observationDefinitionService.list());
|
||||
initDto.setSpecimenDefs(specimenDefinitionService.list());
|
||||
if (searchKey == null || searchKey.isEmpty()) {
|
||||
// 如果searchKey为空,则查询所有
|
||||
return switch (type) {
|
||||
case "device" -> R.ok(deviceDefinitionService.list(new QueryWrapper<DeviceDefinition>().eq("status_enum",2)));
|
||||
case "observation" -> R.ok(observationDefinitionService.list(new QueryWrapper<ObservationDefinition>().eq("status_enum",2) ));
|
||||
case "specimen" -> R.ok(specimenDefinitionService.list(new QueryWrapper<SpecimenDefinition>().eq("status_enum",2)));
|
||||
default -> R.ok(initDto);
|
||||
};
|
||||
} else {
|
||||
// 如果searchKey不为空,则根据name模糊查询
|
||||
return switch (type) {
|
||||
case "device" ->
|
||||
R.ok(deviceDefinitionService.list((new QueryWrapper<DeviceDefinition>().like("name", searchKey).eq("status_enum",2))));
|
||||
case "observation" ->
|
||||
R.ok(observationDefinitionService.list((new QueryWrapper<ObservationDefinition>().like("name", searchKey).eq("status_enum",2))));
|
||||
case "specimen" ->
|
||||
R.ok(specimenDefinitionService.list((new QueryWrapper<SpecimenDefinition>().like("name", searchKey).eq("status_enum",2))));
|
||||
default -> R.ok();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public R<?> getInfoDetail(Long id) {
|
||||
LisConfigManageDto manageDto = new LisConfigManageDto();
|
||||
manageDto.setActivityDefDeviceDefs(activityDefDeviceDefMapper.selectList(new QueryWrapper<ActivityDefDeviceDef>().eq("activity_definition_id", id)));
|
||||
manageDto.setActivityDefObservationDefs(activityDefObservationDefMapper.selectList(new QueryWrapper<ActivityDefObservationDef>().eq("activity_definition_id", id)));
|
||||
manageDto.setActivityDefSpecimenDefs(activityDefSpecimenDefMapper.selectList(new QueryWrapper<ActivityDefSpecimenDef>().eq("activity_definition_id", id)));
|
||||
return R.ok(manageDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> saveAll(LisConfigManageDto manageDto) {
|
||||
//先全部删除项目下详情
|
||||
activityDefDeviceDefMapper.delete(new QueryWrapper<ActivityDefDeviceDef>().eq("activity_definition_id", manageDto.getId()));
|
||||
activityDefObservationDefMapper.delete(new QueryWrapper<ActivityDefObservationDef>().eq("activity_definition_id", manageDto.getId()));
|
||||
activityDefSpecimenDefMapper.delete(new QueryWrapper<ActivityDefSpecimenDef>().eq("activity_definition_id", manageDto.getId()));
|
||||
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
|
||||
// 根据ID查询【诊疗目录】详情
|
||||
DiagnosisTreatmentDto diseaseTreatmentOne = activityDefinitionManageMapper.getDiseaseTreatmentOne(manageDto.getId(), tenantId);
|
||||
manageDto.getActivityDefDeviceDefs().forEach(activityDefDeviceDef -> {
|
||||
activityDefDeviceDef.setActivityDefinitionId(manageDto.getId());
|
||||
activityDefDeviceDef.setActivityDefinitionName(diseaseTreatmentOne.getName());
|
||||
activityDefDeviceDefMapper.insert(activityDefDeviceDef);
|
||||
});
|
||||
manageDto.getActivityDefObservationDefs().forEach(activityDefObservationDef -> {
|
||||
activityDefObservationDef.setActivityDefinitionId(manageDto.getId());
|
||||
activityDefObservationDef.setActivityDefinitionName(diseaseTreatmentOne.getName());
|
||||
activityDefObservationDefMapper.insert(activityDefObservationDef);
|
||||
});
|
||||
manageDto.getActivityDefSpecimenDefs().forEach(activityDefSpecimenDef -> {
|
||||
activityDefSpecimenDef.setActivityDefinitionId(manageDto.getId());
|
||||
activityDefSpecimenDef.setActivityDefinitionName(diseaseTreatmentOne.getName());
|
||||
activityDefSpecimenDefMapper.insert(activityDefSpecimenDef);
|
||||
});
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> createAll(Long patientId,Long ServiceId, Long itemId) {
|
||||
// 根据ID查询检查项目详情
|
||||
List<ActivityDefDeviceDef> devices = activityDefDeviceDefMapper.selectList(new QueryWrapper<ActivityDefDeviceDef>().eq("activity_definition_id", itemId));
|
||||
List<ActivityDefObservationDef> observations= activityDefObservationDefMapper.selectList(new QueryWrapper<ActivityDefObservationDef>().eq("activity_definition_id", itemId));
|
||||
List<ActivityDefSpecimenDef> specimens = activityDefSpecimenDefMapper.selectList(new QueryWrapper<ActivityDefSpecimenDef>().eq("activity_definition_id", itemId));
|
||||
devices.forEach(activityDefDeviceDef -> {
|
||||
Device device = new Device();
|
||||
device.setDeviceDefId(activityDefDeviceDef.getDeviceDefinitionId());
|
||||
device.setName(activityDefDeviceDef.getDeviceDefinitionName());
|
||||
//TODO 器材实体待完善,生成器材请求
|
||||
|
||||
});
|
||||
observations.forEach(activityDefObservationDef -> {
|
||||
Observation observation = new Observation();
|
||||
//TODO 初始字段具体观测定义字段待完善
|
||||
observation.setPatientId(patientId);
|
||||
observation.setObservationDefinitionId(activityDefObservationDef.getObservationDefinitionId());
|
||||
observationService.save(observation);
|
||||
});
|
||||
specimens.forEach(activityDefSpecimenDef -> {
|
||||
Specimen specimen = new Specimen();
|
||||
//TODO 初始字段具体标本定义字段待完善
|
||||
specimen.setServiceId(ServiceId);
|
||||
specimen.setSpecimenDefinitionId(activityDefSpecimenDef.getSpecimenDefinitionId());
|
||||
specimen.setPatientId(patientId);
|
||||
specimen.setCollectionStatusEnum(SpecCollectStatus.PENDING.getValue());
|
||||
specimen.setSpecimenUnit(activityDefSpecimenDef.getSpecimenUnit());
|
||||
specimen.setSpecimenVolume(activityDefSpecimenDef.getSpecimenVolume());
|
||||
specimenService.save(specimen);
|
||||
});
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.openhis.web.Inspection.appservice.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.administration.domain.ObservationDefinition;
|
||||
import com.openhis.administration.mapper.ObservationDefinitionMapper;
|
||||
import com.openhis.administration.service.IInstrumentService;
|
||||
import com.openhis.administration.service.IObservationDefinitionService;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.core.common.enums.DelFlag;
|
||||
import com.openhis.common.enums.ObservationType;
|
||||
import com.openhis.common.enums.PublicationStatus;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisPageUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.Inspection.appservice.IObservationManageAppService;
|
||||
import com.openhis.web.Inspection.dto.ObservationDefManageDto;
|
||||
import com.openhis.web.Inspection.dto.ObservationDefManageInitDto;
|
||||
import com.openhis.web.Inspection.dto.ObservationDefSelParam;
|
||||
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author
|
||||
* @Date 2025/9/23
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ObservationManageAppServiceImpl implements IObservationManageAppService
|
||||
{
|
||||
private final ObservationDefinitionMapper observationDefinitionMapper;
|
||||
|
||||
private final IObservationDefinitionService observationDefinitionService;
|
||||
|
||||
private final IInstrumentService instrumentService;
|
||||
|
||||
|
||||
@Override
|
||||
public R<?> getManageInit() {
|
||||
|
||||
ObservationDefManageInitDto observationDefManageInitDto = new ObservationDefManageInitDto();
|
||||
// 获取状态
|
||||
List<ObservationDefManageInitDto.statusEnumOption> statusEnumOptions = Stream.of(PublicationStatus.values())
|
||||
.map(status -> new ObservationDefManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
observationDefManageInitDto.setStatusFlagOptions(statusEnumOptions);
|
||||
//观测类型
|
||||
List<ObservationDefManageInitDto.ObservationTypeEnumOption> ObservationTypeEnumOptions = Stream.of(com.openhis.common.enums.ObservationType.values())
|
||||
.map(status -> new ObservationDefManageInitDto.ObservationTypeEnumOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
observationDefManageInitDto.setObservationTypeList(ObservationTypeEnumOptions);
|
||||
//仪器列表
|
||||
List<ObservationDefManageInitDto.InstrumentEnumOption> InstrumentEnumOptions = instrumentService.list().stream()
|
||||
.map(status -> new ObservationDefManageInitDto.InstrumentEnumOption(status.getId(), status.getInstrumentName()))
|
||||
.collect(Collectors.toList());
|
||||
observationDefManageInitDto.setInstrumentEnumOptionList(InstrumentEnumOptions);
|
||||
return R.ok(observationDefManageInitDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> getObservationDefPage(ObservationDefSelParam ObservationDefSelParam, String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
|
||||
QueryWrapper<ObservationDefinition> queryWrapper = HisQueryUtils.buildQueryWrapper(ObservationDefSelParam,
|
||||
searchKey, new HashSet<>(Arrays.asList( "name", "code")), request);
|
||||
Page<ObservationDefManageDto> ObservationPage = HisPageUtils.selectPage(observationDefinitionMapper, queryWrapper, pageNo, pageSize, ObservationDefManageDto.class);
|
||||
ObservationPage.getRecords().forEach(item -> {
|
||||
item.setInstrumentId_dictText(instrumentService.getById(item.getInstrumentId()).getInstrumentName());
|
||||
item.setStatusEnumText(EnumUtils.getInfoByValue(PublicationStatus.class, item.getStatusEnum()));
|
||||
item.setObservationTypeEnumText(EnumUtils.getInfoByValue(ObservationType.class, item.getObservationTypeEnum()));
|
||||
});
|
||||
|
||||
return R.ok(ObservationPage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> updateOrAddObservationDef(ObservationDefinition Observation) {
|
||||
Observation.setDeleteFlag(DelFlag.NO.getCode());
|
||||
observationDefinitionService.saveOrUpdate(Observation);
|
||||
return R.ok(" 添加成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> getObservationDefOne(Long id) {
|
||||
ObservationDefinition observationDefinition = observationDefinitionService.getById(id);
|
||||
ObservationDefManageDto dto = new ObservationDefManageDto();
|
||||
BeanUtils.copyProperties(observationDefinition,dto);
|
||||
return R.ok(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> editObservationDefStatus(List<Long> ids, Integer status) {
|
||||
List<ObservationDefinition> observationDefinitionList = new CopyOnWriteArrayList<>();
|
||||
for (Long detail : ids) {
|
||||
ObservationDefinition observationDefinition = new ObservationDefinition();
|
||||
observationDefinition.setId(detail);
|
||||
observationDefinition.setStatusEnum(status);
|
||||
observationDefinitionList.add(observationDefinition);
|
||||
}
|
||||
return observationDefinitionService.updateBatchById(observationDefinitionList) ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"观测信息"}))
|
||||
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.openhis.web.Inspection.appservice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
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.common.enums.AdministrativeGender;
|
||||
import com.openhis.common.enums.SpecCollectStatus;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.lab.domain.Specimen;
|
||||
import com.openhis.lab.service.ISpecimenService;
|
||||
import com.openhis.web.Inspection.appservice.ISampleCollectAppManageAppService;
|
||||
import com.openhis.web.Inspection.dto.SampleCollectManageDto;
|
||||
import com.openhis.web.Inspection.dto.SampleCollectStatusRequest;
|
||||
import com.openhis.web.Inspection.mapper.SampleCollectMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Description 样本采集
|
||||
* @Author
|
||||
* @Date 2025/10/16
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class SampleCollectManageAppService implements ISampleCollectAppManageAppService {
|
||||
|
||||
private final SampleCollectMapper sampleCollectMapper;
|
||||
|
||||
private final ISpecimenService specimenService;
|
||||
|
||||
@Override
|
||||
public R<?> getSampleCollectList(SampleCollectManageDto sampleCollectManageDto, Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
|
||||
QueryWrapper<SampleCollectManageDto> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(sampleCollectManageDto,
|
||||
searchKey, new HashSet<>(Arrays.asList( "patient_name", "charge_name")), request);
|
||||
IPage<SampleCollectManageDto> sampleCollectList = sampleCollectMapper.getSampleCollectList(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
Long total = sampleCollectMapper.getSampleCollectListTotal(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
sampleCollectList.getRecords().forEach(e -> {
|
||||
// 性别
|
||||
e.setGenderEnumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
||||
// 采集状态
|
||||
e.setCollectionStatusEnumText(EnumUtils.getInfoByValue(SpecCollectStatus.class, e.getCollectionStatusEnum()));
|
||||
});
|
||||
if(total == null){
|
||||
//总条数为null
|
||||
total = 0L;
|
||||
}
|
||||
sampleCollectList.setTotal(total);
|
||||
return R.ok(sampleCollectList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> updateSampleStatus(SampleCollectStatusRequest statusRequest) {
|
||||
// 根据状态类型设置对应的状态值
|
||||
Integer status = switch (statusRequest.getType()) {
|
||||
case "待采集" -> SpecCollectStatus.PENDING.getValue();
|
||||
case "已采集" -> SpecCollectStatus.COLLECTED.getValue();
|
||||
case "已接收" -> SpecCollectStatus.RECEIVED.getValue();
|
||||
default -> 0;
|
||||
};
|
||||
|
||||
// 批量更新样本状态
|
||||
specimenService.listByIds(statusRequest.getIds()).forEach(specimen -> {
|
||||
Integer currentStatus = specimen.getCollectionStatusEnum(); // 获取当前样本状态
|
||||
// 如果传入状态是已接收,但当前状态是待采集,跳过更新
|
||||
if (Objects.equals(status, SpecCollectStatus.RECEIVED.getValue()) && Objects.equals(currentStatus, SpecCollectStatus.PENDING.getValue())) {
|
||||
return;
|
||||
}
|
||||
// 构建更新条件
|
||||
UpdateWrapper<Specimen> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.in("id", statusRequest.getIds()) // 设置批量更新的条件
|
||||
.set("collection_status_enum", status); // 设置更新的状态字段
|
||||
// 如果状态为已采集,且采集日期不为空,跳过采集日期的更新,仅更新状态
|
||||
if (Objects.equals(status, SpecCollectStatus.COLLECTED.getValue())) {
|
||||
if (specimen.getCollectionDate() == null) {
|
||||
// 如果采集日期为空,则设置当前日期
|
||||
updateWrapper.set("collection_date", new Date());
|
||||
}
|
||||
updateWrapper.set("received_date", null);
|
||||
} else if (Objects.equals(status, SpecCollectStatus.PENDING.getValue())) {
|
||||
updateWrapper.set("collection_date", null); // 清空采集日期
|
||||
} else if (Objects.equals(status, SpecCollectStatus.RECEIVED.getValue())) {
|
||||
updateWrapper.set("received_date", new Date());
|
||||
}
|
||||
// 执行更新
|
||||
specimenService.update(updateWrapper);
|
||||
});
|
||||
if (Objects.equals(status, SpecCollectStatus.RECEIVED.getValue())) {
|
||||
// TODO 接收样本后续逻辑
|
||||
System.err.println("接收样本后!!");
|
||||
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.openhis.web.Inspection.appservice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.openhis.administration.domain.SpecimenDefinition;
|
||||
import com.openhis.administration.mapper.SpecimenDefinitionMapper;
|
||||
import com.openhis.administration.service.ISpecimenDefinitionService;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.PublicationStatus;
|
||||
import com.openhis.common.enums.SpecimenType;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisPageUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.Inspection.appservice.ISpecimenManageAppService;
|
||||
import com.openhis.web.Inspection.dto.SpecimenDefManageDto;
|
||||
import com.openhis.web.Inspection.dto.SpecimenDefManageInitDto;
|
||||
import com.openhis.web.Inspection.dto.SpecimenDefSelParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @Description
|
||||
* @Author
|
||||
* @Date 2025/9/9
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SpecimenManageAppServiceImpl implements ISpecimenManageAppService {
|
||||
|
||||
private final SpecimenDefinitionMapper specimenDefinitionMapper;
|
||||
|
||||
private final ISpecimenDefinitionService specimenDefinitionService;
|
||||
@Override
|
||||
public R<?> getManageInit() {
|
||||
SpecimenDefManageInitDto specimenDefManageInitDto = new SpecimenDefManageInitDto();
|
||||
|
||||
// 获取状态
|
||||
List<SpecimenDefManageInitDto.statusEnumOption> statusEnumOptions = Stream.of(PublicationStatus.values())
|
||||
.map(status -> new SpecimenDefManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
specimenDefManageInitDto.setStatusFlagOptions(statusEnumOptions);
|
||||
// 获取录种类
|
||||
List<SpecimenDefManageInitDto.SpecimenType> typeList = Stream.of(SpecimenType.values())
|
||||
.map(status -> new SpecimenDefManageInitDto.SpecimenType(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
specimenDefManageInitDto.setSpecimenTypeList(typeList);
|
||||
|
||||
|
||||
return R.ok(specimenDefManageInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 样本目录查询
|
||||
* @param SpecimenDefSelParam 查询条件
|
||||
* @param searchKey 查询条件-模糊查询
|
||||
* @param pageNo 查询条件
|
||||
* @param pageSize 查询条件
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public R<?> getSpecimenPage(SpecimenDefSelParam SpecimenDefSelParam, String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
|
||||
QueryWrapper<SpecimenDefinition> queryWrapper = HisQueryUtils.buildQueryWrapper(SpecimenDefSelParam,
|
||||
searchKey, new HashSet<>(Arrays.asList("custom_code", "specimen_name", "py_str", "wb_str")), request);
|
||||
Page<SpecimenDefManageDto> specimenPage = HisPageUtils.selectPage(specimenDefinitionMapper, queryWrapper, pageNo, pageSize, SpecimenDefManageDto.class);
|
||||
specimenPage.getRecords().forEach(specimenDefManageDto -> {
|
||||
specimenDefManageDto.setSpecimenTypeEnumText(EnumUtils.getInfoByValue(SpecimenType.class, specimenDefManageDto.getSpecimenTypeEnum())) ;
|
||||
specimenDefManageDto.setStatusEnumText(EnumUtils.getInfoByValue(PublicationStatus.class, specimenDefManageDto.getStatusEnum()));
|
||||
});
|
||||
return R.ok(specimenPage);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public R<?> updateOrAddSpecimen(SpecimenDefinition specimenDefinition) {
|
||||
specimenDefinitionService.saveOrUpdate(specimenDefinition);
|
||||
return R.ok(" 添加成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> getSpecimenOne(Long id) {
|
||||
SpecimenDefinition specimenDefinition = specimenDefinitionService.getById(id);
|
||||
return R.ok(specimenDefinition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> editSpecimenStatus(List<Long> ids, Integer status) {
|
||||
List<SpecimenDefinition> specimenDefinitionList = new CopyOnWriteArrayList<>();
|
||||
for (Long detail : ids) {
|
||||
SpecimenDefinition specimenDefinition = new SpecimenDefinition();
|
||||
specimenDefinition.setId(detail);
|
||||
specimenDefinition.setStatusEnum(status);
|
||||
specimenDefinitionList.add(specimenDefinition);
|
||||
}
|
||||
return specimenDefinitionService.updateBatchById(specimenDefinitionList) ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[]{"样本信息"}))
|
||||
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.openhis.web.Inspection.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.administration.domain.Instrument;
|
||||
import com.core.common.enums.DelFlag;
|
||||
import com.openhis.common.enums.PublicationStatus;
|
||||
import com.openhis.web.Inspection.appservice.IInstrumentManageAppService;
|
||||
import com.openhis.web.Inspection.dto.InstrumentSelParam;
|
||||
import com.openhis.web.Inspection.dto.InstrumentStatusRequest;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @Description 仪器器材信息
|
||||
* @Author
|
||||
* @Date 2025/9/18
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/inspection/instrument")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class InstrumentController {
|
||||
|
||||
|
||||
private final IInstrumentManageAppService appService;
|
||||
|
||||
|
||||
@GetMapping("/init")
|
||||
public R<?> getDiseaseTreatmentInit() {
|
||||
return appService.getManageInit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询样本类型分页列表
|
||||
*
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/information-page")
|
||||
public R<?> getInstrumentPage(InstrumentSelParam InstrumentSelParam,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return appService.getInstrumentPage(InstrumentSelParam,searchKey, pageNo, pageSize, request);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/information")
|
||||
public R<?> editInstrument(@Validated @RequestBody Instrument instrument) {
|
||||
instrument.setDeleteFlag(DelFlag.NO.getCode());
|
||||
|
||||
return appService.updateOrAddInstrument(instrument);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/information-one")
|
||||
public R<?> getInstrument(@RequestParam Long id) {
|
||||
return appService.getInstrumentOne(id);
|
||||
}
|
||||
|
||||
@PostMapping("/information-status")
|
||||
public R<?> updateInstrumentStatus( @RequestBody InstrumentStatusRequest InstrumentStatusRequest ) {
|
||||
//默认停用
|
||||
Integer status = PublicationStatus.RETIRED.getValue();
|
||||
if("启用".equals( InstrumentStatusRequest.getType())){
|
||||
status = PublicationStatus.ACTIVE.getValue();
|
||||
}
|
||||
return appService.editInstrumentStatus(InstrumentStatusRequest.getIds(),status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.openhis.web.Inspection.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.Inspection.appservice.ILaboratoryManageAppService;
|
||||
import com.openhis.web.Inspection.dto.ReportResultManageDto;
|
||||
import com.openhis.web.Inspection.dto.SampleCollectManageDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @Description 检测中心相关
|
||||
* @Author
|
||||
* @Date 2025/10/24
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/inspection/laboratory")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class LaboratoryController {
|
||||
private final ILaboratoryManageAppService appService;
|
||||
|
||||
@GetMapping("/information-page")
|
||||
public R<?> getReportResultPage(ReportResultManageDto reportResultManageDto, @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return appService.getReportResultList( reportResultManageDto, pageNo, pageSize, searchKey, request);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public R<?> getReportById(@PathVariable Long id) {
|
||||
// 调用 ReportService 获取报告数据
|
||||
return appService.getReportById(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.openhis.web.Inspection.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.Inspection.appservice.ILisConfigManageAppService;
|
||||
import com.openhis.web.Inspection.dto.LisConfigManageDto;
|
||||
import com.openhis.web.datadictionary.dto.DiagnosisTreatmentSelParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @Description 检验定义配置
|
||||
* @Author
|
||||
* @Date 2025/9/29
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/inspection/lisConfig")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class LisConfigController {
|
||||
|
||||
|
||||
private ILisConfigManageAppService lisConfigManageAppService;
|
||||
|
||||
/**
|
||||
* @Description 获取检验项目列表
|
||||
* @Author
|
||||
* @Date 2025/9/29
|
||||
*/
|
||||
@RequestMapping("/init-page")
|
||||
public R<?> getDiseaseTreatmentList(DiagnosisTreatmentSelParam DiagnosisTreatmentSelParam, String searchKey,
|
||||
Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
return lisConfigManageAppService.getDiseaseTreatmentPage(DiagnosisTreatmentSelParam, searchKey, pageNo, pageSize, request);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据项目id获取详细
|
||||
* @return
|
||||
*/
|
||||
@GetMapping ("/info-detail")
|
||||
public R<?> getInfoDetail(Long id) {
|
||||
return lisConfigManageAppService.getInfoDetail(id);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping ("/init-list")
|
||||
public R<?> getInfoList(String searchKey,String type) {
|
||||
return lisConfigManageAppService.getInfoList(searchKey, type);
|
||||
|
||||
}
|
||||
/**
|
||||
* 修改检验配置
|
||||
* @param
|
||||
* @param manageDto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/saveAll")
|
||||
public R<?> saveInfo(@RequestBody LisConfigManageDto manageDto) {
|
||||
|
||||
return lisConfigManageAppService.saveAll(manageDto);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.openhis.web.Inspection.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.administration.domain.ObservationDefinition;
|
||||
import com.core.common.enums.DelFlag;
|
||||
import com.openhis.common.enums.PublicationStatus;
|
||||
import com.openhis.web.Inspection.appservice.IObservationManageAppService;
|
||||
import com.openhis.web.Inspection.dto.ObservationDefSelParam;
|
||||
import com.openhis.web.Inspection.dto.ObservationDefStatusRequest;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @Description 仪器器材信息
|
||||
* @Author
|
||||
* @Date 2025/9/18
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/inspection/observation")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class ObservationDefController {
|
||||
|
||||
|
||||
private final IObservationManageAppService appService;
|
||||
|
||||
|
||||
@GetMapping("/init")
|
||||
public R<?> getTreatmentInit() {
|
||||
return appService.getManageInit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询样本类型分页列表
|
||||
*
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/information-page")
|
||||
public R<?> getObservationPage(ObservationDefSelParam observationDefSelParam,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return appService.getObservationDefPage(observationDefSelParam,searchKey, pageNo, pageSize, request);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/information")
|
||||
public R<?> editObservation(@Validated @RequestBody ObservationDefinition observation) {
|
||||
observation.setDeleteFlag(DelFlag.NO.getCode());
|
||||
|
||||
return appService.updateOrAddObservationDef(observation);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/information-one")
|
||||
public R<?> getObservation(@RequestParam Long id) {
|
||||
return appService.getObservationDefOne(id);
|
||||
}
|
||||
|
||||
@PostMapping("/information-status")
|
||||
public R<?> updateObservationStatus( @RequestBody ObservationDefStatusRequest observationDefStatusRequest) {
|
||||
//默认停用
|
||||
Integer status = PublicationStatus.RETIRED.getValue();
|
||||
if("启用".equals( observationDefStatusRequest.getType())){
|
||||
status = PublicationStatus.ACTIVE.getValue();
|
||||
}
|
||||
return appService.editObservationDefStatus(observationDefStatusRequest.getIds(),status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.openhis.web.Inspection.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.common.enums.PublicationStatus;
|
||||
import com.openhis.web.Inspection.appservice.ISampleCollectAppManageAppService;
|
||||
import com.openhis.web.Inspection.dto.SampleCollectManageDto;
|
||||
import com.openhis.web.Inspection.dto.SampleCollectStatusRequest;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @Description 样本采集
|
||||
* @Author
|
||||
* @Date 2025/10/16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/inspection/collection")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class SampleCollectController {
|
||||
|
||||
private final ISampleCollectAppManageAppService appService;
|
||||
|
||||
|
||||
@GetMapping("/information-page")
|
||||
public R<?> getSampleCollectPage(SampleCollectManageDto sampleCollectManageDto,@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return appService.getSampleCollectList( sampleCollectManageDto, pageNo, pageSize, searchKey, request);
|
||||
}
|
||||
|
||||
@PostMapping("/information-status")
|
||||
public R<?> editSampleCollectStatus(@RequestBody SampleCollectStatusRequest statusRequest) {
|
||||
return appService.updateSampleStatus(statusRequest);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.openhis.web.Inspection.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.administration.domain.SpecimenDefinition;
|
||||
import com.core.common.enums.DelFlag;
|
||||
import com.openhis.common.enums.PublicationStatus;
|
||||
import com.openhis.web.Inspection.appservice.ISpecimenManageAppService;
|
||||
import com.openhis.web.Inspection.dto.SpecimenDefSelParam;
|
||||
import com.openhis.web.Inspection.dto.SpecimenDefStatusRequest;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @Description 样本定义相关
|
||||
* @Author
|
||||
* @Date 2025/9/9
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/inspection/specimen")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class SpecimenDefController {
|
||||
|
||||
private final ISpecimenManageAppService specimenManageAppService;
|
||||
|
||||
|
||||
@GetMapping("/init")
|
||||
public R<?> getDiseaseTreatmentInit() {
|
||||
return specimenManageAppService.getManageInit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询样本类型分页列表
|
||||
*
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/information-page")
|
||||
public R<?> getSpecimenPage(SpecimenDefSelParam specimenDefSelParam,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return specimenManageAppService.getSpecimenPage(specimenDefSelParam,searchKey, pageNo, pageSize, request);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/information")
|
||||
public R<?> editSpecimen(@Validated @RequestBody SpecimenDefinition specimenDefinition) {
|
||||
specimenDefinition.setStatusEnum( PublicationStatus.ACTIVE.getValue());
|
||||
specimenDefinition.setDeleteFlag(DelFlag.NO.getCode());
|
||||
return specimenManageAppService.updateOrAddSpecimen(specimenDefinition);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/information-one")
|
||||
public R<?> getSpecimen(@RequestParam Long id) {
|
||||
return specimenManageAppService.getSpecimenOne(id);
|
||||
}
|
||||
|
||||
@PostMapping("/information-status")
|
||||
public R<?> updateSpecimenStatus( @RequestBody SpecimenDefStatusRequest specimenDefStatusRequest) {
|
||||
//默认停用
|
||||
Integer status = PublicationStatus.RETIRED.getValue();
|
||||
if("启用".equals( specimenDefStatusRequest.getType())){
|
||||
status = PublicationStatus.ACTIVE.getValue();
|
||||
}
|
||||
return specimenManageAppService.editSpecimenStatus(specimenDefStatusRequest.getIds(),status);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.openhis.web.Inspection.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description 分页返回
|
||||
* @Author
|
||||
* @Date 2025/9/17
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class InstrumentManageDto {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 仪器编号,唯一且不能为空 */
|
||||
private String instrumentCode;
|
||||
|
||||
/** 仪器名称,必填项 */
|
||||
private String instrumentName;
|
||||
|
||||
/** 仪器主编号 */
|
||||
private String instrumentMainCode;
|
||||
|
||||
/** 仪器类型,选择项 */
|
||||
private Integer instrumentTypeEnum;
|
||||
private String instrumentTypeEnumText;
|
||||
|
||||
/** 仪器型号 */
|
||||
private String instrumentModel;
|
||||
|
||||
/** 生产厂家 */
|
||||
private String manufacturer;
|
||||
|
||||
/** 仪器序列号 */
|
||||
private String serialNumber;
|
||||
|
||||
/** 购买公司 */
|
||||
private String purchasingCompany;
|
||||
|
||||
/** 联系人员 */
|
||||
private String contactPerson;
|
||||
|
||||
/** 购买日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date purchaseDate;
|
||||
|
||||
/** 原价格 */
|
||||
private BigDecimal originalPrice;
|
||||
|
||||
/** 成交价格 */
|
||||
private BigDecimal transactionPrice;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
/** 安装日期 */
|
||||
private Date installationDate;
|
||||
|
||||
/** 安装人员 */
|
||||
private String installationPerson;
|
||||
|
||||
/** 维护人员 */
|
||||
private String maintenancePerson;
|
||||
|
||||
/** 所属科室 */
|
||||
@Dict(dictTable = "adm_organization", dictCode = "id", dictText = "name")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long orgId;
|
||||
private String orgId_dictText;
|
||||
|
||||
/** 鉴定人员 */
|
||||
private String identificationPerson;
|
||||
|
||||
/** 记录温度 */
|
||||
private String recordedTemperature;
|
||||
|
||||
/** 仪器附件 */
|
||||
private String accessories;
|
||||
|
||||
/** 仪器状态 */
|
||||
private Integer instrumentStatusEnum;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
/** 报损日期 */
|
||||
private Date damageReportDate;
|
||||
|
||||
/** 可复查仪器 是否 */
|
||||
private Integer recheckableInstrumentEnum;
|
||||
|
||||
/** 使用状态,是否 */
|
||||
private Integer usageStatusEnum;
|
||||
|
||||
/** 停用原因 */
|
||||
private String decommissionReason;
|
||||
|
||||
/** 备注 */
|
||||
private String remarks;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.openhis.web.Inspection.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author
|
||||
* @date
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class InstrumentManageInitDto {
|
||||
private List<statusEnumOption> statusFlagOptions;
|
||||
private List<InstrumentType> InstrumentTypeList;
|
||||
private List<InstrumentStatusEnumOption> InstrumentStatusEnumList;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Data
|
||||
public static class statusEnumOption {
|
||||
private Integer value;
|
||||
private String info;
|
||||
public statusEnumOption(Integer value, String info) {
|
||||
this.value = value;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class InstrumentStatusEnumOption {
|
||||
private Integer value;
|
||||
private String info;
|
||||
public InstrumentStatusEnumOption(Integer value, String info) {
|
||||
this.value = value;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class InstrumentType {
|
||||
private Integer value;
|
||||
private String info;
|
||||
public InstrumentType(Integer value, String info) {
|
||||
this.value = value;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.openhis.web.Inspection.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 样本定义分页检索条件
|
||||
*
|
||||
* @author lpt
|
||||
* @date 2025-02-25
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class InstrumentSelParam {
|
||||
|
||||
/** 仪器类型 */
|
||||
private Integer instrumentTypeEnum;
|
||||
|
||||
/** 状态 */
|
||||
private Integer statusEnum;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.openhis.web.Inspection.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author
|
||||
* @Date 2025/9/18
|
||||
*/
|
||||
@Data
|
||||
public class InstrumentStatusRequest {
|
||||
private List<Long> ids;
|
||||
private String type;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.openhis.web.Inspection.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.lab.domain.ActivityDefDeviceDef;
|
||||
import com.openhis.lab.domain.ActivityDefObservationDef;
|
||||
import com.openhis.lab.domain.ActivityDefSpecimenDef;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author
|
||||
* @Date 2025/9/30
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class LisConfigManageDto {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
private List<ActivityDefDeviceDef> activityDefDeviceDefs;
|
||||
|
||||
private List<ActivityDefObservationDef> activityDefObservationDefs;
|
||||
|
||||
private List<ActivityDefSpecimenDef> activityDefSpecimenDefs;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.openhis.web.Inspection.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.openhis.administration.domain.DeviceDefinition;
|
||||
import com.openhis.administration.domain.ObservationDefinition;
|
||||
import com.openhis.administration.domain.SpecimenDefinition;
|
||||
import com.openhis.web.datadictionary.dto.DeviceManageDto;
|
||||
import com.openhis.web.datadictionary.dto.DiagnosisTreatmentDto;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author
|
||||
* @Date 2025/10/10
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class LisConfigManageInitDto {
|
||||
|
||||
private List <DeviceDefinition> deviceDefs;
|
||||
|
||||
private List<ObservationDefinition> observationDefs;
|
||||
|
||||
private List<SpecimenDefinition> specimenDefs;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.openhis.web.Inspection.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description 分页返回
|
||||
* @Author
|
||||
* @Date 2025/9/17
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ObservationDefManageDto {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
|
||||
/** 观测名称,用于标识观测的具体名称 */
|
||||
private String name;
|
||||
|
||||
/** 观测代码,用于唯一标识一个观测项 */
|
||||
private String code;
|
||||
|
||||
/** 观测类型,例如:实验室、临床症状等 */
|
||||
private Integer observationTypeEnum;
|
||||
private String observationTypeEnumText;
|
||||
|
||||
/** 参考范围,例如:3.0-6.0 mg/dL,用于指示正常范围 */
|
||||
private String referenceRange;
|
||||
|
||||
@Dict(dictTable = "adm_instrument", dictCode = "id", dictText = "instrument_name")
|
||||
/** 观测仪器id */
|
||||
private Long instrumentId;
|
||||
private String instrumentId_dictText;
|
||||
|
||||
/** 状态 */
|
||||
private Integer statusEnum;
|
||||
private String statusEnumText;
|
||||
|
||||
/** 删除状态) */
|
||||
private String deleteFlag;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.openhis.web.Inspection.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author
|
||||
* @date
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ObservationDefManageInitDto {
|
||||
private List<statusEnumOption> statusFlagOptions;
|
||||
private List<ObservationTypeEnumOption> ObservationTypeList;
|
||||
private List<InstrumentEnumOption> instrumentEnumOptionList;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Data
|
||||
public static class statusEnumOption {
|
||||
private Integer value;
|
||||
private String info;
|
||||
public statusEnumOption(Integer value, String info) {
|
||||
this.value = value;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class ObservationTypeEnumOption {
|
||||
private Integer value;
|
||||
private String info;
|
||||
public ObservationTypeEnumOption(Integer value, String info) {
|
||||
this.value = value;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
@Data
|
||||
public static class InstrumentEnumOption {
|
||||
private Long value;
|
||||
private String info;
|
||||
public InstrumentEnumOption(Long value, String info) {
|
||||
this.value = value;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.openhis.web.Inspection.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 样本定义分页检索条件
|
||||
*
|
||||
* @author lpt
|
||||
* @date 2025-02-25
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ObservationDefSelParam {
|
||||
|
||||
/** 类型 */
|
||||
private Integer observationTypeEnum;
|
||||
|
||||
/** 状态 */
|
||||
private Integer statusEnum;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.openhis.web.Inspection.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author
|
||||
* @Date 2025/9/18
|
||||
*/
|
||||
@Data
|
||||
public class ObservationDefStatusRequest {
|
||||
private List<Long> ids;
|
||||
private String type;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.openhis.web.Inspection.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author
|
||||
* @Date 2025/10/17
|
||||
*/
|
||||
@Data
|
||||
public class ReportResultManageDto {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long parentId;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
private String patientName; // 患者名称
|
||||
private String chargeName; // 项目名称
|
||||
private String specimenName; // 样本名称
|
||||
private String doctorName; // 开单医生
|
||||
private String observationName;//观测定义名称
|
||||
private String observationResult; // 观测结果
|
||||
private String referenceRange; // 参考范围
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private String observationDate;//观测时间
|
||||
private Integer genderEnum; // 性别
|
||||
private String genderEnumText;// 性别文本
|
||||
private String technicianName;// 检查人员
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private String authoredTime; // 开单时间
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.openhis.web.Inspection.dto;
|
||||
|
||||
import com.core.common.core.domain.entity.SysMenu;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author
|
||||
* @Date 2025/10/17
|
||||
*/
|
||||
@Data
|
||||
public class SampleCollectManageDto {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long parentId;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
private String patientName; // 患者名称
|
||||
private String chargeName; // 项目名称
|
||||
private String specimenName; // 样本名称
|
||||
private String doctorName; // 开单医生
|
||||
|
||||
private Integer specimenVolume; //样本量
|
||||
private String specimenUnit; //样本单位
|
||||
|
||||
private Integer genderEnum; // 性别
|
||||
private String genderEnumText;// 性别文本
|
||||
|
||||
private Integer collectionStatusEnum;//采集状态
|
||||
private String collectionStatusEnumText; // 采集状态文本
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date collectionDate; // 采集时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date receivedDate; // 接收时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private String authoredTime; // 开单时间
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.openhis.web.Inspection.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author
|
||||
* @Date 2025/10/23
|
||||
*/
|
||||
@Data
|
||||
public class SampleCollectStatusRequest {
|
||||
private List<Long> ids;
|
||||
private String type;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.openhis.web.Inspection.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description 分页返回
|
||||
* @Author
|
||||
* @Date 2025/9/17
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SpecimenDefManageDto {
|
||||
/** $column.columnComment */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 样本类型 */
|
||||
private Integer specimenTypeEnum;
|
||||
private String specimenTypeEnumText;
|
||||
|
||||
/** 样本名称 */
|
||||
private String specimenName;
|
||||
|
||||
/** 自定义码 */
|
||||
private String customCode;
|
||||
|
||||
/** 类型顺序 */
|
||||
private Integer typeOrder;
|
||||
|
||||
/** 外部代码 */
|
||||
private String externalCode;
|
||||
|
||||
/** 序号 */
|
||||
private Integer serialNumber;
|
||||
|
||||
/** 全网型 */
|
||||
private String globalType;
|
||||
|
||||
/** 拼音 */
|
||||
private String pyStr;
|
||||
|
||||
/** 五笔 */
|
||||
private String wbStr;
|
||||
|
||||
/** 样本类 */
|
||||
private String specimenClass;
|
||||
|
||||
/** 扩展类型 */
|
||||
private String extendedType;
|
||||
|
||||
/** WHONET代码 */
|
||||
private String whonetCode;
|
||||
|
||||
|
||||
/** 状态 */
|
||||
private Integer statusEnum;
|
||||
private String statusEnumText;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.openhis.web.Inspection.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author
|
||||
* @date
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SpecimenDefManageInitDto {
|
||||
private List<statusEnumOption> statusFlagOptions;
|
||||
private List<SpecimenType> SpecimenTypeList;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Data
|
||||
public static class statusEnumOption {
|
||||
private Integer value;
|
||||
private String info;
|
||||
public statusEnumOption(Integer value, String info) {
|
||||
this.value = value;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class SpecimenType {
|
||||
private Integer value;
|
||||
private String info;
|
||||
List<SpecimenType> children = new ArrayList<>();
|
||||
|
||||
public SpecimenType(Integer value, String info) {
|
||||
this.value = value;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.openhis.web.Inspection.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 样本定义分页检索条件
|
||||
*
|
||||
* @author lpt
|
||||
* @date 2025-02-25
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SpecimenDefSelParam {
|
||||
|
||||
/** 样本类型 */
|
||||
private Integer specimenTypeEnum;
|
||||
|
||||
/** 状态 */
|
||||
private Integer statusEnum;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.openhis.web.Inspection.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author
|
||||
* @Date 2025/9/18
|
||||
*/
|
||||
@Data
|
||||
public class SpecimenDefStatusRequest {
|
||||
private List<Long> ids;
|
||||
private String type;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.openhis.web.Inspection.mapper;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author
|
||||
* @Date 2025/10/24 16:40
|
||||
*/
|
||||
public interface GroupRecMapper {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.openhis.web.Inspection.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.Inspection.dto.ReportResultManageDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author
|
||||
* @Date 2025/11/5 9:36
|
||||
*/
|
||||
@Mapper
|
||||
public interface LisReportMapper {
|
||||
|
||||
IPage<ReportResultManageDto> getReportResultList(@Param("page") Page<ReportResultManageDto> page, @Param(Constants.WRAPPER) QueryWrapper<ReportResultManageDto> queryWrapper);
|
||||
|
||||
Long getReportResultListTotal (@Param("page")Page<ReportResultManageDto> page, @Param(Constants.WRAPPER) QueryWrapper<ReportResultManageDto> queryWrapper);
|
||||
List<ReportResultManageDto> getReportListById(@Param(Constants.WRAPPER) QueryWrapper<ReportResultManageDto> queryWrapper);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.openhis.web.Inspection.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.Inspection.dto.SampleCollectManageDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author
|
||||
* @Date 2025/10/17 11:27
|
||||
*/
|
||||
@Mapper
|
||||
public interface SampleCollectMapper {
|
||||
IPage<SampleCollectManageDto> getSampleCollectList(@Param("page")Page<SampleCollectManageDto> page, @Param(Constants.WRAPPER) QueryWrapper<SampleCollectManageDto> queryWrapper);
|
||||
|
||||
|
||||
Long getSampleCollectListTotal (@Param("page")Page<SampleCollectManageDto> page, @Param(Constants.WRAPPER) QueryWrapper<SampleCollectManageDto> queryWrapper);
|
||||
|
||||
}
|
||||
@@ -18,7 +18,8 @@ public interface IOrganizationAppService {
|
||||
* @param request 请求数据
|
||||
* @return 机构树分页列表
|
||||
*/
|
||||
Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, HttpServletRequest request);
|
||||
Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, String sortField, String sortOrder,
|
||||
HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 机构信息详情
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.enums.DelFlag;
|
||||
import com.core.common.utils.*;
|
||||
import com.openhis.administration.domain.EncounterLocation;
|
||||
import com.openhis.administration.domain.Location;
|
||||
@@ -77,7 +78,9 @@ public class LocationAppServiceImpl implements ILocationAppService {
|
||||
*/
|
||||
@Override
|
||||
public R<?> enableLocation(List<Long> locationIdList) {
|
||||
List<Location> locationList = locationService.getLocationList(locationIdList);
|
||||
// 根据ID查询停用状态的
|
||||
List<Location> locationList = locationService.getLocationList(locationIdList,
|
||||
Collections.singletonList(LocationStatus.INACTIVE.getValue()));
|
||||
if (locationIdList != null && !locationIdList.isEmpty()) {
|
||||
for (Location location : locationList) {
|
||||
if (LocationForm.HOUSE.getValue().equals(location.getFormEnum())
|
||||
@@ -117,7 +120,8 @@ public class LocationAppServiceImpl implements ILocationAppService {
|
||||
*/
|
||||
@Override
|
||||
public R<?> deactivateLocation(List<Long> locationIdList) {
|
||||
List<Location> locationList = locationService.getLocationList(locationIdList);
|
||||
List<Location> locationList = locationService.getLocationList(locationIdList,
|
||||
Arrays.asList(LocationStatus.ACTIVE.getValue(), LocationStatus.IDLE.getValue()));
|
||||
if (locationIdList != null && !locationIdList.isEmpty()) {
|
||||
for (Location location : locationList) {
|
||||
if (LocationForm.BED.getValue().equals(location.getFormEnum())) {
|
||||
@@ -231,6 +235,23 @@ public class LocationAppServiceImpl implements ILocationAppService {
|
||||
// 启用停用
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(LocationStatus.class, e.getStatusEnum()));
|
||||
});
|
||||
// 如果是查询病房
|
||||
if (LocationForm.HOUSE.getValue().equals(locationPageParam.getFormEnum())) {
|
||||
// 查询疗区
|
||||
LambdaQueryWrapper<Location> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(Location::getFormEnum, LocationForm.WARD.getValue()).eq(Location::getDeleteFlag,
|
||||
DelFlag.NO.getCode());
|
||||
List<Location> list = locationService.list(wrapper);
|
||||
// 根据busNo拼接疗区
|
||||
HashMap<String, String> map = list.stream().collect(Collectors.toMap(Location::getBusNo, Location::getName,
|
||||
(oldValue, newValue) -> newValue, HashMap::new));
|
||||
locationPage.getRecords().forEach(e -> {
|
||||
String[] split = e.getBusNo().split("\\.");
|
||||
if (split.length == 2) {
|
||||
e.setParentName(map.get(split[0]));
|
||||
}
|
||||
});
|
||||
}
|
||||
return R.ok(locationPage);
|
||||
}
|
||||
|
||||
@@ -242,7 +263,16 @@ public class LocationAppServiceImpl implements ILocationAppService {
|
||||
*/
|
||||
@Override
|
||||
public R<?> addLocation(LocationAddOrEditDto locationAddOrEditDto) {
|
||||
|
||||
// 不能为空
|
||||
if (StringUtils.isEmpty(locationAddOrEditDto.getName())) {
|
||||
return R.fail(false, "名称不能为空");
|
||||
}
|
||||
// 去除空格
|
||||
String name = locationAddOrEditDto.getName().replaceAll("[ ]", "");
|
||||
// 判断是否存在同名
|
||||
if (locationService.isExistName(name, locationAddOrEditDto.getBusNo(), locationAddOrEditDto.getId())) {
|
||||
return R.fail(false, "【" + name + "】已存在");
|
||||
}
|
||||
Location location = new Location();
|
||||
BeanUtils.copyProperties(locationAddOrEditDto, location);
|
||||
location.setFormEnum(Integer.valueOf(locationAddOrEditDto.getFormEnum()));
|
||||
@@ -278,6 +308,16 @@ public class LocationAppServiceImpl implements ILocationAppService {
|
||||
*/
|
||||
@Override
|
||||
public R<?> editLocation(LocationAddOrEditDto locationAddOrEditDto) {
|
||||
// 不能为空
|
||||
if (StringUtils.isEmpty(locationAddOrEditDto.getName())) {
|
||||
return R.fail(false, "名称不能为空");
|
||||
}
|
||||
// 去除空格
|
||||
String name = locationAddOrEditDto.getName().replaceAll("[ ]", "");
|
||||
// 判断是否存在同名
|
||||
if (locationService.isExistName(name, locationAddOrEditDto.getBusNo(), locationAddOrEditDto.getId())) {
|
||||
return R.fail(false, "【" + name + "】已存在");
|
||||
}
|
||||
Location location = new Location();
|
||||
BeanUtils.copyProperties(locationAddOrEditDto, location);
|
||||
// 拼音码
|
||||
@@ -377,4 +417,4 @@ public class LocationAppServiceImpl implements ILocationAppService {
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.openhis.web.basedatamanage.appservice.impl;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -9,6 +10,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.AssignSeqUtil;
|
||||
@@ -26,6 +28,8 @@ import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.web.basedatamanage.appservice.IOrganizationAppService;
|
||||
import com.openhis.web.basedatamanage.dto.OrganizationDto;
|
||||
|
||||
import static com.baomidou.mybatisplus.core.toolkit.StringUtils.camelToUnderline;
|
||||
|
||||
@Service
|
||||
public class OrganizationAppServiceImpl implements IOrganizationAppService {
|
||||
|
||||
@@ -36,9 +40,25 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
|
||||
@Override
|
||||
public Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
public Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, String sortField,
|
||||
String sortOrder, HttpServletRequest request) {
|
||||
// 查询机构列表
|
||||
Page<Organization> page = organizationService.page(new Page<>(pageNo, pageSize));
|
||||
// 创建Page对象
|
||||
Page<Organization> page = new Page<>(pageNo, pageSize);
|
||||
// 处理动态排序(仅当排序字段有效时才添加排序条件)
|
||||
if (sortField != null && !sortField.isEmpty()) {
|
||||
// 校验排序字段是否为Organization实体中的有效字段(防止非法字段)
|
||||
if (isValidField(Organization.class, sortField)) {
|
||||
// 驼峰转下划线处理
|
||||
String underlineField = camelToUnderline(sortField);
|
||||
// 默认为升序,若指定desc则按降序
|
||||
boolean isAsc = sortOrder == null || "asc".equalsIgnoreCase(sortOrder);
|
||||
page.addOrder(isAsc ? OrderItem.asc(underlineField) : OrderItem.desc(underlineField));
|
||||
}
|
||||
}
|
||||
// 执行分页查询(此时排序条件会被应用)
|
||||
page = organizationService.page(page);
|
||||
|
||||
List<Organization> organizationList = page.getRecords();
|
||||
// 将机构列表转为树结构
|
||||
List<OrganizationDto> orgTree = buildTree(organizationList);
|
||||
@@ -199,4 +219,21 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
|
||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"机构信息停用"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验字段是否为指定类中的有效属性
|
||||
*/
|
||||
private boolean isValidField(Class<?> clazz, String fieldName) {
|
||||
if (clazz == null || fieldName == null || fieldName.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
// 获取类中所有声明的字段(包括私有)
|
||||
Field field = clazz.getDeclaredField(fieldName);
|
||||
return field != null;
|
||||
} catch (NoSuchFieldException e) {
|
||||
// 字段不存在
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -406,7 +406,8 @@ public class PractitionerAppServiceImpl implements IPractitionerAppService {
|
||||
if (1L == userId) {
|
||||
return R.fail(null, "admin不允许删除");
|
||||
}
|
||||
iBizUserService.remove(new LambdaQueryWrapper<BizUser>().eq(BizUser::getUserId, userId));
|
||||
// iBizUserService.remove(new LambdaQueryWrapper<BizUser>().eq(BizUser::getUserId, userId));
|
||||
practitionerAppAppMapper.delUser(userId);
|
||||
practitionerAppAppMapper.delUserRole(userId);
|
||||
Practitioner one =
|
||||
iPractitionerService.getOne(new LambdaQueryWrapper<Practitioner>().eq(Practitioner::getUserId, userId));
|
||||
|
||||
@@ -47,8 +47,11 @@ public class OrganizationController {
|
||||
*/
|
||||
@GetMapping(value = "/organization")
|
||||
public R<?> getOrganizationPage(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "100") Integer pageSize, HttpServletRequest request) {
|
||||
Page<OrganizationDto> organizationTree = iOrganizationAppService.getOrganizationTree(pageNo, pageSize, request);
|
||||
@RequestParam(value = "pageSize", defaultValue = "100") Integer pageSize,
|
||||
@RequestParam(value = "sortField", required = false) String sortField,
|
||||
@RequestParam(value = "sortOrder", required = false) String sortOrder, HttpServletRequest request) {
|
||||
Page<OrganizationDto> organizationTree =
|
||||
iOrganizationAppService.getOrganizationTree(pageNo, pageSize, sortField, sortOrder, request);
|
||||
return R.ok(organizationTree,
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"机构信息"}));
|
||||
}
|
||||
|
||||
@@ -3,11 +3,10 @@
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@@ -31,6 +30,9 @@ public class LocationInfoDto {
|
||||
/** 名称 */
|
||||
private String name;
|
||||
|
||||
/** 父名称 */
|
||||
private String parentName;
|
||||
|
||||
/** 状态编码 */
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
@@ -44,7 +46,7 @@ public class LocationInfoDto {
|
||||
private String formEnum_enumText;
|
||||
|
||||
/** 机构编码 */
|
||||
@Dict(dictCode = "id",dictText = "name",dictTable = "adm_organization")
|
||||
@Dict(dictCode = "id", dictText = "name", dictTable = "adm_organization")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long organizationId;
|
||||
private String organizationId_dictText;
|
||||
|
||||
@@ -63,4 +63,9 @@ public class OrgLocQueryDto {
|
||||
/** 显示顺序 */
|
||||
private Integer displayOrder;
|
||||
|
||||
/**
|
||||
* 项目编码 | 药品:1 耗材:2
|
||||
*/
|
||||
private String itemCode;
|
||||
|
||||
}
|
||||
|
||||
@@ -47,6 +47,13 @@ public interface PractitionerAppAppMapper {
|
||||
List<PractitionerOrgAndLocationDto>
|
||||
getOrgAndLocationDtoList(@Param("practitionerIdList") List<Long> practitionerIdList);
|
||||
|
||||
/**
|
||||
* 逻辑删除系统用户
|
||||
*
|
||||
* @param userId 系统用户id
|
||||
*/
|
||||
void delUser(@Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 物理删除系统用户与角色的关系
|
||||
*
|
||||
|
||||
@@ -90,4 +90,9 @@ public class HealthcareServiceFormData {
|
||||
/** 医保编码 */
|
||||
private String ybNo;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String busNo;
|
||||
|
||||
}
|
||||
@@ -20,26 +20,32 @@ import com.openhis.web.chargemanage.dto.EncounterPatientPrescriptionDto;
|
||||
public interface IInpatientChargeAppService {
|
||||
|
||||
/**
|
||||
* 查询就诊患者分页列表
|
||||
* 门诊收费页面初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> inpatientChargeInit();
|
||||
|
||||
/**
|
||||
* 查询住院患者分页列表
|
||||
*
|
||||
* @param encounterPatientPageParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param request 请求
|
||||
* @return 就诊患者分页列表
|
||||
* @return 住院患者分页列表
|
||||
*/
|
||||
R<?> getEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者处方列表
|
||||
* 根据就诊id查询患者待结算信息
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 患者处方列表
|
||||
* @return 患者待结算信息
|
||||
*/
|
||||
List<EncounterPatientPrescriptionDto> getEncounterPatientPrescription(Long encounterId, String startTime,
|
||||
String endTime);
|
||||
List<EncounterPatientPrescriptionDto> getEncounterPatientPrescription(Long encounterId);
|
||||
|
||||
/**
|
||||
* 医保转自费
|
||||
@@ -56,11 +62,4 @@ public interface IInpatientChargeAppService {
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> changeToMedicalInsurance(Long encounterId);
|
||||
|
||||
/**
|
||||
* 门诊收费页面初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> outpatientChargeInit();
|
||||
}
|
||||
|
||||
@@ -40,6 +40,14 @@ public interface IOutpatientChargeAppService {
|
||||
*/
|
||||
List<EncounterPatientPrescriptionDto> getEncounterPatientPrescription(Long encounterId);
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者处方列表并新增字段:实收金额、应收金额、优惠金额、折扣率
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 患者处方列表
|
||||
*/
|
||||
List<EncounterPatientPrescriptionDto> getEncounterPatientPrescriptionWithPrice(Long encounterId);
|
||||
|
||||
/**
|
||||
* 医保转自费
|
||||
*
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
*/
|
||||
package com.openhis.web.chargemanage.appservice.impl;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -21,10 +22,7 @@ import com.openhis.administration.service.IAccountService;
|
||||
import com.openhis.administration.service.IChargeItemService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.AdministrativeGender;
|
||||
import com.openhis.common.enums.ChargeItemContext;
|
||||
import com.openhis.common.enums.ChargeItemStatus;
|
||||
import com.openhis.common.enums.EncounterClass;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.chargemanage.appservice.IInpatientChargeAppService;
|
||||
@@ -51,33 +49,32 @@ public class InpatientChargeAppServiceImpl implements IInpatientChargeAppService
|
||||
private IAccountService accountService;
|
||||
|
||||
/**
|
||||
* 门诊收费页面初始化
|
||||
* 住院结算页面初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> outpatientChargeInit() {
|
||||
public R<?> inpatientChargeInit() {
|
||||
OutpatientInitDto initDto = new OutpatientInitDto();
|
||||
List<OutpatientInitDto.chargeItemStatusOption> chargeItemStatusOptions = new ArrayList<>();
|
||||
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.PLANNED.getValue(),
|
||||
ChargeItemStatus.PLANNED.getInfo()));
|
||||
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.BILLABLE.getValue(),
|
||||
ChargeItemStatus.BILLABLE.getInfo()));
|
||||
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.BILLED.getValue(),
|
||||
ChargeItemStatus.BILLED.getInfo()));
|
||||
initDto.setChargeItemStatusOptions(chargeItemStatusOptions);
|
||||
List<OutpatientInitDto.encounterStatusOption> encounterStatusOptions = new ArrayList<>();
|
||||
encounterStatusOptions
|
||||
.add(new OutpatientInitDto.encounterStatusOption(EncounterZyStatus.DISCHARGED_FROM_HOSPITAL.getValue(),
|
||||
EncounterZyStatus.DISCHARGED_FROM_HOSPITAL.getInfo()));
|
||||
encounterStatusOptions.add(new OutpatientInitDto.encounterStatusOption(
|
||||
EncounterZyStatus.ALREADY_SETTLED.getValue(), EncounterZyStatus.ALREADY_SETTLED.getInfo()));
|
||||
initDto.setEncounterStatusOptions(encounterStatusOptions);
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询就诊患者分页列表
|
||||
* 查询住院患者分页列表
|
||||
*
|
||||
* @param encounterPatientPageParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param request 请求
|
||||
* @return 就诊患者分页列表
|
||||
* @return 住院患者分页列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam, String searchKey,
|
||||
@@ -90,14 +87,17 @@ public class InpatientChargeAppServiceImpl implements IInpatientChargeAppService
|
||||
CommonConstants.FieldName.EncounterBusNo, CommonConstants.FieldName.IdCard)),
|
||||
request);
|
||||
// 就诊患者分页列表
|
||||
Page<EncounterPatientPageDto> encounterPatientPage = inpatientChargeAppMapper
|
||||
.selectEncounterPatientPage(EncounterClass.IMP.getValue(), new Page<>(pageNo, pageSize), queryWrapper);
|
||||
Page<EncounterPatientPageDto> encounterPatientPage = inpatientChargeAppMapper.selectEncounterPatientPage(
|
||||
EncounterClass.IMP.getValue(), EncounterZyStatus.DISCHARGED_FROM_HOSPITAL.getValue(),
|
||||
EncounterZyStatus.ALREADY_SETTLED.getValue(), ChargeItemStatus.BILLABLE.getValue(),
|
||||
ChargeItemStatus.BILLED.getValue(), ChargeItemStatus.REFUNDED.getValue(),
|
||||
AccountType.PERSONAL_CASH_ACCOUNT.getCode(), new Page<>(pageNo, pageSize), queryWrapper);
|
||||
|
||||
encounterPatientPage.getRecords().forEach(e -> {
|
||||
// 性别枚举
|
||||
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
||||
// 收费状态枚举
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getStatusEnum()));
|
||||
// 住院状态
|
||||
e.setEncounterStatus_enumText(EnumUtils.getInfoByValue(EncounterZyStatus.class, e.getEncounterStatus()));
|
||||
// 计算年龄
|
||||
e.setAge(e.getBirthDate() != null ? AgeCalculatorUtil.getAge(e.getBirthDate()) : "");
|
||||
});
|
||||
@@ -105,36 +105,20 @@ public class InpatientChargeAppServiceImpl implements IInpatientChargeAppService
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者处方列表
|
||||
* 根据就诊id查询患者待结算信息
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 患者处方列表
|
||||
* @return 患者待结算信息
|
||||
*/
|
||||
@Override
|
||||
public List<EncounterPatientPrescriptionDto> getEncounterPatientPrescription(Long encounterId, String startTime,
|
||||
String endTime) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
|
||||
startTime = startTime + "000000";
|
||||
|
||||
endTime = endTime + "235959";
|
||||
|
||||
Date startDate = null;
|
||||
Date endDate = null;
|
||||
try {
|
||||
startDate = sdf.parse(startTime);
|
||||
endDate = sdf.parse(endTime);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
public List<EncounterPatientPrescriptionDto> getEncounterPatientPrescription(Long encounterId) {
|
||||
List<EncounterPatientPrescriptionDto> prescriptionDtoList =
|
||||
inpatientChargeAppMapper.selectEncounterPatientPrescription(encounterId,
|
||||
ChargeItemContext.ACTIVITY.getValue(), ChargeItemContext.MEDICATION.getValue(),
|
||||
ChargeItemContext.DEVICE.getValue(), ChargeItemContext.REGISTER.getValue(),
|
||||
ChargeItemStatus.PLANNED.getValue(), ChargeItemStatus.BILLABLE.getValue(),
|
||||
ChargeItemStatus.BILLED.getValue(), ChargeItemStatus.REFUNDING.getValue(),
|
||||
ChargeItemStatus.REFUNDED.getValue(), ChargeItemStatus.PART_REFUND.getValue(), startDate, endDate);
|
||||
ChargeItemStatus.REFUNDED.getValue(), ChargeItemStatus.PART_REFUND.getValue());
|
||||
prescriptionDtoList.forEach(e -> {
|
||||
// 收费状态枚举
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getStatusEnum()));
|
||||
|
||||
@@ -68,7 +68,7 @@ public class OutpatientPricingAppServiceImpl implements IOutpatientPricingAppSer
|
||||
public IPage<AdviceBaseDto> getAdviceBaseInfo(AdviceBaseDto adviceBaseDto, String searchKey, Long locationId,
|
||||
Long organizationId, Integer pageNo, Integer pageSize) {
|
||||
return iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, searchKey, locationId, null,
|
||||
organizationId, pageNo, pageSize, Whether.YES.getValue(), List.of(1, 2, 3));
|
||||
organizationId, pageNo, pageSize, Whether.YES.getValue(), List.of(1, 2, 3), null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.core.common.utils.AgeCalculatorUtil;
|
||||
import com.core.common.utils.AssignSeqUtil;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.administration.domain.ChargeItem;
|
||||
import com.openhis.administration.service.IChargeItemService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
@@ -80,8 +81,9 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi
|
||||
public R<?> outpatientRefundInit() {
|
||||
OutpatientInitDto initDto = new OutpatientInitDto();
|
||||
List<OutpatientInitDto.chargeItemStatusOption> chargeItemStatusOptions = new ArrayList<>();
|
||||
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.BILLED.getValue(),
|
||||
ChargeItemStatus.BILLED.getInfo()));
|
||||
// 门诊退费页面去掉已收费状态筛选
|
||||
// chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.BILLED.getValue(),
|
||||
// ChargeItemStatus.BILLED.getInfo()));
|
||||
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.REFUNDING.getValue(),
|
||||
ChargeItemStatus.REFUNDING.getInfo()));
|
||||
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.REFUNDED.getValue(),
|
||||
@@ -122,11 +124,6 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi
|
||||
refundItemList.forEach(e -> {
|
||||
// 退费状态
|
||||
e.setRefundStatus_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getRefundStatus()));
|
||||
// 发放状态
|
||||
e.setDispenseStatus_enumText(EnumUtils.getInfoByValue(DispenseStatus.class, e.getDispenseStatus()));
|
||||
// 执行状态
|
||||
e.setServiceStatus_enumText(EnumUtils.getInfoByValue(RequestStatus.class, e.getServiceStatus()));
|
||||
|
||||
});
|
||||
refundItemList.sort(Comparator.comparing(RefundItemDto::getPaymentId));
|
||||
return R.ok(refundItemList);
|
||||
@@ -140,7 +137,6 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi
|
||||
*/
|
||||
@Override
|
||||
public R<?> refundPayment(List<RefundItemParam> refundItemList) {
|
||||
|
||||
// 未退费用项,生成新的请求发放费用项
|
||||
List<RefundItemParam> creatList = new ArrayList<>();
|
||||
for (RefundItemParam param : refundItemList) {
|
||||
@@ -149,7 +145,7 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi
|
||||
creatList.add(param);
|
||||
}
|
||||
}
|
||||
|
||||
// todo 半退逻辑需修改
|
||||
if (!creatList.isEmpty()) {
|
||||
// 未退费费用项id集合
|
||||
List<Long> creatChargeItemIdList =
|
||||
@@ -245,108 +241,232 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi
|
||||
// 退费费用项id集合
|
||||
List<Long> chargeItemIdList =
|
||||
refundItemList.stream().map(RefundItemParam::getChargeItemId).collect(Collectors.toList());
|
||||
|
||||
// 根据费用项id查询费用项请求发放信息
|
||||
List<RefundItemDto> chargeItemList = outpatientRefundAppMapper.selectRefundItem(chargeItemIdList,
|
||||
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_SERVICE_REQUEST,
|
||||
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.Common.THREE);
|
||||
|
||||
List<Long> medDisIdList = new ArrayList<>();
|
||||
List<Long> devDisIdList = new ArrayList<>();
|
||||
// 服务请求id集合
|
||||
List<Long> medReqIdList = new ArrayList<>();
|
||||
List<Long> devReqIdList = new ArrayList<>();
|
||||
List<Long> serReqIdList = new ArrayList<>();
|
||||
// 查询退费项目信息
|
||||
List<ChargeItem> chargeItemList = chargeItemService.listByIds(chargeItemIdList);
|
||||
if (chargeItemList != null && !chargeItemList.isEmpty()) {
|
||||
chargeItemList.forEach(item -> {
|
||||
switch (item.getServiceTable()) {
|
||||
case CommonConstants.TableName.MED_MEDICATION_REQUEST -> medReqIdList.add(item.getServiceId());
|
||||
case CommonConstants.TableName.WOR_DEVICE_REQUEST -> devReqIdList.add(item.getServiceId());
|
||||
case CommonConstants.TableName.WOR_SERVICE_REQUEST -> serReqIdList.add(item.getServiceId());
|
||||
}
|
||||
});
|
||||
}
|
||||
// 处理退药申请
|
||||
if (!medReqIdList.isEmpty()) {
|
||||
// 药品请求查询
|
||||
List<MedicationRequest> medicationRequests = medicationRequestService.listByIds(medReqIdList);
|
||||
// 药品发放查询
|
||||
List<MedicationDispense> medicationDispenses =
|
||||
medicationDispenseService.selectByRequestIdList(medReqIdList);
|
||||
// 根据请求id做map
|
||||
Map<Long, List<MedicationDispense>> medicationDispenseMap =
|
||||
medicationDispenses.stream().collect(Collectors.groupingBy(MedicationDispense::getMedReqId));
|
||||
for (MedicationRequest medicationRequest : medicationRequests) {
|
||||
// 根据请求匹配发放
|
||||
List<MedicationDispense> medicationDispenseList = medicationDispenseMap.get(medicationRequest.getId());
|
||||
// 判断是否是退药流程
|
||||
boolean isRefundFlow = false;
|
||||
if (medicationDispenseList != null) {
|
||||
for (MedicationDispense dispense : medicationDispenseList) {
|
||||
// 先判断是否包含“已完成/部分完成”的药品,这决定了是走“退药流程”还是“取消流程”
|
||||
if (DispenseStatus.COMPLETED.getValue().equals(dispense.getStatusEnum())
|
||||
|| DispenseStatus.PART_COMPLETED.getValue().equals(dispense.getStatusEnum())) {
|
||||
isRefundFlow = true;
|
||||
break; // 只要有一条是完成状态,整个单子即视为走退药流程
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (RefundItemDto dto : chargeItemList) {
|
||||
|
||||
if (CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(dto.getServiceTable())) {
|
||||
// 药品需要先退药
|
||||
if (DispenseStatus.COMPLETED.getValue().equals(dto.getDispenseStatus())
|
||||
|| DispenseStatus.PART_COMPLETED.getValue().equals(dto.getDispenseStatus())) {
|
||||
// 药品请求查询
|
||||
MedicationRequest medicationRequest = medicationRequestService.getById(dto.getRequestId());
|
||||
if (isRefundFlow) {
|
||||
// ==================== 走退药流程 (生成新单据) ====================
|
||||
// 校验是否重复申请
|
||||
if (medicationRequest.getRefundMedicineId() != null) {
|
||||
throw new ServiceException("已申请退药,请勿重复申请");
|
||||
}
|
||||
// 生成药品请求(退药)
|
||||
medicationRequest.setId(null); // 药品请求id
|
||||
medicationRequest
|
||||
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.MEDICATION_RES_NO.getPrefix(), 4)); // 药品请求编码
|
||||
medicationRequest.setQuantity(dto.getQuantity().multiply(new BigDecimal("-1"))); // 请求数量
|
||||
medicationRequest.setUnitCode(dto.getUnitCode()); // 请求单位编码
|
||||
medicationRequest.setStatusEnum(RequestStatus.CANCELLED.getValue()); // 请求状态
|
||||
medicationRequest.setRefundMedicineId(dto.getRequestId()); // 退药id
|
||||
medicationRequest.setPrescriptionNo(String.valueOf("T" + dto.getPrescriptionNo()));
|
||||
medicationRequestService.save(medicationRequest);
|
||||
MedicationRequest newRefundRequest = new MedicationRequest();
|
||||
BeanUtils.copyProperties(medicationRequest, newRefundRequest);
|
||||
newRefundRequest.setId(null); // 清空ID以新增
|
||||
newRefundRequest
|
||||
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.MEDICATION_RES_NO.getPrefix(), 4));
|
||||
newRefundRequest.setQuantity(medicationRequest.getQuantity().multiply(new BigDecimal("-1"))); // 数量取反
|
||||
newRefundRequest.setStatusEnum(RequestStatus.CANCELLED.getValue());
|
||||
newRefundRequest.setRefundMedicineId(medicationRequest.getId()); // 关联原ID
|
||||
newRefundRequest.setPrescriptionNo("T" + medicationRequest.getPrescriptionNo());
|
||||
medicationRequestService.save(newRefundRequest);
|
||||
Long newRequestId = newRefundRequest.getId();
|
||||
|
||||
} else {
|
||||
if (DispenseStatus.STOPPED.getValue().equals(dto.getDispenseStatus())
|
||||
&& NotPerformedReason.REFUND.getValue().equals(dto.getNotPerformedReason())) {
|
||||
throw new ServiceException("已申请退药,请勿重复申请");
|
||||
// 再生成对应的负向发药记录,并关联退药请求
|
||||
List<MedicationDispense> newDispensesToSave = new ArrayList<>();
|
||||
for (MedicationDispense originDispense : medicationDispenseList) {
|
||||
// 只处理已完成或部分完成的记录
|
||||
if (DispenseStatus.COMPLETED.getValue().equals(originDispense.getStatusEnum())
|
||||
|| DispenseStatus.PART_COMPLETED.getValue().equals(originDispense.getStatusEnum())) {
|
||||
MedicationDispense refundDispense = new MedicationDispense();
|
||||
BeanUtils.copyProperties(originDispense, refundDispense);
|
||||
refundDispense.setId(null); // ID置空
|
||||
refundDispense.setDispenseQuantity(BigDecimal.ZERO); // 已退数量
|
||||
refundDispense.setMedReqId(newRequestId); // 关联退药请求id
|
||||
refundDispense
|
||||
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.MEDICATION_DIS_NO.getPrefix(), 4));
|
||||
// 退药状态
|
||||
refundDispense.setStatusEnum(DispenseStatus.PENDING_REFUND.getValue());
|
||||
newDispensesToSave.add(refundDispense);
|
||||
}
|
||||
}
|
||||
|
||||
// 批量保存新的发药记录
|
||||
if (!newDispensesToSave.isEmpty()) {
|
||||
medicationDispenseService.saveBatch(newDispensesToSave);
|
||||
}
|
||||
} else {
|
||||
// ==================== 走直接取消流程 (修改原单据状态) ====================
|
||||
if (medicationDispenseList != null) {
|
||||
List<MedicationDispense> dispensesToUpdate = new ArrayList<>();
|
||||
for (MedicationDispense medicationDispense : medicationDispenseList) {
|
||||
// 检查是否已经是退药状态
|
||||
if (DispenseStatus.STOPPED.getValue().equals(medicationDispense.getStatusEnum())
|
||||
&& NotPerformedReason.REFUND.getValue().equals(medicationDispense.getStatusEnum())) {
|
||||
throw new ServiceException("已申请退药,请勿重复申请");
|
||||
}
|
||||
// 修改状态
|
||||
medicationDispense.setStatusEnum(DispenseStatus.STOPPED.getValue())
|
||||
.setNotPerformedReasonEnum(NotPerformedReason.REFUND.getValue());
|
||||
dispensesToUpdate.add(medicationDispense);
|
||||
}
|
||||
// 批量更新
|
||||
if (!dispensesToUpdate.isEmpty()) {
|
||||
medicationDispenseService.updateBatchById(dispensesToUpdate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 处理退耗材申请
|
||||
if (!devReqIdList.isEmpty()) {
|
||||
// 耗材请求查询
|
||||
List<DeviceRequest> deviceRequests = deviceRequestService.listByIds(devReqIdList);
|
||||
// 耗材发放查询
|
||||
List<DeviceDispense> deviceDispenses = deviceDispenseService.selectByRequestIdList(devReqIdList);
|
||||
// 根据请求id做map
|
||||
Map<Long, List<DeviceDispense>> deviceDispenseMap =
|
||||
deviceDispenses.stream().collect(Collectors.groupingBy(DeviceDispense::getDeviceReqId));
|
||||
for (DeviceRequest deviceRequest : deviceRequests) {
|
||||
// 根据请求匹配发放
|
||||
List<DeviceDispense> deviceDispenseList = deviceDispenseMap.get(deviceRequest.getId());
|
||||
// 判断是否是退耗材流程
|
||||
boolean isRefundFlow = false;
|
||||
if (deviceDispenseList != null) {
|
||||
for (DeviceDispense dispense : deviceDispenseList) {
|
||||
// 先判断是否包含“已完成/部分完成”的耗材,这决定了是走“退耗材流程”还是“取消流程”
|
||||
if (DispenseStatus.COMPLETED.getValue().equals(dispense.getStatusEnum())
|
||||
|| DispenseStatus.PART_COMPLETED.getValue().equals(dispense.getStatusEnum())) {
|
||||
isRefundFlow = true;
|
||||
break; // 只要有一条是完成状态,整个单子即视为走退耗材流程
|
||||
}
|
||||
}
|
||||
medDisIdList.add(dto.getDispenseId());
|
||||
}
|
||||
|
||||
} else if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(dto.getServiceTable())) {
|
||||
if (isRefundFlow) {
|
||||
// ==================== 走退耗材流程 (生成新单据) ====================
|
||||
// 校验是否重复申请
|
||||
if (deviceRequest.getRefundDeviceId() != null) {
|
||||
throw new ServiceException("已申请退耗材,请勿重复申请");
|
||||
}
|
||||
DeviceRequest newRefundRequest = new DeviceRequest();
|
||||
BeanUtils.copyProperties(deviceRequest, newRefundRequest);
|
||||
newRefundRequest.setId(null); // 清空ID以新增
|
||||
newRefundRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4));
|
||||
newRefundRequest.setQuantity(deviceRequest.getQuantity().multiply(new BigDecimal("-1"))); // 数量取反
|
||||
newRefundRequest.setStatusEnum(RequestStatus.CANCELLED.getValue());
|
||||
newRefundRequest.setRefundDeviceId(deviceRequest.getId()); // 关联原ID
|
||||
newRefundRequest.setPrescriptionNo("T" + deviceRequest.getPrescriptionNo());
|
||||
deviceRequestService.save(newRefundRequest);
|
||||
Long newRequestId = newRefundRequest.getId();
|
||||
|
||||
// 再生成对应的负向发耗材记录,并关联退耗材请求
|
||||
List<DeviceDispense> newDispensesToSave = new ArrayList<>();
|
||||
for (DeviceDispense originDispense : deviceDispenseList) {
|
||||
// 只处理已完成或部分完成的记录
|
||||
if (DispenseStatus.COMPLETED.getValue().equals(originDispense.getStatusEnum())
|
||||
|| DispenseStatus.PART_COMPLETED.getValue().equals(originDispense.getStatusEnum())) {
|
||||
DeviceDispense refundDispense = new DeviceDispense();
|
||||
BeanUtils.copyProperties(originDispense, refundDispense);
|
||||
refundDispense.setId(null); // ID置空
|
||||
refundDispense.setDispenseQuantity(BigDecimal.ZERO); // 已退数量
|
||||
refundDispense.setDeviceReqId(newRequestId); // 关联退耗材请求id
|
||||
refundDispense
|
||||
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_DIS_NO.getPrefix(), 4));
|
||||
// 退耗材状态
|
||||
refundDispense.setStatusEnum(DispenseStatus.PENDING_REFUND.getValue());
|
||||
newDispensesToSave.add(refundDispense);
|
||||
}
|
||||
}
|
||||
|
||||
// 批量保存新的发耗材记录
|
||||
if (!newDispensesToSave.isEmpty()) {
|
||||
deviceDispenseService.saveBatch(newDispensesToSave);
|
||||
}
|
||||
} else {
|
||||
// ==================== 走直接取消流程 (修改原单据状态) ====================
|
||||
if (deviceDispenseList != null) {
|
||||
List<DeviceDispense> dispensesToUpdate = new ArrayList<>();
|
||||
for (DeviceDispense deviceDispense : deviceDispenseList) {
|
||||
// 检查是否已经是退耗材状态
|
||||
if (DispenseStatus.STOPPED.getValue().equals(deviceDispense.getStatusEnum())
|
||||
&& NotPerformedReason.REFUND.getValue().equals(deviceDispense.getStatusEnum())) {
|
||||
throw new ServiceException("已申请退耗材,请勿重复申请");
|
||||
}
|
||||
// 修改状态
|
||||
deviceDispense.setStatusEnum(DispenseStatus.STOPPED.getValue())
|
||||
.setNotPerformedReasonEnum(NotPerformedReason.REFUND.getValue());
|
||||
dispensesToUpdate.add(deviceDispense);
|
||||
}
|
||||
// 批量更新
|
||||
if (!dispensesToUpdate.isEmpty()) {
|
||||
deviceDispenseService.updateBatchById(dispensesToUpdate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 处理退诊疗项目申请
|
||||
// 诊疗申请待更新id列表
|
||||
List<Long> serReqUpdateList = new ArrayList<>();
|
||||
if (!serReqIdList.isEmpty()) {
|
||||
// 查询诊疗申请
|
||||
List<ServiceRequest> serviceRequestList = serviceRequestService.listByIds(serReqIdList);
|
||||
for (ServiceRequest serviceRequest : serviceRequestList) {
|
||||
// 诊疗项目需医技科室同意退费
|
||||
if (RequestStatus.COMPLETED.getValue().equals(dto.getServiceStatus())) {
|
||||
// 服务请求查询
|
||||
ServiceRequest serviceRequest = serviceRequestService.getById(dto.getRequestId());
|
||||
if (RequestStatus.COMPLETED.getValue().equals(serviceRequest.getStatusEnum())) {
|
||||
if (serviceRequest.getRefundServiceId() != null) {
|
||||
throw new ServiceException("已申请退费,请勿重复申请");
|
||||
}
|
||||
// 生成服务请求(取消服务)
|
||||
serviceRequest.setId(null); // 服务请求id
|
||||
serviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.SERVICE_RES_NO.getPrefix(), 4)); // 服务请求编码
|
||||
serviceRequest.setQuantity(dto.getQuantity().multiply(new BigDecimal("-1"))); // 请求数量
|
||||
serviceRequest.setUnitCode(dto.getUnitCode()); // 请求单位编码
|
||||
serviceRequest.setQuantity(serviceRequest.getQuantity().multiply(new BigDecimal("-1"))); // 请求数量
|
||||
serviceRequest.setStatusEnum(RequestStatus.CANCELLED.getValue()); // 请求状态
|
||||
serviceRequest.setRefundServiceId(dto.getRequestId()); // 退药id
|
||||
serviceRequest.setRefundServiceId(serviceRequest.getId());// 退id
|
||||
serviceRequest.setId(null); // 服务请求id
|
||||
serviceRequestService.save(serviceRequest);
|
||||
|
||||
} else {
|
||||
if (RequestStatus.STOPPED.getValue().equals(dto.getServiceStatus())) {
|
||||
if (RequestStatus.STOPPED.getValue().equals(serviceRequest.getStatusEnum())) {
|
||||
throw new ServiceException("已申请退费,请勿重复申请");
|
||||
}
|
||||
serReqIdList.add(dto.getServiceId());
|
||||
}
|
||||
|
||||
} else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(dto.getServiceTable())) {
|
||||
// 耗材需要先退药
|
||||
if (DispenseStatus.COMPLETED.getValue().equals(dto.getDispenseStatus())
|
||||
|| DispenseStatus.PART_COMPLETED.getValue().equals(dto.getDispenseStatus())) {
|
||||
// 耗材请求查询
|
||||
DeviceRequest deviceRequest = deviceRequestService.getById(dto.getRequestId());
|
||||
if (deviceRequest.getRefundDeviceId() == null) {
|
||||
// 生成耗材请求(退耗材)
|
||||
deviceRequest.setId(null); // 耗材请求id
|
||||
deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4)); // 耗材请求编码
|
||||
deviceRequest.setQuantity(dto.getQuantity().multiply(new BigDecimal("-1"))); // 请求数量
|
||||
deviceRequest.setUnitCode(dto.getUnitCode()); // 请求单位编码
|
||||
deviceRequest.setStatusEnum(RequestStatus.CANCELLED.getValue()); // 请求状态
|
||||
deviceRequest.setRefundDeviceId(dto.getRequestId()); // 退药id
|
||||
deviceRequestService.save(deviceRequest);
|
||||
}
|
||||
} else if (!DispenseStatus.STOPPED.getValue().equals(dto.getDispenseStatus())) {
|
||||
devDisIdList.add(dto.getDispenseId());
|
||||
serReqUpdateList.add(serviceRequest.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 更新收费状态:退费中
|
||||
chargeItemService.updateRefundChargeStatus(chargeItemIdList);
|
||||
|
||||
if (!medDisIdList.isEmpty()) {
|
||||
// 更新未发放药品状态:停止发放,停止原因:退费
|
||||
medicationDispenseService.updateStopDispenseStatus(medDisIdList, NotPerformedReason.REFUND.getValue());
|
||||
// 更新未执行诊疗状态:停止
|
||||
if (!serReqUpdateList.isEmpty()) {
|
||||
serviceRequestService.updateStopRequestStatus(serReqUpdateList);
|
||||
}
|
||||
if (!devDisIdList.isEmpty()) {
|
||||
// 更新未发放耗材状态:停止发放,停止原因:退费
|
||||
deviceDispenseService.updateStopDispenseStatus(devDisIdList, NotPerformedReason.REFUND.getValue());
|
||||
}
|
||||
if (!serReqIdList.isEmpty()) {
|
||||
// 更新未执行诊疗状态:停止
|
||||
serviceRequestService.updateStopRequestStatus(serReqIdList);
|
||||
}
|
||||
|
||||
// 返回退费成功信息
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"门诊退费"}));
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.core.common.core.domain.model.LoginUser;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -228,7 +229,8 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra
|
||||
|
||||
CancelPaymentDto cancelPaymentDto = new CancelPaymentDto();
|
||||
BeanUtils.copyProperties(cancelRegPaymentDto, cancelPaymentDto);
|
||||
|
||||
//LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
//String string1 = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH);
|
||||
// 开通医保的处理
|
||||
if ("1".equals(SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH))
|
||||
&& account != null && !CommonConstants.BusinessName.DEFAULT_CONTRACT_NO.equals(account.getContractNo())) {
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
*/
|
||||
package com.openhis.web.chargemanage.controller;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
@@ -16,18 +16,18 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 门诊收费 controller
|
||||
* 住院收费 controller
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/charge-manage/inpa-charge")
|
||||
@RequestMapping("/charge-manage/inpatient-charge")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class InpatientChargeController {
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private IInpatientChargeAppService inpatientChargeAppService;
|
||||
|
||||
/**
|
||||
@@ -36,39 +36,38 @@ public class InpatientChargeController {
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> outpatientChargeInit() {
|
||||
return inpatientChargeAppService.outpatientChargeInit();
|
||||
public R<?> inpatientChargeInit() {
|
||||
return inpatientChargeAppService.inpatientChargeInit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询就诊患者分页列表
|
||||
* 查询住院患者分页列表
|
||||
*
|
||||
* @param encounterPatientPageParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param request 请求
|
||||
* @return 就诊患者分页列表
|
||||
* @return 住院患者分页列表
|
||||
*/
|
||||
@GetMapping(value = "/encounter-patient-page")
|
||||
public R<?> getEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return R.ok(inpatientChargeAppService.getEncounterPatientPage(encounterPatientPageParam, searchKey, pageNo,
|
||||
pageSize, request));
|
||||
return inpatientChargeAppService.getEncounterPatientPage(encounterPatientPageParam, searchKey, pageNo, pageSize,
|
||||
request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者处方列表
|
||||
* 根据就诊id查询患者待结算信息
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 患者处方列表
|
||||
* @return 患者待结算信息
|
||||
*/
|
||||
@GetMapping(value = "/patient-prescription")
|
||||
public R<?> getEncounterPatientPrescription(@RequestParam Long encounterId, @RequestParam String startTime,
|
||||
@RequestParam String endTime) {
|
||||
return R.ok(inpatientChargeAppService.getEncounterPatientPrescription(encounterId, startTime, endTime));
|
||||
public R<?> getEncounterPatientPrescription(Long encounterId) {
|
||||
return R.ok(inpatientChargeAppService.getEncounterPatientPrescription(encounterId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,6 @@ package com.openhis.web.chargemanage.controller;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
@@ -71,6 +70,17 @@ public class OutpatientChargeController {
|
||||
return R.ok(outpatientChargeAppService.getEncounterPatientPrescription(encounterId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者处方列表并新增字段:实收金额、应收金额、优惠金额、折扣率
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 患者处方列表
|
||||
*/
|
||||
@GetMapping(value = "/patient-prescription-with-price")
|
||||
public R<?> getEncounterPatientPrescriptionWithPrice(@RequestParam Long encounterId) {
|
||||
return R.ok(outpatientChargeAppService.getEncounterPatientPrescriptionWithPrice(encounterId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 医保转自费
|
||||
*
|
||||
|
||||
@@ -11,7 +11,6 @@ import org.springframework.format.annotation.DateTimeFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
@@ -32,6 +31,10 @@ public class EncounterPatientPageDto {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/** 住院状态 */
|
||||
private Integer encounterStatus;
|
||||
private String encounterStatus_enumText;
|
||||
|
||||
/**
|
||||
* 患者
|
||||
*/
|
||||
|
||||
@@ -67,4 +67,9 @@ public class EncounterPatientPageParam {
|
||||
* 收费状态
|
||||
*/
|
||||
private Integer statusEnum;
|
||||
|
||||
/**
|
||||
* 患者状态
|
||||
*/
|
||||
private Integer encounterStatus;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ public class OutpatientInitDto {
|
||||
|
||||
private List<OutpatientInitDto.chargeItemStatusOption> chargeItemStatusOptions;
|
||||
|
||||
private List<OutpatientInitDto.encounterStatusOption> encounterStatusOptions;
|
||||
|
||||
/**
|
||||
* 收费状态
|
||||
*/
|
||||
@@ -33,4 +35,18 @@ public class OutpatientInitDto {
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 住院状态
|
||||
*/
|
||||
@Data
|
||||
public static class encounterStatusOption {
|
||||
private Integer value;
|
||||
private String label;
|
||||
|
||||
public encounterStatusOption(Integer value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,4 +33,7 @@ public class PractitionerMetadata {
|
||||
/** 五笔码 */
|
||||
private String wbStr;
|
||||
|
||||
/** 医生职称 */
|
||||
private String drProfttlCode;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,14 +3,15 @@
|
||||
*/
|
||||
package com.openhis.web.chargemanage.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 退款项目 dto
|
||||
*
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
package com.openhis.web.chargemanage.mapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -28,12 +27,18 @@ public interface InpatientChargeAppMapper {
|
||||
/**
|
||||
* 查询就诊患者分页列表
|
||||
*
|
||||
* @param classEnum 住院患者类型:住院
|
||||
* @param dischargedFromHospital 住院状态:已出院
|
||||
* @param alreadySettled 住院状态:已结算出院
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 就诊患者分页列表
|
||||
*/
|
||||
Page<EncounterPatientPageDto> selectEncounterPatientPage(@Param("classEnum") Integer classEnum,
|
||||
@Param("page") Page<EncounterPatientPageDto> page,
|
||||
@Param("dischargedFromHospital") Integer dischargedFromHospital,
|
||||
@Param("alreadySettled") Integer alreadySettled, @Param("billable") Integer billable,
|
||||
@Param("billed") Integer billed, @Param("refunded") Integer refunded,
|
||||
@Param("personalCashAccount") String personalCashAccount, @Param("page") Page<EncounterPatientPageDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<EncounterPatientPageParam> queryWrapper);
|
||||
|
||||
/**
|
||||
@@ -56,5 +61,5 @@ public interface InpatientChargeAppMapper {
|
||||
@Param("activity") Integer activity, @Param("medication") Integer medication, @Param("device") Integer device,
|
||||
@Param("register") Integer register, @Param("planned") Integer planned, @Param("billable") Integer billable,
|
||||
@Param("billed") Integer billed, @Param("refunding") Integer refunding, @Param("refunded") Integer refunded,
|
||||
@Param("partRefund") Integer partRefund, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||
@Param("partRefund") Integer partRefund);
|
||||
}
|
||||
|
||||
@@ -57,4 +57,33 @@ public interface OutpatientChargeAppMapper {
|
||||
@Param("billed") Integer billed, @Param("refunding") Integer refunding, @Param("refunded") Integer refunded,
|
||||
@Param("partRefund") Integer partRefund);
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者处方列表并新增字段:应收金额,实收金额,优惠金额,折扣率
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @param activity 项目
|
||||
* @param medication 药品
|
||||
* @param device 耗材
|
||||
* @param register 挂号费
|
||||
* @param planned 收费状态:待收费
|
||||
* @param billable 收费状态:待结算
|
||||
* @param billed 收费状态:已结算
|
||||
* @param refunding 收费状态:退费中
|
||||
* @param refunded 收费状态:全部退费
|
||||
* @param partRefund 收费状态:部分退费
|
||||
* @param discountCode 优惠枚举码
|
||||
* @param selfCode 现金枚举码
|
||||
* @param selfVxCode 微信枚举码
|
||||
* @param selfAliCode 支付宝枚举码
|
||||
* @param selfUnionCode 银联枚举码
|
||||
* @return 患者处方列表
|
||||
*/
|
||||
List<EncounterPatientPrescriptionDto> selectEncounterPatientPrescriptionWithPrice(
|
||||
@Param("encounterId") Long encounterId, @Param("activity") Integer activity,
|
||||
@Param("medication") Integer medication, @Param("device") Integer device, @Param("register") Integer register,
|
||||
@Param("planned") Integer planned, @Param("billable") Integer billable, @Param("billed") Integer billed,
|
||||
@Param("refunding") Integer refunding, @Param("refunded") Integer refunded,
|
||||
@Param("partRefund") Integer partRefund, @Param("discountCode") Integer discountCode,
|
||||
@Param("self") Integer selfCode, @Param("selfVx") Integer selfVxCode, @Param("selfAli") Integer selfAliCode,
|
||||
@Param("selfUnion") Integer selfUnionCode);
|
||||
}
|
||||
|
||||
@@ -92,4 +92,19 @@ public class AdviceItemPrintInfoDto {
|
||||
* 排序号
|
||||
*/
|
||||
private Integer sortNumber;
|
||||
|
||||
/**
|
||||
* 中药付数
|
||||
*/
|
||||
private BigDecimal chineseHerbsDoseQuantity;
|
||||
|
||||
/**
|
||||
* 医保等级甲乙类
|
||||
*/
|
||||
private String chrgitmLv;
|
||||
|
||||
/**
|
||||
* 是否基药
|
||||
*/
|
||||
private Integer basicFlag;
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import lombok.Data;
|
||||
@@ -93,6 +91,22 @@ public class AdvicePrintInfoDto {
|
||||
private String unitCode;
|
||||
private String unitCode_dictText;
|
||||
|
||||
/**
|
||||
* 医保等级
|
||||
*/
|
||||
private Integer chrgitmLv;
|
||||
private String chrgitmLv_enumText;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 患者id
|
||||
*/
|
||||
private String patientId;
|
||||
|
||||
/**
|
||||
* 医嘱项目打印列表
|
||||
*/
|
||||
|
||||
@@ -30,10 +30,14 @@ public class PerformRecordDto {
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/** 执行时间 */
|
||||
/** 预计执行时间 */
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date occurrenceTime;
|
||||
|
||||
/** 实际执行时间 */
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date recordedTime;
|
||||
|
||||
/** 执行位置 */
|
||||
private String locationName;
|
||||
|
||||
|
||||
@@ -109,6 +109,7 @@ public class ItemDefinitionServiceImpl implements IItemDefinitionService {
|
||||
.set(ChargeItemDefinition::getYbType, chargeItemDefinition.getYbType())
|
||||
.set(ChargeItemDefinition::getTypeCode, chargeItemDefinition.getTypeCode())
|
||||
.set(ChargeItemDefinition::getPrice, chargeItemDefinition.getPrice())
|
||||
.set(ChargeItemDefinition::getPriceCode, chargeItemDefinition.getPriceCode())
|
||||
.set(ChargeItemDefinition::getChargeName, chargeItemDefinition.getChargeName());
|
||||
|
||||
return chargeItemDefinitionService.update(null, updateWrapper);
|
||||
|
||||
@@ -30,7 +30,7 @@ import com.openhis.administration.service.ISupplierService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.AssignSeqEnum;
|
||||
import com.openhis.common.enums.DelFlag;
|
||||
import com.core.common.enums.DelFlag;
|
||||
import com.openhis.common.enums.SupplierType;
|
||||
import com.openhis.common.enums.Whether;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
|
||||
@@ -24,4 +24,14 @@ public class ActivityChildJsonDto {
|
||||
*/
|
||||
private BigDecimal childrenRequestNum;
|
||||
|
||||
/**
|
||||
* 售价
|
||||
*/
|
||||
private BigDecimal retailPrice;
|
||||
|
||||
/**
|
||||
* 诊疗名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
}
|
||||
|
||||
@@ -5,14 +5,10 @@ import java.math.BigDecimal;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import com.openhis.common.enums.DeviceCategory;
|
||||
import com.openhis.common.enums.PublicationStatus;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 器材目录分页检索
|
||||
*
|
||||
@@ -118,7 +114,7 @@ public class DeviceManageDto {
|
||||
|
||||
/** 供应商 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@Dict(dictTable = "adm_supplier",dictCode = "id",dictText = "name")
|
||||
@Dict(dictTable = "adm_supplier", dictCode = "id", dictText = "name")
|
||||
private Long supplyId;
|
||||
private String supplyId_dictText;
|
||||
|
||||
|
||||
@@ -3,12 +3,10 @@ package com.openhis.web.datadictionary.dto;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import com.openhis.common.enums.DeviceCategory;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
@@ -136,7 +134,7 @@ public class DeviceManageUpDto {
|
||||
|
||||
/** 医保类别 */
|
||||
private String ybType;
|
||||
|
||||
|
||||
/** 医保等级 */
|
||||
private Integer chrgitmLv;
|
||||
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
package com.openhis.web.datadictionary.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import com.openhis.common.enums.ActivityDefCategory;
|
||||
import com.openhis.common.enums.PublicationStatus;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 诊疗目录分页检索
|
||||
*
|
||||
@@ -105,8 +102,8 @@ public class DiagnosisTreatmentDto {
|
||||
private String ybType;
|
||||
private String ybType_dictText;
|
||||
|
||||
// /** 购入价 */
|
||||
// private BigDecimal purchasePrice;
|
||||
// /** 购入价 */
|
||||
// private BigDecimal purchasePrice;
|
||||
|
||||
/** 零售价 */
|
||||
private BigDecimal retailPrice;
|
||||
@@ -124,4 +121,9 @@ public class DiagnosisTreatmentDto {
|
||||
private Integer pricingFlag;
|
||||
private String pricingFlag_enumText;
|
||||
|
||||
/**
|
||||
* 物价编码
|
||||
*/
|
||||
private String priceCode;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
package com.openhis.web.datadictionary.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import com.openhis.common.enums.ActivityDefCategory;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 诊疗目录分页更新
|
||||
*
|
||||
@@ -111,4 +109,9 @@ public class DiagnosisTreatmentUpDto {
|
||||
/** 划价标记 */
|
||||
private Integer pricingFlag;
|
||||
|
||||
/**
|
||||
* 物价编码
|
||||
*/
|
||||
private String priceCode;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.openhis.web.datadictionary.dto;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@@ -71,4 +70,9 @@ public class ItemUpFromDirectoryDto {
|
||||
/** 价格 */
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 物价编码
|
||||
*/
|
||||
private String priceCode;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
package com.openhis.web.doctorstation.appservice;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.doctorstation.dto.AllergyIntoInfoDto;
|
||||
|
||||
/**
|
||||
* 医生站-患者过敏与不耐受管理的应用类
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/4/10
|
||||
*/
|
||||
public interface IDoctorStationAllergyIntolAppService {
|
||||
|
||||
/**
|
||||
* 患者过敏与不耐受数据初始化
|
||||
*
|
||||
* @return 基础数据
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 查询患者过敏与不耐受信息
|
||||
*
|
||||
* @param patientId 患者Id
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 患者过敏与不耐受信息
|
||||
*/
|
||||
R<?> getAllergyIntoleranceInfo(Long patientId, Integer pageNo, Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 作废当条患者过敏与不耐受信息
|
||||
*
|
||||
* @param allergyIntoInfoDto 患者过敏与不耐受信息
|
||||
* @return
|
||||
*/
|
||||
R<?> invalidateAllergyIntolerance(AllergyIntoInfoDto allergyIntoInfoDto);
|
||||
|
||||
/**
|
||||
* 新增患者过敏与不耐受信息
|
||||
*
|
||||
* @param allergyIntoInfoDto 患者过敏与不耐受信息
|
||||
* @return
|
||||
*/
|
||||
R<?> addAllergyIntoleranceInfo(AllergyIntoInfoDto allergyIntoInfoDto);
|
||||
|
||||
}
|
||||
@@ -43,6 +43,15 @@ public interface IDoctorStationChineseMedicalAppService {
|
||||
*/
|
||||
R<?> saveTcmDiagnosis(SaveDiagnosisParam saveDiagnosisParam);
|
||||
|
||||
|
||||
/**
|
||||
* 保存中医诊断
|
||||
*
|
||||
* @param saveDiagnosisParam 诊断信息
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> updateTcmDiagnosis(SaveDiagnosisParam saveDiagnosisParam);
|
||||
|
||||
/**
|
||||
* 查询中医就诊诊断信息
|
||||
*
|
||||
|
||||
@@ -69,6 +69,14 @@ public interface IDoctorStationDiagnosisAppService {
|
||||
*/
|
||||
R<?> saveDoctorDiagnosis(SaveDiagnosisParam saveDiagnosisParam);
|
||||
|
||||
/**
|
||||
* 医生保存诊断
|
||||
*
|
||||
* @param saveDiagnosisParam 诊断信息
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> saveDoctorDiagnosisNew(SaveDiagnosisParam saveDiagnosisParam);
|
||||
|
||||
/**
|
||||
* 查询诊断定义业务分类数据
|
||||
*
|
||||
@@ -101,4 +109,13 @@ public interface IDoctorStationDiagnosisAppService {
|
||||
* @return 查询结果
|
||||
*/
|
||||
R<?> getDiagnosisList(String searchKey, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 查询诊断信息
|
||||
*
|
||||
* @param searchKey 目标字符
|
||||
* @param encounterId 请求
|
||||
* @return 查询结果
|
||||
*/
|
||||
R<?> getEncounterDiagnosisByEncounterId(Long encounterId, String searchKey);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.core.common.core.domain.R;
|
||||
import com.openhis.web.doctorstation.dto.PatientInfoDto;
|
||||
import com.openhis.web.doctorstation.dto.PrescriptionInfoBaseDto;
|
||||
import com.openhis.web.doctorstation.dto.PrescriptionInfoDetailDto;
|
||||
import com.openhis.web.doctorstation.dto.ReceptionStatisticsDto;
|
||||
|
||||
/**
|
||||
* 医生站-主页面 应用Service
|
||||
@@ -70,7 +71,7 @@ public interface IDoctorStationMainAppService {
|
||||
* @return 处方号列表信息
|
||||
*/
|
||||
IPage<PrescriptionInfoBaseDto> getPrescriptionPageInfo(PrescriptionInfoBaseDto prescriptionInfoBaseDto,
|
||||
String searchKey, Integer pageNo, Integer pageSize);
|
||||
String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 查询处方详情
|
||||
@@ -80,4 +81,14 @@ public interface IDoctorStationMainAppService {
|
||||
*/
|
||||
List<PrescriptionInfoDetailDto> getPrescriptionDetailInfo(String prescriptionNo);
|
||||
|
||||
/**
|
||||
* 查询接诊统计
|
||||
*
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param practitionerId 参与者id
|
||||
* @return 接诊统计
|
||||
*/
|
||||
List<ReceptionStatisticsDto> getReceptionStatistics(String startTime,String endTime,Long practitionerId);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,195 +0,0 @@
|
||||
package com.openhis.web.doctorstation.appservice.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.DateUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.clinical.domain.AllergyIntolerance;
|
||||
import com.openhis.clinical.mapper.AllergyIntoleranceMapper;
|
||||
import com.openhis.clinical.service.IAllergyIntoleranceService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.ClinicalStatus;
|
||||
import com.openhis.common.enums.Criticality;
|
||||
import com.openhis.common.enums.Severity;
|
||||
import com.openhis.common.enums.VerificationStatus;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisPageUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.doctorstation.appservice.IDoctorStationAllergyIntolAppService;
|
||||
import com.openhis.web.doctorstation.dto.AllergyIntoInfoDto;
|
||||
import com.openhis.web.doctorstation.dto.AllergyIntoInitDto;
|
||||
|
||||
/**
|
||||
* 医生站-患者过敏与不耐受管理的实现
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/4/10
|
||||
*/
|
||||
@Service
|
||||
public class DoctorStationAllergyIntolAppServiceImpl implements IDoctorStationAllergyIntolAppService {
|
||||
|
||||
@Autowired
|
||||
private IAllergyIntoleranceService allergyIntoleranceService;
|
||||
|
||||
@Autowired
|
||||
private AllergyIntoleranceMapper allergyIntoleranceMapper;
|
||||
|
||||
/**
|
||||
* 患者过敏与不耐受数据初始化
|
||||
*
|
||||
* @return 基础数据
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
AllergyIntoInitDto initDto = new AllergyIntoInitDto();
|
||||
|
||||
// 获取临床状况列表
|
||||
List<AllergyIntoInitDto.statusEnumOption> statusEnumOption1 = Stream.of(ClinicalStatus.values())
|
||||
.map(status -> new AllergyIntoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
initDto.setClinicalStatusOptions(statusEnumOption1);
|
||||
|
||||
// 获取临床状况列表
|
||||
List<AllergyIntoInitDto.statusEnumOption> statusEnumOption2 = Stream.of(VerificationStatus.values())
|
||||
.map(status -> new AllergyIntoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
initDto.setVerificationStatusOptions(statusEnumOption2);
|
||||
|
||||
// 获取危险程度列表
|
||||
List<AllergyIntoInitDto.statusEnumOption> statusEnumOption3 = Stream.of(Criticality.values())
|
||||
.map(status -> new AllergyIntoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
initDto.setCriticalityOptions(statusEnumOption3);
|
||||
|
||||
// 获取严重程度列表
|
||||
List<AllergyIntoInitDto.statusEnumOption> statusEnumOption4 = Stream.of(Severity.values())
|
||||
.map(status -> new AllergyIntoInitDto.statusEnumOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
initDto.setSeverityOptions(statusEnumOption4);
|
||||
|
||||
return R.ok(initDto);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询患者过敏与不耐受信息
|
||||
*
|
||||
* @param patientId 患者Id
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 患者过敏与不耐受信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getAllergyIntoleranceInfo(Long patientId, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request) {
|
||||
|
||||
// 构建查询条件
|
||||
QueryWrapper<AllergyIntolerance> queryWrapper = HisQueryUtils.buildQueryWrapper(null, null, null, request);
|
||||
|
||||
// 根据患者ID查询过敏与不耐受记录
|
||||
queryWrapper.eq(CommonConstants.FieldName.PatientId, patientId);
|
||||
// 设置排序
|
||||
queryWrapper.orderByAsc(CommonConstants.FieldName.CreateTime);
|
||||
// 分页查询
|
||||
Page<AllergyIntoInfoDto> allergyIntolerancePage =
|
||||
HisPageUtils.selectPage(allergyIntoleranceMapper, queryWrapper, pageNo, pageSize, AllergyIntoInfoDto.class);
|
||||
|
||||
allergyIntolerancePage.getRecords().forEach(e -> {
|
||||
// 临床状况回显赋值
|
||||
e.setClinicalStatusEnum_enumText(EnumUtils.getInfoByValue(ClinicalStatus.class, e.getClinicalStatusEnum()));
|
||||
// 验证状态回显赋值
|
||||
e.setVerificationStatusEnum_enumText(
|
||||
EnumUtils.getInfoByValue(VerificationStatus.class, e.getVerificationStatusEnum()));
|
||||
// 危险程度回显赋值
|
||||
e.setCriticalityEnum_enumText(EnumUtils.getInfoByValue(Criticality.class, e.getCriticalityEnum()));
|
||||
// 严重程度回显赋值
|
||||
e.setSeverityEnum_enumText(EnumUtils.getInfoByValue(Severity.class, e.getSeverityEnum()));
|
||||
|
||||
});
|
||||
|
||||
// 返回【患者过敏与不耐受信息】分页
|
||||
return R.ok(allergyIntolerancePage);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 作废当条患者过敏与不耐受信息
|
||||
*
|
||||
* @param allergyIntoInfoDto 患者过敏与不耐受信息
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public R<?> invalidateAllergyIntolerance(AllergyIntoInfoDto allergyIntoInfoDto) {
|
||||
|
||||
AllergyIntolerance allergyIntolerance = new AllergyIntolerance();
|
||||
|
||||
// 获取当前登录账号的参与者id
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
|
||||
allergyIntolerance.setId(allergyIntoInfoDto.getId()).setClinicalStatusEnum(ClinicalStatus.RESOLVED.getValue())
|
||||
.setVerificationStatusEnum(VerificationStatus.REFUTED.getValue())
|
||||
.setTypeEnum(allergyIntoInfoDto.getTypeEnum()).setCategoryCode(allergyIntoInfoDto.getCategoryCode())
|
||||
.setCriticalityEnum(allergyIntoInfoDto.getCriticalityEnum()).setCode(allergyIntoInfoDto.getCode())
|
||||
.setPatientId(allergyIntoInfoDto.getPatientId()).setDescription(allergyIntoInfoDto.getDescription())
|
||||
.setSeverityEnum(allergyIntoInfoDto.getSeverityEnum())
|
||||
.setOnsetDateTime(allergyIntoInfoDto.getOnsetDateTime()).setCheckPractitionerId(practitionerId)
|
||||
.setLastReactionOccurrence(allergyIntoInfoDto.getLastReactionOccurrence())
|
||||
.setNote(allergyIntoInfoDto.getNote());
|
||||
|
||||
boolean result = allergyIntoleranceService.saveOrUpdateAllergyIntolerance(allergyIntolerance);
|
||||
|
||||
if (result) {
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"过敏与不耐受"}));
|
||||
} else {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增患者过敏与不耐受信息
|
||||
*
|
||||
* @param allergyIntoInfoDto 患者过敏与不耐受信息
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public R<?> addAllergyIntoleranceInfo(AllergyIntoInfoDto allergyIntoInfoDto) {
|
||||
|
||||
AllergyIntolerance allergyIntolerance = new AllergyIntolerance();
|
||||
// 获取当前登录账号的参与者id
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
|
||||
allergyIntolerance.setId(allergyIntoInfoDto.getId()).setClinicalStatusEnum(ClinicalStatus.ACTIVE.getValue())
|
||||
.setVerificationStatusEnum(VerificationStatus.CONFIRMED.getValue())
|
||||
.setTypeEnum(allergyIntoInfoDto.getTypeEnum()).setCategoryCode(allergyIntoInfoDto.getCategoryCode())
|
||||
.setCriticalityEnum(allergyIntoInfoDto.getCriticalityEnum()).setCode(allergyIntoInfoDto.getCode())
|
||||
.setPatientId(allergyIntoInfoDto.getPatientId()).setDescription(allergyIntoInfoDto.getDescription())
|
||||
.setSeverityEnum(allergyIntoInfoDto.getSeverityEnum())
|
||||
.setOnsetDateTime(allergyIntoInfoDto.getOnsetDateTime()).setPractitionerId(practitionerId)
|
||||
.setRecordedDate(DateUtils.getNowDate())
|
||||
.setLastReactionOccurrence(allergyIntoInfoDto.getLastReactionOccurrence())
|
||||
.setNote(allergyIntoInfoDto.getNote());
|
||||
|
||||
boolean result = allergyIntoleranceService.saveOrUpdateAllergyIntolerance(allergyIntolerance);
|
||||
|
||||
if (result) {
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"过敏与不耐受"}));
|
||||
} else {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00011, null));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.openhis.web.doctorstation.appservice.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -239,6 +236,82 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊断"}));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 医生保存诊断
|
||||
*
|
||||
* @param saveDiagnosisParam 诊断信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> saveDoctorDiagnosisNew(SaveDiagnosisParam saveDiagnosisParam) {
|
||||
// 患者id
|
||||
Long patientId = saveDiagnosisParam.getPatientId();
|
||||
// 就诊ID
|
||||
Long encounterId = saveDiagnosisParam.getEncounterId();
|
||||
// 诊断定义集合
|
||||
List<SaveDiagnosisChildParam> diagnosisChildList = saveDiagnosisParam.getDiagnosisChildList();
|
||||
// 先删除再保存
|
||||
// iEncounterDiagnosisService.deleteEncounterDiagnosisInfos(encounterId);
|
||||
// 保存诊断管理
|
||||
Condition condition;
|
||||
for (SaveDiagnosisChildParam saveDiagnosisChildParam : diagnosisChildList) {
|
||||
|
||||
//中医如果是修改
|
||||
if (saveDiagnosisChildParam.getUpdateId() != null) {
|
||||
continue;
|
||||
}
|
||||
condition = new Condition();
|
||||
condition.setId(saveDiagnosisChildParam.getConditionId());
|
||||
condition.setVerificationStatusEnum(saveDiagnosisChildParam.getVerificationStatusEnum());
|
||||
condition.setPatientId(patientId);
|
||||
condition.setDefinitionId(saveDiagnosisChildParam.getDefinitionId());
|
||||
condition.setYbNo(saveDiagnosisChildParam.getYbNo());
|
||||
condition.setRecordedDatetime(new Date());
|
||||
condition.setRecorderId(SecurityUtils.getLoginUser().getPractitionerId());// 记录人
|
||||
iConditionService.saveOrUpdate(condition);
|
||||
saveDiagnosisChildParam.setConditionId(condition.getId());
|
||||
}
|
||||
|
||||
|
||||
// 保存就诊诊断
|
||||
EncounterDiagnosis encounterDiagnosis;
|
||||
for (SaveDiagnosisChildParam saveDiagnosisChildParam : diagnosisChildList) {
|
||||
if (saveDiagnosisChildParam.getUpdateId() != null) {
|
||||
String updateId = saveDiagnosisChildParam.getUpdateId();
|
||||
String[] split = updateId.split("-");
|
||||
// String[] ConditionIds = saveDiagnosisChildParam.getUpdateConditionId().split("-");
|
||||
int i=1;
|
||||
for (String s : split) {
|
||||
encounterDiagnosis = new EncounterDiagnosis();
|
||||
encounterDiagnosis.setId(Long.parseLong(s));
|
||||
encounterDiagnosis.setEncounterId(encounterId);
|
||||
// encounterDiagnosis.setConditionId(saveDiagnosisChildParam.getConditionId());
|
||||
encounterDiagnosis.setMaindiseFlag(saveDiagnosisChildParam.getMaindiseFlag());
|
||||
encounterDiagnosis.setDiagSrtNo(saveDiagnosisChildParam.getDiagSrtNo()); // 排序号
|
||||
encounterDiagnosis.setMedTypeCode(saveDiagnosisChildParam.getMedTypeCode());// 医疗类型
|
||||
encounterDiagnosis.setDiagnosisDesc(saveDiagnosisChildParam.getDiagnosisDesc()); // 诊断描述
|
||||
encounterDiagnosis.setIptDiseTypeCode(saveDiagnosisChildParam.getIptDiseTypeCode()); // 患者疾病诊断类型代码
|
||||
iEncounterDiagnosisService.saveOrUpdate(encounterDiagnosis);
|
||||
i++;
|
||||
}
|
||||
}else {
|
||||
encounterDiagnosis = new EncounterDiagnosis();
|
||||
encounterDiagnosis.setId(saveDiagnosisChildParam.getEncounterDiagnosisId());
|
||||
encounterDiagnosis.setEncounterId(encounterId);
|
||||
encounterDiagnosis.setConditionId(saveDiagnosisChildParam.getConditionId());
|
||||
encounterDiagnosis.setMaindiseFlag(saveDiagnosisChildParam.getMaindiseFlag());
|
||||
encounterDiagnosis.setDiagSrtNo(saveDiagnosisChildParam.getDiagSrtNo()); // 排序号
|
||||
encounterDiagnosis.setMedTypeCode(saveDiagnosisChildParam.getMedTypeCode());// 医疗类型
|
||||
encounterDiagnosis.setDiagnosisDesc(saveDiagnosisChildParam.getDiagnosisDesc()); // 诊断描述
|
||||
encounterDiagnosis.setIptDiseTypeCode(saveDiagnosisChildParam.getIptDiseTypeCode()); // 患者疾病诊断类型代码
|
||||
iEncounterDiagnosisService.saveOrUpdate(encounterDiagnosis);
|
||||
}
|
||||
|
||||
}
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊断"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询诊断定义业务分类数据
|
||||
*
|
||||
@@ -358,4 +431,41 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
|
||||
|
||||
return R.ok(conditionDefinitionListBySearchKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询就诊诊断信息
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 就诊诊断信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getEncounterDiagnosisByEncounterId(Long encounterId,String searchKey) {
|
||||
List<DiagnosisQueryDto> encounterDiagnosis = doctorStationDiagnosisAppMapper.getEncounterDiagnosis(encounterId);
|
||||
List<DiagnosisQueryDto> encounterDiagnosisKey = new ArrayList<>();
|
||||
for (DiagnosisQueryDto diagnosis : encounterDiagnosis) {
|
||||
// 中医诊断/西医诊断
|
||||
if (ConditionDefinitionSource.TRADITIONAL_CHINESE_MEDICINE_DIAGNOSIS.getValue()
|
||||
.equals(diagnosis.getSourceEnum())
|
||||
|| ConditionDefinitionSource.TRADITIONAL_CHINESE_MEDICINE_SYNDROME_CATALOG.getValue()
|
||||
.equals(diagnosis.getSourceEnum())) {
|
||||
diagnosis.setTypeName(CommonConstants.BusinessName.TCM_DIAGNOSIS);
|
||||
} else {
|
||||
diagnosis.setTypeName(CommonConstants.BusinessName.WESTERN_MEDICINE_DIAGNOSIS);
|
||||
}
|
||||
// 验证状态
|
||||
diagnosis.setVerificationStatusEnum_enumText(
|
||||
EnumUtils.getInfoByValue(ConditionVerificationStatus.class, diagnosis.getVerificationStatusEnum()));
|
||||
}
|
||||
|
||||
if(searchKey!=null&&!"".equals(searchKey)){
|
||||
for (DiagnosisQueryDto diagnosis : encounterDiagnosis) {
|
||||
if(diagnosis.getName().contains(searchKey)){
|
||||
encounterDiagnosisKey.add(diagnosis);
|
||||
}
|
||||
}
|
||||
return R.ok(encounterDiagnosisKey);
|
||||
}
|
||||
|
||||
return R.ok(encounterDiagnosis);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,12 +21,14 @@ import com.openhis.administration.domain.Encounter;
|
||||
import com.openhis.administration.domain.EncounterParticipant;
|
||||
import com.openhis.administration.mapper.EncounterMapper;
|
||||
import com.openhis.administration.service.IEncounterParticipantService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.doctorstation.dto.PatientInfoDto;
|
||||
import com.openhis.web.doctorstation.dto.PrescriptionInfoBaseDto;
|
||||
import com.openhis.web.doctorstation.dto.PrescriptionInfoDetailDto;
|
||||
import com.openhis.web.doctorstation.dto.ReceptionStatisticsDto;
|
||||
import com.openhis.web.doctorstation.mapper.DoctorStationMainAppMapper;
|
||||
|
||||
/**
|
||||
@@ -89,10 +91,12 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
|
||||
} else {
|
||||
queryWrapper.orderByDesc("register_time");
|
||||
}
|
||||
// 只查询当前登录科室相关的患者
|
||||
queryWrapper.eq(currentUserOrganizationId != null, CommonConstants.FieldName.OrgId, currentUserOrganizationId);
|
||||
IPage<PatientInfoDto> patientInfo = doctorStationMainAppMapper.getPatientInfo(new Page<>(pageNo, pageSize),
|
||||
ParticipantType.REGISTRATION_DOCTOR.getCode(), ParticipantType.ADMITTER.getCode(),
|
||||
ClinicalStatus.INACTIVE.getValue(), userId, currentUserOrganizationId, pricingFlag,
|
||||
EncounterStatus.PLANNED.getValue(), EncounterActivityStatus.ACTIVE.getValue(), queryWrapper);
|
||||
ParticipantType.REGISTRATION_DOCTOR.getCode(), ParticipantType.ADMITTER.getCode(), userId,
|
||||
currentUserOrganizationId, pricingFlag, EncounterStatus.PLANNED.getValue(),
|
||||
EncounterActivityStatus.ACTIVE.getValue(), queryWrapper);
|
||||
patientInfo.getRecords().forEach(e -> {
|
||||
// 性别
|
||||
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
||||
@@ -213,10 +217,10 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
|
||||
*/
|
||||
@Override
|
||||
public IPage<PrescriptionInfoBaseDto> getPrescriptionPageInfo(PrescriptionInfoBaseDto prescriptionInfoBaseDto,
|
||||
String searchKey, Integer pageNo, Integer pageSize) {
|
||||
String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<PrescriptionInfoBaseDto> queryWrapper = HisQueryUtils.buildQueryWrapper(prescriptionInfoBaseDto,
|
||||
searchKey, new HashSet<>(Arrays.asList("prescription_no", "patient_name", "practitioner_name")), null);
|
||||
searchKey, new HashSet<>(Arrays.asList("prescription_no", "practitioner_name")), request);
|
||||
IPage<PrescriptionInfoBaseDto> prescriptionPageInfo =
|
||||
doctorStationMainAppMapper.getPrescriptionPageInfo(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
List<PrescriptionInfoBaseDto> PrescriptionInfo = prescriptionPageInfo.getRecords();
|
||||
@@ -260,4 +264,18 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
|
||||
return prescriptionDetailInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询接诊统计
|
||||
*
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param practitionerId 参与者id
|
||||
* @return 接诊统计
|
||||
*/
|
||||
@Override
|
||||
public List<ReceptionStatisticsDto> getReceptionStatistics(String startTime, String endTime, Long practitionerId) {
|
||||
return doctorStationMainAppMapper.getReceptionStatistics(ParticipantType.ADMITTER.getCode(), startTime, endTime,
|
||||
practitionerId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
package com.openhis.web.doctorstation.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.doctorstation.appservice.IDoctorStationAllergyIntolAppService;
|
||||
import com.openhis.web.doctorstation.dto.AllergyIntoInfoDto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 医生站-患者过敏与不耐受管理
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/4/10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/doctor-station/allergy-intolerance")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class DoctorStationAllergyIntolController {
|
||||
@Autowired
|
||||
private IDoctorStationAllergyIntolAppService doctorStationAllergyIntolAppService;
|
||||
|
||||
/**
|
||||
* 患者过敏与不耐受数据初始化
|
||||
*
|
||||
* @return 基础数据
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
|
||||
return doctorStationAllergyIntolAppService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询患者过敏与不耐受信息
|
||||
*
|
||||
* @param patientId 患者Id
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 患者过敏与不耐受信息
|
||||
*/
|
||||
@GetMapping(value = "/allergy-intolerance-info")
|
||||
public R<?> getAllergyIntolerance(@RequestParam Long patientId,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
|
||||
return doctorStationAllergyIntolAppService.getAllergyIntoleranceInfo(patientId, pageNo, pageSize, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 作废当条患者过敏与不耐受信息
|
||||
*
|
||||
* @param allergyIntoInfoDto 患者过敏与不耐受信息
|
||||
* @return
|
||||
*/
|
||||
@PutMapping(value = "/allergy-intolerance-info")
|
||||
public R<?> invalidateAllergyIntolerance(@RequestBody AllergyIntoInfoDto allergyIntoInfoDto) {
|
||||
|
||||
return doctorStationAllergyIntolAppService.invalidateAllergyIntolerance(allergyIntoInfoDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增患者过敏与不耐受信息
|
||||
*
|
||||
* @param allergyIntoInfoDto 患者过敏与不耐受信息
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/allergy-intolerance-info")
|
||||
public R<?> addAllergyIntoleranceInfo(@Validated @RequestBody AllergyIntoInfoDto allergyIntoInfoDto) {
|
||||
|
||||
return doctorStationAllergyIntolAppService.addAllergyIntoleranceInfo(allergyIntoInfoDto);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -72,6 +72,17 @@ public class DoctorStationChineseMedicalController {
|
||||
return iDoctorStationChineseMedicalAppService.saveTcmDiagnosis(saveDiagnosisParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改中医诊断
|
||||
*
|
||||
* @param saveDiagnosisParam 诊断信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping(value = "/update-tcm-diagnosis")
|
||||
public R<?> updateTcmDiagnosis(@RequestBody SaveDiagnosisParam saveDiagnosisParam) {
|
||||
return iDoctorStationChineseMedicalAppService.updateTcmDiagnosis(saveDiagnosisParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询中医就诊诊断信息
|
||||
*
|
||||
|
||||
@@ -140,6 +140,18 @@ public class DoctorStationDiagnosisController {
|
||||
return iDoctorStationDiagnosisAppService.saveDoctorDiagnosis(saveDiagnosisParam);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 医生保存诊断
|
||||
*
|
||||
* @param saveDiagnosisParam 诊断信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping(value = "/save-doctor-diagnosisnew")
|
||||
public R<?> saveDoctorDiagnosisNew(@RequestBody SaveDiagnosisParam saveDiagnosisParam) {
|
||||
return iDoctorStationDiagnosisAppService.saveDoctorDiagnosisNew(saveDiagnosisParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询诊断定义业务分类数据
|
||||
*
|
||||
@@ -162,6 +174,17 @@ public class DoctorStationDiagnosisController {
|
||||
return iDoctorStationDiagnosisAppService.getEncounterDiagnosis(encounterId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询就诊诊断信息
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 就诊诊断信息
|
||||
*/
|
||||
@GetMapping(value = "/get-encounter-diagnosis-ele")
|
||||
public R<?> getEncounterDiagnosisByEncounterId(@RequestParam Long encounterId,@RequestParam String searchKey) {
|
||||
return iDoctorStationDiagnosisAppService.getEncounterDiagnosisByEncounterId(encounterId,searchKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询就诊诊断信息
|
||||
*
|
||||
|
||||
@@ -116,9 +116,9 @@ public class DoctorStationMainController {
|
||||
public R<?> getPrescriptionPageInfo(PrescriptionInfoBaseDto prescriptionInfoBaseDto,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "20") Integer pageSize) {
|
||||
return R.ok(
|
||||
iDoctorStationMainAppService.getPrescriptionPageInfo(prescriptionInfoBaseDto, searchKey, pageNo, pageSize));
|
||||
@RequestParam(value = "pageSize", defaultValue = "20") Integer pageSize, HttpServletRequest request) {
|
||||
return R.ok(iDoctorStationMainAppService.getPrescriptionPageInfo(prescriptionInfoBaseDto, searchKey, pageNo,
|
||||
pageSize, request));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,4 +132,19 @@ public class DoctorStationMainController {
|
||||
return R.ok(iDoctorStationMainAppService.getPrescriptionDetailInfo(prescriptionNo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询接诊统计
|
||||
*
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param practitionerId 参与者id
|
||||
* @return 接诊统计
|
||||
*/
|
||||
@GetMapping(value = "/reception-statistics")
|
||||
public R<?> getReceptionStatistics(@RequestParam("startTime") String startTime,
|
||||
@RequestParam("endTime") String endTime,
|
||||
@RequestParam(value = "practitionerId", required = false) Long practitionerId) {
|
||||
return R.ok(iDoctorStationMainAppService.getReceptionStatistics(startTime, endTime, practitionerId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,4 +42,9 @@ public class ActivityChildrenJsonParams {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 诊断ID
|
||||
*/
|
||||
private Long encounterDiagnosisId;
|
||||
|
||||
}
|
||||
|
||||
@@ -234,6 +234,10 @@ public class AdviceSaveDto {
|
||||
*/
|
||||
private Integer sortNumber;
|
||||
|
||||
/** 请求基于什么的ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long basedOnId;
|
||||
|
||||
/**
|
||||
* 设置默认值
|
||||
*/
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
package com.openhis.web.doctorstation.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 患者过敏不耐受Dto
|
||||
*
|
||||
* @author liuhr
|
||||
* @date 2025/4/10
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AllergyIntoInfoDto {
|
||||
|
||||
/** ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 临床状况 */
|
||||
private Integer clinicalStatusEnum;
|
||||
private String clinicalStatusEnum_enumText;
|
||||
|
||||
/** 验证状态 */
|
||||
private Integer verificationStatusEnum;
|
||||
private String verificationStatusEnum_enumText;
|
||||
|
||||
/** 类型 */
|
||||
private Integer typeEnum;
|
||||
|
||||
/** 过敏原类别 */
|
||||
@Dict(dictCode = "allergy_category")
|
||||
private String categoryCode;
|
||||
private String categoryCode_dictText;
|
||||
|
||||
/** 危险程度 */
|
||||
private Integer criticalityEnum;
|
||||
private String criticalityEnum_enumText;
|
||||
|
||||
/** 过敏物质编码 */
|
||||
@Dict(dictCode = "allergy_code")
|
||||
private String code;
|
||||
private String code_dictText;
|
||||
|
||||
/** 患者ID */
|
||||
@Dict(dictTable = "adm_patient", dictCode = "id", dictText = "name")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long patientId;
|
||||
private String patientId_dictText;
|
||||
|
||||
/** 反应描述 */
|
||||
private String description;
|
||||
|
||||
/** 严重程度 */
|
||||
private Integer severityEnum;
|
||||
private String severityEnum_enumText;
|
||||
|
||||
/** 过敏发生开始日期 */
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date onsetDateTime;
|
||||
|
||||
/** 记录者 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@Dict(dictTable = "adm_practitioner", dictCode = "id", dictText = "name")
|
||||
private Long practitionerId;
|
||||
private String practitionerId_dictText;
|
||||
|
||||
/** 断言者 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long checkPractitionerId;
|
||||
|
||||
/** 记录日期 */
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date recordedDate;
|
||||
|
||||
/** 最后反应发生日期 */
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date lastReactionOccurrence ;
|
||||
|
||||
/** 备注 */
|
||||
private String note;
|
||||
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package com.openhis.web.doctorstation.dto;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
@@ -10,7 +12,6 @@ import com.openhis.common.annotation.Dict;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* 处方信息 dto
|
||||
@@ -48,6 +49,12 @@ public class PrescriptionInfoBaseDto {
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date requestTime;
|
||||
|
||||
/**
|
||||
* 开方医生id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long practitionerId;
|
||||
|
||||
/**
|
||||
* 开方医生
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.openhis.web.doctorstation.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 检验检查开立历史 dto
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProofAndTestHistoryDto {
|
||||
|
||||
/**
|
||||
* 医嘱签发时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date authoredTime;
|
||||
|
||||
/**
|
||||
* 开立医生
|
||||
*/
|
||||
private String requester;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.openhis.web.doctorstation.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 检验检查结果url传参 dto
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProofAndTestResultDto {
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String busNo;
|
||||
|
||||
/**
|
||||
* 医嘱名称
|
||||
*/
|
||||
private String adviceName;
|
||||
|
||||
/**
|
||||
* 请求地址
|
||||
*/
|
||||
private String requestUrl;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.openhis.web.doctorstation.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 接诊统计 dto
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ReceptionStatisticsDto {
|
||||
|
||||
/**
|
||||
* 参与者id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long practitionerId;
|
||||
|
||||
/**
|
||||
* 参与者
|
||||
*/
|
||||
private String practitionerName;
|
||||
|
||||
/**
|
||||
* 接诊次数
|
||||
*/
|
||||
private Integer receptionNums;
|
||||
|
||||
}
|
||||
@@ -68,4 +68,14 @@ public class SaveDiagnosisChildParam {
|
||||
/** 患者疾病诊断类型代码 */
|
||||
private Integer iptDiseTypeCode;
|
||||
|
||||
/**
|
||||
* 中医分证候用修改id,中间用 - 分割
|
||||
*/
|
||||
private String updateId;
|
||||
|
||||
/**
|
||||
* 中医修改证候的新值,中间用 - 分割
|
||||
*/
|
||||
private String updateConditionId;
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.openhis.web.doctorstation.dto.PatientInfoDto;
|
||||
import com.openhis.web.doctorstation.dto.PrescriptionInfoBaseDto;
|
||||
import com.openhis.web.doctorstation.dto.PrescriptionInfoDetailDto;
|
||||
import com.openhis.web.doctorstation.dto.ReceptionStatisticsDto;
|
||||
|
||||
/**
|
||||
* 医生站-主页面 应用Mapper
|
||||
@@ -25,7 +26,6 @@ public interface DoctorStationMainAppMapper {
|
||||
* @param page 分页参数
|
||||
* @param participantType 参与者类型 - 挂号医生
|
||||
* @param participantType2 参与者类型 - 接诊医生
|
||||
* @param ClinicalStatus 过敏史状态
|
||||
* @param userId 当前登录账号ID
|
||||
* @param currentUserOrganizationId 当前登录账号所属的科室ID
|
||||
* @param pricingFlag 划价标记
|
||||
@@ -36,9 +36,8 @@ public interface DoctorStationMainAppMapper {
|
||||
*/
|
||||
IPage<PatientInfoDto> getPatientInfo(@Param("page") Page<PatientInfoDto> page,
|
||||
@Param("participantType") String participantType, @Param("participantType2") String participantType2,
|
||||
@Param("ClinicalStatus") Integer ClinicalStatus, @Param("userId") Long userId,
|
||||
@Param("currentUserOrganizationId") Long currentUserOrganizationId, @Param("pricingFlag") Integer pricingFlag,
|
||||
@Param("encounterStatus") Integer encounterStatus,
|
||||
@Param("userId") Long userId, @Param("currentUserOrganizationId") Long currentUserOrganizationId,
|
||||
@Param("pricingFlag") Integer pricingFlag, @Param("encounterStatus") Integer encounterStatus,
|
||||
@Param("activityStatus") Integer activityStatus,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<PatientInfoDto> queryWrapper);
|
||||
|
||||
@@ -62,4 +61,17 @@ public interface DoctorStationMainAppMapper {
|
||||
List<PrescriptionInfoDetailDto> getPrescriptionDetailInfo(@Param("prescriptionNo") String prescriptionNo,
|
||||
@Param("encounterId") Long encounterId);
|
||||
|
||||
/**
|
||||
* 查询接诊统计
|
||||
*
|
||||
* @param typeCode 类型 | 接诊医生
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param practitionerId 参与者id
|
||||
* @return 接诊统计
|
||||
*/
|
||||
List<ReceptionStatisticsDto> getReceptionStatistics(@Param("typeCode") String typeCode,
|
||||
@Param("startTime") String startTime, @Param("endTime") String endTime,
|
||||
@Param("practitionerId") Long practitionerId);
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ public interface IDocDefinitionAppService {
|
||||
*/
|
||||
R<?> addDefinition(DocDefinitionDto definitionDto);
|
||||
|
||||
|
||||
/**
|
||||
* 修改文书定义
|
||||
*
|
||||
@@ -39,4 +38,12 @@ public interface IDocDefinitionAppService {
|
||||
R<?> getDefinitionDetailById(Long id);
|
||||
|
||||
DocDefinitionDto getDefinitionById(Long id);
|
||||
|
||||
/**
|
||||
* 获取文书ID
|
||||
*
|
||||
* @param menuEnum 来源类型
|
||||
* @return 文书列表
|
||||
*/
|
||||
R<?> getDefinitionId(Integer menuEnum);
|
||||
}
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
package com.openhis.web.document.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.document.dto.DocRecordDto;
|
||||
import com.openhis.web.document.dto.DocRecordPatientQueryParam;
|
||||
import com.openhis.web.document.dto.DocRecordQueryParam;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文书记录 应用Service
|
||||
*/
|
||||
public interface IDocRecordAppService {
|
||||
|
||||
// /**
|
||||
// * 新增记录
|
||||
// *
|
||||
// * @param docRecordDto 文书记录信息
|
||||
// * @return
|
||||
// */
|
||||
// R<?> createOrEditRecord(DocRecordDto docRecordDto);
|
||||
// /**
|
||||
// * 新增记录
|
||||
// *
|
||||
// * @param docRecordDto 文书记录信息
|
||||
// * @return
|
||||
// */
|
||||
// R<?> createOrEditRecord(DocRecordDto docRecordDto);
|
||||
R<?> addRecord(DocRecordDto docRecordDto);
|
||||
|
||||
R<?> updateRecord(DocRecordDto docRecordDto);
|
||||
@@ -28,9 +28,11 @@ public interface IDocRecordAppService {
|
||||
/**
|
||||
* 根据患者ID或就诊ID获取文书记录列表,只针对不需返回患者具体信息的列表,体温单除外,单独处理
|
||||
*/
|
||||
R<?> getRecordByEncounterIdList(DocRecordQueryParam docRecordQueryParam, Integer isPage, Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
|
||||
R<?> getRecordByEncounterIdList(DocRecordQueryParam docRecordQueryParam, Integer isPage, Integer pageNo,
|
||||
Integer pageSize, String searchKey, HttpServletRequest request);
|
||||
|
||||
R<?> getRecordPageList(DocRecordPatientQueryParam docRecordPatientQueryParam, List<Integer> primaryMenuEnumList, Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
|
||||
R<?> getRecordPageList(DocRecordPatientQueryParam docRecordPatientQueryParam, List<Integer> primaryMenuEnumList,
|
||||
Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 根据文书记录ID获取文书记录信息
|
||||
@@ -50,4 +52,47 @@ public interface IDocRecordAppService {
|
||||
* @return
|
||||
*/
|
||||
R<?> deleteRecord(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 根据患者ID或就诊ID以及时间获取文书记录列表,只针对不需返回患者具体信息的列表,体温单除外,单独处理 需返回患者具体信息的列表,请使用getPatientRecordList
|
||||
*
|
||||
* @param docRecordQueryParam 文书记录查询参数
|
||||
* @param recordTime 时间
|
||||
* @return R
|
||||
*/
|
||||
R<?> getRecordByEncounterIdAndTimeList(DocRecordQueryParam docRecordQueryParam, String recordTime);
|
||||
|
||||
/**
|
||||
* 根据文书记录ID打印文书记录
|
||||
*
|
||||
* @param recordId 文书记录ID
|
||||
* @return R
|
||||
*/
|
||||
R<?> recordPrint(Long recordId);
|
||||
|
||||
/**
|
||||
* 新增或编辑记录
|
||||
*
|
||||
* @param docRecordDto 文书记录信息
|
||||
* @return R
|
||||
*/
|
||||
R<?> saveOrUpdateRecord(DocRecordDto docRecordDto);
|
||||
|
||||
/**
|
||||
* 根据病历ID、病人ID和温度单ID获取温度单信息
|
||||
*
|
||||
* @param docRecordQueryParam 文书记录查询参数
|
||||
* @return 温度单信息
|
||||
*/
|
||||
R<?> temperatureChart(DocRecordQueryParam docRecordQueryParam);
|
||||
|
||||
/**
|
||||
* 护理记录总结
|
||||
*
|
||||
* @param docRecordQueryParam 文书记录查询参数
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return 护理记录总结
|
||||
*/
|
||||
R<?> summaryNursingRecords(DocRecordQueryParam docRecordQueryParam, String startTime, String endTime);
|
||||
}
|
||||
@@ -1,20 +1,18 @@
|
||||
package com.openhis.web.document.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.document.domain.DocStatistics;
|
||||
import com.openhis.web.document.dto.DocRecordQueryParam;
|
||||
import com.openhis.web.document.dto.DocStatisticsDto;
|
||||
import com.openhis.web.document.dto.DocStatisticsQueryParam;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.document.dto.DocStatisticsDto;
|
||||
import com.openhis.web.document.dto.DocStatisticsQueryParam;
|
||||
|
||||
/**
|
||||
* 文档模板 业务接口
|
||||
*/
|
||||
public interface IDocStatisticsAppService {
|
||||
|
||||
|
||||
public R<?> createOrUpdte(List<DocStatisticsDto> docStatisticsList);
|
||||
|
||||
public R<?> delete(List<Long> ids);
|
||||
@@ -23,6 +21,23 @@ public interface IDocStatisticsAppService {
|
||||
|
||||
public R<?> queryByEncounterId(Long encounterId);
|
||||
|
||||
R<?> getStatisticsList(DocStatisticsQueryParam queryParam, Integer isPage, Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request);
|
||||
R<?> getStatisticsList(DocStatisticsQueryParam queryParam, Integer isPage, Integer pageNo, Integer pageSize,
|
||||
String searchKey, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 根据病人ID和病例ID获取温度单信息
|
||||
*
|
||||
* @param encounterId 病例ID
|
||||
* @param patientId 病人ID
|
||||
* @param tempId 体温单ID
|
||||
* @return 体温单信息
|
||||
*/
|
||||
List<DocStatisticsDto> getStatisticsListByEncounterIdAndPatientId(Long encounterId, Long patientId, Long tempId);
|
||||
|
||||
/**
|
||||
* 保存/更新入院体征
|
||||
*
|
||||
* @param docStatisticsDtoList 入院体征list
|
||||
*/
|
||||
void saveOrUpdateAdmissionSigns(List<DocStatisticsDto> docStatisticsDtoList);
|
||||
}
|
||||
@@ -1,5 +1,13 @@
|
||||
package com.openhis.web.document.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.AssignSeqUtil;
|
||||
@@ -14,18 +22,13 @@ import com.openhis.document.service.IDocDefinitionService;
|
||||
import com.openhis.web.document.appservice.IDocDefinitionAppService;
|
||||
import com.openhis.web.document.appservice.IDocDefinitionOrganizationAppService;
|
||||
import com.openhis.web.document.dto.DirectoryNode;
|
||||
import com.openhis.web.document.dto.DocDefinitionOrganizationDto;
|
||||
import com.openhis.web.document.dto.DocDefinitionDto;
|
||||
import com.openhis.web.document.dto.DocDefinitionOrganizationDto;
|
||||
import com.openhis.web.document.dto.DocDefinitonParam;
|
||||
import com.openhis.web.document.mapper.DocDefinitionAppMapper;
|
||||
import com.openhis.web.document.util.DocumentDirectoryProcessor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -39,7 +42,6 @@ public class DocDefinitionAppServiceImpl implements IDocDefinitionAppService {
|
||||
@Resource
|
||||
private DocDefinitionAppMapper docDefinitionAppMapper;
|
||||
|
||||
|
||||
@Autowired(required = false)
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
|
||||
@@ -58,18 +60,18 @@ public class DocDefinitionAppServiceImpl implements IDocDefinitionAppService {
|
||||
if (definitionDto.getVueRouter() == null || definitionDto.getVueRouter().trim().isEmpty()) {
|
||||
return R.fail("新增文书定义失败:文书路由不能为空(或不能为空白字符)");
|
||||
}
|
||||
if (definitionDto.getUseRangeEnum() != null && DocUseRangeEnum.DEPT_USE.getValue().equals(definitionDto.getUseRangeEnum()) && definitionDto.getOrganizationIds() == null) {
|
||||
if (definitionDto.getUseRangeEnum() != null
|
||||
&& DocUseRangeEnum.DEPT_USE.getValue().equals(definitionDto.getUseRangeEnum())
|
||||
&& definitionDto.getOrganizationIds() == null) {
|
||||
return R.fail("新增文书定义失败:科室分配时,科室不能为空");
|
||||
}
|
||||
|
||||
// 2. 校验"名称+版本号"唯一性(避免重复创建)
|
||||
long duplicateCount = docDefinitionService.lambdaQuery()
|
||||
.eq(DocDefinition::getName, definitionDto.getName().trim())
|
||||
.eq(DocDefinition::getVersion, definitionDto.getVersion().trim())
|
||||
.count();
|
||||
long duplicateCount =
|
||||
docDefinitionService.lambdaQuery().eq(DocDefinition::getName, definitionDto.getName().trim())
|
||||
.eq(DocDefinition::getVersion, definitionDto.getVersion().trim()).count();
|
||||
if (duplicateCount > 0) {
|
||||
log.warn("新增文书定义失败:名称={}、版本号={}的文书已存在",
|
||||
definitionDto.getName(), definitionDto.getVersion());
|
||||
log.warn("新增文书定义失败:名称={}、版本号={}的文书已存在", definitionDto.getName(), definitionDto.getVersion());
|
||||
return R.fail("新增文书定义失败:相同名称和版本号的文书已存在,请修改后重试");
|
||||
}
|
||||
|
||||
@@ -116,15 +118,14 @@ public class DocDefinitionAppServiceImpl implements IDocDefinitionAppService {
|
||||
// 5. 保存文书定义
|
||||
boolean saveSuccess = docDefinitionService.save(docDefinition);
|
||||
if (!saveSuccess) {
|
||||
log.error("新增文书定义失败:数据库保存异常(名称={}, 版本号={}, 业务编号={}",
|
||||
definitionDto.getName(), definitionDto.getVersion(), busNo);
|
||||
log.error("新增文书定义失败:数据库保存异常(名称={}, 版本号={}, 业务编号={}", definitionDto.getName(), definitionDto.getVersion(),
|
||||
busNo);
|
||||
return R.fail("新增文书定义失败:数据库保存操作异常");
|
||||
}
|
||||
|
||||
// 6. 科室分配(仅当使用范围为"科室级"时执行)
|
||||
if (DocUseRangeEnum.DEPT_USE.getValue().equals(definitionDto.getUseRangeEnum())
|
||||
&& definitionDto.getOrganizationIds() != null
|
||||
&& !definitionDto.getOrganizationIds().isEmpty()) {
|
||||
&& definitionDto.getOrganizationIds() != null && !definitionDto.getOrganizationIds().isEmpty()) {
|
||||
DocDefinitionOrganizationDto orgDto = new DocDefinitionOrganizationDto();
|
||||
orgDto.setBusNo(busNo);
|
||||
orgDto.setDefinitionId(docDefinition.getId());
|
||||
@@ -136,7 +137,6 @@ public class DocDefinitionAppServiceImpl implements IDocDefinitionAppService {
|
||||
return R.ok("新增文书定义成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改文书定义(版本号冲突时自动新增,含科室分配更新)
|
||||
*/
|
||||
@@ -158,7 +158,9 @@ public class DocDefinitionAppServiceImpl implements IDocDefinitionAppService {
|
||||
if (definitionDto.getBusNo() == null || definitionDto.getBusNo().trim().isEmpty()) {
|
||||
return R.fail("修改文书定义失败:文书业务编号不能为空(或不能为空白字符)");
|
||||
}
|
||||
if (definitionDto.getUseRangeEnum() != null && DocUseRangeEnum.DEPT_USE.getValue().equals(definitionDto.getUseRangeEnum()) && definitionDto.getOrganizationIds() == null) {
|
||||
if (definitionDto.getUseRangeEnum() != null
|
||||
&& DocUseRangeEnum.DEPT_USE.getValue().equals(definitionDto.getUseRangeEnum())
|
||||
&& definitionDto.getOrganizationIds() == null) {
|
||||
return R.fail("修改文书定义失败:科室分配时,科室不能为空");
|
||||
}
|
||||
// 2. 校验文书是否存在
|
||||
@@ -170,8 +172,7 @@ public class DocDefinitionAppServiceImpl implements IDocDefinitionAppService {
|
||||
|
||||
// 3. 版本号冲突处理(版本号不一致时,转为新增逻辑)
|
||||
if (!existingDoc.getVersion().trim().equals(definitionDto.getVersion().trim())) {
|
||||
log.info("修改文书定义:版本号冲突(原版本={}, 新版本={}),自动执行新增逻辑",
|
||||
existingDoc.getVersion(), definitionDto.getVersion());
|
||||
log.info("修改文书定义:版本号冲突(原版本={}, 新版本={}),自动执行新增逻辑", existingDoc.getVersion(), definitionDto.getVersion());
|
||||
// 新增前清空ID,避免覆盖原有记录
|
||||
definitionDto.setId(null);
|
||||
return addDefinition(definitionDto);
|
||||
@@ -211,8 +212,7 @@ public class DocDefinitionAppServiceImpl implements IDocDefinitionAppService {
|
||||
// 6. 执行修改
|
||||
boolean updateSuccess = docDefinitionService.updateById(existingDoc);
|
||||
if (!updateSuccess) {
|
||||
log.error("修改文书定义失败:数据库更新异常(ID={}, 业务编号={}",
|
||||
definitionDto.getId(), definitionDto.getBusNo());
|
||||
log.error("修改文书定义失败:数据库更新异常(ID={}, 业务编号={}", definitionDto.getId(), definitionDto.getBusNo());
|
||||
return R.fail("修改文书定义失败:数据库更新操作异常");
|
||||
} else {
|
||||
// 7. 更新科室分配(仅当使用范围为"科室级"时执行)
|
||||
@@ -255,20 +255,14 @@ public class DocDefinitionAppServiceImpl implements IDocDefinitionAppService {
|
||||
}
|
||||
|
||||
// 2. 数据库查询文书定义列表
|
||||
List<DocDefinitionDto> docList = docDefinitionAppMapper.getDefinationList(
|
||||
param.getUseRanges(),
|
||||
param.getOrganizationId(),
|
||||
hospitalId,
|
||||
param.getName(),
|
||||
param.getPrimaryMenuEnum()
|
||||
);
|
||||
List<DocDefinitionDto> docList = docDefinitionAppMapper.getDefinationList(param.getUseRanges(),
|
||||
param.getOrganizationId(), hospitalId, param.getName(), param.getPrimaryMenuEnum());
|
||||
|
||||
// 3. 构建树形结构(空列表时返回空树,避免空指针)
|
||||
List<DirectoryNode> treeNodes = new ArrayList<>();
|
||||
if (docList != null && !docList.isEmpty()) {
|
||||
treeNodes = DocumentDirectoryProcessor.buildDocumentDirectory(docList);
|
||||
log.info("获取文书定义树形列表成功:医院ID={}, 文书数量={}, 树形节点数量={}",
|
||||
hospitalId, docList.size(), treeNodes.size());
|
||||
log.info("获取文书定义树形列表成功:医院ID={}, 文书数量={}, 树形节点数量={}", hospitalId, docList.size(), treeNodes.size());
|
||||
} else {
|
||||
log.info("获取文书定义树形列表成功:医院ID={}, 暂无匹配的文书定义", hospitalId);
|
||||
}
|
||||
@@ -293,8 +287,7 @@ public class DocDefinitionAppServiceImpl implements IDocDefinitionAppService {
|
||||
return R.fail("获取文书定义详情失败:未查询到对应的文书定义信息");
|
||||
}
|
||||
|
||||
log.info("获取文书定义详情成功:ID={}, 名称={}, 业务编号={}",
|
||||
id, docDto.getName(), docDto.getBusNo());
|
||||
log.info("获取文书定义详情成功:ID={}, 名称={}, 业务编号={}", id, docDto.getName(), docDto.getBusNo());
|
||||
return R.ok(docDto, "获取文书定义详情成功");
|
||||
}
|
||||
|
||||
@@ -311,8 +304,8 @@ public class DocDefinitionAppServiceImpl implements IDocDefinitionAppService {
|
||||
|
||||
// 2. 查询该文书已分配的科室ID列表
|
||||
LambdaQueryWrapper<DocDefinitionOrganization> orgWrapper = new LambdaQueryWrapper<>();
|
||||
orgWrapper.eq(DocDefinitionOrganization::getDefinitionId, id)
|
||||
.eq(DocDefinitionOrganization::getBusNo, doc.getBusNo());
|
||||
orgWrapper.eq(DocDefinitionOrganization::getDefinitionId, id).eq(DocDefinitionOrganization::getBusNo,
|
||||
doc.getBusNo());
|
||||
List<DocDefinitionOrganization> orgList = docDefinitionOrganizationService.list(orgWrapper);
|
||||
|
||||
// 3. 提取科室ID并封装DTO
|
||||
@@ -327,4 +320,29 @@ public class DocDefinitionAppServiceImpl implements IDocDefinitionAppService {
|
||||
|
||||
return docDto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文书ID
|
||||
*
|
||||
* @param menuEnum 来源类型(DocDefinitionEnum)
|
||||
* @return 文书列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDefinitionId(Integer menuEnum) {
|
||||
// 1. 获取当前登录用户的医院ID(避免跨医院查询)
|
||||
Long hospitalId = SecurityUtils.getLoginUser().getHospitalId();
|
||||
if (hospitalId == null) {
|
||||
log.warn("获取文书定义树形列表失败:当前登录用户未关联医院ID");
|
||||
return R.fail("获取文书定义树形列表失败:当前用户未关联医院,请重新登录");
|
||||
}
|
||||
if (menuEnum == null) {
|
||||
return R.fail("来源类型不能为空");
|
||||
}
|
||||
// 2. 数据库查询文书定义列表
|
||||
LambdaQueryWrapper<DocDefinition> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DocDefinition::getHospitalId, hospitalId);
|
||||
queryWrapper.eq(DocDefinition::getPrimaryMenuEnum, menuEnum);
|
||||
List<DocDefinition> docList = docDefinitionService.list(queryWrapper);
|
||||
return R.ok(docList);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,27 @@
|
||||
package com.openhis.web.document.appservice.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -10,16 +30,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.AgeCalculatorUtil;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.common.enums.AdministrativeGender;
|
||||
import com.openhis.common.enums.DocStatusEnum;
|
||||
import com.openhis.common.enums.DocTypeEnum;
|
||||
import com.openhis.common.enums.EncounterClass;
|
||||
import com.openhis.common.utils.HisPageUtils;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.document.domain.DocRecord;
|
||||
import com.openhis.document.domain.DocStatistics;
|
||||
import com.openhis.document.mapper.DocRecordMapper;
|
||||
import com.openhis.document.service.IDocRecordService;
|
||||
import com.openhis.document.service.IDocStatisticsService;
|
||||
import com.openhis.web.document.appservice.IDocDefinitionAppService;
|
||||
import com.openhis.web.document.appservice.IDocRecordAppService;
|
||||
import com.openhis.web.document.appservice.IDocStatisticsAppService;
|
||||
@@ -27,23 +46,10 @@ import com.openhis.web.document.appservice.IDocStatisticsDefinitionAppService;
|
||||
import com.openhis.web.document.dto.*;
|
||||
import com.openhis.web.document.mapper.DocRecordAppMapper;
|
||||
import com.openhis.web.document.util.ConvertToDocStatistics;
|
||||
import com.openhis.web.document.util.OperationDayCalculator;
|
||||
import com.openhis.web.document.util.PermissionProcessor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -62,11 +68,12 @@ public class DocRecordAppServiceImpl implements IDocRecordAppService {
|
||||
@Resource
|
||||
private IDocStatisticsAppService docStatisticsAppService;
|
||||
@Resource
|
||||
private IDocStatisticsService docStatisticsService;
|
||||
@Resource
|
||||
ConvertToDocStatistics convertToDocStatistics;
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate; // 使用 JdbcTemplate 执行 SQL
|
||||
|
||||
|
||||
/**
|
||||
* 插入单条文档操作日志
|
||||
*
|
||||
@@ -80,29 +87,19 @@ public class DocRecordAppServiceImpl implements IDocRecordAppService {
|
||||
}
|
||||
|
||||
try {
|
||||
String sql = "INSERT INTO doc_record_log(" +
|
||||
"record_id, definition_id, definition_bus_no, content_json, " +
|
||||
"status_enum, organization_id, encounter_id, patient_id, record_time, " +
|
||||
"create_by, create_time, update_by, update_time, delete_flag, tenant_id" +
|
||||
") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
String sql = "INSERT INTO doc_record_log(" + "record_id, definition_id, definition_bus_no, content_json, "
|
||||
+ "status_enum, organization_id, encounter_id, patient_id, record_time, "
|
||||
+ "create_by, create_time, update_by, update_time, delete_flag, tenant_id"
|
||||
+ ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
Object[] params = {
|
||||
docRecord.getId(),
|
||||
docRecord.getDefinitionId(),
|
||||
docRecord.getDefinitionBusNo(),
|
||||
docRecord.getContentJson(),
|
||||
docRecord.getStatusEnum(),
|
||||
docRecord.getOrganizationId(),
|
||||
docRecord.getEncounterId(),
|
||||
docRecord.getPatientId(),
|
||||
new Timestamp(docRecord.getRecordTime().getTime()),
|
||||
SecurityUtils.getUsername(),
|
||||
new Timestamp(new Date().getTime()),
|
||||
null, // update_by
|
||||
null, // update_time
|
||||
0, // delete_flag(未删除)
|
||||
docRecord.getTenantId()
|
||||
};
|
||||
Object[] params = {docRecord.getId(), docRecord.getDefinitionId(), docRecord.getDefinitionBusNo(),
|
||||
docRecord.getContentJson(), docRecord.getStatusEnum(), docRecord.getOrganizationId(),
|
||||
docRecord.getEncounterId(), docRecord.getPatientId(),
|
||||
new Timestamp(docRecord.getRecordTime().getTime()), SecurityUtils.getUsername(),
|
||||
new Timestamp(new Date().getTime()), null, // update_by
|
||||
null, // update_time
|
||||
0, // delete_flag(未删除)
|
||||
docRecord.getTenantId()};
|
||||
|
||||
int rowsAffected = jdbcTemplate.update(sql, params);
|
||||
return rowsAffected > 0;
|
||||
@@ -125,11 +122,10 @@ public class DocRecordAppServiceImpl implements IDocRecordAppService {
|
||||
}
|
||||
|
||||
try {
|
||||
String sql = "INSERT INTO doc_record_log(" +
|
||||
"record_id, definition_id, definition_bus_no, content_json, " +
|
||||
"status_enum, organization_id, encounter_id, patient_id, record_time, " +
|
||||
"create_by, create_time, update_by, update_time, delete_flag, tenant_id" +
|
||||
") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
String sql = "INSERT INTO doc_record_log(" + "record_id, definition_id, definition_bus_no, content_json, "
|
||||
+ "status_enum, organization_id, encounter_id, patient_id, record_time, "
|
||||
+ "create_by, create_time, update_by, update_time, delete_flag, tenant_id"
|
||||
+ ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
int[] results = jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
|
||||
@Override
|
||||
@@ -210,7 +206,6 @@ public class DocRecordAppServiceImpl implements IDocRecordAppService {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 文书统计 - 新增、编辑记录
|
||||
*
|
||||
@@ -246,7 +241,8 @@ public class DocRecordAppServiceImpl implements IDocRecordAppService {
|
||||
docRecord.setDefinitionId(docRecordDto.getDefinitionId());
|
||||
docRecord.setDefinitionBusNo(docRecordDto.getDefinitionBusNo());
|
||||
docRecord.setContentJson(docRecordDto.getContentJson());
|
||||
docRecord.setStatusEnum(docRecordDto.getStatusEnum() == null ? DocStatusEnum.DRAFT.getValue() : docRecordDto.getStatusEnum());
|
||||
docRecord.setStatusEnum(
|
||||
docRecordDto.getStatusEnum() == null ? DocStatusEnum.DRAFT.getValue() : docRecordDto.getStatusEnum());
|
||||
docRecord.setOrganizationId(SecurityUtils.getLoginUser().getOrgId());
|
||||
docRecord.setEncounterId(docRecordDto.getEncounterId());
|
||||
docRecord.setPatientId(docRecordDto.getPatientId());
|
||||
@@ -269,9 +265,16 @@ public class DocRecordAppServiceImpl implements IDocRecordAppService {
|
||||
* @return 返回结果 R对象
|
||||
*/
|
||||
public R<?> updateRecord(DocRecordDto docRecordDto) {
|
||||
String checkMsg = initRecordCheck(docRecordDto);
|
||||
if (!checkMsg.isEmpty()) {
|
||||
return R.fail(checkMsg);
|
||||
Integer printCount = docRecordDto.getPrintCount();
|
||||
if (printCount > 0) {
|
||||
return R.fail("已打印的文书记录,禁止修改");
|
||||
}
|
||||
List<String> sourceCodes = Arrays.stream(DocDefinitionEnum.values()).map(DocDefinitionEnum::getValue).toList();
|
||||
if (!sourceCodes.contains(StringUtils.isBlank(docRecordDto.getSource()) ? "" : docRecordDto.getSource())) {
|
||||
String checkMsg = initRecordCheck(docRecordDto);
|
||||
if (!checkMsg.isEmpty()) {
|
||||
return R.fail(checkMsg);
|
||||
}
|
||||
}
|
||||
// 1. 查询原文书记录
|
||||
DocRecord docRecord = docRecordService.getById(docRecordDto.getId());
|
||||
@@ -312,7 +315,8 @@ public class DocRecordAppServiceImpl implements IDocRecordAppService {
|
||||
* 根据患者ID/就诊ID获取文书记录列表(支持分页)
|
||||
*/
|
||||
@Override
|
||||
public R<?> getRecordByEncounterIdList(DocRecordQueryParam docRecordQueryParam, Integer isPage, Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
|
||||
public R<?> getRecordByEncounterIdList(DocRecordQueryParam docRecordQueryParam, Integer isPage, Integer pageNo,
|
||||
Integer pageSize, String searchKey, HttpServletRequest request) {
|
||||
// 1. 参数校验
|
||||
if (docRecordQueryParam == null) {
|
||||
return R.fail("患者文书记录:查询参数不能为空");
|
||||
@@ -326,10 +330,10 @@ public class DocRecordAppServiceImpl implements IDocRecordAppService {
|
||||
|
||||
// 2. 分页查询逻辑
|
||||
if (isPage != null && isPage == 1) {
|
||||
QueryWrapper<DocRecordDto> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
docRecordQueryParam, null, null, request);
|
||||
IPage<DocRecordDto> pageResult = docRecordAppMapper.getRecordPageListByEncounterId(
|
||||
new Page<>(pageNo, pageSize), queryWrapper);
|
||||
QueryWrapper<DocRecordDto> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(docRecordQueryParam, null, null, request);
|
||||
IPage<DocRecordDto> pageResult =
|
||||
docRecordAppMapper.getRecordPageListByEncounterId(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
return R.ok(pageResult, "获取患者文书记录列表成功");
|
||||
}
|
||||
// 3. 不分页查询逻辑
|
||||
@@ -350,15 +354,16 @@ public class DocRecordAppServiceImpl implements IDocRecordAppService {
|
||||
queryWrapper.eq(DocRecord::getOrganizationId, docRecordQueryParam.getOrganizationId());
|
||||
}
|
||||
|
||||
DocDefinitionDto docDefinitionDto = docDefinitionAppService.getDefinitionById(docRecordQueryParam.getDefinitionId());
|
||||
DocDefinitionDto docDefinitionDto =
|
||||
docDefinitionAppService.getDefinitionById(docRecordQueryParam.getDefinitionId());
|
||||
// 实体转DTO
|
||||
List<DocRecordDto> dtoList = new ArrayList<>();
|
||||
List<DocRecord> recordList = docRecordService.list(queryWrapper);
|
||||
for (DocRecord record : recordList) {
|
||||
DocRecordDto dto = new DocRecordDto();
|
||||
BeanUtils.copyProperties(record, dto);
|
||||
dto.setName(docDefinitionDto!=null?docDefinitionDto.getName():"");
|
||||
dto.setVersion(docDefinitionDto!=null?docDefinitionDto.getVersion():"");
|
||||
dto.setName(docDefinitionDto != null ? docDefinitionDto.getName() : "");
|
||||
dto.setVersion(docDefinitionDto != null ? docDefinitionDto.getVersion() : "");
|
||||
dtoList.add(dto);
|
||||
}
|
||||
return R.ok(dtoList, "获取患者文书记录列表成功");
|
||||
@@ -369,18 +374,20 @@ public class DocRecordAppServiceImpl implements IDocRecordAppService {
|
||||
* 查询患者文书记录列表(携带患者信息,支持分页)
|
||||
*/
|
||||
@Override
|
||||
public R<?> getRecordPageList(DocRecordPatientQueryParam docRecordPatientQueryParam, List<Integer> primaryMenuEnumList, Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
|
||||
public R<?> getRecordPageList(DocRecordPatientQueryParam docRecordPatientQueryParam,
|
||||
List<Integer> primaryMenuEnumList, Integer pageNo, Integer pageSize, String searchKey,
|
||||
HttpServletRequest request) {
|
||||
if (docRecordPatientQueryParam == null) {
|
||||
return R.fail("文书记录:查询参数不能为空");
|
||||
}
|
||||
|
||||
// 构建查询条件(支持患者姓名搜索)
|
||||
QueryWrapper<DocRecordPatientDto> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
docRecordPatientQueryParam, searchKey, new HashSet<>(Arrays.asList("patient_name", "bus_no")), request);
|
||||
QueryWrapper<DocRecordPatientDto> queryWrapper = HisQueryUtils.buildQueryWrapper(docRecordPatientQueryParam,
|
||||
searchKey, new HashSet<>(Arrays.asList("patient_name", "bus_no")), request);
|
||||
|
||||
// 分页查询
|
||||
IPage<DocRecordPatientDto> pageResult = docRecordAppMapper.getRecordPageList(
|
||||
new Page<>(pageNo, pageSize), primaryMenuEnumList, queryWrapper);
|
||||
IPage<DocRecordPatientDto> pageResult =
|
||||
docRecordAppMapper.getRecordPageList(new Page<>(pageNo, pageSize), primaryMenuEnumList, queryWrapper);
|
||||
|
||||
// 处理返回结果:枚举值转中文描述、计算患者年龄
|
||||
if (pageResult != null && !pageResult.getRecords().isEmpty()) {
|
||||
@@ -477,6 +484,7 @@ public class DocRecordAppServiceImpl implements IDocRecordAppService {
|
||||
// 4. 执行删除
|
||||
boolean deleteSuccess = docRecordService.removeByIds(ids);
|
||||
if (deleteSuccess) {
|
||||
docStatisticsAppService.delete(ids);
|
||||
// 5. 批量插入删除日志
|
||||
boolean logSuccess = insertBatchLog(logRecordList);
|
||||
if (!logSuccess) {
|
||||
@@ -487,4 +495,538 @@ public class DocRecordAppServiceImpl implements IDocRecordAppService {
|
||||
return R.fail("删除患者文书记录失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据患者ID或就诊ID以及时间获取文书记录列表,只针对不需返回患者具体信息的列表,体温单除外,单独处理 需返回患者具体信息的列表,请使用getPatientRecordList
|
||||
*
|
||||
* @param docRecordQueryParam 文书记录查询参数
|
||||
* @param recordTime 时间
|
||||
* @return R
|
||||
*/
|
||||
@Override
|
||||
public R<?> getRecordByEncounterIdAndTimeList(DocRecordQueryParam docRecordQueryParam, String recordTime) {
|
||||
// 参数校验
|
||||
if (docRecordQueryParam == null) {
|
||||
return R.fail("患者文书记录:查询参数不能为空");
|
||||
}
|
||||
if (docRecordQueryParam.getPatientId() == null && docRecordQueryParam.getEncounterId() == null) {
|
||||
return R.fail("患者文书记录:患者ID和就诊ID不能同时为空");
|
||||
}
|
||||
if (docRecordQueryParam.getDefinitionId() == null) {
|
||||
return R.fail("患者文书记录:文书类型(定义)ID不能为空");
|
||||
}
|
||||
// 未传时间,按照当前时间
|
||||
Date recordDate = StringUtils.isBlank(recordTime) ? new Date()
|
||||
: Date.from(LocalDate.parse(recordTime, DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay()
|
||||
.atZone(ZoneId.systemDefault()).toInstant());
|
||||
// 患者ID查询条件
|
||||
LambdaQueryWrapper<DocRecord> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (docRecordQueryParam.getPatientId() != null) {
|
||||
queryWrapper.eq(DocRecord::getPatientId, docRecordQueryParam.getPatientId())
|
||||
.eq(DocRecord::getEncounterId, docRecordQueryParam.getEncounterId())
|
||||
.ge(DocRecord::getRecordTime, recordDate).lt(DocRecord::getRecordTime,
|
||||
Date.from(recordDate.toInstant().atZone(ZoneId.systemDefault()).plusDays(1).toInstant()));
|
||||
}
|
||||
// 文书类型ID(必传)
|
||||
queryWrapper.eq(DocRecord::getDefinitionId, docRecordQueryParam.getDefinitionId());
|
||||
// 就诊ID查询条件(修复原逻辑:原代码字段匹配错误,用EncounterId匹配DefinitionBusNo)
|
||||
// if (docRecordQueryParam.getEncounterId() != null) {
|
||||
// queryWrapper.eq(DocRecord::getEncounterId, docRecordQueryParam.getEncounterId());
|
||||
// }
|
||||
// 科室ID查询条件(修复原逻辑:原代码字段匹配错误,用OrganizationId匹配EncounterId)
|
||||
if (docRecordQueryParam.getOrganizationId() != null) {
|
||||
queryWrapper.eq(DocRecord::getOrganizationId, docRecordQueryParam.getOrganizationId());
|
||||
}
|
||||
DocDefinitionDto docDefinitionDto =
|
||||
docDefinitionAppService.getDefinitionById(docRecordQueryParam.getDefinitionId());
|
||||
// 实体转DTO
|
||||
List<DocRecordDto> dtoList = new ArrayList<>();
|
||||
List<DocRecord> recordList = docRecordService.list(queryWrapper);
|
||||
for (DocRecord record : recordList) {
|
||||
DocRecordDto dto = new DocRecordDto();
|
||||
BeanUtils.copyProperties(record, dto);
|
||||
dto.setName(docDefinitionDto != null ? docDefinitionDto.getName() : "");
|
||||
dto.setVersion(docDefinitionDto != null ? docDefinitionDto.getVersion() : "");
|
||||
dtoList.add(dto);
|
||||
}
|
||||
return R.ok(dtoList, "获取患者文书记录列表成功");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文书记录ID打印文书记录
|
||||
*
|
||||
* @param recordId 文书记录ID
|
||||
* @return R
|
||||
*/
|
||||
@Override
|
||||
public R<?> recordPrint(Long recordId) {
|
||||
LambdaQueryWrapper<DocRecord> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(DocRecord::getId, recordId);
|
||||
DocRecord record = docRecordService.getOne(wrapper);
|
||||
if (record != null) {
|
||||
record.setPrintCount(record.getPrintCount() + 1);
|
||||
docRecordService.updateById(record);
|
||||
}
|
||||
return R.ok(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或编辑记录(根据id是否为空判断新增或编辑)
|
||||
*
|
||||
* @param docRecordDto 文书记录信息
|
||||
* @return R
|
||||
*/
|
||||
@Override
|
||||
public R<?> saveOrUpdateRecord(DocRecordDto docRecordDto) {
|
||||
Long id = docRecordDto.getId();
|
||||
if (id == null) {
|
||||
return addRecord(docRecordDto);
|
||||
} else {
|
||||
return updateRecord(docRecordDto);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据病历ID、病人ID和体温单ID获取温度单信息
|
||||
*
|
||||
* @param docRecordQueryParam 文书记录查询参数
|
||||
* @return 体温单信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> temperatureChart(DocRecordQueryParam docRecordQueryParam) {
|
||||
// 参数校验
|
||||
if (docRecordQueryParam == null) {
|
||||
return R.fail("患者文书记录:查询参数不能为空");
|
||||
}
|
||||
Long encounterId = docRecordQueryParam.getEncounterId();
|
||||
Long patientId = docRecordQueryParam.getPatientId();
|
||||
Long tempId = docRecordQueryParam.getDefinitionId();
|
||||
if (encounterId == null) {
|
||||
return R.fail("患者文书记录:就诊ID不能为空");
|
||||
}
|
||||
if (patientId == null) {
|
||||
return R.fail("患者文书记录:患者ID不能为空");
|
||||
}
|
||||
if (tempId == null) {
|
||||
return R.fail("患者文书记录:文书类型(定义)ID不能为空");
|
||||
}
|
||||
// 根据病历ID和患者ID获取住院、出院时间
|
||||
Map<String, Date> dateMap = getDateByEncounterId(encounterId, patientId);
|
||||
Date hospDate = dateMap.get("hospDate");
|
||||
Date outDate = dateMap.get("outDate");
|
||||
// 所有的chartsSmalls
|
||||
List<TrendChartsSmall> allTrendChartsSmalls = new ArrayList<>();
|
||||
// 获取体温单信息
|
||||
List<DocStatisticsDto> statisticsList =
|
||||
docStatisticsAppService.getStatisticsListByEncounterIdAndPatientId(encounterId, patientId, tempId);
|
||||
// 过滤出血压
|
||||
List<DocStatisticsDto> bloodPressureList = statisticsList.stream().filter(item -> {
|
||||
String code = item.getStatisticDefinitionCode();
|
||||
if (code != null) {
|
||||
return TemperatureChartEnum.BLOOD_PRESSURE.getCode().equals(code);
|
||||
}
|
||||
return false;
|
||||
}).toList();
|
||||
// 移除血压
|
||||
statisticsList.removeAll(bloodPressureList);
|
||||
// 获取每一天 上下午 各最新一条的数据
|
||||
bloodPressureList = getLatestRecordsPerPeriod(bloodPressureList);
|
||||
// 添加血压list
|
||||
statisticsList.addAll(bloodPressureList);
|
||||
// 先排序 按时间分组,确保同一组的数据应该在一组
|
||||
statisticsList.sort(Comparator.comparing(DocStatisticsDto::getRecordTime));
|
||||
// 转换为TrendChartsSmall集合
|
||||
for (DocStatisticsDto docStatisticsDto : statisticsList) {
|
||||
// typeCode
|
||||
String typeCode = docStatisticsDto.getStatisticDefinitionCode();
|
||||
// typeValue
|
||||
String typeValue = docStatisticsDto.getValue();
|
||||
// 如果typeValue为空,数据不添加进list
|
||||
if (StringUtils.isBlank(typeValue)) {
|
||||
continue;
|
||||
}
|
||||
// date
|
||||
Date date = docStatisticsDto.getRecordTime();
|
||||
// times
|
||||
String times = formatDate(date, "HH:mm:ss");
|
||||
// weekNo
|
||||
Integer weekNo = calculateWeek(hospDate, date);
|
||||
// orderByDateTimes 暂时不用
|
||||
String orderByDateTimes = null;
|
||||
// id 暂时不用
|
||||
String id = null;
|
||||
// collectionMode 体温(003)、脉搏(002)、呼吸(001)、疼痛等级(016)为 1,其余为null
|
||||
Integer collectionMode = null;
|
||||
List<String> temperatureChartCodes =
|
||||
Arrays.asList(TemperatureChartEnum.TEMPERATURE.getCode(), TemperatureChartEnum.PULSE.getCode(),
|
||||
TemperatureChartEnum.BREATH.getCode(), TemperatureChartEnum.PAIN_SCORE.getCode());
|
||||
if (temperatureChartCodes.contains(typeCode)) {
|
||||
collectionMode = 1;
|
||||
if (isChineseWithSpace(typeValue)) {
|
||||
typeCode = TemperatureChartEnum.TEMPERATURE_CHINESE.getCode();
|
||||
}
|
||||
}
|
||||
TrendChartsSmall trendChartsSmall =
|
||||
new TrendChartsSmall(collectionMode, date, times, typeCode, typeValue, weekNo, orderByDateTimes, id);
|
||||
allTrendChartsSmalls.add(trendChartsSmall);
|
||||
}
|
||||
// 体温单信息
|
||||
TrendChartsOutput trendChartsOutput = returnTrendChartsOutput(allTrendChartsSmalls, encounterId, hospDate);
|
||||
trendChartsOutput.setOutDate(outDate);
|
||||
// 术后天数
|
||||
calculatePostopDay(trendChartsOutput, getPostopDate(encounterId, patientId));
|
||||
return R.ok(trendChartsOutput);
|
||||
}
|
||||
|
||||
/**
|
||||
* 护理记录总结
|
||||
*
|
||||
* @param docRecordQueryParam 文书记录查询参数
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return 护理记录总结
|
||||
*/
|
||||
@Override
|
||||
public R<?> summaryNursingRecords(DocRecordQueryParam docRecordQueryParam, String startTime, String endTime) {
|
||||
// 参数校验
|
||||
if (docRecordQueryParam == null) {
|
||||
return R.fail("患者文书记录:查询参数不能为空");
|
||||
}
|
||||
Long encounterId = docRecordQueryParam.getEncounterId();
|
||||
Long patientId = docRecordQueryParam.getPatientId();
|
||||
Long definitionId = docRecordQueryParam.getDefinitionId();
|
||||
if (encounterId == null) {
|
||||
return R.fail("患者文书记录:就诊ID不能为空");
|
||||
}
|
||||
if (patientId == null) {
|
||||
return R.fail("患者文书记录:患者ID不能为空");
|
||||
}
|
||||
if (definitionId == null) {
|
||||
return R.fail("患者文书记录:文书类型(定义)ID不能为空");
|
||||
}
|
||||
List<DocRecordDto> docRecordList = new ArrayList<>();
|
||||
// 查询所有
|
||||
LambdaQueryWrapper<DocRecord> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(DocRecord::getEncounterId, encounterId);
|
||||
wrapper.eq(DocRecord::getPatientId, patientId);
|
||||
wrapper.eq(DocRecord::getDefinitionId, definitionId);
|
||||
// 有时间就按时间条件查询
|
||||
if (StringUtils.isNotBlank(startTime)) {
|
||||
wrapper.ge(DocRecord::getRecordTime, LocalDate.parse(startTime));
|
||||
}
|
||||
if (StringUtils.isNotBlank(endTime)) {
|
||||
wrapper.lt(StringUtils.isNotBlank(endTime), DocRecord::getRecordTime, LocalDate.parse(endTime).plusDays(1));
|
||||
}
|
||||
// 时间最新数据在前面
|
||||
wrapper.orderByDesc(DocRecord::getRecordTime);
|
||||
List<DocRecord> recordList = docRecordService.list(wrapper);
|
||||
recordList.forEach(record -> {
|
||||
DocRecordDto dto = new DocRecordDto();
|
||||
BeanUtils.copyProperties(record, dto);
|
||||
docRecordList.add(dto);
|
||||
});
|
||||
// 有时间则会总结出入量
|
||||
List<Long> recordIds = docRecordList.stream().map(DocRecordDto::getId).toList();
|
||||
if (StringUtils.isNotBlank(startTime) && StringUtils.isNotBlank(endTime) && !recordIds.isEmpty()) {
|
||||
// 查询出入量
|
||||
LambdaQueryWrapper<DocStatistics> statisticsWrapper = new LambdaQueryWrapper<>();
|
||||
if (docRecordQueryParam.getDefinitionId() != null) {
|
||||
statisticsWrapper.eq(DocStatistics::getDefinitionId, docRecordQueryParam.getDefinitionId());
|
||||
}
|
||||
statisticsWrapper.eq(DocStatistics::getSource, DocDefinitionEnum.NURSING_RECORD.getValue());
|
||||
statisticsWrapper.in(DocStatistics::getRecordId, recordIds);
|
||||
statisticsWrapper.in(DocStatistics::getStatisticDefinitionCode,
|
||||
Arrays.asList(TemperatureChartEnum.OUTPUT.getTypeCode(), TemperatureChartEnum.INPUT.getTypeCode()));
|
||||
// 获取出、入量数据
|
||||
List<DocStatistics> nursingRecordList = docStatisticsService.list(statisticsWrapper);
|
||||
if (!nursingRecordList.isEmpty()) {
|
||||
// 总出量
|
||||
BigDecimal totalOutput = BigDecimal.ZERO;
|
||||
// 总入量
|
||||
BigDecimal totalInput = BigDecimal.ZERO;
|
||||
for (DocStatistics statistics : nursingRecordList) {
|
||||
BigDecimal value = new BigDecimal(statistics.getValue());
|
||||
if (statistics.getStatisticDefinitionCode().equals(TemperatureChartEnum.OUTPUT.getTypeCode())) {
|
||||
// 计算总出量
|
||||
totalOutput = totalOutput.add(value);
|
||||
} else {
|
||||
// 计算总入量
|
||||
totalInput = totalInput.add(value);
|
||||
}
|
||||
}
|
||||
// 将总出、入量添加要返回的数据中
|
||||
DocRecordDto dto = new DocRecordDto();
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put(TemperatureChartEnum.OUTPUT.getTypeCode(), totalOutput.toString());
|
||||
map.put(TemperatureChartEnum.INPUT.getTypeCode(), totalInput.toString());
|
||||
dto.setContentJson(JSONObject.toJSONString(map));
|
||||
docRecordList.add(dto);
|
||||
}
|
||||
}
|
||||
return R.ok(docRecordList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回封装好的体温单
|
||||
*
|
||||
* @param allTrendChartsSmalls 所有的chartsSmalls
|
||||
* @return 封装好的体温单
|
||||
*/
|
||||
private TrendChartsOutput returnTrendChartsOutput(List<TrendChartsSmall> allTrendChartsSmalls, Long encounterId,
|
||||
Date hospDate) {
|
||||
allTrendChartsSmalls.sort(Comparator.comparing(TrendChartsSmall::getDate));
|
||||
// temperaturePulses 集合
|
||||
List<TrendChartsBig> temperaturePulses = new ArrayList<>();
|
||||
// temperaturePulses中的chartsSmalls集合
|
||||
List<TrendChartsSmall> bigSmalls = null;
|
||||
// 获取others数据
|
||||
List<TrendChartsSmall> others = new ArrayList<>(allTrendChartsSmalls.stream()
|
||||
.filter(item -> (item.getCollectionMode() == null || item.getCollectionMode() != 1)).toList());
|
||||
// 尿量、大便次数、小便次数、入量、其他 记录的是前一天的,时间要减一天
|
||||
// isOneDayInAdvance(others);
|
||||
// 移除others数据
|
||||
allTrendChartsSmalls.removeAll(others);
|
||||
// 根据病历ID获取入科时间
|
||||
Date admissionDate = getDateByEncounterId(encounterId);
|
||||
// 为入科 TrendChartsSmall 准备数据
|
||||
int weekNo = calculateWeek(hospDate, admissionDate);
|
||||
// 入科 TrendChartsSmall
|
||||
TrendChartsSmall admissionSmall = new TrendChartsSmall(null, admissionDate,
|
||||
formatDate(admissionDate, "HH:mm:ss"), TemperatureChartEnum.WARD_ADMISSION.getCode(),
|
||||
TemperatureChartEnum.WARD_ADMISSION.getDescription() + "," + formatDate(admissionDate, "HH:mm"), weekNo,
|
||||
formatDate(admissionDate, "yyyy-MM-dd HH:mm:ss"), "");
|
||||
ArrayList<TrendChartsSmall> admissionBig = new ArrayList<>();
|
||||
admissionBig.add(admissionSmall);
|
||||
// 先添加入科
|
||||
temperaturePulses.add(new TrendChartsBig(admissionBig, weekNo));
|
||||
// 根据记录时间分组
|
||||
long compareTime = 0L;
|
||||
for (TrendChartsSmall trendChartsSmall : allTrendChartsSmalls) {
|
||||
// 获取当前项的时间[date]
|
||||
long smallTime = trendChartsSmall.getDate().getTime();
|
||||
// 时间相同的分一组
|
||||
if (compareTime == smallTime && bigSmalls != null) {
|
||||
bigSmalls.add(trendChartsSmall);
|
||||
} else {
|
||||
// 当时间与上一条的时间不同时创建新集合并添加进temperaturePulses
|
||||
// 1.创建TrendChartsSmall集合
|
||||
bigSmalls = new ArrayList<>();
|
||||
// 1.1 将trendChartsSmall添加进TrendChartsSmall集合
|
||||
bigSmalls.add(trendChartsSmall);
|
||||
// 2.创建新的TrendChartsBig 并传入 chartsSmalls、weekNo
|
||||
TrendChartsBig trendChartsBig = new TrendChartsBig(bigSmalls, trendChartsSmall.getWeekNo());
|
||||
// 2.2 temperaturePulses 添加 TrendChartsBig
|
||||
temperaturePulses.add(trendChartsBig);
|
||||
// 将新的时间赋值给进行比较的时间
|
||||
compareTime = smallTime;
|
||||
}
|
||||
}
|
||||
return new TrendChartsOutput(hospDate, null, null, temperaturePulses, others);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验是否为汉字
|
||||
*
|
||||
* @param content 待校验字符串
|
||||
* @return 校验结果
|
||||
*/
|
||||
public static boolean isChineseWithSpace(String content) {
|
||||
Pattern regex = Pattern.compile("^[\\u4E00-\\u9FA5\\s]+$");
|
||||
if (StringUtils.isBlank(content)) {
|
||||
return false;
|
||||
} else {
|
||||
return regex.matcher(content).matches();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 提前一天
|
||||
*
|
||||
* @param others others集合
|
||||
*/
|
||||
private void isOneDayInAdvance(List<TrendChartsSmall> others) {
|
||||
List<String> tiqian = Arrays.asList(TemperatureChartEnum.INPUT.getCode(),
|
||||
TemperatureChartEnum.BOWEL_MOVEMENT_FREQUENCY.getCode(), TemperatureChartEnum.URINATION_FREQUENCY.getCode(),
|
||||
TemperatureChartEnum.URINE_VOLUME.getCode(), TemperatureChartEnum.OTHERS.getCode());
|
||||
others.forEach(item -> {
|
||||
if (StringUtils.isBlank(item.getTypeCode()) && tiqian.contains(item.getTypeCode())) {
|
||||
LocalDate date = item.getDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
date = date.plusDays(-1);
|
||||
item.setDate(Date.from(date.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 每一天的血压取上下午各最新的一条
|
||||
*
|
||||
* @param list 血压集合
|
||||
* @return 每天上下午各最新一条的血压数据的集合
|
||||
*/
|
||||
private List<DocStatisticsDto> getLatestRecordsPerPeriod(List<DocStatisticsDto> list) {
|
||||
// 安全校验:列表为空或null时直接返回空列表
|
||||
if (list == null || list.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 按上午(AM)/下午(PM)分组,获取每组符合规则的最新数据
|
||||
Map<String, Optional<DocStatisticsDto>> latestByAmPm =
|
||||
list.stream().filter(item -> item.getValue() != null && !"/".equals(item.getValue().trim())) // 过滤无效值
|
||||
.collect(Collectors.groupingBy(
|
||||
// 按时间判断上下午:12点前为上午,12点及以后为下午
|
||||
dto -> {
|
||||
LocalTime time = dto.getRecordTime().toInstant().atZone(ZoneId.systemDefault()).toLocalTime();
|
||||
return time.isBefore(LocalTime.NOON) ? "AM" : "PM";
|
||||
}, Collectors.collectingAndThen(Collectors.toList(), groupList -> {
|
||||
// 第一步:筛选出数值型数据(非汉字)
|
||||
List<DocStatisticsDto> numericData = groupList.stream()
|
||||
.filter(dto -> !isChineseWithSpace(dto.getValue())).collect(Collectors.toList());
|
||||
// 第二步:如果有数值型数据,取最新的;否则取分组内最新的汉字数据
|
||||
List<DocStatisticsDto> targetData = numericData.isEmpty() ? groupList : numericData;
|
||||
return targetData.stream().max(Comparator.comparing(DocStatisticsDto::getRecordTime));
|
||||
})));
|
||||
// 提取有效数据并按时间排序
|
||||
List<DocStatisticsDto> validData = latestByAmPm.values().stream().filter(Optional::isPresent).map(Optional::get)
|
||||
.sorted(Comparator.comparing(DocStatisticsDto::getRecordTime)).toList();
|
||||
// 拼接上下午数据(上午值 + 逗号 + 下午值)
|
||||
List<DocStatisticsDto> result = new ArrayList<>();
|
||||
if (validData.size() == 1) {
|
||||
// 只有单条数据(上午/下午),直接保留
|
||||
result.add(validData.get(0));
|
||||
} else if (validData.size() >= 2) {
|
||||
// 取前两条(上午+下午)拼接,上午作为主数据
|
||||
DocStatisticsDto amDto = validData.get(0);
|
||||
DocStatisticsDto pmDto = validData.get(1);
|
||||
amDto.setValue(amDto.getValue() + "," + pmDto.getValue());
|
||||
result.add(amDto);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算weekNo 例:开始日期:2025-11-08 当前日期:2025-11-17 -> 2
|
||||
*
|
||||
* @param startDate 开始日期
|
||||
* @param endDate 结束日期
|
||||
* @return endDate是距startDate的第几周
|
||||
*/
|
||||
private int calculateWeek(Date startDate, Date endDate) {
|
||||
LocalDate start = startDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
LocalDate end = endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
if (start.isAfter(end)) {
|
||||
throw new IllegalArgumentException("开始日期不能晚于结束日期");
|
||||
}
|
||||
// 计算出的相差天数要加1
|
||||
long days = ChronoUnit.DAYS.between(start, end) + 1;
|
||||
return (int)Math.ceil(days / 7.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算术后天数 [斜线(/)前是最新的术后天数]
|
||||
*
|
||||
* @param trendChartsOutput 体温单
|
||||
* @param postopDateList 手术时间list
|
||||
*
|
||||
*/
|
||||
private void calculatePostopDay(TrendChartsOutput trendChartsOutput, List<LocalDateTime> postopDateList) {
|
||||
if (!postopDateList.isEmpty()) {
|
||||
// 统计术后天数的截至日期
|
||||
LocalDate endDate;
|
||||
if (trendChartsOutput.getOutDate() == null) {
|
||||
endDate = LocalDate.now();
|
||||
} else {
|
||||
endDate = trendChartsOutput.getOutDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
}
|
||||
// 添加手术信息
|
||||
for (LocalDateTime dateTime : postopDateList) {
|
||||
// 手术时间
|
||||
Date postopDate = Date.from(dateTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||
String times = formatDate(postopDate, "HH:mm:ss");
|
||||
String typeValue =
|
||||
TemperatureChartEnum.OPERATION.getDescription() + "," + formatDate(postopDate, "HH:mm");
|
||||
// 封装手术信息
|
||||
TrendChartsSmall postopSmall =
|
||||
new TrendChartsSmall(null, postopDate, times, TemperatureChartEnum.OPERATION.getCode(), typeValue,
|
||||
calculateWeek(trendChartsOutput.getHospDate(), postopDate), null, null);
|
||||
// 将收入信息添加到有入科信息的集合中
|
||||
trendChartsOutput.getTemperaturePulses().get(0).getChartsSmalls().add(postopSmall);
|
||||
}
|
||||
// 计算术后天数
|
||||
for (LocalDate currentDate = postopDateList.get(0).toLocalDate(); !currentDate.isAfter(endDate);
|
||||
currentDate = currentDate.plusDays(1)) {
|
||||
// 获取术后天数
|
||||
String typeValue = OperationDayCalculator.calculateOperationDay(
|
||||
postopDateList.stream().map(LocalDateTime::toLocalDate).toList(), currentDate);
|
||||
// 封装[术后天数]信息
|
||||
Date date = Date.from(currentDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
TrendChartsSmall postopSmall =
|
||||
new TrendChartsSmall(null, date, null, TemperatureChartEnum.POSTOP_DAYS.getCode(), typeValue,
|
||||
calculateWeek(trendChartsOutput.getHospDate(), date), null, null);
|
||||
trendChartsOutput.getOthers().add(postopSmall);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取住院、出院时间
|
||||
*
|
||||
* @param encounterId 病历ID
|
||||
* @param patientId 患者ID
|
||||
* @return 住院时间
|
||||
*/
|
||||
private Map<String, Date> getDateByEncounterId(Long encounterId, Long patientId) {
|
||||
String sql =
|
||||
"SELECT start_time,end_time FROM adm_encounter WHERE id = ? AND patient_id = ? AND status_enum = ? AND class_enum = ?";
|
||||
Object[] params = {encounterId, patientId, EncounterZyStatus.ADMITTED_TO_THE_HOSPITAL.getValue(),
|
||||
EncounterClass.IMP.getValue()};
|
||||
Map<String, Object> result = jdbcTemplate.queryForMap(sql, params);
|
||||
HashMap<String, Date> map = new HashMap<>();
|
||||
map.put("hospDate", (Timestamp)result.get("start_time"));
|
||||
map.put("outTime", (Timestamp)result.get("end_time"));
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取入科时间
|
||||
*
|
||||
* @param encounterId 病历ID
|
||||
* @return 入科时间
|
||||
*/
|
||||
private Date getDateByEncounterId(Long encounterId) {
|
||||
String sql =
|
||||
"SELECT ael.start_time FROM adm_encounter ae INNER JOIN adm_encounter_location ael ON ae.ID=ael.encounter_id AND ael.form_enum=? AND ael.status_enum=? AND ael.delete_flag='0' AND ael.tenant_id=1 LEFT JOIN adm_location al ON ael.location_id=al.ID AND al.delete_flag='0' AND al.tenant_id=1 WHERE ae.ID=? AND ae.delete_flag='0' AND ae.tenant_id=1";
|
||||
Object[] params = {LocationForm.BED.getValue(), EncounterActivityStatus.ACTIVE.getValue(), encounterId};
|
||||
Timestamp timestamp = jdbcTemplate.queryForObject(sql, params, Timestamp.class);
|
||||
return Date.from(timestamp.toInstant());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取手术时间
|
||||
*
|
||||
* @param encounterId 病历ID
|
||||
* @param patientId 患者ID
|
||||
* @return 手术时间列表
|
||||
*/
|
||||
private List<LocalDateTime> getPostopDate(Long encounterId, Long patientId) {
|
||||
String sql =
|
||||
"SELECT cpp.start_time FROM cli_procedure_performer cpp LEFT JOIN cli_procedure cp ON cpp.procedure_id=cp.ID LEFT JOIN adm_encounter ae ON ae.patient_id=cp.patient_id AND ae.ID=cp.encounter_id AND ae.status_enum=? AND ae.class_enum=? WHERE cp.patient_id=? AND cp.status_enum=? AND cp.encounter_id=? AND cpp.start_time> ae.start_time AND cpp.end_time <= ae.end_time ORDER BY cpp.start_time";
|
||||
Object[] params = {EncounterZyStatus.ADMITTED_TO_THE_HOSPITAL.getValue(), EncounterClass.IMP.getValue(),
|
||||
patientId, 5, encounterId};
|
||||
List<Timestamp> dates = jdbcTemplate.queryForList(sql, Timestamp.class, params);
|
||||
|
||||
return dates.stream().map(date -> date.toLocalDateTime()).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Date转字符串
|
||||
*
|
||||
* @param date 时间
|
||||
* @param pattern 解析格式
|
||||
* @return 转后后的时间字符串
|
||||
*/
|
||||
private String formatDate(Date date, String pattern) {
|
||||
LocalDateTime localDateTime = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||
return localDateTime.format(formatter);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,21 @@
|
||||
package com.openhis.web.document.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.common.enums.DocDefinitionEnum;
|
||||
import com.openhis.common.utils.HisPageUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.document.domain.DocStatistics;
|
||||
@@ -14,13 +24,8 @@ import com.openhis.document.service.IDocStatisticsService;
|
||||
import com.openhis.web.document.appservice.IDocStatisticsAppService;
|
||||
import com.openhis.web.document.dto.DocStatisticsDto;
|
||||
import com.openhis.web.document.dto.DocStatisticsQueryParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 文档模板 业务实现类
|
||||
@@ -34,23 +39,23 @@ public class DocStatisticsAppServiceImpl implements IDocStatisticsAppService {
|
||||
@Resource
|
||||
private DocStatisticsMapper docStatisticsMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public R<?> createOrUpdte(List<DocStatisticsDto> docStatisticsList) {
|
||||
if (docStatisticsList.size() == 0) {
|
||||
return R.ok();
|
||||
}
|
||||
//根据recordId和statisticDefinitionId判断是否存在,存在则更新,不存在则新增
|
||||
// 根据recordId和statisticDefinitionId判断是否存在,存在则更新,不存在则新增
|
||||
LambdaQueryWrapper<DocStatistics> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DocStatistics::getRecordId, docStatisticsList.get(0).getRecordId());
|
||||
// queryWrapper.eq(DocStatistics::getStatisticDefinitionId, docStatisticsList.get(0).getStatisticDefinitionId());
|
||||
// queryWrapper.eq(DocStatistics::getStatisticDefinitionId,
|
||||
// docStatisticsList.get(0).getStatisticDefinitionId());
|
||||
List<DocStatistics> docStatisticsOldList = docStatisticsService.list(queryWrapper);
|
||||
if (docStatisticsOldList.size() > 0) {
|
||||
//批量删除
|
||||
// 批量删除
|
||||
docStatisticsService.removeByIds(docStatisticsOldList.stream().map(DocStatistics::getId).toList());
|
||||
}
|
||||
List<DocStatistics> docStatisticsInsertList = new ArrayList<>();
|
||||
//批量新增
|
||||
// 批量新增
|
||||
for (DocStatisticsDto docStatisticsDto : docStatisticsList) {
|
||||
DocStatistics docStatistics = new DocStatistics();
|
||||
docStatistics.setRecordId(docStatisticsDto.getRecordId());
|
||||
@@ -62,6 +67,7 @@ public class DocStatisticsAppServiceImpl implements IDocStatisticsAppService {
|
||||
docStatistics.setValue(docStatisticsDto.getValue());
|
||||
docStatistics.setRecordTime(docStatisticsDto.getRecordTime());
|
||||
docStatistics.setSource(docStatisticsDto.getSource());
|
||||
docStatistics.setDefinitionId(docStatisticsDto.getDefinitionId());
|
||||
docStatisticsInsertList.add(docStatistics);
|
||||
}
|
||||
boolean result = docStatisticsService.saveBatch(docStatisticsInsertList);
|
||||
@@ -74,7 +80,15 @@ public class DocStatisticsAppServiceImpl implements IDocStatisticsAppService {
|
||||
|
||||
@Override
|
||||
public R<?> delete(List<Long> ids) {
|
||||
return null;
|
||||
LambdaUpdateWrapper<DocStatistics> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.in(DocStatistics::getRecordId, ids);
|
||||
wrapper.set(DocStatistics::getDeleteFlag, "1");
|
||||
boolean update = docStatisticsService.update(wrapper);
|
||||
if (update) {
|
||||
return R.ok();
|
||||
} else {
|
||||
return R.fail("删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -106,19 +120,19 @@ public class DocStatisticsAppServiceImpl implements IDocStatisticsAppService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> getStatisticsList(DocStatisticsQueryParam queryParam, Integer isPage, Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
|
||||
public R<?> getStatisticsList(DocStatisticsQueryParam queryParam, Integer isPage, Integer pageNo, Integer pageSize,
|
||||
String searchKey, HttpServletRequest request) {
|
||||
// 1. 分页查询逻辑
|
||||
if (isPage != null && isPage == 1) {
|
||||
QueryWrapper<DocStatistics> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
queryParam, null, null, request);
|
||||
QueryWrapper<DocStatistics> queryWrapper = HisQueryUtils.buildQueryWrapper(queryParam, null, null, request);
|
||||
// 按记录时间倒序(最新记录在前)
|
||||
queryWrapper.lambda().orderByDesc(DocStatistics::getRecordTime);
|
||||
|
||||
Page<DocStatisticsDto> recordPage = HisPageUtils.selectPage(
|
||||
docStatisticsMapper, queryWrapper, pageNo, pageSize, DocStatisticsDto.class);
|
||||
Page<DocStatisticsDto> recordPage =
|
||||
HisPageUtils.selectPage(docStatisticsMapper, queryWrapper, pageNo, pageSize, DocStatisticsDto.class);
|
||||
return R.ok(recordPage, "获取患者文书统计数据成功");
|
||||
}
|
||||
//2. 不分页查询逻辑
|
||||
// 2. 不分页查询逻辑
|
||||
else {
|
||||
LambdaQueryWrapper<DocStatistics> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// 患者ID查询条件
|
||||
@@ -148,4 +162,48 @@ public class DocStatisticsAppServiceImpl implements IDocStatisticsAppService {
|
||||
return R.ok(dtoList, "获取患者文书统计数据成功");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据病历ID、病人ID和体温单ID获取温度单信息
|
||||
*
|
||||
* @param encounterId 病历ID
|
||||
* @param patientId 病人ID
|
||||
* @param tempId 体温单ID
|
||||
* @return 体温单信息
|
||||
*/
|
||||
@Override
|
||||
public List<DocStatisticsDto> getStatisticsListByEncounterIdAndPatientId(Long encounterId, Long patientId,
|
||||
Long tempId) {
|
||||
List<DocStatistics> statisticsList =
|
||||
docStatisticsMapper.getTempList(encounterId, patientId, tempId, DocDefinitionEnum.TEMPERATURE.getValue());
|
||||
// 实体转DTO
|
||||
List<DocStatisticsDto> dtoList = new ArrayList<>();
|
||||
for (DocStatistics statistics : statisticsList) {
|
||||
DocStatisticsDto dto = new DocStatisticsDto();
|
||||
BeanUtils.copyProperties(statistics, dto);
|
||||
dtoList.add(dto);
|
||||
}
|
||||
return dtoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存/更新入院体征
|
||||
*
|
||||
* @param docStatisticsDtoList 入院体征list
|
||||
*/
|
||||
@Override
|
||||
public void saveOrUpdateAdmissionSigns(List<DocStatisticsDto> docStatisticsDtoList) {
|
||||
// 实体类 转换
|
||||
List<DocStatistics> docStatisticsList = docStatisticsDtoList.stream().map(item -> {
|
||||
DocStatistics statistics = new DocStatistics();
|
||||
BeanUtils.copyProperties(item, statistics);
|
||||
return statistics;
|
||||
}).toList();
|
||||
// 需要删除的
|
||||
List<DocStatistics> removeList = docStatisticsList.stream().filter(item -> item.getId() != null).toList();
|
||||
// 需要新增的
|
||||
List<DocStatistics> addList = docStatisticsList.stream().filter(item -> item.getId() == null).toList();
|
||||
docStatisticsService.removeBatchByIds(removeList.stream().map(DocStatistics::getId).toList());
|
||||
docStatisticsService.saveBatch(addList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
package com.openhis.web.document.appservice.impl;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -17,14 +26,8 @@ import com.openhis.web.document.appservice.IDocStatisticsDefinitionAppService;
|
||||
import com.openhis.web.document.dto.DocStatisticsDefinitionDto;
|
||||
import com.openhis.web.document.dto.OptionDto;
|
||||
import com.openhis.web.document.mapper.DocStatisticsDefinitionAppMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 文档模板 业务实现类
|
||||
@@ -41,6 +44,7 @@ public class DocStatisticsDefinitionAppServiceImpl implements IDocStatisticsDefi
|
||||
private DocStatisticsDefinitionAppMapper docStatisticsDefinitionAppMapper;
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Override
|
||||
public R<?> createOrEdit(DocStatisticsDefinitionDto docStatisticsDefinitionDto) {
|
||||
if (docStatisticsDefinitionDto == null) {
|
||||
@@ -67,7 +71,8 @@ public class DocStatisticsDefinitionAppServiceImpl implements IDocStatisticsDefi
|
||||
}
|
||||
}
|
||||
// 区分新增/编辑逻辑
|
||||
return docStatisticsDefinitionDto.getId() == null ? add(docStatisticsDefinitionDto) : update(docStatisticsDefinitionDto);
|
||||
return docStatisticsDefinitionDto.getId() == null ? add(docStatisticsDefinitionDto)
|
||||
: update(docStatisticsDefinitionDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,6 +102,8 @@ public class DocStatisticsDefinitionAppServiceImpl implements IDocStatisticsDefi
|
||||
docStatisticsDefinition.setUnit(docStatisticsDefinitionDto.getUnit());
|
||||
docStatisticsDefinition.setDictType(docStatisticsDefinitionDto.getDictType());
|
||||
docStatisticsDefinition.setDictName(docStatisticsDefinitionDto.getDictName());
|
||||
// 新增字段:类型代码 例:003-体温
|
||||
docStatisticsDefinition.setTypeCode(docStatisticsDefinitionDto.getTypeCode());
|
||||
boolean saveResult = iDocStatisticsDefinitionService.save(docStatisticsDefinition);
|
||||
if (saveResult) {
|
||||
return R.ok("文档统计定义新增成功");
|
||||
@@ -113,7 +120,8 @@ public class DocStatisticsDefinitionAppServiceImpl implements IDocStatisticsDefi
|
||||
return R.fail(checkResult);
|
||||
}
|
||||
// 校验待更新数据是否存在
|
||||
DocStatisticsDefinition existingData = iDocStatisticsDefinitionService.getById(docStatisticsDefinitionDto.getId());
|
||||
DocStatisticsDefinition existingData =
|
||||
iDocStatisticsDefinitionService.getById(docStatisticsDefinitionDto.getId());
|
||||
if (existingData == null) {
|
||||
return R.fail("更新文档统计定义失败,目标数据不存在");
|
||||
}
|
||||
@@ -128,6 +136,7 @@ public class DocStatisticsDefinitionAppServiceImpl implements IDocStatisticsDefi
|
||||
existingData.setUnit(docStatisticsDefinitionDto.getUnit());
|
||||
existingData.setDictType(docStatisticsDefinitionDto.getDictType());
|
||||
existingData.setDictName(docStatisticsDefinitionDto.getDictName());
|
||||
existingData.setTypeCode(docStatisticsDefinitionDto.getTypeCode());
|
||||
boolean updateResult = iDocStatisticsDefinitionService.updateById(existingData);
|
||||
if (updateResult) {
|
||||
// 同步更新选项列表
|
||||
@@ -157,22 +166,22 @@ public class DocStatisticsDefinitionAppServiceImpl implements IDocStatisticsDefi
|
||||
/**
|
||||
* 分页查询列表-不包含options(分页)
|
||||
*
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 每页条数
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 每页条数
|
||||
* @param searchKey 搜索关键词
|
||||
* @param request 请求对象
|
||||
* @param request 请求对象
|
||||
* @return 分页结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> getPageList(Integer pageNo, Integer pageSize, String searchKey, HttpServletRequest request) {
|
||||
// Map<String, Object> keyMap = redisCache.getAllDictDataWithKeys(CacheConstants.SYS_DICT_KEY);
|
||||
// Map<String, Object> keyMap = redisCache.getAllDictDataWithKeys(CacheConstants.SYS_DICT_KEY);
|
||||
// 构建查询条件(支持多字段搜索)
|
||||
QueryWrapper<DocStatisticsDefinition> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
null, searchKey, new HashSet<>(Arrays.asList("name", "code")), request);
|
||||
QueryWrapper<DocStatisticsDefinition> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(null, searchKey, new HashSet<>(Arrays.asList("name", "code")), request);
|
||||
// 按记录时间倒序(最新记录在前)
|
||||
queryWrapper.lambda().orderByDesc(DocStatisticsDefinition::getDisplayOrder);
|
||||
Page<DocStatisticsDefinitionDto> recordPage = HisPageUtils.selectPage(
|
||||
docStatisticsDefinitionMapper, queryWrapper, pageNo, pageSize, DocStatisticsDefinitionDto.class);
|
||||
Page<DocStatisticsDefinitionDto> recordPage = HisPageUtils.selectPage(docStatisticsDefinitionMapper,
|
||||
queryWrapper, pageNo, pageSize, DocStatisticsDefinitionDto.class);
|
||||
// 转换为分页结果
|
||||
return R.ok(recordPage, "文档统计定义列表获取成功");
|
||||
}
|
||||
@@ -185,7 +194,7 @@ public class DocStatisticsDefinitionAppServiceImpl implements IDocStatisticsDefi
|
||||
*/
|
||||
@Override
|
||||
public List<DocStatisticsDefinitionDto> getList(Integer isStatistics) {
|
||||
Map<String, Object> keyMap = redisCache.getAllDictDataWithKeys(CacheConstants.SYS_DICT_KEY);
|
||||
Map<String, Object> keyMap = redisCache.getAllDictDataWithKeys(CacheConstants.SYS_DICT_KEY);
|
||||
LambdaQueryWrapper<DocStatisticsDefinition> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (isStatistics != null) {
|
||||
queryWrapper.eq(DocStatisticsDefinition::getIsStatistics, isStatistics);
|
||||
@@ -199,10 +208,11 @@ public class DocStatisticsDefinitionAppServiceImpl implements IDocStatisticsDefi
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DocStatisticsDefinitionDto> getListWithOptionList(Integer isStatistics) {
|
||||
//从redis中获取所有字典数据
|
||||
Map<String, Object> keyMap = redisCache.getAllDictDataWithKeys(CacheConstants.SYS_DICT_KEY);
|
||||
// 从redis中获取所有字典数据
|
||||
Map<String, Object> keyMap = redisCache.getAllDictDataWithKeys(CacheConstants.SYS_DICT_KEY);
|
||||
LambdaQueryWrapper<DocStatisticsDefinition> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (isStatistics != null) {
|
||||
queryWrapper.eq(DocStatisticsDefinition::getIsStatistics, isStatistics);
|
||||
@@ -212,15 +222,16 @@ public class DocStatisticsDefinitionAppServiceImpl implements IDocStatisticsDefi
|
||||
for (DocStatisticsDefinition data : dataList) {
|
||||
DocStatisticsDefinitionDto dto = new DocStatisticsDefinitionDto();
|
||||
BeanUtils.copyProperties(data, dto);
|
||||
if(keyMap.containsKey(CacheConstants.SYS_DICT_KEY+data.getDictType()))
|
||||
{
|
||||
List<SysDictData> dictData = (List<SysDictData>) keyMap.get(CacheConstants.SYS_DICT_KEY+data.getDictType());
|
||||
if (keyMap.containsKey(CacheConstants.SYS_DICT_KEY + data.getDictType())) {
|
||||
List<SysDictData> dictData =
|
||||
(List<SysDictData>)keyMap.get(CacheConstants.SYS_DICT_KEY + data.getDictType());
|
||||
dto.setOptionList(dictData);
|
||||
}
|
||||
resultList.add(dto);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文档统计定义选项列表并按指定格式返回
|
||||
*
|
||||
@@ -237,8 +248,8 @@ public class DocStatisticsDefinitionAppServiceImpl implements IDocStatisticsDefi
|
||||
}
|
||||
|
||||
// 3. 按code字段分组
|
||||
Map<String, List<OptionDto>> groupCodeMap = optionDtoList.stream()
|
||||
.collect(Collectors.groupingBy(OptionDto::getCode));
|
||||
Map<String, List<OptionDto>> groupCodeMap =
|
||||
optionDtoList.stream().collect(Collectors.groupingBy(OptionDto::getCode));
|
||||
|
||||
// 4. 准备最终返回的结果列表
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
@@ -260,8 +271,7 @@ public class DocStatisticsDefinitionAppServiceImpl implements IDocStatisticsDefi
|
||||
String listKey = code + "List";
|
||||
|
||||
// 检查分组中是否存在任何optionId为null的元素
|
||||
boolean hasNullOptionId = optionDtos.stream()
|
||||
.anyMatch(dto -> dto.getOptionId() == null);
|
||||
boolean hasNullOptionId = optionDtos.stream().anyMatch(dto -> dto.getOptionId() == null);
|
||||
|
||||
// 如果存在null的optionId,返回空集合;否则正常处理
|
||||
List<Map<String, Object>> optionList;
|
||||
@@ -269,14 +279,12 @@ public class DocStatisticsDefinitionAppServiceImpl implements IDocStatisticsDefi
|
||||
optionList = new ArrayList<>(); // 返回空集合
|
||||
} else {
|
||||
// 正常转换有效元素
|
||||
optionList = optionDtos.stream()
|
||||
.map(dto -> {
|
||||
Map<String, Object> optionMap = new HashMap<>();
|
||||
optionMap.put("id", dto.getOptionId().toString());
|
||||
optionMap.put("option", dto.getOption());
|
||||
return optionMap;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
optionList = optionDtos.stream().map(dto -> {
|
||||
Map<String, Object> optionMap = new HashMap<>();
|
||||
optionMap.put("id", dto.getOptionId().toString());
|
||||
optionMap.put("option", dto.getOption());
|
||||
return optionMap;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 添加列表到结果中(即使是空集合)
|
||||
@@ -287,7 +295,6 @@ public class DocStatisticsDefinitionAppServiceImpl implements IDocStatisticsDefi
|
||||
return R.ok(resultList, "文档统计定义选项列表获取成功");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public R<?> deleteDocStatisticsDefinition(Long id) {
|
||||
if (id == null) {
|
||||
@@ -301,6 +308,4 @@ public class DocStatisticsDefinitionAppServiceImpl implements IDocStatisticsDefi
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user