patient+doctor

master
zhuqing 2 years ago
parent 12bcd2ee45
commit 81284dd473

@ -9,7 +9,6 @@ import com.ruoyi.system.domain.resp.PcTDoctorQueryByPageResp;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -61,10 +60,11 @@ public class TDoctorController extends BaseController
@ApiOperation("导出医生信息列表") @ApiOperation("导出医生信息列表")
@Log(title = "医生信息", businessType = BusinessType.EXPORT) @Log(title = "医生信息", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, TDoctor tDoctor) public void export(HttpServletResponse response, @RequestBody @Validated PcTDoctorQueryByPageReq pcTDoctorQueryByPageReq)
{ {
List<TDoctor> list = tDoctorService.selectTDoctorList(tDoctor); // List<TDoctor> list = tDoctorService.selectTDoctorList(tDoctor);
ExcelUtil<TDoctor> util = new ExcelUtil<TDoctor>(TDoctor.class); List<PcTDoctorQueryByPageResp> list = tDoctorService.queryByPage(pcTDoctorQueryByPageReq);
ExcelUtil<PcTDoctorQueryByPageResp> util = new ExcelUtil<PcTDoctorQueryByPageResp>(PcTDoctorQueryByPageResp.class);
util.exportExcel(response, list, "医生信息数据"); util.exportExcel(response, list, "医生信息数据");
} }

@ -1,6 +1,7 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
@ -107,19 +108,23 @@ public class SysLoginController
//添加医生和医院标识返回 //添加医生和医院标识返回
Long hospitalId = null; Long hospitalId = null;
Long doctorId = null; Long doctorId = null;
TDoctor tDoctor = new TDoctor();
tDoctor.setUserId(user.getUserId());
List<TDoctor> selectTDoctorList = itDoctorService.selectTDoctorList(tDoctor);
if (!ObjectUtils.isEmpty(selectTDoctorList)){
doctorId = selectTDoctorList.get(0).getId();
}
THospital tHospital = new THospital(); THospital tHospital = new THospital();
tHospital.setAdminId(user.getUserId()); tHospital.setAdminId(user.getUserId());
List<THospital> tHospitals = itHospitalService.selectTHospitalList(tHospital); List<THospital> tHospitals = itHospitalService.selectTHospitalList(tHospital);
if (!ObjectUtils.isEmpty(tHospitals)){ if (!ObjectUtils.isEmpty(tHospitals)){
hospitalId = tHospitals.get(0).getId(); hospitalId = tHospitals.get(0).getId();
} }
ajax.put("hospitalId", hospitalId); //医生登录返回hospitalId
TDoctor tDoctor = new TDoctor(); if (Objects.isNull(hospitalId) && Objects.nonNull(doctorId)){
tDoctor.setUserId(user.getUserId()); hospitalId = selectTDoctorList.get(0).getHospitalId();
List<TDoctor> selectTDoctorList = itDoctorService.selectTDoctorList(tDoctor);
if (!ObjectUtils.isEmpty(selectTDoctorList)){
doctorId = selectTDoctorList.get(0).getId();
} }
ajax.put("hospitalId", hospitalId);
ajax.put("doctorId", doctorId); ajax.put("doctorId", doctorId);
return ajax; return ajax;
} }

