diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/TDoctorController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/TDoctorController.java index 091e945..8f29c24 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/TDoctorController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/TDoctorController.java @@ -9,7 +9,6 @@ import com.ruoyi.system.domain.resp.PcTDoctorQueryByPageResp; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.BeanUtils; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; @@ -61,10 +60,11 @@ public class TDoctorController extends BaseController @ApiOperation("导出医生信息列表") @Log(title = "医生信息", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, TDoctor tDoctor) + public void export(HttpServletResponse response, @RequestBody @Validated PcTDoctorQueryByPageReq pcTDoctorQueryByPageReq) { - List list = tDoctorService.selectTDoctorList(tDoctor); - ExcelUtil util = new ExcelUtil(TDoctor.class); +// List list = tDoctorService.selectTDoctorList(tDoctor); + List list = tDoctorService.queryByPage(pcTDoctorQueryByPageReq); + ExcelUtil util = new ExcelUtil(PcTDoctorQueryByPageResp.class); util.exportExcel(response, list, "医生信息数据"); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java index 9a7e521..bbb8900 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java @@ -1,6 +1,7 @@ package com.ruoyi.web.controller.system; import java.util.List; +import java.util.Objects; import java.util.Set; import com.ruoyi.common.exception.ServiceException; @@ -107,19 +108,23 @@ public class SysLoginController //添加医生和医院标识返回 Long hospitalId = null; Long doctorId = null; + TDoctor tDoctor = new TDoctor(); + tDoctor.setUserId(user.getUserId()); + List selectTDoctorList = itDoctorService.selectTDoctorList(tDoctor); + if (!ObjectUtils.isEmpty(selectTDoctorList)){ + doctorId = selectTDoctorList.get(0).getId(); + } THospital tHospital = new THospital(); tHospital.setAdminId(user.getUserId()); List tHospitals = itHospitalService.selectTHospitalList(tHospital); if (!ObjectUtils.isEmpty(tHospitals)){ hospitalId = tHospitals.get(0).getId(); } - ajax.put("hospitalId", hospitalId); - TDoctor tDoctor = new TDoctor(); - tDoctor.setUserId(user.getUserId()); - List selectTDoctorList = itDoctorService.selectTDoctorList(tDoctor); - if (!ObjectUtils.isEmpty(selectTDoctorList)){ - doctorId = selectTDoctorList.get(0).getId(); + //医生登录返回hospitalId + if (Objects.isNull(hospitalId) && Objects.nonNull(doctorId)){ + hospitalId = selectTDoctorList.get(0).getHospitalId(); } + ajax.put("hospitalId", hospitalId); ajax.put("doctorId", doctorId); return ajax; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/PcTDoctorQueryByPageReq.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/PcTDoctorQueryByPageReq.java index 04f1a5a..7ec1995 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/PcTDoctorQueryByPageReq.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/PcTDoctorQueryByPageReq.java @@ -1,5 +1,6 @@ package com.ruoyi.system.domain.req; +import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.annotation.Excel; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -21,12 +22,14 @@ public class PcTDoctorQueryByPageReq { * startTime */ @ApiModelProperty("开始时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date startTime; /** * endTime */ @ApiModelProperty("结束时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date endTime; /** 编号 */ 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 013f76a..28216d6 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 @@ -1,5 +1,6 @@ package com.ruoyi.system.domain.req; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -21,12 +22,14 @@ public class PcTPatintQueryByPageReq { * startTime */ @ApiModelProperty("开始时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date startTime; /** * endTime */ @ApiModelProperty("结束时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date endTime; /** 编号 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/PcTDoctorQueryByPageResp.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/PcTDoctorQueryByPageResp.java index 95d305d..c2bf826 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/PcTDoctorQueryByPageResp.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/PcTDoctorQueryByPageResp.java @@ -24,14 +24,17 @@ public class PcTDoctorQueryByPageResp { /** 编号 */ @ApiModelProperty("编号") + @Excel(name = "工作证号") private String identifier; /** 名称 */ @ApiModelProperty("名称") + @Excel(name = "名称") private String name; /** 电话 */ @ApiModelProperty("电话") + @Excel(name = "电话") private String phone; /** 用户性别(0男 1女 2未知) */ @@ -70,10 +73,14 @@ public class PcTDoctorQueryByPageResp { @ApiModelProperty("医院id") private Long hospitalId; + /** 删除标志(0代表存在 2代表删除) */ + @ApiModelProperty("删除标志(0代表存在 2代表删除) ") + private String delFlag; /** 创建时间 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @ApiModelProperty("创建时间") + @Excel(name = "注册时间") private Date createTime; /** 更新时间 */ @@ -82,14 +89,17 @@ public class PcTDoctorQueryByPageResp { private Date updateTime; @ApiModelProperty("患者个数") + @Excel(name = "患者个数") private int countPatints; /** 最近一次就诊时间 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @ApiModelProperty("最近一次就诊时间") + @Excel(name = "最近一次就诊时间") private Date latestTime; @ApiModelProperty("诊断次数") + @Excel(name = "诊断次数") private int countRecords; public int getCountRecords() { @@ -244,6 +254,14 @@ public class PcTDoctorQueryByPageResp { this.countPatints = countPatints; } + public String getDelFlag() { + return delFlag; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + @Override public String toString() { return "PcTDoctorQueryByPageResp{" + @@ -261,6 +279,7 @@ public class PcTDoctorQueryByPageResp { ", medicalLicense='" + medicalLicense + '\'' + ", qrCode='" + qrCode + '\'' + ", hospitalId=" + hospitalId + + ", delFlag='" + delFlag + '\'' + ", createTime=" + createTime + ", updateTime=" + updateTime + ", countPatints=" + countPatints + 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 7b6637a..bb4c504 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 @@ -39,6 +39,7 @@ public class PcTPatientQueryByPageResp { /** 用户性别(0男 1女 2未知) */ @ApiModelProperty("用户性别(0男 1女 2未知)") + @Excel(name = "用户性别(0男 1女 2未知)") private String sex; /** 年龄 */ diff --git a/ruoyi-system/src/main/resources/mapper/system/TDoctorMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TDoctorMapper.xml index 51fce70..616b44d 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TDoctorMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TDoctorMapper.xml @@ -156,6 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" introduction, medical_license as medicalLicense, qr_code as qrCode, + del_flag as delFlag, hospital_id as hospitalId, create_time as createTime, update_time as updateTime diff --git a/ruoyi-system/src/main/resources/mapper/system/TPatientMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TPatientMapper.xml index d36e7a8..65bf7b2 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TPatientMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TPatientMapper.xml @@ -134,13 +134,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" a.disease, a.create_time as createTime, 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 left join t_hospital c on b.hospital_id = c.id left join t_doctor d on b.doctor_id = d.id - and del_flag = #{delFlag} + and a.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') @@ -155,7 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and b.doctor_d = #{doctorId} - and d.name = like concat('%', #{doctorName}, '%') + and d.name like concat('%', #{doctorName}, '%') GROUP BY a.id