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;
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.openhis.common.enums.*;
import com.openhis.common.utils.EnumUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
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.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.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;
@@ -44,8 +30,9 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
@AllArgsConstructor
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")
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);
return diseaseManageAppService.getDiseaseInit();
}
/**
@@ -85,24 +60,8 @@ public class DiseaseManageController {
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@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】分页
return R.ok(diseasePage);
return diseaseManageAppService.getDiseaseList(diseaseManageSelParam, searchKey, pageNo, pageSize, request);
}
/**
@@ -113,11 +72,9 @@ public class DiseaseManageController {
*/
@GetMapping("/information-one")
public R<?> getDiseaseOne(@RequestParam Long id) {
DiseaseManageDto diseaseManageDto = new DiseaseManageDto();
// 根据ID查询【病种目录】
ConditionDefinition conditionDefinition = iConditionDefinitionService.getById(id);
BeanUtils.copyProperties(conditionDefinition, diseaseManageDto);
return R.ok(diseaseManageDto);
return diseaseManageAppService.getDiseaseOne(id);
}
/**
@@ -133,9 +90,7 @@ public class DiseaseManageController {
BeanUtils.copyProperties(diseaseManageDto, conditionDefinition);
// 更新病种信息
return iConditionDefinitionService.updateById(conditionDefinition)
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"疾病目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
return diseaseManageAppService.editDisease(diseaseManageDto);
}
/**
@@ -146,19 +101,8 @@ public class DiseaseManageController {
*/
@PutMapping("/information-stop")
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)
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"疾病目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
return diseaseManageAppService.editDiseaseStop(ids);
}
/**
@@ -169,19 +113,9 @@ public class DiseaseManageController {
*/
@PutMapping("/information-start")
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)
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"疾病目录"}))
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
return diseaseManageAppService.editDiseaseStart(ids);
}
/**
@@ -192,13 +126,8 @@ public class DiseaseManageController {
*/
@PostMapping("/information")
public R<?> addDisease(@Validated @RequestBody DiseaseManageUpDto diseaseManageUpDto) {
ConditionDefinition conditionDefinition = new ConditionDefinition();
BeanUtils.copyProperties(diseaseManageUpDto, conditionDefinition);
// 新增外来病种目录
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));
return diseaseManageAppService.addDisease(diseaseManageUpDto);
}
/**

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,10 +3,7 @@ package com.openhis.web.pharmacymanage.controller;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.core.common.core.domain.R;
import com.openhis.web.pharmacymanage.appservice.IWesternMedicineDispenseAppService;
@@ -74,7 +71,7 @@ public class WesternMedicineDispenseController {
*
* @param prescriptionNo 处方号
*/
@GetMapping("/medicine-dispense")
@PutMapping("/medicine-dispense")
public R<?> medicineDispense(@RequestParam(value = "prescriptionNo") String prescriptionNo) {
return iWesternMedicineDispenseService.medicineDispense(prescriptionNo);
}
@@ -85,9 +82,10 @@ public class WesternMedicineDispenseController {
* @param prescriptionNo 处方号
* @param notPerformedReasonEnum 未发药原因
*/
@GetMapping("/medicine-cancel")
@PutMapping("/medicine-cancel")
public R<?> medicineCancel(@RequestParam(value = "prescriptionNo") String prescriptionNo,
@RequestParam(value = "prescriptionNo") Integer notPerformedReasonEnum) {
return iWesternMedicineDispenseService.medicineCancel(prescriptionNo, notPerformedReasonEnum);
@RequestParam(value = "notPerformedReasonEnum") Integer 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 com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.experimental.Accessors;
@@ -21,6 +23,7 @@ public class EncounterInfoPageDto implements Serializable {
private static final long serialVersionUID = 1L;
/** 就诊ID */
@JsonSerialize(using = ToStringSerializer.class)
private Long encounterId;
/** 科室 */

View File

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

View File

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

View File

@@ -24,11 +24,14 @@ public class PrescriptionMedicineInfoDto implements Serializable {
/** 科室 */
private String departmentName;
/** 开单医生 */
private String doctorName;
/** 项目类型 */
private String itemType;
/** 开单医生 */
private String doctorName;
/** 诊断名称 */
private String conditionName;
/** 处方号 */
private String prescriptionNo;
@@ -76,5 +79,5 @@ public class PrescriptionMedicineInfoDto implements Serializable {
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 Date birth_date;
private Date birthDate;
/** 年龄 */
private String age;
@@ -49,5 +49,5 @@ public class PrescriptionPatientInfoDto implements Serializable {
private String encounterDate;
/** 总金额 */
private BigDecimal totalPrice;
private double totalPrice;
}

View File

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

View File

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

View File

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