From 3947391c30693400acc606d0a57ab834401c750a Mon Sep 17 00:00:00 2001
From: chenfei <18955928961@163.com>
Date: Thu, 11 Aug 2022 15:06:26 +0800
Subject: [PATCH 1/5] =?UTF-8?q?=E5=B0=B1=E8=AF=8A=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=98=AF=E5=90=A6=E5=88=A0=E9=99=A4=E6=9F=A5?=
=?UTF-8?q?=E8=AF=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../system/domain/req/TRecordResultReq.java | 13 +++++++++++++
.../ruoyi/system/service/ITPatientService.java | 16 ++++++++--------
.../resources/mapper/system/TRecordMapper.xml | 3 +++
3 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/TRecordResultReq.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/TRecordResultReq.java
index 39676ac..5afb76e 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/TRecordResultReq.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/TRecordResultReq.java
@@ -48,6 +48,9 @@ public class TRecordResultReq
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String endTime;
+ @ApiModelProperty("是否查看删除状态 默认null不查看,1为查看全部")
+ private String delFlag;
+
public String getName()
{
return name;
@@ -178,4 +181,14 @@ public class TRecordResultReq
{
this.doctorName = doctorName;
}
+
+ public String getDelFlag()
+ {
+ return delFlag;
+ }
+
+ public void setDelFlag(String delFlag)
+ {
+ this.delFlag = delFlag;
+ }
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITPatientService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITPatientService.java
index 504c354..076069a 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITPatientService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITPatientService.java
@@ -7,15 +7,15 @@ import com.ruoyi.system.domain.resp.PcTPatientQueryByPageResp;
/**
* 患者信息Service接口
- *
+ *
* @author ruoyi
* @date 2022-08-03
*/
-public interface ITPatientService
+public interface ITPatientService
{
/**
* 查询患者信息
- *
+ *
* @param id 患者信息主键
* @return 患者信息
*/
@@ -23,7 +23,7 @@ public interface ITPatientService
/**
* 查询患者信息列表
- *
+ *
* @param tPatient 患者信息
* @return 患者信息集合
*/
@@ -31,7 +31,7 @@ public interface ITPatientService
/**
* 新增患者信息
- *
+ *
* @param tPatient 患者信息
* @return 结果
*/
@@ -39,7 +39,7 @@ public interface ITPatientService
/**
* 修改患者信息
- *
+ *
* @param tPatient 患者信息
* @return 结果
*/
@@ -47,7 +47,7 @@ public interface ITPatientService
/**
* 批量删除患者信息
- *
+ *
* @param ids 需要删除的患者信息主键集合
* @return 结果
*/
@@ -55,7 +55,7 @@ public interface ITPatientService
/**
* 删除患者信息信息
- *
+ *
* @param id 患者信息主键
* @return 结果
*/
diff --git a/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml
index bf13ea1..8504bc3 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml
@@ -199,6 +199,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and tp.age = #{age}
and tp.sex = #{sex}
and tp.identifier like concat('%', #{identifier}, '%')
+
+ and td.del_flag = '0' and tp.del_flag = '0'
+
and DATE_FORMAT(tp.create_time,'%Y-%m') = DATE_FORMAT(#{createTime},'%Y-%m')
From ee3ad8b72893af1bc9d98a3da76471baf9efe69b Mon Sep 17 00:00:00 2001
From: zhuqing
Date: Thu, 11 Aug 2022 16:54:13 +0800
Subject: [PATCH 2/5] patient
---
.../web/controller/pc/TPatientController.java | 7 +-
.../domain/req/PcTPatintQueryByPageReq.java | 24 +++++++
.../resp/PcTPatientQueryByPageResp.java | 69 ++++++++++++++-----
.../ruoyi/system/mapper/TRecordMapper.java | 2 +-
.../service/impl/TDoctorServiceImpl.java | 2 +-
.../service/impl/TPatientServiceImpl.java | 23 ++++++-
.../mapper/system/TPatientMapper.xml | 13 +++-
.../resources/mapper/system/TRecordMapper.xml | 3 +-
8 files changed, 116 insertions(+), 27 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/TPatientController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/TPatientController.java
index 3c0f3b5..c7ed6a0 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/TPatientController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/TPatientController.java
@@ -60,10 +60,11 @@ public class TPatientController extends BaseController
@ApiOperation("导出患者信息列表")
@Log(title = "患者信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
- public void export(HttpServletResponse response, TPatient tPatient)
+ public void export(HttpServletResponse response, @RequestBody @Validated PcTPatintQueryByPageReq pcTPatintQueryByPageReq)
{
- List list = tPatientService.selectTPatientList(tPatient);
- ExcelUtil util = new ExcelUtil(TPatient.class);
+ List list = tPatientService.queryByPage(pcTPatintQueryByPageReq);
+ //List list = tPatientService.selectTPatientList(tPatient);
+ ExcelUtil util = new ExcelUtil(PcTPatientQueryByPageResp.class);
util.exportExcel(response, list, "患者信息数据");
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/PcTPatintQueryByPageReq.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/PcTPatintQueryByPageReq.java
index b1040f3..013f76a 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/PcTPatintQueryByPageReq.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/PcTPatintQueryByPageReq.java
@@ -37,6 +37,22 @@ public class PcTPatintQueryByPageReq {
@ApiModelProperty("名称")
private String name;
+ /** 名称 */
+ @ApiModelProperty("医生名称")
+ private String doctorName;
+
+ /** 删除标志(0代表存在 2代表删除) */
+ @ApiModelProperty("删除标志(0代表存在 2代表删除) ")
+ private String delFlag;
+
+ public String getDelFlag() {
+ return delFlag;
+ }
+
+ public void setDelFlag(String delFlag) {
+ this.delFlag = delFlag;
+ }
+
public Long getHospitalId() {
return hospitalId;
}
@@ -84,4 +100,12 @@ public class PcTPatintQueryByPageReq {
public void setName(String name) {
this.name = name;
}
+
+ public String getDoctorName() {
+ return doctorName;
+ }
+
+ public void setDoctorName(String doctorName) {
+ this.doctorName = doctorName;
+ }
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/PcTPatientQueryByPageResp.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/PcTPatientQueryByPageResp.java
index 5838bc9..7b6637a 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/PcTPatientQueryByPageResp.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/PcTPatientQueryByPageResp.java
@@ -1,6 +1,7 @@
package com.ruoyi.system.domain.resp;
import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -23,14 +24,17 @@ public class PcTPatientQueryByPageResp {
/** 编号 */
@ApiModelProperty("编号")
+ @Excel(name = "档案号")
private String identifier;
/** 名称 */
@ApiModelProperty("名称")
+ @Excel(name = "名称")
private String name;
/** 电话 */
@ApiModelProperty("电话")
+ @Excel(name = "电话")
private String phone;
/** 用户性别(0男 1女 2未知) */
@@ -39,6 +43,7 @@ public class PcTPatientQueryByPageResp {
/** 年龄 */
@ApiModelProperty("年龄")
+ @Excel(name = "年龄")
private Integer age;
/** 身高 */
@@ -55,6 +60,7 @@ public class PcTPatientQueryByPageResp {
/** 基础疾病 */
@ApiModelProperty("基础疾病")
+ @Excel(name = "基础疾病")
private String disease;
/** 删除标志(0代表存在 2代表删除) */
@@ -71,6 +77,29 @@ public class PcTPatientQueryByPageResp {
@ApiModelProperty("更新时间")
private Date updateTime;
+ /** 最后一次就诊时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @ApiModelProperty("最后诊断时间")
+ @Excel(name = "最后诊断时间")
+ private Date latestTime;
+
+ @ApiModelProperty("诊断次数")
+ @Excel(name = "诊断次数")
+ private int countRecords;
+
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @ApiModelProperty("初次就诊时间")
+ @Excel(name = "初次就诊时间")
+ private Date firstTime;
+
+ /** 基础疾病 */
+ @ApiModelProperty("诊断医生")
+ @Excel(name = "诊断医生")
+ private String doctorName;
+//
+//
+// List recordList;
+
public Long getId() {
return id;
}
@@ -183,23 +212,27 @@ public class PcTPatientQueryByPageResp {
this.updateTime = updateTime;
}
- @Override
- public String toString() {
- return "PcTPatientQueryByPageResp{" +
- "id=" + id +
- ", openId='" + openId + '\'' +
- ", identifier='" + identifier + '\'' +
- ", name='" + name + '\'' +
- ", phone='" + phone + '\'' +
- ", sex='" + sex + '\'' +
- ", age=" + age +
- ", height=" + height +
- ", weight=" + weight +
- ", marriage='" + marriage + '\'' +
- ", disease='" + disease + '\'' +
- ", delFlag='" + delFlag + '\'' +
- ", createTime=" + createTime +
- ", updateTime=" + updateTime +
- '}';
+ public Date getLatestTime() {
+ return latestTime;
+ }
+
+ public void setLatestTime(Date latestTime) {
+ this.latestTime = latestTime;
+ }
+
+ public int getCountRecords() {
+ return countRecords;
+ }
+
+ public void setCountRecords(int countRecords) {
+ this.countRecords = countRecords;
+ }
+
+ public Date getFirstTime() {
+ return firstTime;
+ }
+
+ public void setFirstTime(Date firstTime) {
+ this.firstTime = firstTime;
}
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TRecordMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TRecordMapper.java
index f27f503..6147914 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TRecordMapper.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TRecordMapper.java
@@ -88,7 +88,7 @@ public interface TRecordMapper
* @param tRecord
* @return
*/
- public List selectTRecordDoctorFirst(TRecord tRecord);
+ public List selectTRecordDoctorPatientFirst(TRecord tRecord);
/**
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TDoctorServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TDoctorServiceImpl.java
index e0ee9d1..bd1583e 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TDoctorServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TDoctorServiceImpl.java
@@ -111,7 +111,7 @@ public class TDoctorServiceImpl implements ITDoctorService
List pcTDoctorQueryByPageResps = tDoctorMapper.queryByPage(pcTDoctorQueryByPageReq);
pcTDoctorQueryByPageResps.stream().forEach(a ->{
record.setDoctorId(a.getId());
- List tRecords = tRecordMapper.selectTRecordDoctorFirst(record);
+ List tRecords = tRecordMapper.selectTRecordDoctorPatientFirst(record);
//最近一次就诊时间
if (!ObjectUtils.isEmpty(tRecords)){
a.setLatestTime(tRecords.get(0).getCreateTime());
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TPatientServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TPatientServiceImpl.java
index 2a1c529..eaafadf 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TPatientServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TPatientServiceImpl.java
@@ -4,13 +4,16 @@ import java.util.List;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.system.domain.TRecord;
import com.ruoyi.system.domain.req.PcTPatintQueryByPageReq;
import com.ruoyi.system.domain.resp.PcTPatientQueryByPageResp;
+import com.ruoyi.system.mapper.TRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TPatientMapper;
import com.ruoyi.system.domain.TPatient;
import com.ruoyi.system.service.ITPatientService;
+import org.springframework.util.ObjectUtils;
/**
* 患者信息Service业务层处理
@@ -24,6 +27,8 @@ public class TPatientServiceImpl implements ITPatientService
@Autowired
private TPatientMapper tPatientMapper;
+ @Autowired
+ private TRecordMapper tRecordMapper;
/**
* 查询患者信息
*
@@ -100,7 +105,23 @@ public class TPatientServiceImpl implements ITPatientService
@Override
public List queryByPage(PcTPatintQueryByPageReq pcTPatintQueryByPageReq) {
- return tPatientMapper.queryByPage(pcTPatintQueryByPageReq);
+ Long hospitalId = pcTPatintQueryByPageReq.getHospitalId();
+ TRecord record = new TRecord();
+ record.setStatus("1");
+ record.setHospitalId(hospitalId);
+ List pcTPatientQueryByPageResps = tPatientMapper.queryByPage(pcTPatintQueryByPageReq);
+ pcTPatientQueryByPageResps.stream().forEach(a ->{
+ record.setPatientId(a.getId());
+ List tRecords = tRecordMapper.selectTRecordDoctorPatientFirst(record);
+ //最后一次/初次就诊时间
+ if (!ObjectUtils.isEmpty(tRecords)){
+ a.setLatestTime(tRecords.get(0).getCreateTime());
+ a.setFirstTime(tRecords.get(tRecords.size()-1).getCreateTime());
+ }
+ //诊断次数
+ a.setCountRecords(tRecords.size());
+ });
+ return pcTPatientQueryByPageResps;
}
@Override
diff --git a/ruoyi-system/src/main/resources/mapper/system/TPatientMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TPatientMapper.xml
index 57e8590..d36e7a8 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TPatientMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TPatientMapper.xml
@@ -133,10 +133,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.marriage,
a.disease,
a.create_time as createTime,
- a.update_time as updateTime
+ a.update_time as updateTime,
+ d.`name` as doctorName,
from t_patient a left join t_patient_hospital_doctor b on a.id = b.patient_id
+ left join t_hospital c on b.hospital_id = c.id
+ left join t_doctor d on b.doctor_id = d.id
- a.del_flag = '0'
+
+ and del_flag = #{delFlag}
+
AND a.create_time between DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i:%s') and DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i:%s')
@@ -149,7 +154,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and b.doctor_d = #{doctorId}
+
+ and d.name = like concat('%', #{doctorName}, '%')
+
+ GROUP BY a.id
order by a.create_time desc
diff --git a/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml
index 8504bc3..603fe5b 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml
@@ -159,9 +159,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-