master
zhuqing 2 years ago
parent 3947391c30
commit ee3ad8b728

@ -60,10 +60,11 @@ public class TPatientController extends BaseController
@ApiOperation("导出患者信息列表") @ApiOperation("导出患者信息列表")
@Log(title = "患者信息", businessType = BusinessType.EXPORT) @Log(title = "患者信息", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, TPatient tPatient) public void export(HttpServletResponse response, @RequestBody @Validated PcTPatintQueryByPageReq pcTPatintQueryByPageReq)
{ {
List<TPatient> list = tPatientService.selectTPatientList(tPatient); List<PcTPatientQueryByPageResp> list = tPatientService.queryByPage(pcTPatintQueryByPageReq);
ExcelUtil<TPatient> util = new ExcelUtil<TPatient>(TPatient.class); //List<TPatient> list = tPatientService.selectTPatientList(tPatient);
ExcelUtil<PcTPatientQueryByPageResp> util = new ExcelUtil<PcTPatientQueryByPageResp>(PcTPatientQueryByPageResp.class);
util.exportExcel(response, list, "患者信息数据"); util.exportExcel(response, list, "患者信息数据");
} }

@ -37,6 +37,22 @@ public class PcTPatintQueryByPageReq {
@ApiModelProperty("名称") @ApiModelProperty("名称")
private String name; 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() { public Long getHospitalId() {
return hospitalId; return hospitalId;
} }
@ -84,4 +100,12 @@ public class PcTPatintQueryByPageReq {
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public String getDoctorName() {
return doctorName;
}
public void setDoctorName(String doctorName) {
this.doctorName = doctorName;
}
} }