@ -1,5 +1,6 @@
package com.ruoyi.system.domain.req; package com.ruoyi.system.domain.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel; 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;
@ -21,12 +22,14 @@ public class PcTDoctorQueryByPageReq {
* startTime * startTime
*/ */
@ApiModelProperty("开始时间") @ApiModelProperty("开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime; private Date startTime;
/** /**
* endTime * endTime
*/ */
@ApiModelProperty("结束时间") @ApiModelProperty("结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime; private Date endTime;
/** 编号 */ /** 编号 */

@ -1,5 +1,6 @@
package com.ruoyi.system.domain.req; package com.ruoyi.system.domain.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -21,12 +22,14 @@ public class PcTPatintQueryByPageReq {
* startTime * startTime
*/ */
@ApiModelProperty("开始时间") @ApiModelProperty("开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime; private Date startTime;
/** /**
* endTime * endTime
*/ */
@ApiModelProperty("结束时间") @ApiModelProperty("结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime; private Date endTime;
/** 编号 */ /** 编号 */

@ -24,14 +24,17 @@ public class PcTDoctorQueryByPageResp {
/** 编号 */ /** 编号 */
@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未知 */
@ -70,10 +73,14 @@ public class PcTDoctorQueryByPageResp {
@ApiModelProperty("医院id") @ApiModelProperty("医院id")
private Long hospitalId; private Long hospitalId;
/** 删除标志0代表存在 2代表删除 */
@ApiModelProperty("删除标志0代表存在 2代表删除 ")
private String delFlag;
/** 创建时间 */ /** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
@Excel(name = "注册时间")
private Date createTime; private Date createTime;
/** 更新时间 */ /** 更新时间 */
@ -82,14 +89,17 @@ public class PcTDoctorQueryByPageResp {
private Date updateTime; private Date updateTime;
@ApiModelProperty("患者个数") @ApiModelProperty("患者个数")
@Excel(name = "患者个数")
private int countPatints; private int countPatints;
/** 最近一次就诊时间 */ /** 最近一次就诊时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("最近一次就诊时间") @ApiModelProperty("最近一次就诊时间")
@Excel(name = "最近一次就诊时间")
private Date latestTime; private Date latestTime;
@ApiModelProperty("诊断次数") @ApiModelProperty("诊断次数")
@Excel(name = "诊断次数")
private int countRecords; private int countRecords;
public int getCountRecords() { public int getCountRecords() {
@ -244,6 +254,14 @@ public class PcTDoctorQueryByPageResp {
this.countPatints = countPatints; this.countPatints = countPatints;
} }
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
@Override @Override
public String toString() { public String toString() {
return "PcTDoctorQueryByPageResp{" + return "PcTDoctorQueryByPageResp{" +
@ -261,6 +279,7 @@ public class PcTDoctorQueryByPageResp {
", medicalLicense='" + medicalLicense + '\'' + ", medicalLicense='" + medicalLicense + '\'' +
", qrCode='" + qrCode + '\'' + ", qrCode='" + qrCode + '\'' +
", hospitalId=" + hospitalId + ", hospitalId=" + hospitalId +
", delFlag='" + delFlag + '\'' +
", createTime=" + createTime + ", createTime=" + createTime +
", updateTime=" + updateTime + ", updateTime=" + updateTime +
", countPatints=" + countPatints + ", countPatints=" + countPatints +

@ -39,6 +39,7 @@ public class PcTPatientQueryByPageResp {
/** 用户性别0男 1女 2未知 */ /** 用户性别0男 1女 2未知 */
@ApiModelProperty("用户性别0男 1女 2未知") @ApiModelProperty("用户性别0男 1女 2未知")
@Excel(name = "用户性别0男 1女 2未知")
private String sex; private String sex;
/** 年龄 */ /** 年龄 */

@ -156,6 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
introduction, introduction,
medical_license as medicalLicense, medical_license as medicalLicense,
qr_code as qrCode, qr_code as qrCode,
del_flag as delFlag,
hospital_id as hospitalId, hospital_id as hospitalId,
create_time as createTime, create_time as createTime,
update_time as updateTime update_time as updateTime

@ -134,13 +134,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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, a.del_flag as delFlag,
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_hospital c on b.hospital_id = c.id
left join t_doctor d on b.doctor_id = d.id left join t_doctor d on b.doctor_id = d.id
<where> <where>
<if test="delFlag != null"> <if test="delFlag != null">
and del_flag = #{delFlag} and a.del_flag = #{delFlag}
</if> </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')
@ -155,7 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and b.doctor_d = #{doctorId} and b.doctor_d = #{doctorId}
</if> </if>
<if test="doctorName != null and doctorName != ''"> <if test="doctorName != null and doctorName != ''">
and d.name = like concat('%', #{doctorName}, '%') and d.name like concat('%', #{doctorName}, '%')
</if> </if>
</where> </where>
GROUP BY a.id GROUP BY a.id

Loading…
Cancel
Save