Merge branch 'master' of codeup.aliyun.com:61c0318acd8b75daa5a125f7/medical/openhis

This commit is contained in:
Zhang.YC
2025-03-31 09:13:10 +08:00
18 changed files with 805 additions and 384 deletions

View File

@@ -0,0 +1,80 @@
package com.openhis.web.datadictionary.appservice;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.GetMapping;
import com.core.common.core.domain.R;
import com.openhis.web.datadictionary.dto.DiseaseManageSelParam;
import com.openhis.web.datadictionary.dto.DiseaseManageUpDto;
/**
* 病种目录
*
* @author liuhr
* @date 2025/3/30
*/
public interface IDiseaseManageAppService {
/**
* 病种目录初始化
*
* @return
*/
R<?> getDiseaseInit();
/**
* 查询病种目录分页列表
*
* @param diseaseManageSelParam 查询条件
* @param searchKey 查询条件-模糊查询
* @param pageNo 当前页码
* @param pageSize 查询条数
* @return
*/
R<?> getDiseaseList(DiseaseManageSelParam diseaseManageSelParam, String searchKey, Integer pageNo, Integer pageSize,
HttpServletRequest request);
/**
* 根据id查询疾病详情
*
* @param id 疾病ID
* @return
*/
R<?> getDiseaseOne(Long id);
/**
* 病种目录编辑
*
* @param diseaseManageDto 病种目录列表
* @return
*/
R<?> editDisease(DiseaseManageUpDto diseaseManageDto);
/**
* 病种目录停用
*
* @param ids 病种目录ID列表
* @return
*/
R<?> editDiseaseStop(List<Long> ids);
/**
* 病种目录启用
*
* @param ids 病种目录ID列表
* @return
*/
R<?> editDiseaseStart(List<Long> ids);
/**
* 新增外来病种目录
*
* @param diseaseManageUpDto 病种目录
* @return
*/
R<?> addDisease(DiseaseManageUpDto diseaseManageUpDto);
}

View File

@@ -0,0 +1,205 @@
package com.openhis.web.datadictionary.appservice.impl;
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;
import javax.servlet.http.HttpServletRequest;
import com.core.common.utils.ChineseConvertUtils;
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.MessageUtils;
import com.core.common.utils.bean.BeanUtils;
import com.openhis.clinical.domain.ConditionDefinition;
import com.openhis.clinical.mapper.ConditionDefinitionMapper;
import com.openhis.clinical.service.IConditionDefinitionService;
import com.openhis.common.constant.PromptMsgConstant;
import com.openhis.common.enums.ConditionDefinitionSource;
import com.openhis.common.enums.PublicationStatus;
import com.openhis.common.enums.Whether;
import com.openhis.common.utils.EnumUtils;
import com.openhis.common.utils.HisPageUtils;
import com.openhis.common.utils.HisQueryUtils;
import com.openhis.web.datadictionary.appservice.IDiseaseManageAppService;
import com.openhis.web.datadictionary.dto.DiseaseManageDto;
import com.openhis.web.datadictionary.dto.DiseaseManageInitDto;
import com.openhis.web.datadictionary.dto.DiseaseManageSelParam;
import com.openhis.web.datadictionary.dto.DiseaseManageUpDto;
/**
* 病种目录 实现
*
* @author liuhr
* @date 2025/3/30
*/
@Service
public class DiseaseManageAppServiceImpl implements IDiseaseManageAppService {
@Autowired
private ConditionDefinitionMapper conditionDefinitionMapper;
@Autowired
private IConditionDefinitionService ConditionDefinitionService;
/**
* 病种目录初始化
*
* @return
*/
@Override
public R<?> getDiseaseInit() {
DiseaseManageInitDto diseaseManageInitDto = new DiseaseManageInitDto();
// 获取疾病目录种类
List<DiseaseManageInitDto.diseaseCategory> diseaseCategoryList = Stream.of(ConditionDefinitionSource.values())
.map(status -> new DiseaseManageInitDto.diseaseCategory(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
diseaseManageInitDto.setDiseaseCategoryList(diseaseCategoryList);
// 获取状态
List<DiseaseManageInitDto.statusEnumOption> statusEnumOptions = Stream.of(PublicationStatus.values())
.map(status -> new DiseaseManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
diseaseManageInitDto.setStatusFlagOptions(statusEnumOptions);
return R.ok(diseaseManageInitDto);
}
/**
* 查询病种目录分页列表
*
* @param diseaseManageSelParam 查询条件
* @param searchKey 查询条件-模糊查询
* @param pageNo 当前页码
* @param pageSize 查询条数
* @return
*/
public R<?> getDiseaseList(DiseaseManageSelParam diseaseManageSelParam, String searchKey, Integer pageNo,
Integer pageSize, HttpServletRequest request) {
// 构建查询条件
QueryWrapper<ConditionDefinition> queryWrapper = HisQueryUtils.buildQueryWrapper(diseaseManageSelParam,
searchKey, new HashSet<>(Arrays.asList("condition_code", "name", "py_str", "wb_str")), request);
// 设置排序
queryWrapper.orderByAsc("condition_code");
// 分页查询
Page<DiseaseManageDto> diseasePage =
HisPageUtils.selectPage(conditionDefinitionMapper, queryWrapper, pageNo, pageSize, DiseaseManageDto.class);
diseasePage.getRecords().forEach(e -> {
// 医保对码枚举类回显赋值
e.setYbMatchFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbMatchFlag()));
// 状态
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(PublicationStatus.class, e.getStatusEnum()));
});
// 返回【病种目录列表DTO】分页
return R.ok(diseasePage);
}
/**
* 根据id查询疾病详情
*
* @param id 疾病ID
* @return
*/
public R<?> getDiseaseOne(Long id) {
DiseaseManageDto diseaseManageDto = new DiseaseManageDto();
// 根据ID查询【病种目录】
ConditionDefinition conditionDefinition = ConditionDefinitionService.getById(id);
BeanUtils.copyProperties(conditionDefinition, diseaseManageDto);
return R.ok(diseaseManageDto);
}
/**
* 病种目录编辑
*
* @param diseaseManageDto 病种目录列表
* @return
*/
public R<?> editDisease(DiseaseManageUpDto diseaseManageDto) {
ConditionDefinition conditionDefinition = new ConditionDefinition();
BeanUtils.copyProperties(diseaseManageDto, conditionDefinition);
// 拼音码
conditionDefinition.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(conditionDefinition.getName()));
// 五笔码
conditionDefinition.setWbStr(ChineseConvertUtils.toWBFirstLetter(conditionDefinition.getName()));
// 更新病种信息
return ConditionDefinitionService.updateById(conditionDefinition)
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"疾病目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
/**
* 病种目录停用
*
* @param ids 病种目录ID列表
* @return
*/
public R<?> editDiseaseStop(List<Long> ids) {
List<ConditionDefinition> conditionDefinitionList = new CopyOnWriteArrayList<>();
// 取得更新值
for (Long detail : ids) {
ConditionDefinition conditionDefinition = new ConditionDefinition();
conditionDefinition.setId(detail);
conditionDefinition.setStatusEnum(PublicationStatus.RETIRED.getValue());
conditionDefinitionList.add(conditionDefinition);
}
// 更新病种信息
return ConditionDefinitionService.updateBatchById(conditionDefinitionList)
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"疾病目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
/**
* 病种目录启用
*
* @param ids 病种目录ID列表
* @return
*/
public R<?> editDiseaseStart(List<Long> ids) {
List<ConditionDefinition> conditionDefinitionList = new CopyOnWriteArrayList<>();
// 取得更新值
for (Long detail : ids) {
ConditionDefinition conditionDefinition = new ConditionDefinition();
conditionDefinition.setId(detail);
conditionDefinition.setStatusEnum(PublicationStatus.ACTIVE.getValue());
conditionDefinitionList.add(conditionDefinition);
}
// 更新病种信息
return ConditionDefinitionService.updateBatchById(conditionDefinitionList)
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"疾病目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
}
/**
* 新增外来病种目录
*
* @param diseaseManageUpDto 病种目录
* @return
*/
public R<?> addDisease(DiseaseManageUpDto diseaseManageUpDto) {
ConditionDefinition conditionDefinition = new ConditionDefinition();
BeanUtils.copyProperties(diseaseManageUpDto, conditionDefinition);
// 新增外来病种目录
conditionDefinition.setStatusEnum(PublicationStatus.DRAFT.getValue());
// 拼音码
conditionDefinition.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(conditionDefinition.getName()));
// 五笔码
conditionDefinition.setWbStr(ChineseConvertUtils.toWBFirstLetter(conditionDefinition.getName()));
return ConditionDefinitionService.addDisease(conditionDefinition)
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"疾病目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null));
}
}

