患者档案。

This commit is contained in:
haown 2024-08-06 15:45:18 +08:00
parent 1a7c8068b0
commit b4592aa012
7 changed files with 463 additions and 1 deletions

View File

@ -11,6 +11,7 @@ import com.xinelu.manage.domain.patientinfo.PatientInfo;
import com.xinelu.manage.dto.patientinfo.PatientBaseInfoDto;
import com.xinelu.manage.dto.patientinfo.PatientInfoDto;
import com.xinelu.manage.service.patientinfo.IPatientInfoService;
import com.xinelu.manage.vo.patientinfo.PatientInfoVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
@ -42,7 +43,7 @@ public class PatientInfoController extends BaseController {
/**
* 查询患者信息列表
*/
@ApiOperation("患者档案列表")
@ApiOperation("查询患者信息列表")
@PreAuthorize("@ss.hasPermi('manage:patientInfo:list')")
@GetMapping("/list")
public TableDataInfo list(PatientInfoDto patientInfo) {
@ -51,6 +52,22 @@ public class PatientInfoController extends BaseController {
return getDataTable(list);
}
/**
* @description 患者管理-患者档案
* @param patientInfo 患者档案查询传输对象
* @return 患者信息列表
* @Author haown
* @Date 2024-08-05 08:45
*/
@ApiOperation("患者管理-患者档案")
@PreAuthorize("@ss.hasPermi('manage:patientInfo:list')")
@GetMapping("/getPatientList")
public TableDataInfo getPatientList(PatientInfoDto patientInfo) {
startPage();
List<PatientInfoVo> list = patientInfoService.getPatientList(patientInfo);
return getDataTable(list);
}
/**
* 导出患者信息列表
*/

View File

@ -4,6 +4,8 @@ import com.xinelu.manage.domain.patientinfo.PatientInfo;
import com.xinelu.manage.domain.residentinfo.ResidentInfo;
import com.xinelu.manage.dto.patientinfo.PatientInfoDto;
import com.xinelu.manage.vo.patientinfo.PatientBaseInfoVo;
import com.xinelu.manage.vo.patientinfo.PatientInfoVo;
import com.xinelu.manage.vo.patientinfo.PatientNextTaskVo;
import java.util.List;
/**
@ -37,6 +39,24 @@ public interface PatientInfoMapper {
*/
List<PatientInfo> selectPatientInfoList(PatientInfoDto patientInfo);
/**
* @description 患者管理患者档案列表
* @param patientInfo 患者信息查询传输对象
* @return 患者信息集合
* @Author haown
* @Date 2024-08-05 14:46
*/
List<PatientInfoVo> getPatientList(PatientInfoDto patientInfo);
/**
* @description
* @param patientId 患者主键
* @return 下次任务
* @Author haown
* @Date 2024-08-06 14:54
*/
PatientNextTaskVo getPatientNextTask(Long patientId);
/**
* 新增患者信息
*

View File

@ -3,6 +3,7 @@ package com.xinelu.manage.service.patientinfo;
import com.xinelu.manage.domain.patientinfo.PatientInfo;
import com.xinelu.manage.dto.patientinfo.PatientBaseInfoDto;
import com.xinelu.manage.dto.patientinfo.PatientInfoDto;
import com.xinelu.manage.vo.patientinfo.PatientInfoVo;
import java.util.List;
/**
@ -28,6 +29,15 @@ public interface IPatientInfoService {
*/
List<PatientInfo> selectPatientInfoList(PatientInfoDto patientInfo);
/**
* @description 患者管理患者档案列表
* @param patientInfo 患者信息查询传输对象
* @return 患者信息集合
* @Author haown
* @Date 2024-08-05 14:46
*/
List<PatientInfoVo> getPatientList(PatientInfoDto patientInfo);
/**
* 查询患者信息列表
*

View File

@ -20,6 +20,8 @@ import com.xinelu.manage.mapper.residentinfo.ResidentInfoMapper;
import com.xinelu.manage.mapper.signpatientrecord.SignPatientRecordMapper;
import com.xinelu.manage.service.patientinfo.IPatientInfoService;
import com.xinelu.manage.service.patientvisitrecord.IPatientVisitRecordService;
import com.xinelu.manage.vo.patientinfo.PatientInfoVo;
import com.xinelu.manage.vo.patientinfo.PatientNextTaskVo;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
@ -70,6 +72,50 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
return patientInfoMapper.selectPatientInfoList(patientInfo);
}
/**
* @description 患者管理患者档案列表
* @param patientInfo 患者信息查询传输对象
* @return 患者信息集合
* @Author haown
* @Date 2024-08-05 14:46
*/
@DataScope(agencyAlias = "p", userAlias = "p.attending_physician_id")
@Override public List<PatientInfoVo> getPatientList(PatientInfoDto patientInfo) {
List<PatientInfoVo> patientInfoVoList = patientInfoMapper.getPatientList(patientInfo);
patientInfoVoList.forEach(patientInfoVo -> {
// 下次任务
PatientNextTaskVo patientNextTask = patientInfoMapper.getPatientNextTask(patientInfoVo.getId());
if (ObjectUtils.isNotEmpty(patientNextTask)) {
patientInfoVo.setNextTaskName(patientNextTask.getTaskName());
patientInfoVo.setNextTaskTime(patientNextTask.getExecuteDateTime());
}
});
// 按照患者id分组
//Map<Long, List<PatientInfoVo>> groupById = patientInfoVoList.stream().collect(Collectors.groupingBy(PatientInfoVo::getId));
//// 计算患者任务总数已执行任务数量已完成任务数量
//for (Long patientId : groupById.keySet()) {
// PatientInfoVo patientInfoVo = groupById.get(patientId).get(0);
// List<PatientInfoVo> perPatientList = groupById.get(patientId);
// // 任务总数
// patientInfoVo.setTaskNum(BigDecimal.valueOf(perPatientList.size()));
// // 任务执行数量
// Map<String, List<PatientInfoVo>> groupByExecute = patientInfoVoList.stream().collect(Collectors.groupingBy(PatientInfoVo::getNodeExecuteStatus));
// BigDecimal taskExecuteNum = BigDecimal.valueOf(groupByExecute.get(groupByExecute.get(NodeExecuteStatusEnum.EXECUTED.getInfo())).size());
// patientInfoVo.setTaskExecuteNum(taskExecuteNum);
// // 任务执行率
// patientInfoVo.setTaskExecuteRate(patientInfoVo.getTaskExecuteNum().divide(patientInfoVo.getTaskNum(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
// // 任务完成数量
// BigDecimal taskFinishNum = BigDecimal.valueOf(perPatientList.stream().filter(perPatient -> perPatient.getNodeFinishDate() != null).count());
// patientInfoVo.setTaskFinishNum(taskFinishNum);
// // 任务完成率
// patientInfoVo.setTaskFinishRate(patientInfoVo.getTaskFinishNum().divide(patientInfoVo.getTaskNum(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
// //
//}
return patientInfoVoList;
}
/**
* 查询患者信息列表
*

View File

@ -0,0 +1,240 @@
package com.xinelu.manage.vo.patientinfo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xinelu.common.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import lombok.Data;
/**
* @description: 患者档案列表返回视图类
* @author: haown
* @create: 2024-08-05 09:00
**/
@Data
public class PatientInfoVo {
/**
* 主键id
*/
private Long id;
/**
* 居民信息表id
*/
@ApiModelProperty(value = "居民信息表id")
private Long residentId;
/**
* 患者姓名
*/
@ApiModelProperty(value = "患者姓名")
private String patientName;
/**
* 患者电话
*/
@ApiModelProperty(value = "患者电话")
private String patientPhone;
/**
* 出生日期格式yyyy-MM-dd
*/
@ApiModelProperty(value = "出生日期格式yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate birthDate;
/**
* 身份证号
*/
@ApiModelProperty(value = "身份证号")
private String cardNo;
/**
* 性别MALEFEMALE
*/
@ApiModelProperty(value = "性别MALEFEMALE")
@Excel(name = "性别MALEFEMALE")
private String sex;
/**
* 住址
*/
@ApiModelProperty(value = "住址")
@Excel(name = "住址")
private String address;
/**
* 患者类型预住院患者PRE_HOSPITALIZED_PATIENT在院患者IN_HOSPITAL_PATIENT门诊患者OUTPATIENT出院患者DISCHARGED_PATIENT
* 签约患者CONTRACTED_PATIENT
*/
@ApiModelProperty(value = "患者类型预住院患者PRE_HOSPITALIZED_PATIENT在院患者IN_HOSPITAL_PATIENT门诊患者OUTPATIENT出院患者DISCHARGED_PATIENT签约患者CONTRACTED_PATIENT")
private String patientType;
/**
* 就诊方式门诊OUTPATIENT_SERVICE住院BE_IN_HOSPITAL
*/
@ApiModelProperty(value = "就诊方式门诊OUTPATIENT_SERVICE住院BE_IN_HOSPITAL")
private String visitMethod;
/** 就诊流水号 */
@ApiModelProperty(value = "就诊流水号")
private String visitSerialNumber;
/** 门诊/住院号 */
@ApiModelProperty(value = "门诊/住院号")
private String inHospitalNumber;
/**
* 主要诊断
*/
@ApiModelProperty(value = "主要诊断")
private String mainDiagnosis;
/**
* 主治医生
*/
@ApiModelProperty(value = "主治医生")
@Excel(name = "主治医生")
private String attendingPhysicianName;
/**
* 所属医院id
*/
@ApiModelProperty(value = "所属医院id")
private Long hospitalAgencyId;
/**
* 所属医院名称
*/
@ApiModelProperty(value = "所属医院名称")
@Excel(name = "所属医院名称")
private String hospitalAgencyName;
/**
* 所属院区id
*/
@ApiModelProperty(value = "所属院区id")
private Long campusAgencyId;
/**
* 所属院区名称
*/
@ApiModelProperty(value = "所属院区名称")
@Excel(name = "所属院区名称")
private String campusAgencyName;
/**
* 所属科室id
*/
@ApiModelProperty(value = "所属科室id")
private Long departmentId;
/**
* 所属科室名称
*/
@ApiModelProperty(value = "所属科室名称")
@Excel(name = "所属科室名称")
private String departmentName;
/**
* 所属病区id
*/
@ApiModelProperty(value = "所属病区id")
private Long wardId;
/**
* 所属病区名称
*/
@ApiModelProperty(value = "所属病区名称")
@Excel(name = "所属病区名称")
private String wardName;
/**
* 最新一条就诊记录id
*/
@ApiModelProperty(value = "最新一条就诊记录id")
private Long patientVisitRecordId;
/**
* 就诊时间格式yyyy-MM-dd HH:mm:ss
*/
@ApiModelProperty(value = "就诊时间格式yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime visitDate;
/**
* 患者来源微信小程序WE_CHAT_APPLET微信公众号WE_CHAT_OFFICIAL_ACCOUNT管理端MANAGE_END
*/
@ApiModelProperty(value = "患者来源微信小程序WE_CHAT_APPLET微信公众号WE_CHAT_OFFICIAL_ACCOUNT管理端MANAGE_END")
private String patientSource;
/** 节点任务执行状态已执行EXECUTED未执行UNEXECUTED */
@ApiModelProperty(value = "节点任务执行状态已执行EXECUTED未执行UNEXECUTED")
private String nodeExecuteStatus;
/** 患者宣教阅读或问卷提交的时间null表示尚未阅读或提交 */
@ApiModelProperty(value = "患者宣教阅读或问卷提交的时间")
private LocalDateTime nodeFinishDate;
/**
* 管理路径节点名称
*/
private String routeNodeName;
/**
* 管理路径节点时间
*/
private Integer routeNodeDay;
/**
* 任务执行时间
*/
private LocalDateTime executeDateTime;
/** 节点任务完成状态已完成EXECUTED未完成UNEXECUTED */
@ApiModelProperty(value = "节点任务执行状态已执行EXECUTED未执行UNEXECUTED")
private String nodeFinishStatus;
/**
* 任务总数
*/
@ApiModelProperty(value = "任务总数")
private BigDecimal taskNum;
/**
* 任务执行数量
*/
@ApiModelProperty(value = "任务执行数量")
private BigDecimal taskExecuteNum;
/**
* 任务执行率
*/
@ApiModelProperty(value = "任务执行率")
private BigDecimal taskExecuteRate;
/**
* 任务完成数量
*/
@ApiModelProperty(value = "任务完成数量")
private BigDecimal taskFinishNum;
/**
* 任务完成率
*/
@ApiModelProperty(value = "任务完成率")
private BigDecimal taskFinishRate;
/**
* 下次任务名称
*/
@ApiModelProperty(value = "下次任务名称")
private String nextTaskName;
@ApiModelProperty(value = "下次任务执行时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime nextTaskTime;
}

View File

@ -0,0 +1,23 @@
package com.xinelu.manage.vo.patientinfo;
import java.time.LocalDateTime;
import lombok.Data;
/**
* @description: 患者下次任务查询返回视图类
* @author: haown
* @create: 2024-08-06 14:48
**/
@Data
public class PatientNextTaskVo {
/**
* 任务名称
*/
private String taskName;
/**
* 任务执行时间
*/
private LocalDateTime executeDateTime;
}

View File

@ -169,6 +169,112 @@
order by p.id desc
</select>
<select id="getPatientList" parameterType="com.xinelu.manage.dto.patientinfo.PatientInfoDto"
resultType="com.xinelu.manage.vo.patientinfo.PatientInfoVo">
select p.*, count(p.id) as taskNum, SUM(p.task_finish_status) as taskFinishNum, SUM(p.task_execute_status) as taskExecuteNum,
ROUND(SUM(p.task_finish_status) / count(p.id) * 100, 2) as taskFinishRate,
ROUND(SUM(p.task_execute_status) / count(p.id) * 100, 2) as taskExecuteRate
from
patient_task_view p
<where>
<if test="residentId != null">
and p.resident_id = #{residentId}
</if>
<if test="patientName != null and patientName != ''">
and p.patient_name = #{patientName}
</if>
<if test="patientPhone != null and patientPhone != ''">
and p.patient_phone like concat('%', #{patientPhone}, '%')
</if>
<if test="cardNo != null and cardNo != ''">
and p.card_no = #{cardNo}
</if>
<if test="patientType != null and patientType != ''">
<choose>
<when test="patientType == 'OUTPATIENT_DISCHARGE'.toString()">
and (p.patient_type = 'OUTPATIENT' or p.patient_type = 'DISCHARGED_PATIENT')
</when>
<otherwise>
and p.patient_type = #{patientType}
</otherwise>
</choose>
</if>
<if test="attendingPhysicianId != null">
and p.attending_physician_id = #{attendingPhysicianId}
</if>
<if test="mainDiagnosis != null and mainDiagnosis != ''">
and p.main_diagnosis like concat('%', #{mainDiagnosis}, '%')
</if>
<if test="hospitalAgencyId != null ">
and p.hospital_agency_id = #{hospitalAgencyId}
</if>
<if test="campusAgencyId != null ">
and p.campus_agency_id = #{campusAgencyId}
</if>
<if test="departmentId != null ">
and p.department_id = #{departmentId}
</if>
<if test="wardId != null ">
and p.ward_id = #{wardId}
</if>
<if test="visitMethod != null and visitMethod != ''">
and p.visit_method = #{visitMethod}
</if>
<if test="visitDateStart != null ">
and date_format(p.visit_date, '%y%m%d') >= date_format(#{visitDateStart}, '%y%m%d')
</if>
<if test="visitDateEnd != null ">
and date_format(p.visit_date, '%y%m%d') &lt;= date_format(#{visitDateEnd}, '%y%m%d')
</if>
<if test="admissionTimeStart != null ">
and date_format(p.admission_time,'%y%m%d') >= date_format(#{admissionTimeStart}, '%y%m%d')
</if>
<if test="admissionTimeEnd != null ">
and date_format(p.admission_time,'%y%m%d') &lt;= date_format(#{admissionTimeEnd}, '%y%m%d')
</if>
<if test="dischargeTimeStart != null ">
and date_format(p.discharge_time,'%y%m%d') >= date_format(#{dischargeTimeStart}, '%y%m%d')
</if>
<if test="dischargeTimeEnd != null ">
and date_format(p.discharge_time,'%y%m%d') &lt;= date_format(#{dischargeTimeEnd}, '%y%m%d')
</if>
<if test="appointmentDateStart != null ">
and date_format(p.appointment_date, '%y%m%d') >= date_format(#{appointmentDateStart}, '%y%m%d')
</if>
<if test="appointmentDateEnd != null ">
and date_format(p.appointment_date, '%y%m%d') &lt;= date_format(#{appointmentDateEnd}, '%y%m%d')
</if>
<if test="appointmentTreatmentGroup != null and appointmentTreatmentGroup != ''">
and p.appointment_treatment_group = #{appointmentTreatmentGroup}
</if>
<if test="registrationNo != null and registrationNo != ''">
and p.registration_no = #{registrationNo}
</if>
<if test="visitSerialNumber != null and visitSerialNumber != ''">
and p.visit_serial_number = #{visitSerialNumber}
</if>
<if test="responsibleNurse != null and responsibleNurse != ''">
and p.responsible_nurse = #{responsibleNurse}
</if>
<if test="patientSource != null and patientSource != ''">
and p.patient_source = #{patientSource}
</if>
<if test="surgicalName != null and surgicalName != ''">
and p.surgical_name = #{surgicalName}
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where>
GROUP BY p.id order by p.id desc
</select>
<select id="getPatientNextTask" parameterType="Long" resultType="com.xinelu.manage.vo.patientinfo.PatientNextTaskVo">
select p.task_name, p.execute_date_time from patient_task_view p
where
p.id = #{patientId} and p.node_execute_status = 'UNEXECUTED'
order by p.execute_date_time limit 1
</select>
<select id="selectPatientInfoById" parameterType="Long" resultMap="PatientInfoResult">
<include refid="selectPatientInfoVo" />
where id = #{id}