门诊输液更新
This commit is contained in:
@@ -48,8 +48,6 @@ public interface IOutpatientInfusionRecordService {
|
|||||||
*/
|
*/
|
||||||
List<OutpatientInfusionRecordDto> getPatientInfusionRecord(OutpatientInfusionPatientDto outpatientInfusionPatientDto);
|
List<OutpatientInfusionRecordDto> getPatientInfusionRecord(OutpatientInfusionPatientDto outpatientInfusionPatientDto);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行单个患者门诊输液
|
* 执行单个患者门诊输液
|
||||||
*
|
*
|
||||||
@@ -59,4 +57,19 @@ public interface IOutpatientInfusionRecordService {
|
|||||||
*/
|
*/
|
||||||
boolean editPatientInfusionRecord(OutpatientInfusionRecordDto outpatientInfusionRecordDto,Long exeCount);
|
boolean editPatientInfusionRecord(OutpatientInfusionRecordDto outpatientInfusionRecordDto,Long exeCount);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行输液后,修改执行结束时间
|
||||||
|
*
|
||||||
|
* @param outpatientInfusionRecordDto 患者输液信息
|
||||||
|
* @return 修改成功/失败
|
||||||
|
*/
|
||||||
|
boolean editPatientInfusionTime(OutpatientInfusionRecordDto outpatientInfusionRecordDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示门诊输液执行记录查询
|
||||||
|
*
|
||||||
|
* @return 门诊输液记录列表
|
||||||
|
*/
|
||||||
|
List<OutpatientInfusionRecordDto> getPatientInfusionPerformRecord();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.core.common.utils.AgeCalculatorUtil;
|
import com.core.common.utils.AgeCalculatorUtil;
|
||||||
@@ -21,6 +22,8 @@ import com.core.common.utils.AssignSeqUtil;
|
|||||||
import com.core.common.utils.DateUtils;
|
import com.core.common.utils.DateUtils;
|
||||||
import com.core.common.utils.SecurityUtils;
|
import com.core.common.utils.SecurityUtils;
|
||||||
import com.openhis.administration.domain.Practitioner;
|
import com.openhis.administration.domain.Practitioner;
|
||||||
|
import com.openhis.administration.domain.PractitionerRole;
|
||||||
|
import com.openhis.administration.service.IPractitionerRoleService;
|
||||||
import com.openhis.administration.service.IPractitionerService;
|
import com.openhis.administration.service.IPractitionerService;
|
||||||
import com.openhis.common.enums.AdministrativeGender;
|
import com.openhis.common.enums.AdministrativeGender;
|
||||||
import com.openhis.common.enums.ClinicalStatus;
|
import com.openhis.common.enums.ClinicalStatus;
|
||||||
@@ -34,6 +37,7 @@ import com.openhis.web.outpatientmanage.dto.OutpatientInfusionRecordDto;
|
|||||||
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionSearchParam;
|
import com.openhis.web.outpatientmanage.dto.OutpatientInfusionSearchParam;
|
||||||
import com.openhis.web.outpatientmanage.mapper.OutpatientManageMapper;
|
import com.openhis.web.outpatientmanage.mapper.OutpatientManageMapper;
|
||||||
import com.openhis.workflow.domain.ServiceRequest;
|
import com.openhis.workflow.domain.ServiceRequest;
|
||||||
|
import com.openhis.workflow.mapper.ServiceRequestMapper;
|
||||||
import com.openhis.workflow.service.IServiceRequestService;
|
import com.openhis.workflow.service.IServiceRequestService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,6 +58,12 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
|
|||||||
@Autowired
|
@Autowired
|
||||||
IPractitionerService practitionerService;
|
IPractitionerService practitionerService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
IPractitionerRoleService practitionerRoleService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ServiceRequestMapper serviceRequestMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
/**
|
/**
|
||||||
* 获取门诊输液记录初期数据列表
|
* 获取门诊输液记录初期数据列表
|
||||||
@@ -129,6 +139,10 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
|
|||||||
// 构建查询条件
|
// 构建查询条件
|
||||||
QueryWrapper<OutpatientInfusionPatientDto> queryWrapper = HisQueryUtils.buildQueryWrapper(null, searchKey,
|
QueryWrapper<OutpatientInfusionPatientDto> queryWrapper = HisQueryUtils.buildQueryWrapper(null, searchKey,
|
||||||
new HashSet<>(Arrays.asList("patient_busNo", "encounter_busNo", "patient_name")), null);
|
new HashSet<>(Arrays.asList("patient_busNo", "encounter_busNo", "patient_name")), null);
|
||||||
|
// based_on_id 是为空的
|
||||||
|
queryWrapper.eq("based_on_id",null);
|
||||||
|
// 状态是未完成的
|
||||||
|
queryWrapper.in("status_enum", EventStatus.IN_PROGRESS.getValue(), EventStatus.NOT_DONE.getValue());
|
||||||
// 添加时间段查询条件
|
// 添加时间段查询条件
|
||||||
if (beginTime != null && endTime != null) {
|
if (beginTime != null && endTime != null) {
|
||||||
queryWrapper.ge("begin_time", beginTime);
|
queryWrapper.ge("begin_time", beginTime);
|
||||||
@@ -164,7 +178,10 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
|
|||||||
// 创建查询包装器
|
// 创建查询包装器
|
||||||
QueryWrapper<OutpatientInfusionRecordDto> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<OutpatientInfusionRecordDto> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("patient_id", outpatientInfusionPatientDto.getPatientId());
|
queryWrapper.eq("patient_id", outpatientInfusionPatientDto.getPatientId());
|
||||||
|
// based_on_id 是为空的
|
||||||
|
queryWrapper.eq("based_on_id",null);
|
||||||
|
// 状态是未完成的
|
||||||
|
queryWrapper.in("status_enum", EventStatus.IN_PROGRESS.getValue(), EventStatus.NOT_DONE.getValue());
|
||||||
// 从数据库获取输液记录列表
|
// 从数据库获取输液记录列表
|
||||||
List<OutpatientInfusionRecordDto> infusionList =
|
List<OutpatientInfusionRecordDto> infusionList =
|
||||||
outpatientManageMapper.getOutpatientInfusionRecord(queryWrapper);
|
outpatientManageMapper.getOutpatientInfusionRecord(queryWrapper);
|
||||||
@@ -187,9 +204,12 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
|
|||||||
// 根据执行人ID,通过登录userId获取
|
// 根据执行人ID,通过登录userId获取
|
||||||
Practitioner practitioner =
|
Practitioner practitioner =
|
||||||
practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId());
|
practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId());
|
||||||
if (practitioner == null) {
|
// 以执行人ID,获取执行人的身份类别
|
||||||
|
PractitionerRole practitionerRole = practitionerRoleService.getPractitionerRoleById(practitioner.getId());
|
||||||
|
if (practitioner == null || practitionerRole == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
String busNo = AssignSeqUtil.formatString(outpatientInfusionRecordDto.getBusNo(), exeCount, 3);
|
String busNo = AssignSeqUtil.formatString(outpatientInfusionRecordDto.getBusNo(), exeCount, 3);
|
||||||
// 当输液未被全部执行时,可以修改继续执行,生成一条执行记录
|
// 当输液未被全部执行时,可以修改继续执行,生成一条执行记录
|
||||||
if ((BigDecimal.valueOf(exeCount)).compareTo(outpatientInfusionRecordDto.getMedicationAntity()) < 0) {
|
if ((BigDecimal.valueOf(exeCount)).compareTo(outpatientInfusionRecordDto.getMedicationAntity()) < 0) {
|
||||||
@@ -210,20 +230,78 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR
|
|||||||
.setEncounterId(outpatientInfusionRecordDto.getEncounterId())
|
.setEncounterId(outpatientInfusionRecordDto.getEncounterId())
|
||||||
// 执行人id,通过登录userId获取
|
// 执行人id,通过登录userId获取
|
||||||
.setPerformerId(practitioner.getId())
|
.setPerformerId(practitioner.getId())
|
||||||
|
// 设置执行人身份类别
|
||||||
|
.setPerformerTypeCode(practitionerRole.getRoleCode())
|
||||||
// 设置执行日期为当前时间
|
// 设置执行日期为当前时间
|
||||||
.setOccurrenceStartTime(DateUtils.getNowDate())
|
.setOccurrenceStartTime(DateUtils.getNowDate())
|
||||||
// 默认30结束
|
// 默认30结束
|
||||||
.setOccurrenceEndTime(DateUtils.addDateMinute(DateUtils.getNowDate(), 30));
|
.setOccurrenceEndTime(DateUtils.addDateMinute(DateUtils.getNowDate(), 30));
|
||||||
|
|
||||||
boolean result = serviceRequestService.save(serviceRequest);
|
boolean result = serviceRequestService.save(serviceRequest);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 判断如果是执行该患者最后一次记录,更新原来的服请求状态
|
||||||
|
if ((BigDecimal.valueOf(exeCount + 1)).compareTo(outpatientInfusionRecordDto.getMedicationAntity()) == 0) {
|
||||||
|
// 以id为主条件更新服务申请管理表
|
||||||
|
UpdateWrapper<ServiceRequest> updateWrapper = new UpdateWrapper<>();
|
||||||
|
updateWrapper.eq("id", outpatientInfusionRecordDto.getServiceId())
|
||||||
|
.set("status_enum", EventStatus.COMPLETED.getValue())
|
||||||
|
.set("performer_type_code", practitionerRole.getRoleCode())
|
||||||
|
.set("performer_id", practitioner.getId())
|
||||||
|
.set("occurrence_start_time", DateUtils.getNowDate())
|
||||||
|
.set("occurrence_end_time", DateUtils.getNowDate());
|
||||||
|
int countUpdate = serviceRequestMapper.update(null, updateWrapper);
|
||||||
|
if (countUpdate < 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行输液后,修改执行结束时间
|
||||||
|
*
|
||||||
|
* @param outpatientInfusionRecordDto 患者输液信息
|
||||||
|
* @return 修改成功/失败
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean editPatientInfusionTime(OutpatientInfusionRecordDto outpatientInfusionRecordDto) {
|
||||||
|
// 以id为主条件更新服务申请管理表
|
||||||
|
UpdateWrapper<ServiceRequest> updateWrapper = new UpdateWrapper<>();
|
||||||
|
updateWrapper.eq("id", outpatientInfusionRecordDto.getServiceId()).set("occurrence_end_time",
|
||||||
|
DateUtils.parseDate(outpatientInfusionRecordDto.getOccurrenceEndTime()));
|
||||||
|
int countUpdate = serviceRequestMapper.update(null, updateWrapper);
|
||||||
|
if (countUpdate < 0) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示门诊输液执行记录查询
|
||||||
|
*
|
||||||
|
* @return 门诊输液记录列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<OutpatientInfusionRecordDto> getPatientInfusionPerformRecord() {
|
||||||
|
// 创建查询包装器
|
||||||
|
QueryWrapper<OutpatientInfusionRecordDto> queryWrapper = new QueryWrapper<>();
|
||||||
|
// based_on_id 不为空
|
||||||
|
queryWrapper.isNotNull("based_on_id");
|
||||||
|
// 状态是已完成
|
||||||
|
queryWrapper.eq("status_enum", EventStatus.COMPLETED.getValue());
|
||||||
|
|
||||||
|
// 从数据库获取输液记录列表
|
||||||
|
List<OutpatientInfusionRecordDto> infusionPerformList =
|
||||||
|
outpatientManageMapper.getOutpatientInfusionRecord(queryWrapper);
|
||||||
|
|
||||||
|
return infusionPerformList;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ import com.openhis.workflow.service.IServiceRequestService;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 门诊输液记录
|
* 门诊输液记录
|
||||||
*
|
*
|
||||||
@@ -80,15 +82,63 @@ public class OutpatientInfusionRecordController {
|
|||||||
* @param outpatientInfusionRecordDto 患者输液信息
|
* @param outpatientInfusionRecordDto 患者输液信息
|
||||||
* @return 门诊输液记录列表
|
* @return 门诊输液记录列表
|
||||||
*/
|
*/
|
||||||
@PutMapping("/outpatient-record-skintest")
|
@PutMapping("/infusion-perform")
|
||||||
public R<?>
|
public R<?>
|
||||||
editPatientInfusionRecord(@Validated @RequestBody OutpatientInfusionRecordDto outpatientInfusionRecordDto) {
|
editPatientInfusionRecord(@Validated @RequestBody OutpatientInfusionRecordDto outpatientInfusionRecordDto) {
|
||||||
// 获取执行次数
|
// 获取执行次数
|
||||||
Long exeCount =
|
Long exeCount =
|
||||||
serviceRequestService.countServiceRequestByBasedOnId(outpatientInfusionRecordDto.getServiceId());
|
serviceRequestService.countServiceRequestByBasedOnId(outpatientInfusionRecordDto.getServiceId());
|
||||||
outpatientInfusionRecordService.editPatientInfusionRecord(outpatientInfusionRecordDto,exeCount);
|
boolean res = outpatientInfusionRecordService.editPatientInfusionRecord(outpatientInfusionRecordDto, exeCount);
|
||||||
|
if (!res) {
|
||||||
|
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||||
|
}
|
||||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"患者门诊输液执行"}));
|
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"患者门诊输液执行"}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量执行患者门诊输液
|
||||||
|
*
|
||||||
|
* @param outpatientInfusionRecordDtoList 患者输液信息列表
|
||||||
|
* @return 门诊输液记录列表
|
||||||
|
*/
|
||||||
|
@PutMapping("/infusion-perform/batch")
|
||||||
|
public R<?> batchEditPatientInfusionRecord(
|
||||||
|
@Validated @RequestBody List<OutpatientInfusionRecordDto> outpatientInfusionRecordDtoList) {
|
||||||
|
// 获取执行次数
|
||||||
|
for (OutpatientInfusionRecordDto dto : outpatientInfusionRecordDtoList) {
|
||||||
|
Long exeCount = serviceRequestService.countServiceRequestByBasedOnId(dto.getServiceId());
|
||||||
|
boolean res = outpatientInfusionRecordService.editPatientInfusionRecord(dto, exeCount);
|
||||||
|
if (!res) {
|
||||||
|
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"患者门诊输液执行"}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行输液后,修改执行结束时间
|
||||||
|
*
|
||||||
|
* @param outpatientInfusionRecordDto 患者输液信息
|
||||||
|
*/
|
||||||
|
@PutMapping("/infusion-perform-time")
|
||||||
|
public R<?>
|
||||||
|
editPatientInfusionTime(@Validated @RequestBody OutpatientInfusionRecordDto outpatientInfusionRecordDto) {
|
||||||
|
boolean res = outpatientInfusionRecordService.editPatientInfusionTime(outpatientInfusionRecordDto);
|
||||||
|
if (!res) {
|
||||||
|
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||||
|
}
|
||||||
|
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"患者门诊输液记录"}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示门诊输液执行记录查询
|
||||||
|
*
|
||||||
|
* @return 门诊输液记录列表
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/infusion-perform-Record")
|
||||||
|
public R<?> getPatientInfusionPerformRecord() {
|
||||||
|
|
||||||
|
return R.ok(outpatientInfusionRecordService.getPatientInfusionPerformRecord());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ public class OutpatientInfusionPatientDto {
|
|||||||
/** 病人生日 */
|
/** 病人生日 */
|
||||||
private Date birthDate;
|
private Date birthDate;
|
||||||
|
|
||||||
|
/** 病人身份证号 */
|
||||||
|
private String idCard;
|
||||||
|
|
||||||
/** 病人年龄 */
|
/** 病人年龄 */
|
||||||
private String ageString;
|
private String ageString;
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ public class OutpatientInfusionRecordDto {
|
|||||||
private String genderEnum_enumText;
|
private String genderEnum_enumText;
|
||||||
|
|
||||||
/** 已执行数量 */
|
/** 已执行数量 */
|
||||||
private Integer executionCount;
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long executionCount;
|
||||||
|
|
||||||
/** 执行护士 */
|
/** 执行护士 */
|
||||||
@Dict(dictCode = "id", dictTable = "adm_practitioner", dictText = "name")
|
@Dict(dictCode = "id", dictTable = "adm_practitioner", dictText = "name")
|
||||||
|
|||||||
@@ -140,6 +140,7 @@
|
|||||||
T1.patient_busNo,
|
T1.patient_busNo,
|
||||||
T1.patient_id,
|
T1.patient_id,
|
||||||
T1.patient_name,
|
T1.patient_name,
|
||||||
|
T1.id_card,
|
||||||
T1.gender_enum,
|
T1.gender_enum,
|
||||||
T1.create_time
|
T1.create_time
|
||||||
from
|
from
|
||||||
@@ -152,6 +153,7 @@
|
|||||||
pt.bus_no AS patient_busNo, --病人ID(前台显示用)
|
pt.bus_no AS patient_busNo, --病人ID(前台显示用)
|
||||||
sr.patient_id, --病人ID
|
sr.patient_id, --病人ID
|
||||||
pt.name AS patient_name, --病人姓名
|
pt.name AS patient_name, --病人姓名
|
||||||
|
pt.name AS id_card, --病人身份证号
|
||||||
pt.gender_enum AS gender_enum, --病人性别
|
pt.gender_enum AS gender_enum, --病人性别
|
||||||
mr.create_time AS create_time --开单时间
|
mr.create_time AS create_time --开单时间
|
||||||
FROM
|
FROM
|
||||||
@@ -177,6 +179,7 @@
|
|||||||
SELECT
|
SELECT
|
||||||
T1.service_id,
|
T1.service_id,
|
||||||
T1.bus_no,
|
T1.bus_no,
|
||||||
|
T1.execution_count,
|
||||||
T1.based_on_id,
|
T1.based_on_id,
|
||||||
T1.activity_id,
|
T1.activity_id,
|
||||||
T1.prescription_no,
|
T1.prescription_no,
|
||||||
@@ -204,6 +207,7 @@
|
|||||||
SELECT
|
SELECT
|
||||||
sr.id AS service_id, --服务申请管理ID
|
sr.id AS service_id, --服务申请管理ID
|
||||||
sr.bus_no, -- 服务请求编码
|
sr.bus_no, -- 服务请求编码
|
||||||
|
(SELECT COUNT(*) FROM wor_service_request WHERE based_on_id = SPLIT_PART(sr.bus_no, '.', 1)) AS execution_count, -- 执行次数
|
||||||
sr.based_on_id, --请求基于什么的ID
|
sr.based_on_id, --请求基于什么的ID
|
||||||
sr.activity_id,--请求code,输液
|
sr.activity_id,--请求code,输液
|
||||||
sr.prescription_no, --处方号
|
sr.prescription_no, --处方号
|
||||||
@@ -242,7 +246,6 @@
|
|||||||
ad.bus_no = 'sy001' -- 皮试检查的编号,todo:编号未定,后期修改
|
ad.bus_no = 'sy001' -- 皮试检查的编号,todo:编号未定,后期修改
|
||||||
AND mr.infusion_flag = 1
|
AND mr.infusion_flag = 1
|
||||||
AND md.infusion_flag = 1
|
AND md.infusion_flag = 1
|
||||||
AND sr.status_enum in (2,3) --服务状态未完成
|
|
||||||
|
|
||||||
</where>
|
</where>
|
||||||
ORDER BY
|
ORDER BY
|
||||||
|
|||||||
Reference in New Issue
Block a user