View File

@@ -1,32 +1,18 @@
package com.openhis.web.datadictionary.controller; package com.openhis.web.datadictionary.controller;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.openhis.common.enums.*; import org.springframework.beans.factory.annotation.Autowired;
import com.openhis.common.utils.EnumUtils;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
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.core.domain.R;
import com.core.common.utils.MessageUtils;
import com.core.common.utils.bean.BeanUtils; import com.core.common.utils.bean.BeanUtils;
import com.openhis.clinical.domain.ConditionDefinition; import com.openhis.clinical.domain.ConditionDefinition;
import com.openhis.clinical.mapper.ConditionDefinitionMapper; import com.openhis.web.datadictionary.appservice.IDiseaseManageAppService;
import com.openhis.clinical.service.IConditionDefinitionService;
import com.openhis.common.constant.PromptMsgConstant;
import com.openhis.common.utils.HisPageUtils;
import com.openhis.common.utils.HisQueryUtils;
import com.openhis.web.datadictionary.dto.DiseaseManageDto; import com.openhis.web.datadictionary.dto.DiseaseManageDto;
import com.openhis.web.datadictionary.dto.DiseaseManageInitDto;
import com.openhis.web.datadictionary.dto.DiseaseManageSelParam; import com.openhis.web.datadictionary.dto.DiseaseManageSelParam;
import com.openhis.web.datadictionary.dto.DiseaseManageUpDto; import com.openhis.web.datadictionary.dto.DiseaseManageUpDto;
@@ -44,8 +30,9 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j @Slf4j
@AllArgsConstructor @AllArgsConstructor
public class DiseaseManageController { public class DiseaseManageController {
private final IConditionDefinitionService iConditionDefinitionService;
private final ConditionDefinitionMapper conditionDefinitionMapper; @Autowired
private IDiseaseManageAppService diseaseManageAppService;
/** /**
* 病种目录初始化 * 病种目录初始化
@@ -55,19 +42,7 @@ public class DiseaseManageController {
@GetMapping("/information-init") @GetMapping("/information-init")
public R<?> getDiseaseInit() { public R<?> getDiseaseInit() {
DiseaseManageInitDto diseaseManageInitDto = new DiseaseManageInitDto(); return diseaseManageAppService.getDiseaseInit();
// 获取疾病目录种类
List<DiseaseManageInitDto.diseaseCategory> diseaseCategoryList = Stream.of(ConditionDefinitionSource.values())
.map(status -> new DiseaseManageInitDto.diseaseCategory(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
diseaseManageInitDto.setDiseaseCategoryList(diseaseCategoryList);
// 获取状态
List<DiseaseManageInitDto.statusEnumOption> statusEnumOptions = Stream.of(PublicationStatus.values())
.map(status -> new DiseaseManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
.collect(Collectors.toList());
diseaseManageInitDto.setStatusFlagOptions(statusEnumOptions);
return R.ok(diseaseManageInitDto);
} }
/** /**
@@ -85,24 +60,8 @@ public class DiseaseManageController {
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) { @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
// 构建查询条件
QueryWrapper<ConditionDefinition> queryWrapper = HisQueryUtils.buildQueryWrapper(diseaseManageSelParam,
searchKey, new HashSet<>(Arrays.asList("condition_code", "name", "py_str", "wb_str")), request);
// 设置排序
queryWrapper.orderByAsc("condition_code");
// 分页查询
Page<DiseaseManageDto> diseasePage =
HisPageUtils.selectPage(conditionDefinitionMapper, queryWrapper, pageNo, pageSize, DiseaseManageDto.class);
diseasePage.getRecords().forEach(e -> {
// 医保对码枚举类回显赋值
e.setYbMatchFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbMatchFlag()));
//状态
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(PublicationStatus.class, e.getStatusEnum()));
});
// 返回【病种目录列表DTO】分页 // 返回【病种目录列表DTO】分页
return R.ok(diseasePage); return diseaseManageAppService.getDiseaseList(diseaseManageSelParam, searchKey, pageNo, pageSize, request);
} }
/** /**
@@ -113,11 +72,9 @@ public class DiseaseManageController {
*/ */
@GetMapping("/information-one") @GetMapping("/information-one")
public R<?> getDiseaseOne(@RequestParam Long id) { public R<?> getDiseaseOne(@RequestParam Long id) {
DiseaseManageDto diseaseManageDto = new DiseaseManageDto();
// 根据ID查询【病种目录】 // 根据ID查询【病种目录】
ConditionDefinition conditionDefinition = iConditionDefinitionService.getById(id); return diseaseManageAppService.getDiseaseOne(id);
BeanUtils.copyProperties(conditionDefinition, diseaseManageDto);
return R.ok(diseaseManageDto);
} }
/** /**
@@ -133,9 +90,7 @@ public class DiseaseManageController {
BeanUtils.copyProperties(diseaseManageDto, conditionDefinition); BeanUtils.copyProperties(diseaseManageDto, conditionDefinition);
// 更新病种信息 // 更新病种信息
return iConditionDefinitionService.updateById(conditionDefinition) return diseaseManageAppService.editDisease(diseaseManageDto);
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"疾病目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
} }
/** /**
@@ -146,19 +101,8 @@ public class DiseaseManageController {
*/ */
@PutMapping("/information-stop") @PutMapping("/information-stop")
public R<?> editDiseaseStop(@RequestBody List<Long> ids) { public R<?> editDiseaseStop(@RequestBody List<Long> ids) {
List<ConditionDefinition> conditionDefinitionList = new CopyOnWriteArrayList<>();
// 取得更新值
for (Long detail : ids) {
ConditionDefinition conditionDefinition = new ConditionDefinition();
conditionDefinition.setId(detail);
conditionDefinition.setStatusEnum(PublicationStatus.RETIRED.getValue());
conditionDefinitionList.add(conditionDefinition);
}
// 更新病种信息 // 更新病种信息
return iConditionDefinitionService.updateBatchById(conditionDefinitionList) return diseaseManageAppService.editDiseaseStop(ids);
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"疾病目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
} }
/** /**
@@ -169,19 +113,9 @@ public class DiseaseManageController {
*/ */
@PutMapping("/information-start") @PutMapping("/information-start")
public R<?> editDiseaseStart(@RequestBody List<Long> ids) { public R<?> editDiseaseStart(@RequestBody List<Long> ids) {
List<ConditionDefinition> conditionDefinitionList = new CopyOnWriteArrayList<>();
// 取得更新值
for (Long detail : ids) {
ConditionDefinition conditionDefinition = new ConditionDefinition();
conditionDefinition.setId(detail);
conditionDefinition.setStatusEnum(PublicationStatus.ACTIVE.getValue());
conditionDefinitionList.add(conditionDefinition);
}
// 更新病种信息 // 更新病种信息
return iConditionDefinitionService.updateBatchById(conditionDefinitionList) return diseaseManageAppService.editDiseaseStart(ids);
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"疾病目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
} }
/** /**
@@ -192,13 +126,8 @@ public class DiseaseManageController {
*/ */
@PostMapping("/information") @PostMapping("/information")
public R<?> addDisease(@Validated @RequestBody DiseaseManageUpDto diseaseManageUpDto) { public R<?> addDisease(@Validated @RequestBody DiseaseManageUpDto diseaseManageUpDto) {
ConditionDefinition conditionDefinition = new ConditionDefinition();
BeanUtils.copyProperties(diseaseManageUpDto, conditionDefinition); return diseaseManageAppService.addDisease(diseaseManageUpDto);
// 新增外来病种目录
conditionDefinition.setStatusEnum(PublicationStatus.DRAFT.getValue());
return iConditionDefinitionService.addDisease(conditionDefinition)
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"疾病目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null));
} }
/** /**

View File

@@ -28,7 +28,7 @@ public class DiagnosisTreatmentUpDto {
private Long id; private Long id;
/** 目录类别 */ /** 目录类别 */
@NotNull(message = "目录类别不能为空") @NotBlank(message = "目录类别不能为空")
private String categoryCode; private String categoryCode;
/** 编码 */ /** 编码 */

View File

@@ -55,9 +55,10 @@ public interface IOutpatientInfusionRecordService {
/** /**
* 门诊输液执行历史记录查询 * 门诊输液执行历史记录查询
* *
* @param patientId 患者ID
* @param historyFlag 查询的是否为执行履历 * @param historyFlag 查询的是否为执行履历
* @return 门诊输液记录列表 * @return 门诊输液记录列表
*/ */
List<OutpatientInfusionRecordDto> getPatientInfusionPerformRecord(HttpServletRequest request, boolean historyFlag); List<OutpatientInfusionRecordDto> getPatientInfusionPerformRecord(Long patientId,HttpServletRequest request, boolean historyFlag);
} }

View File

@@ -114,7 +114,7 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
// 构建查询条件 // 构建查询条件
QueryWrapper<OutpatientInfusionRecordDto> queryWrapper = QueryWrapper<OutpatientInfusionRecordDto> queryWrapper =
HisQueryUtils.buildQueryWrapper(new OutpatientInfusionPatientDto(), null, null, request); HisQueryUtils.buildQueryWrapper(null, null, null, request);
queryWrapper.eq(CommonConstants.FieldName.PatientId, outpatientInfusionPatientDto.getPatientId()); queryWrapper.eq(CommonConstants.FieldName.PatientId, outpatientInfusionPatientDto.getPatientId());
// based_on_id 是为空的 // based_on_id 是为空的
@@ -239,7 +239,7 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
public List<Long> checkServiceRequestIsCompleted() { public List<Long> checkServiceRequestIsCompleted() {
//获取全部执行输液记录 //获取全部执行输液记录
List<OutpatientInfusionRecordDto> patientInfusionList =getPatientInfusionPerformRecord(null,false); List<OutpatientInfusionRecordDto> patientInfusionList =getPatientInfusionPerformRecord(null,null,false);
// 按 serviceId 分组 // 按 serviceId 分组
Map<Long, List<OutpatientInfusionRecordDto>> servicePatientInfusionList = patientInfusionList.stream() Map<Long, List<OutpatientInfusionRecordDto>> servicePatientInfusionList = patientInfusionList.stream()
.collect(Collectors.groupingBy(OutpatientInfusionRecordDto::getServiceId)); .collect(Collectors.groupingBy(OutpatientInfusionRecordDto::getServiceId));
@@ -334,16 +334,17 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
/** /**
* 显示门诊输液执行记录查询 * 显示门诊输液执行记录查询
* *
* @param patientId 患者输液信息
* @param historyFlag 查询的是否为执行履历 * @param historyFlag 查询的是否为执行履历
* @return 返回门诊输液执行记录查询 * @return 返回门诊输液执行记录查询
*/ */
@Override @Override
public List<OutpatientInfusionRecordDto> getPatientInfusionPerformRecord(HttpServletRequest request, public List<OutpatientInfusionRecordDto> getPatientInfusionPerformRecord(Long patientId,HttpServletRequest request,
boolean historyFlag) { boolean historyFlag) {
// 构建查询条件 // 构建查询条件
QueryWrapper<OutpatientInfusionRecordDto> queryWrapper = QueryWrapper<OutpatientInfusionRecordDto> queryWrapper =
HisQueryUtils.buildQueryWrapper(new OutpatientInfusionRecordDto(), null, null, request); HisQueryUtils.buildQueryWrapper(null, null, null, request);
// 执行历史查询的条件 // 执行历史查询的条件
if (historyFlag) { if (historyFlag) {
@@ -351,24 +352,30 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
queryWrapper.isNotNull(CommonConstants.FieldName.BasedOnId); queryWrapper.isNotNull(CommonConstants.FieldName.BasedOnId);
// 状态是已完成 // 状态是已完成
queryWrapper.eq(CommonConstants.FieldName.RequestStatus, EventStatus.COMPLETED.getValue()); queryWrapper.eq(CommonConstants.FieldName.RequestStatus, EventStatus.COMPLETED.getValue());
//筛选当前ID的患者历史执行记录
queryWrapper.eq(CommonConstants.FieldName.PatientId,patientId);
//执行次数大于0
queryWrapper.gt("done_num", 0);
List<OutpatientInfusionRecordDto> infusionPerformList = editRecords(queryWrapper); // List<OutpatientInfusionRecordDto> infusionPerformList = editRecords(queryWrapper);
List<Long> medicationIds = checkServiceRequestIsCompleted(infusionPerformList); // List<Long> medicationIds = checkServiceRequestIsCompleted(infusionPerformList);
// 未产生执行历史 // // 未产生执行历史
if (medicationIds == null || medicationIds.isEmpty()) { // if (medicationIds == null || medicationIds.isEmpty()) {
return infusionPerformList; // return infusionPerformList;
} // }
// 筛选一下执行的药品 // // 筛选一下执行的药品
queryWrapper.in(CommonConstants.FieldName.MedicationId, medicationIds); // queryWrapper.in(CommonConstants.FieldName.MedicationId, medicationIds);
return editRecords(queryWrapper); return editRecords(queryWrapper);
// 门诊输液待执行记录查询 // 门诊输液待执行记录查询
} else { } else {
// based_on_id 为空,此条件筛选控制不显示执行履历 // based_on_id 为空,此条件筛选控制不显示执行履历
queryWrapper.isNull(CommonConstants.FieldName.BasedOnId); queryWrapper.isNull(CommonConstants.FieldName.BasedOnId);
// 状态是进行中 // 状态是进行中
queryWrapper.eq(CommonConstants.FieldName.RequestStatus, EventStatus.IN_PROGRESS.getValue()); queryWrapper.eq(CommonConstants.FieldName.RequestStatus, EventStatus.IN_PROGRESS.getValue());
//筛选当前ID的患者历史执行记录
queryWrapper.eq(CommonConstants.FieldName.PatientId,patientId);
return editRecords(queryWrapper); return editRecords(queryWrapper);
} }

View File

@@ -12,7 +12,6 @@ import com.core.common.core.domain.R;
import com.core.common.utils.MessageUtils; import com.core.common.utils.MessageUtils;
import com.openhis.common.constant.PromptMsgConstant; import com.openhis.common.constant.PromptMsgConstant;
import com.openhis.web.outpatientmanage.appservice.IOutpatientInfusionRecordService; import com.openhis.web.outpatientmanage.appservice.IOutpatientInfusionRecordService;
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto;
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionRecordDto; import com.openhis.web.outpatientmanage.dto.OutpatientInfusionRecordDto;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@@ -50,18 +49,18 @@ public class OutpatientInfusionRecordController {
.ok(outpatientInfusionRecordService.getOutpatientInfusionPatientList(searchKey, pageNo, pageSize, request)); .ok(outpatientInfusionRecordService.getOutpatientInfusionPatientList(searchKey, pageNo, pageSize, request));
} }
/** // /**
* 点击患者,查询该患者的输液记录 // * 点击患者,查询该患者的输液记录
* // *
* @param outpatientInfusionPatientDto 患者输液信息 // * @param outpatientInfusionPatientDto 患者输液信息
* @return 当前患者门诊输液待执行列表 // * @return 当前患者门诊输液待执行列表
*/ // */
@GetMapping(value = "/patient-infusion-record") // @GetMapping(value = "/patient-infusion-record")
public R<?> getPatientInfusionRecord(OutpatientInfusionPatientDto outpatientInfusionPatientDto, // public R<?> getPatientInfusionRecord(OutpatientInfusionPatientDto outpatientInfusionPatientDto,
HttpServletRequest request) { // HttpServletRequest request) {
//
return R.ok(outpatientInfusionRecordService.getPatientInfusionRecord(outpatientInfusionPatientDto, request)); // return R.ok(outpatientInfusionRecordService.getPatientInfusionRecord(outpatientInfusionPatientDto, request));
} // }
/** /**
* 批量执行患者门诊输液 * 批量执行患者门诊输液
@@ -98,23 +97,27 @@ public class OutpatientInfusionRecordController {
/** /**
* 门诊输液待执行记录查询 * 门诊输液待执行记录查询
* *
* @param patientId 患者ID
* @return 门诊输液待执行记录列表 * @return 门诊输液待执行记录列表
*/ */
@GetMapping(value = "/infusion-wait-perform-record") @GetMapping(value = "/infusion-wait-perform-record")
public R<?> getPatientInfusionRecords(HttpServletRequest request) { public R<?> getPatientInfusionRecords(@RequestParam(value = "patientId", required = false) Long patientId,
HttpServletRequest request) {
return R.ok(outpatientInfusionRecordService.getPatientInfusionPerformRecord(request, false)); return R.ok(outpatientInfusionRecordService.getPatientInfusionPerformRecord(patientId, request, false));
} }
/** /**
* 门诊输液执行历史记录查询 * 门诊输液执行历史记录查询
* *
* @param patientId 患者ID
* @return 门诊输液执行历史记录列表 * @return 门诊输液执行历史记录列表
*/ */
@GetMapping(value = "/infusion-perform-record") @GetMapping(value = "/infusion-perform-record")
public R<?> getPatientInfusionPerformRecord(HttpServletRequest request) { public R<?> getPatientInfusionPerformRecord(@RequestParam(value = "patientId", required = false) Long patientId,
HttpServletRequest request) {
return R.ok(outpatientInfusionRecordService.getPatientInfusionPerformRecord(request, true)); return R.ok(outpatientInfusionRecordService.getPatientInfusionPerformRecord(patientId, request, true));
} }
} }

View File

@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.util.Date; import java.util.Date;
/** /**

View File

@@ -95,11 +95,15 @@ public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineD
// 查询条件设定 // 查询条件设定
String condition = encounterInfoSearchParam.getCondition(); String condition = encounterInfoSearchParam.getCondition();
encounterInfoSearchParam.setCondition(null);
if (StringUtils.isNotEmpty(condition)){ if (StringUtils.isNotEmpty(condition)){
Pattern pattern = Pattern.compile(".*\\d.*"); Pattern pattern = Pattern.compile(".*\\d.*");
Matcher matcher = pattern.matcher(encounterInfoSearchParam.getCondition()); Matcher matcher = pattern.matcher(condition);
encounterInfoSearchParam.setIdCard(matcher.find() ? condition:""); if (matcher.find()){
encounterInfoSearchParam.setPatientName(!matcher.find() ? condition:""); encounterInfoSearchParam.setIdCard(condition);
} else{
encounterInfoSearchParam.setPatientName(condition);
}
} }
// 构建查询条件 // 构建查询条件
@@ -110,6 +114,12 @@ public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineD
Page<EncounterInfoPageDto> encounterInfoPageDto = westernMedicineDispenseMapper.selectEncounterInfoListPage( Page<EncounterInfoPageDto> encounterInfoPageDto = westernMedicineDispenseMapper.selectEncounterInfoListPage(
new Page<>(pageNo, pageSize), queryWrapper); new Page<>(pageNo, pageSize), queryWrapper);
// 个别项目设定
encounterInfoPageDto.getRecords().forEach(prescriptionPatientInfoDto -> {
// 性别
prescriptionPatientInfoDto.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class,
prescriptionPatientInfoDto.getGenderEnum()));
});
return R.ok(encounterInfoPageDto); return R.ok(encounterInfoPageDto);
} }
@@ -125,12 +135,12 @@ public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineD
PrescriptionPatientInfoDto prescriptionPatientInfoDto = westernMedicineDispenseMapper. PrescriptionPatientInfoDto prescriptionPatientInfoDto = westernMedicineDispenseMapper.
selectPrescriptionPatientInfo(encounterId); selectPrescriptionPatientInfo(encounterId);
// 年龄 // 年龄
prescriptionPatientInfoDto.setAge(AgeCalculatorUtil.getAge(prescriptionPatientInfoDto.getBirth_date())); prescriptionPatientInfoDto.setAge(AgeCalculatorUtil.getAge(prescriptionPatientInfoDto.getBirthDate()));
// 性别 // 性别
prescriptionPatientInfoDto.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, prescriptionPatientInfoDto.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class,
prescriptionPatientInfoDto.getGenderEnum())); prescriptionPatientInfoDto.getGenderEnum()));
// 合同类型 // 合同类型
if (StringUtils.isNull(prescriptionPatientInfoDto.getCategoryEnum())){ if (StringUtils.isNotNull(prescriptionPatientInfoDto.getCategoryEnum())){
prescriptionPatientInfoDto.setCategoryEnum_enumText(EnumUtils.getInfoByValue(FinCategory.class, prescriptionPatientInfoDto.setCategoryEnum_enumText(EnumUtils.getInfoByValue(FinCategory.class,
prescriptionPatientInfoDto.getCategoryEnum())); prescriptionPatientInfoDto.getCategoryEnum()));
} }
@@ -139,9 +149,9 @@ public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineD
selectPrescriptionMedicineInfoList(encounterId); selectPrescriptionMedicineInfoList(encounterId);
// 计算合计金额 // 计算合计金额
if(!prescriptionMedicineInfoList.isEmpty()) { if(!prescriptionMedicineInfoList.isEmpty()) {
BigDecimal totalPrice = new BigDecimal(0); double totalPrice = 0d;
for (PrescriptionMedicineInfoDto item : prescriptionMedicineInfoList) { for (PrescriptionMedicineInfoDto item : prescriptionMedicineInfoList) {
totalPrice.add(item.getTotal_price()); totalPrice += item.getTotalPrice().doubleValue();
} }
prescriptionPatientInfoDto.setTotalPrice(totalPrice); prescriptionPatientInfoDto.setTotalPrice(totalPrice);
} }

View File

@@ -3,10 +3,7 @@ package com.openhis.web.pharmacymanage.controller;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.core.common.core.domain.R; import com.core.common.core.domain.R;
import com.openhis.web.pharmacymanage.appservice.IWesternMedicineDispenseAppService; import com.openhis.web.pharmacymanage.appservice.IWesternMedicineDispenseAppService;
@@ -74,7 +71,7 @@ public class WesternMedicineDispenseController {
* *
* @param prescriptionNo 处方号 * @param prescriptionNo 处方号
*/ */
@GetMapping("/medicine-dispense") @PutMapping("/medicine-dispense")
public R<?> medicineDispense(@RequestParam(value = "prescriptionNo") String prescriptionNo) { public R<?> medicineDispense(@RequestParam(value = "prescriptionNo") String prescriptionNo) {
return iWesternMedicineDispenseService.medicineDispense(prescriptionNo); return iWesternMedicineDispenseService.medicineDispense(prescriptionNo);
} }
@@ -85,9 +82,10 @@ public class WesternMedicineDispenseController {
* @param prescriptionNo 处方号 * @param prescriptionNo 处方号
* @param notPerformedReasonEnum 未发药原因 * @param notPerformedReasonEnum 未发药原因
*/ */
@GetMapping("/medicine-cancel") @PutMapping("/medicine-cancel")
public R<?> medicineCancel(@RequestParam(value = "prescriptionNo") String prescriptionNo, public R<?> medicineCancel(@RequestParam(value = "prescriptionNo") String prescriptionNo,
@RequestParam(value = "prescriptionNo") Integer notPerformedReasonEnum) { @RequestParam(value = "notPerformedReasonEnum") Integer notPerformedReasonEnum) {
return iWesternMedicineDispenseService.medicineCancel(prescriptionNo, notPerformedReasonEnum); //return iWesternMedicineDispenseService.medicineCancel(prescriptionNo, notPerformedReasonEnum);
return R.ok();
} }
} }

View File

@@ -5,6 +5,8 @@ package com.openhis.web.pharmacymanage.dto;
import java.io.Serializable; import java.io.Serializable;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@@ -21,6 +23,7 @@ public class EncounterInfoPageDto implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 就诊ID */ /** 就诊ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long encounterId; private Long encounterId;
/** 科室 */ /** 科室 */

View File

@@ -19,7 +19,7 @@ import lombok.experimental.Accessors;
public class EncounterInfoSearchParam implements Serializable { public class EncounterInfoSearchParam implements Serializable {
/** 科室 */ /** 科室 */
private long departmentId; private Long departmentId;
/** 患者姓名或者证件号 */ /** 患者姓名或者证件号 */
private String condition; private String condition;

View File

@@ -5,6 +5,8 @@ package com.openhis.web.pharmacymanage.dto;
import java.util.List; import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@@ -26,6 +28,7 @@ public class PageInitDto {
@Data @Data
public static class DepartmentOption { public static class DepartmentOption {
@JsonSerialize(using = ToStringSerializer.class)
private Long value; private Long value;
private String label; private String label;

View File

@@ -24,11 +24,14 @@ public class PrescriptionMedicineInfoDto implements Serializable {
/** 科室 */ /** 科室 */
private String departmentName; private String departmentName;
/** 开单医生 */
private String doctorName;
/** 项目类型 */ /** 项目类型 */
private String itemType; private String itemType;
/** 开单医生 */ /** 诊断名称 */
private String doctorName; private String conditionName;
/** 处方号 */ /** 处方号 */
private String prescriptionNo; private String prescriptionNo;
@@ -76,5 +79,5 @@ public class PrescriptionMedicineInfoDto implements Serializable {
private BigDecimal unitPrice; private BigDecimal unitPrice;
/** 金额 */ /** 金额 */
private BigDecimal total_price; private BigDecimal totalPrice;
} }

View File

@@ -30,7 +30,7 @@ public class PrescriptionPatientInfoDto implements Serializable {
private String genderEnum_enumText; private String genderEnum_enumText;
/** 生日 */ /** 生日 */
private Date birth_date; private Date birthDate;
/** 年龄 */ /** 年龄 */
private String age; private String age;
@@ -49,5 +49,5 @@ public class PrescriptionPatientInfoDto implements Serializable {
private String encounterDate; private String encounterDate;
/** 总金额 */ /** 总金额 */
private BigDecimal totalPrice; private double totalPrice;
} }

View File

@@ -8,16 +8,17 @@
patient_name, patient_name,
gender_enum, gender_enum,
encounter_date, encounter_date,
organization_id, department_id,
id_card, id_card,
start_time start_time
FROM FROM
( (
SELECT SELECT
T1.tenant_id,
T1.id AS encounter_id, T1.id AS encounter_id,
T1.start_time, T1.start_time,
TO_CHAR(T1.start_time,'YYYY-MM-DD') AS encounter_date, TO_CHAR(T1.start_time,'YYYY-MM-DD') AS encounter_date,
T1.organization_id, T1.organization_id AS department_id,
T2.gender_enum, T2.gender_enum,
T2.name AS patient_name, T2.name AS patient_name,
T2.id_card, T2.id_card,
@@ -74,8 +75,10 @@
<select id="selectPrescriptionMedicineInfoList" resultType="com.openhis.web.pharmacymanage.dto.PrescriptionMedicineInfoDto"> <select id="selectPrescriptionMedicineInfoList" resultType="com.openhis.web.pharmacymanage.dto.PrescriptionMedicineInfoDto">
SELECT SELECT
DISTINCT DISTINCT
T7.name AS department_name, T8.name AS department_name,
T8.name AS doctor_name, T9.name AS doctor_name,
'西药开药' AS item_type,
T7.name AS condition_name,
T2.prescription_no, T2.prescription_no,
T4.name AS medicine_name, T4.name AS medicine_name,
T3.total_volume, T3.total_volume,
@@ -104,10 +107,13 @@
ON T1.med_req_id = T5.service_id ON T1.med_req_id = T5.service_id
INNER JOIN adm_encounter AS T6 INNER JOIN adm_encounter AS T6
ON T1.encounter_id = T6.id ON T1.encounter_id = T6.id
LEFT OUTER JOIN adm_organization AS T7 INNER JOIN cli_condition_definition AS T7
ON T6.organization_id = T7.id ON T2.condition_id = T7.id
LEFT OUTER JOIN adm_practitioner AS T8 LEFT OUTER JOIN adm_organization AS T8
ON T1.practitioner_id = T8.id ON T6.organization_id = T8.id
LEFT OUTER JOIN adm_practitioner AS T9
ON T1.practitioner_id = T9.id
WHERE WHERE
T1.encounter_id = #{encounterId} T1.encounter_id = #{encounterId}
AND T1.status_enum = 2 AND T1.status_enum = 2

View File

@@ -24,20 +24,24 @@ export function listWesternmedicine(query) {
}) })
} }
export function updateMedicion(prescriptionNo) {
export function updateMedicion(data) {
return request({ return request({
url: '/pharmacy-manage/western-medicine-dispense/medicine-dispense', url: '/pharmacy-manage/western-medicine-dispense/medicine-dispense',
method: 'put', method: 'put',
data: data params: {
prescriptionNo: prescriptionNo
}
}) })
} }
export function backMedicion(data) { export function backMedicion(prescriptionNo,notPerformedReasonEnum) {
return request({ return request({
url: '/pharmacy-manage/western-medicine-dispense/medicine-cancel', url: '/pharmacy-manage/western-medicine-dispense/medicine-cancel',
method: 'put', method: 'put',
data: data params: {
prescriptionNo: prescriptionNo,
notPerformedReasonEnum:notPerformedReasonEnum
}
}) })
} }

View File

@@ -1,88 +1,162 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<div class="left"> <div class="left">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch"> <el-form
<el-form-item label="姓名或证件号" prop="condition"> :model="queryParams"
<el-input v-model="queryParams.condition" placeholder="请输入姓名/证件号" clearable style="width: 150px" ref="queryRef"
@keyup.enter="handleQuery" /> :inline="true"
</el-form-item> v-show="showSearch"
<el-form-item label="就诊日期"> >
<el-date-picker v-model="dateRange" type="datetimerange" start-placeholder="开始日期" <el-form-item label="姓名或证件号" prop="condition">
end-placeholder="结束日期" style="width: auto" value-format="YYYY-MM-DD HH:mm:ss" /> <el-input
</el-form-item> v-model="queryParams.condition"
<el-form-item label="科室" prop="departmentId"> placeholder="请输入姓名/证件号"
<el-select v-model="queryParams.departmentId" placeholder="请选择科室" clearable clearable
@keyup.enter="handleQuery" style="width: 160px"> style="width: 150px"
<el-option v-for="item in departmentList" :key="item.value" :label="item.label" @keyup.enter="handleQuery"
:value="item.value" /> />
</el-select> </el-form-item>
</el-form-item> <el-form-item label="就诊日期">
<el-form-item> <el-date-picker
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> v-model="dateRange"
<el-button icon="Refresh" @click="resetQuery">重置</el-button> type="daterange"
</el-form-item> start-placeholder="开始日期"
</el-form> end-placeholder="结束日期"
style="width: auto"
value-format="YYYY-MM-DD"
/>
</el-form-item>
<el-form-item label="科室" prop="departmentId">
<el-select
v-model="queryParams.departmentId"
placeholder="请选择科室"
clearable
@keyup.enter="handleQuery"
style="width: 160px"
>
<el-option
v-for="item in departmentList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"
>搜索</el-button
>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table :data="patientList" border style="width: 100%; height: 60vh" highlight-current-row <el-table
@current-change="handleCurrentChange"> :data="patientList"
<el-table-column prop="prescriptionNo" label="科室" width="120" /> border
<el-table-column prop="patientName" label="姓名" width="100" /> style="width: 100%; height: 60vh"
<el-table-column prop="genderEnum_enumText" label="性别" width="80" /> highlight-current-row
<!-- <el-table-column prop="ageString" label="开单医生" width="80" /> --> @current-change="handleCurrentChange"
<el-table-column prop="idCard" label="就诊日期" width="140" /> >
</el-table> <el-table-column prop="departmentName" label="科室" width="120" />
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNo" <el-table-column prop="patientName" label="姓名" width="100" />
v-model:limit="queryParams.pageSize" @pagination="getList" /> <el-table-column prop="genderEnum_enumText" label="性别" width="80" />
</div> <!-- <el-table-column prop="ageString" label="开单医生" width="80" /> -->
<el-table-column prop="encounterDate" label="就诊日期" width="140" />
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</div>
<div class="right"> <div class="right">
<div style="display: flex; align-items: center;"> <div style="display: flex; align-items: center">
<p style="margin-right: 60px;font-size: 19px;">患者基本信息</p> <p style="margin-right: 60px; font-size: 19px">患者基本信息</p>
<el-button type="primary" plain @click="submitMedicine" icon="SuccessFilled">发药</el-button>
<el-button type="warning" plain @click="backMedicine" icon="CircleClose" <!-- <el-button type="success" plain @click="print" icon="Printer" style="margin-left: 30px;">打印</el-button> -->
style="margin-left: 30px;">作废</el-button> </div>
<el-button type="success" plain @click="print" icon="Printer" style="margin-left: 30px;">打印</el-button> <div class="top">
</div> <el-row>
<div class="top"> <el-col :span="4">姓名{{ personInfo.patientName }}</el-col>
<el-row> <el-col :span="3">性别{{ personInfo.genderEnum_enumText }}</el-col>
<el-col :span="4">姓名</el-col> <el-col :span="3">年龄{{ personInfo.age }}</el-col>
<el-col :span="3">性别</el-col> <el-col :span="5"
<el-col :span="3">年龄</el-col> >合同类型{{ personInfo.categoryEnum_enumText }}</el-col
<el-col :span="4">合同类型</el-col> > </el-row
<el-col :span="6">证件号</el-col> ><br />
</el-row><br> <el-row>
<el-row> <el-col :span="5">就诊科室{{ personInfo.organizationName }}</el-col>
<el-col :span="4">就诊科室</el-col> <el-col :span="5">就诊日期{{ personInfo.encounterDate }}</el-col>
<el-col :span="4">就诊日期</el-col> <el-col :span="7">证件号{{ personInfo.idCard }}</el-col>
<el-col :span="6">门诊诊断{{ medicineInfoList.a }}</el-col>
</el-row><br> <!-- <el-col :span="6">门诊诊断{{ personInfo.patientName }}</el-col> --> </el-row
<el-row> ><br />
<el-col :span="4">总金额{{ price ? price.toFixed(2) : '0.00' }}</el-col> <el-row>
</el-row> <el-col :span="4"
</div> >总金额{{
<el-table :data="medicineInfoList" border style="width: 100%; height: 65vh;margin-top: 10px;" personInfo.totalPrice ? personInfo.totalPrice.toFixed(2) : "0.00"
:row-style="rowStyle" :span-method="spanMethod" @selection-change="handleSelectionChange" }}</el-col
ref="tableRef"> >
<el-table-column type="selection" width="40" align="center" /> </el-row>
<el-table-column prop="executeNum" label="科室" width="90" /> </div>
<el-table-column prop="executeNum" label="开单医生" width="100" /> <el-table
<el-table-column prop="executeNum" label="项目类型" width="100" /> :data="medicineInfoList"
<el-table-column prop="doneNum" label="诊断" width="120" /> border
<el-table-column prop="prescriptionNo" label="处方号" width="120" /> style="width: 100%; height: 65vh; margin-top: 10px"
<el-table-column prop="markers" label="成组" width="60"> :row-style="rowStyle"
<template #default="scope"> :span-method="spanMethod"
<span>{{ markers[scope.$index] }}</span> @selection-change="handleSelectionChange"
</template> ref="tableRef"
</el-table-column> >
<el-table-column prop="medicineName" label="药品名称" width="120" /> <el-table-column
<el-table-column prop="totalVolume" label="规格" width="100" /> label="操作"
<el-table-column prop="medicationInformation" label="剂量" width="100" /> align="center"
<el-table-column prop="rateCode" label="频次" width="100" /> width="160"
<el-table-column prop="methodCode" label="用法" width="80" /> class-name="small-padding fixed-width"
<el-table-column prop="dispensePerDuration" label="天数" width="60" /> >
<el-table-column prop="dispensePerQuantity" label="单次发药数" width="80" /> <template #default="scope">
<el-table-column prop="quantity" label="数量" width="80" /> <el-button
<!-- <el-table-column prop="performOrg_dictText" label="是否拆零" width="120"> link
type="primary"
icon="SuccessFilled"
@click="submitMedicine(scope.row)"
>发药</el-button
>
<el-button
link
type="primary"
@click="backMedicine(scope.row)"
icon="CircleClose"
>作废</el-button
>
</template>
</el-table-column>
<el-table-column prop="departmentName" label="科室" width="90" />
<el-table-column prop="doctorName" label="开单医生" width="100" />
<el-table-column prop="itemType" label="项目类型" width="100" />
<el-table-column prop="conditionName" label="诊断" width="120" />
<el-table-column prop="prescriptionNo" label="处方号" width="120" />
<el-table-column prop="markers" label="成组" width="60">
<template #default="scope">
<span>{{ markers[scope.$index] }}</span>
</template>
</el-table-column>
<el-table-column prop="medicineName" label="药品名称" width="120" />
<el-table-column prop="totalVolume" label="规格" width="100" />
<el-table-column prop="dose" label="剂量" width="100" />
<el-table-column prop="rateCode" label="频次" width="100" />
<el-table-column prop="methodCode" label="用法" width="80" />
<el-table-column prop="dispensePerDuration" label="天数" width="60" />
<el-table-column
prop="dispensePerQuantity"
label="单次发药数"
width="80"
/>
<el-table-column prop="quantity" label="数量" width="80" />
<!-- <el-table-column prop="performOrg_dictText" label="是否拆零" width="120">
<template #default="scope"> <template #default="scope">
<el-select v-model="scope.row.performOrg_dictText" placeholder="请选择" <el-select v-model="scope.row.performOrg_dictText" placeholder="请选择"
@change="handleSelectChange(scope.row)"> @change="handleSelectChange(scope.row)">
@@ -91,37 +165,52 @@
</el-select> </el-select>
</template> </template>
</el-table-column> --> </el-table-column> -->
<!-- <el-table-column prop="medicationStatusEnum_enumText" label="追溯码" width="100" /> --> <!-- <el-table-column prop="medicationStatusEnum_enumText" label="追溯码" width="100" /> -->
<el-table-column prop="unitPrice" label="单价" width="60" :formatter="formatPrice" /> <el-table-column
<el-table-column prop="total_price" label="金额" width="70" :formatter="formatPrice" /> prop="unitPrice"
</el-table> label="单价"
</div> width="60"
<el-dialog title="选择作废原因" v-model="showDialog" width="30%"> :formatter="formatPrice"
<!-- 下拉选择框 --> />
<el-select v-model="notPerformedReasonEnum" placeholder="请选择作废原因"> <el-table-column
<el-option v-for="item in backReason" :key="item.value" :label="item.label" :value="item.value" /> prop="totalPrice"
</el-select> label="金额"
width="70"
<!-- 弹窗底部按钮 --> :formatter="formatPrice"
<template #footer> />
<span class="dialog-footer"> </el-table>
<el-button @click="handleCancel"> </el-button>
<el-button type="primary" @click="handleConfirm"> </el-button>
</span>
</template>
</el-dialog>
</div> </div>
<el-dialog title="选择作废原因" v-model="showDialog" width="30%">
<!-- 下拉选择框 -->
<el-select v-model="notPerformedReasonEnum" placeholder="请选择作废原因">
<el-option
v-for="item in backReason"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<!-- 弹窗底部按钮 -->
<template #footer>
<span class="dialog-footer">
<el-button @click="handleCancel"> </el-button>
<el-button type="primary" @click="handleConfirm"> </el-button>
</span>
</template>
</el-dialog>
</div>
</template> </template>
<script setup name="westernmedicine"> <script setup name="westernmedicine">
import { ref, computed } from "vue"; import { ref, computed, onMounted, onBeforeMount } from "vue";
import { ElMessage } from 'element-plus'; import { ElMessage } from "element-plus";
import { import {
listWesternmedicine, listWesternmedicine,
listPatient, listPatient,
updateMedicion, updateMedicion,
listInit, listInit,
backMedicion backMedicion,
} from "./components/api"; } from "./components/api";
const showSearch = ref(true); const showSearch = ref(true);
@@ -132,193 +221,272 @@ const medicineInfoList = ref([]);
const departmentList = ref([]); const departmentList = ref([]);
const dateRange = ref([]); const dateRange = ref([]);
const personInfo = ref([]); const personInfo = ref([]);
const diagnoses = ref(''); const diagnoses = ref("");
const backReason = ref([]); const backReason = ref([]);
const selectedPrescriptionNo = ref(''); const selectedPrescriptionNo = ref("");
const showDialog = ref(false); const showDialog = ref(false);
const notPerformedReasonEnum = ref(); const notPerformedReasonEnum = ref();
const currentRow = ref(null);
const tableRef = ref(null);
const selectedGroupIds = ref(new Set());
const selectedItems = ref(new Set());
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const data = reactive({ const data = reactive({
form: {}, form: {},
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
condition: null, condition: null,
departmentId: null departmentId: null,
}, },
}); });
const { queryParams } = toRefs(data); const { queryParams } = toRefs(data);
function getList() { // 在组件挂载后调用 getList
console.log("222",queryParams.value) onMounted(() => {
listPatient(queryParams.value).then((response) => { setDefaultDateRange();
console.log("Full response1:", response); getList();
patientList.value = response.data.records; });
total.value = response.data.total;
}); // 设置默认日期范围为当天
listInit().then((response) => { function setDefaultDateRange() {
console.log("Full response2:", response); const today = new Date();
departmentList.value = [ const year = today.getFullYear();
{ value: null, label: '全部' }, const month = String(today.getMonth() + 1).padStart(2, "0");
...response.data.departmentOptions const day = String(today.getDate()).padStart(2, "0");
]; const formattedDate = `${year}-${month}-${day}`;
backReason.value = response.data.notPerformedReasonOptions dateRange.value = [formattedDate, formattedDate];
}); console.log("222", dateRange.value);
} }
function getList() {
console.log("224555552", dateRange.value);
queryParams.value.startTimeSTime = dateRange.value[0] + " 00:00:00";
queryParams.value.startTimeETime = dateRange.value[1] + " 23:59:59";
console.log("222", queryParams.value);
listPatient(queryParams.value).then((response) => {
console.log("Full response1:", response);
patientList.value = response.data.records;
total.value = response.data.total;
});
listInit().then((response) => {
console.log("Full response2:", response);
departmentList.value = [
{ value: null, label: "全部" },
...response.data.departmentOptions,
];
backReason.value = response.data.notPerformedReasonOptions;
});
}
/** 重置按钮操作 */
function resetQuery() {
setDefaultDateRange();
medicineInfoList.value = [];
personInfo.value = [];
proxy.resetForm("queryRef");
getList();
}
/** 搜索按钮操作 */ /** 搜索按钮操作 */
function handleQuery() { function handleQuery() {
if (dateRange.value) { if (dateRange.value) {
queryParams.value.startTimeSTime = dateRange.value[0]; queryParams.value.startTimeSTime = dateRange.value[0] + " 00:00:00";
queryParams.value.startTimeETime = dateRange.value[1]; queryParams.value.startTimeETime = dateRange.value[1] + " 23:59:59";
} else { } else {
queryParams.value.startTimeSTime = null; queryParams.value.startTimeSTime = null;
queryParams.value.startTimeETime = null; queryParams.value.startTimeETime = null;
} }
queryParams.value.pageNo = 1; queryParams.value.pageNo = 1;
getList(); listPatient(queryParams.value).then((response) => {
patientList.value = response.data.records;
total.value = response.data.total;
});
} }
function countGroupRows(data) { function countGroupRows(data) {
const groupCounts = new Map(); const groupCounts = new Map();
data.forEach((item, index) => { data.forEach((item, index) => {
if (!groupCounts.has(item.prescriptionNo)) { if (!groupCounts.has(item.prescriptionNo)) {
groupCounts.set(item.prescriptionNo, { count: 0, indices: [] }); groupCounts.set(item.prescriptionNo, { count: 0, indices: [] });
} }
const groupInfo = groupCounts.get(item.prescriptionNo); const groupInfo = groupCounts.get(item.prescriptionNo);
groupInfo.count++; groupInfo.count++;
groupInfo.indices.push(index); groupInfo.indices.push(index);
}); });
return groupCounts; return groupCounts;
} }
function getRowMarkers(groupCounts, data) { function getRowMarkers(groupCounts, data) {
const markers = new Array(data.length).fill(""); const markers = new Array(data.length).fill("");
groupCounts.forEach((groupInfo, prescriptionNo) => { groupCounts.forEach((groupInfo, prescriptionNo) => {
const { count, indices } = groupInfo; const { count, indices } = groupInfo;
if (count === 1) { if (count === 1) {
// 如果只有一行,不显示标记 // 如果只有一行,不显示标记
return; return;
} else if (count === 2) { } else if (count === 2) {
// 如果有两行,分别显示左右括号 // 如果有两行,分别显示左右括号
markers[indices[0]] = "┏"; markers[indices[0]] = "┏";
markers[indices[1]] = "┗ "; markers[indices[1]] = "┗ ";
} else { } else {
// 如果有两行以上,第一条显示左括号,中间用竖线,最后一条显示右括号 // 如果有两行以上,第一条显示左括号,中间用竖线,最后一条显示右括号
markers[indices[0]] = "┏"; markers[indices[0]] = "┏";
for (let i = 1; i < indices.length - 1; i++) { for (let i = 1; i < indices.length - 1; i++) {
markers[indices[i]] = "┃"; markers[indices[i]] = "┃";
} }
markers[indices[indices.length - 1]] = "┗ "; markers[indices[indices.length - 1]] = "┗ ";
} }
}); });
return markers; return markers;
} }
function handleSelectionChange(selection) { function handleSelectionChange(selection) {
selectedPrescriptionNo.value = ''; // 清空之前选中的数据
if (selection.length > 0) { selectedItems.value.clear();
// 获取选中行的 prescriptionNo // 将当前选中的数据存到 selectedItems 中
selectedPrescriptionNo.value = selection[0].prescriptionNo; selection.forEach((item) => {
selectedItems.value.add(item);
});
// 更新 selectedGroupIds
selection.forEach((item) => {
const prescriptionNo = item.prescriptionNo;
// 检查 prescriptionNo 是否同时存在
if (selectedGroupIds.value.has(prescriptionNo)) {
// 如果都存在,则移除它们
selectedGroupIds.value.delete(prescriptionNo);
} else { } else {
selectedPrescriptionNo.value = ''; // 否则添加它们
selectedGroupIds.value.add(prescriptionNo);
} }
});
// 动态更新表格行的选中状态
medicineInfoList.value.forEach((row) => {
const isSelected = selectedGroupIds.value.has(row.prescriptionNo);
tableRef.value.toggleRowSelection(row, isSelected);
});
} }
// 行合并逻辑
function spanMethod({ row, column, rowIndex, columnIndex }) { function spanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 6) { // 假设药品名称在第7列索引为6 // 定义需要合并的列范围前6列包括selection列
const medicineName = row.genderEnum_enumText; const columnsToMerge = [0, 1, 2, 3, 4, 5]; // 假设selection列是第0列其他列依次是1, 2, 3, 4, 5
const count = medicineInfoList.value.filter(item => item.genderEnum_enumText === medicineName).length;
if (rowIndex % count === 0) { // 检查当前列是否在需要合并的列范围内
return [count, 1]; if (columnsToMerge.includes(columnIndex)) {
} else { const prescriptionNo = row.prescriptionNo;
return [0, 0];
} // 查找当前处方号在列表中第一次出现的索引
const firstRowIndex = medicineInfoList.value.findIndex(
(item) => item.prescriptionNo === prescriptionNo
);
// 如果当前行是该处方号的首行则合并count行
if (rowIndex === firstRowIndex) {
// 计算该处方号的总行数
const count = medicineInfoList.value.filter(
(item) => item.prescriptionNo === prescriptionNo
).length;
return [count, 1]; // 合并count行1列
} else {
return [0, 0]; // 其他行不显示
} }
}
// 其他列不进行合并
return [1, 1];
} }
function formatPrice(row, column, cellValue) { function formatPrice(row, column, cellValue) {
if (cellValue === null || cellValue === undefined) { if (cellValue === null || cellValue === undefined) {
return '0.00'; // 如果值为空返回0.00 return "0.00"; // 如果值为空返回0.00
} }
return cellValue.toFixed(2); // 保留两位小数 return cellValue.toFixed(2); // 保留两位小数
} }
function handleCurrentChange(row) { function handleCurrentChange(row) {
currentRow.value = row; // 更新当前选中行的数据 currentRow.value = row; // 更新当前选中行的数据
console.log("当前选中行的数据:", currentRow.value); console.log("当前选中行的数据:", currentRow.value);
listWesternmedicine(currentRow.value).then((response) => {
console.log("121212", response);
personInfo.value = response.data.prescriptionPatientInfoDto;
medicineInfoList.value = response.data.prescriptionMedicineInfoDtoList;
// 统计每个 prescriptionNo 的行数
const groupCounts = countGroupRows(medicineInfoList.value);
// 设置每行的标记
markers.value = getRowMarkers(groupCounts, medicineInfoList.value);
diagnoses.value = medicineInfoList.value
.map((item) => item.诊断 || "无")
.join(", ");
});
}
function submitMedicine(row) {
updateMedicion(row.prescriptionNo).then((response) => {
proxy.$modal.msgSuccess("发药成功");
listWesternmedicine(currentRow.value).then((response) => { listWesternmedicine(currentRow.value).then((response) => {
medicineInfoList.value = response.data; medicineInfoList.value = response.data;
// 统计每个 groupId 的行数 // 统计每个 prescriptionNo 的行数
const groupCounts = countGroupRows(medicineInfoList.value); const groupCounts = countGroupRows(medicineInfoList.value);
// 设置每行的标记 // 设置每行的标记
markers.value = getRowMarkers(groupCounts, medicineInfoList.value); markers.value = getRowMarkers(groupCounts, medicineInfoList.value);
diagnoses.value = medicineInfoList.value.map(item => item.诊断 || '无').join(', ');
}); });
});
} }
function submitMedicine() { function backMedicine(row) {
updateMedicion(selectedPrescriptionNo.value).then((response) => { showDialog.value = true;
proxy.$modal.msgSuccess("发药成功"); selectedPrescriptionNo.value = row.prescriptionNo;
listWesternmedicine(currentRow.value.encounterId).then((response) => { console.log("作废原因:", selectedPrescriptionNo.value, row.prescriptionNo);
medicineInfoList.value = response.data;
// 统计每个 groupId 的行数
const groupCounts = countGroupRows(medicineInfoList.value);
// 设置每行的标记
markers.value = getRowMarkers(groupCounts, medicineInfoList.value);
});
});
}
function backMedicine() {
showDialog.value = true;
} }
function handleConfirm() { function handleConfirm() {
if (!notPerformedReasonEnum.value) { if (!notPerformedReasonEnum.value) {
ElMessage.error('请选择作废原因'); ElMessage.error("请选择作废原因");
return; return;
} }
// 在这里处理作废逻辑,比如调用 API backMedicion(selectedPrescriptionNo.value, notPerformedReasonEnum.value).then(
console.log('作废原因:', selectedPrescriptionNo.value,notPerformedReasonEnum.value); (response) => {
// backMedicion(selectedPrescriptionNo.value,notPerformedReasonEnum.value).then((response) => { proxy.$modal.msgSuccess("作废成功");
// proxy.$modal.msgSuccess("作废成功"); }
// }); );
listWesternmedicine(currentRow.value).then((response) => {
medicineInfoList.value = response.data;
// 统计每个 prescriptionNo 的行数
const groupCounts = countGroupRows(medicineInfoList.value);
// 设置每行的标记
markers.value = getRowMarkers(groupCounts, medicineInfoList.value);
});
showDialog.value = false; showDialog.value = false;
notPerformedReasonEnum.value = ''; // 清空选择 notPerformedReasonEnum.value = ""; // 清空选择
}; }
function handleCancel() { function handleCancel() {
showDialog.value = false; showDialog.value = false;
notPerformedReasonEnum.value = ''; // 清空选择 notPerformedReasonEnum.value = ""; // 清空选择
}; }
getList();
// getList();
</script> </script>
<style scoped> <style scoped>
.app-container { .app-container {
padding: 20px; padding: 20px;
display: flex; display: flex;
} }
.left { .left {
width: 28%; width: 28%;
} }
.right { .right {
margin-left: 2%; margin-left: 2%;
width: 70%; width: 70%;
} }
:deep(.el-table tbody tr:hover > td) { :deep(.el-table tbody tr:hover > td) {
background-color: inherit !important; background-color: inherit !important;
} }
</style> </style>