@ -1,6 +1,7 @@
package com.ruoyi.system.domain.resp; package com.ruoyi.system.domain.resp;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -23,14 +24,17 @@ public class PcTPatientQueryByPageResp {
/** 编号 */ /** 编号 */
@ApiModelProperty("编号") @ApiModelProperty("编号")
@Excel(name = "档案号")
private String identifier; private String identifier;
/** 名称 */ /** 名称 */
@ApiModelProperty("名称") @ApiModelProperty("名称")
@Excel(name = "名称")
private String name; private String name;
/** 电话 */ /** 电话 */
@ApiModelProperty("电话") @ApiModelProperty("电话")
@Excel(name = "电话")
private String phone; private String phone;
/** 用户性别0男 1女 2未知 */ /** 用户性别0男 1女 2未知 */
@ -39,6 +43,7 @@ public class PcTPatientQueryByPageResp {
/** 年龄 */ /** 年龄 */
@ApiModelProperty("年龄") @ApiModelProperty("年龄")
@Excel(name = "年龄")
private Integer age; private Integer age;
/** 身高 */ /** 身高 */
@ -55,6 +60,7 @@ public class PcTPatientQueryByPageResp {
/** 基础疾病 */ /** 基础疾病 */
@ApiModelProperty("基础疾病") @ApiModelProperty("基础疾病")
@Excel(name = "基础疾病")
private String disease; private String disease;
/** 删除标志0代表存在 2代表删除 */ /** 删除标志0代表存在 2代表删除 */
@ -71,6 +77,29 @@ public class PcTPatientQueryByPageResp {
@ApiModelProperty("更新时间") @ApiModelProperty("更新时间")
private Date updateTime; 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<TRecord> recordList;
public Long getId() { public Long getId() {
return id; return id;
} }
@ -183,23 +212,27 @@ public class PcTPatientQueryByPageResp {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
@Override public Date getLatestTime() {
public String toString() { return latestTime;
return "PcTPatientQueryByPageResp{" + }
"id=" + id +
", openId='" + openId + '\'' + public void setLatestTime(Date latestTime) {
", identifier='" + identifier + '\'' + this.latestTime = latestTime;
", name='" + name + '\'' + }
", phone='" + phone + '\'' +
", sex='" + sex + '\'' + public int getCountRecords() {
", age=" + age + return countRecords;
", height=" + height + }
", weight=" + weight +
", marriage='" + marriage + '\'' + public void setCountRecords(int countRecords) {
", disease='" + disease + '\'' + this.countRecords = countRecords;
", delFlag='" + delFlag + '\'' + }
", createTime=" + createTime +
", updateTime=" + updateTime + public Date getFirstTime() {
'}'; return firstTime;
}
public void setFirstTime(Date firstTime) {
this.firstTime = firstTime;
} }
} }

@ -88,7 +88,7 @@ public interface TRecordMapper
* @param tRecord * @param tRecord
* @return * @return
*/ */
public List<TRecord> selectTRecordDoctorFirst(TRecord tRecord); public List<TRecord> selectTRecordDoctorPatientFirst(TRecord tRecord);
/** /**

@ -111,7 +111,7 @@ public class TDoctorServiceImpl implements ITDoctorService
List<PcTDoctorQueryByPageResp> pcTDoctorQueryByPageResps = tDoctorMapper.queryByPage(pcTDoctorQueryByPageReq); List<PcTDoctorQueryByPageResp> pcTDoctorQueryByPageResps = tDoctorMapper.queryByPage(pcTDoctorQueryByPageReq);
pcTDoctorQueryByPageResps.stream().forEach(a ->{ pcTDoctorQueryByPageResps.stream().forEach(a ->{
record.setDoctorId(a.getId()); record.setDoctorId(a.getId());
List<TRecord> tRecords = tRecordMapper.selectTRecordDoctorFirst(record); List<TRecord> tRecords = tRecordMapper.selectTRecordDoctorPatientFirst(record);
//最近一次就诊时间 //最近一次就诊时间
if (!ObjectUtils.isEmpty(tRecords)){ if (!ObjectUtils.isEmpty(tRecords)){
a.setLatestTime(tRecords.get(0).getCreateTime()); a.setLatestTime(tRecords.get(0).getCreateTime());

@ -4,13 +4,16 @@ import java.util.List;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.TRecord;
import com.ruoyi.system.domain.req.PcTPatintQueryByPageReq; import com.ruoyi.system.domain.req.PcTPatintQueryByPageReq;
import com.ruoyi.system.domain.resp.PcTPatientQueryByPageResp; import com.ruoyi.system.domain.resp.PcTPatientQueryByPageResp;
import com.ruoyi.system.mapper.TRecordMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TPatientMapper; import com.ruoyi.system.mapper.TPatientMapper;
import com.ruoyi.system.domain.TPatient; import com.ruoyi.system.domain.TPatient;
import com.ruoyi.system.service.ITPatientService; import com.ruoyi.system.service.ITPatientService;
import org.springframework.util.ObjectUtils;
/** /**
* Service * Service
@ -24,6 +27,8 @@ public class TPatientServiceImpl implements ITPatientService
@Autowired @Autowired
private TPatientMapper tPatientMapper; private TPatientMapper tPatientMapper;
@Autowired
private TRecordMapper tRecordMapper;
/** /**
* *
* *
@ -100,7 +105,23 @@ public class TPatientServiceImpl implements ITPatientService
@Override @Override
public List<PcTPatientQueryByPageResp> queryByPage(PcTPatintQueryByPageReq pcTPatintQueryByPageReq) { public List<PcTPatientQueryByPageResp> queryByPage(PcTPatintQueryByPageReq pcTPatintQueryByPageReq) {
return tPatientMapper.queryByPage(pcTPatintQueryByPageReq); Long hospitalId = pcTPatintQueryByPageReq.getHospitalId();
TRecord record = new TRecord();
record.setStatus("1");
record.setHospitalId(hospitalId);
List<PcTPatientQueryByPageResp> pcTPatientQueryByPageResps = tPatientMapper.queryByPage(pcTPatintQueryByPageReq);
pcTPatientQueryByPageResps.stream().forEach(a ->{
record.setPatientId(a.getId());
List<TRecord> 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 @Override

@ -133,10 +133,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.marriage, a.marriage,
a.disease, a.disease,
a.create_time as createTime, 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 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
<where> <where>
a.del_flag = '0' <if test="delFlag != null">
and del_flag = #{delFlag}
</if>
<if test="startTime != null and endTime != null"> <if test="startTime != null and endTime != null">
AND a.create_time between DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i:%s') and DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i:%s') AND a.create_time between DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i:%s') and DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i:%s')
</if> </if>
@ -149,7 +154,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="doctorId != null"> <if test="doctorId != null">
and b.doctor_d = #{doctorId} and b.doctor_d = #{doctorId}
</if> </if>
<if test="doctorName != null and doctorName != ''">
and d.name = like concat('%', #{doctorName}, '%')
</if>
</where> </where>
GROUP BY a.id
order by a.create_time desc order by a.create_time desc
</select> </select>

@ -159,9 +159,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<!--====================工作台相关接口=====================--> <!--====================工作台相关接口=====================-->
<select id="selectTRecordDoctorFirst" parameterType="TRecord" resultMap="TRecordResult"> <select id="selectTRecordDoctorPatientFirst" parameterType="TRecord" resultMap="TRecordResult">
<include refid="selectTRecordVo"/> <include refid="selectTRecordVo"/>
<where> <where>
<if test="patientId != null "> and patient_id = #{patientId}</if>
<if test="doctorId != null "> and doctor_id = #{doctorId}</if> <if test="doctorId != null "> and doctor_id = #{doctorId}</if>
<if test="hospitalId != null "> and hospital_id = #{hospitalId}</if> <if test="hospitalId != null "> and hospital_id = #{hospitalId}</if>
<if test="status != null and status != ''"> and status = #{status}</if> <if test="status != null and status != ''"> and status = #{status}</if>

Loading…
Cancel
Save