Merge remote-tracking branch 'origin/master'

# Conflicts:
#	ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
master
heminjian502 2 years ago
commit 4d61868bbf

@ -1,20 +1,20 @@
package com.ruoyi.web.controller.api;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.THospital;
import com.ruoyi.system.domain.TRecord;
import com.ruoyi.system.service.ITHospitalService;
import com.ruoyi.system.service.ITRecordService;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.domain.req.AppPatientHospitalDoctor;
import com.ruoyi.system.domain.req.AppPatientReq;
import com.ruoyi.system.domain.req.TRecordResultReq;
import com.ruoyi.system.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
@ -32,6 +32,18 @@ public class AppController extends BaseController
@Autowired
private ITHospitalService tHospitalService;
@Resource
private ITDoctorService tDoctorService;
@Resource
private ITPatientService tPatientService;
@Resource
private ITPatientHospitalDoctorService itPatientHospitalDoctorService;
@Resource
private ISysConfigService configService;
/**
* AI
@ -49,9 +61,166 @@ public class AppController extends BaseController
}
/**
*
*/
@ApiOperation("医院列表")
@GetMapping("/hospital/list")
public AjaxResult hospitalList() {
List<THospital> tHospitals = tHospitalService.selectTHospitalList(new THospital());
return AjaxResult.success(tHospitals);
}
/**
*
*
* @param doctorId id
* @return {@code AjaxResult}
*/
@ApiOperation("医生信息获取")
@GetMapping("/doctor/info")
public AjaxResult doctorInformation(Long doctorId)
{
TDoctor tDoctor = tDoctorService.selectTDoctorById(doctorId);
return AjaxResult.success(tDoctor);
}
/**
*
*
* @param appPatientHospitalDoctor
* @return {@code AjaxResult}
*/
@ApiOperation("患者预约")
@GetMapping("/patient/makeAnAppointment")
public AjaxResult patientsToMakeAnAppointment(AppPatientHospitalDoctor appPatientHospitalDoctor)
{
// 患者预约新增t_record中的一条记录;判断关联表是否存在当前关系
TPatientHospitalDoctor tPatientHospitalDoctor = new TPatientHospitalDoctor();
BeanUtils.copyProperties(appPatientHospitalDoctor, tPatientHospitalDoctor);
TRecord tRecord = new TRecord();
tRecord.setHospitalId(tPatientHospitalDoctor.getHospitalId());
tRecord.setPatientId(tPatientHospitalDoctor.getPatientId());
tRecord.setDoctorId(tPatientHospitalDoctor.getDoctorId());
tRecord.setStatus("0");
tRecord.setCreateBy(getUsername());
tRecordService.insertTRecord(tRecord);
List<TPatientHospitalDoctor> tPHDs = itPatientHospitalDoctorService.selectTPatientHospitalDoctorList(tPatientHospitalDoctor);
if (tPHDs.isEmpty())
{
itPatientHospitalDoctorService.insertTPatientHospitalDoctor(tPatientHospitalDoctor);
}
return AjaxResult.success();
}
@PutMapping("/record/ai/finish/{id}")
@Log(title = "修改患者记录至已诊状态")
public AjaxResult updateStatus(@PathVariable("id") Long id){
if(id == null){
return AjaxResult.error("未获取到记录id");
}
TRecord tRecord = new TRecord();
tRecord.setId(id);
tRecord.setStatus("1");
tRecordService.updateTRecord(tRecord);
return AjaxResult.success("更新状态成功",null);
}
@GetMapping(value = "/config/ai/refreshtime")
@Log(title = "获取AI结果刷新时间接口")
public AjaxResult getConfigKey()
{
String configKey="t.ai.refreshtime";
return AjaxResult.success(configService.selectConfigByKey(configKey));
}
/**
*
*
* @return {@code AjaxResult}
*/
@ApiOperation("诊断记录上传")
@PostMapping("/record/diagnostic/upload")
public AjaxResult diagnosticRecordsUploaded(TRecord tRecord) {
return AjaxResult.success(tRecordService.updateTRecord(tRecord));
}
/**
*
*
* @param tPatient t
* @return {@code AjaxResult}
*/
@ApiOperation("添加患者")
@PostMapping("/patient/add")
public AjaxResult addPatient(AppPatientReq tPatient)
{
tPatientService.insertTPatient(tPatient);
TPatientHospitalDoctor tPatientHospitalDoctor = new TPatientHospitalDoctor();
tPatientHospitalDoctor.setHospitalId(tPatient.getHospitalId());
tPatientHospitalDoctor.setDoctorId(tPatient.getDoctorId());
tPatientHospitalDoctor.setPatientId(tPatient.getId());
List<TPatientHospitalDoctor> tPatientHospitalDoctors = itPatientHospitalDoctorService.selectTPatientHospitalDoctorList(tPatientHospitalDoctor);
if (tPatientHospitalDoctors.isEmpty())
{
itPatientHospitalDoctorService.insertTPatientHospitalDoctor(tPatientHospitalDoctor);
}
return AjaxResult.success();
}
/**
*
*
* @param appPatientHospitalDoctor
* @return {@code AjaxResult}
*/
@ApiOperation("诊断记录列表")
@GetMapping("/record/list")
public AjaxResult diagnosisOfRecordList(AppPatientHospitalDoctor appPatientHospitalDoctor) {
TPatientHospitalDoctor tPatientHospitalDoctor = new TPatientHospitalDoctor();
BeanUtils.copyProperties(appPatientHospitalDoctor, tPatientHospitalDoctor);
List<TRecord> tRecords = tRecordService.queryRecordListByPHDids(tPatientHospitalDoctor);
return AjaxResult.success(tRecords);
}
/**
*
*
* @param id id
* @return {@code AjaxResult}
*/
@ApiOperation("患者诊断记录信息详情")
@GetMapping("/record/info")
public AjaxResult patientsWithDiagnosisOfRecordInformationDetails(Long id) {
return AjaxResult.success(tRecordService.selectById(id));
}
/**
*
*
* @param recordResultReq
* @return {@code AjaxResult}
*/
@ApiOperation("患者已诊列表")
@GetMapping("/record/diagnosedList")
public AjaxResult patientsDiagnosedList(TRecordResultReq recordResultReq) {
recordResultReq.setStatus("0");
return AjaxResult.success(tRecordService.selectTRecordListWithoutResult(recordResultReq));
}
/**
*
*
* @param recordResultReq
* @return {@code AjaxResult}
*/
@ApiOperation("患者候诊列表")
@GetMapping("/record/waitingList")
public AjaxResult patientsWaitingList(TRecordResultReq recordResultReq) {
recordResultReq.setStatus("2");
return AjaxResult.success(tRecordService.selectTRecordListWithoutResult(recordResultReq));
}
}

@ -0,0 +1,68 @@
package com.ruoyi.web.controller.pc;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.TPatient;
import com.ruoyi.system.domain.resp.PlatformDayPlanResp;
import com.ruoyi.system.domain.resp.WeekMonthPersonCountResp;
import com.ruoyi.system.service.ITRecordService;
import com.ruoyi.system.service.impl.PlatformService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* @Author zhuqing
* @Date 2022/8/9
*
*/
@RestController
@RequestMapping("/platform")
@Api("工作台")
public class PlatformController {
@Autowired
private PlatformService platformService;
@ApiOperation("工作台-设备统计")
@PostMapping("/equCount")
public AjaxResult equCount(
@ApiParam(name = "hospitalId",value = "医院id",required = false) @RequestParam(required = false) Long hospitalId,
@ApiParam(name = "doctorId",value = "医生id",required = false) @RequestParam(required = false) Long doctorId){
Map<String, Integer> stringIntegerMap = platformService.equCount(hospitalId, doctorId);
return AjaxResult.success(stringIntegerMap);
}
@ApiOperation("工作台-今日就诊计划")
@PostMapping("/dayPlan")
public AjaxResult dayPlan(
@ApiParam(name = "hospitalId",value = "医院id",required = false) @RequestParam(required = false) Long hospitalId,
@ApiParam(name = "doctorId",value = "医生id",required = false) @RequestParam(required = false) Long doctorId){
List<PlatformDayPlanResp> platformDayPlanResps = platformService.dayPlan(hospitalId, doctorId);
return AjaxResult.success(platformDayPlanResps);
}
@ApiOperation("工作台-就诊人数统计")
@PostMapping("/weekMonthPersonCount")
public AjaxResult weekMonthPersonCount(
@ApiParam(name = "hospitalId",value = "医院id",required = false) @RequestParam(required = false) Long hospitalId,
@ApiParam(name = "doctorId",value = "医生id",required = false) @RequestParam(required = false) Long doctorId,
@ApiParam(name = "weekMonth",value = "周月的区分 1-周 2-月",required = false) @RequestParam(required = false) Long weekMonth){
List<WeekMonthPersonCountResp> weekMonthPersonCountResps = platformService.weekMonthPersonCount(hospitalId, doctorId,weekMonth);
return AjaxResult.success(weekMonthPersonCountResps);
}
@ApiOperation("工作台-患者年龄统计")
@PostMapping("/ageCount")
public AjaxResult ageCount(
@ApiParam(name = "hospitalId",value = "医院id",required = false) @RequestParam(required = false) Long hospitalId,
@ApiParam(name = "doctorId",value = "医生id",required = false) @RequestParam(required = false) Long doctorId){
List<TPatient> tPatients = platformService.ageCount(hospitalId,doctorId);
return AjaxResult.success(tPatients);
}
}

@ -2,7 +2,9 @@ package com.ruoyi.web.controller.pc;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -27,6 +29,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
* @author ruoyi
* @date 2022-08-03
*/
@Api("pc-医院列表")
@RestController
@RequestMapping("/system/hospital")
public class THospitalController extends BaseController
@ -37,6 +40,7 @@ public class THospitalController extends BaseController
/**
*
*/
@ApiOperation("查询医院信息列表")
@GetMapping("/list")
public TableDataInfo list(THospital tHospital)
{
@ -60,6 +64,7 @@ public class THospitalController extends BaseController
/**
*
*/
@ApiOperation("获取医院信息详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
@ -69,6 +74,7 @@ public class THospitalController extends BaseController
/**
*
*/
@ApiOperation("新增医院信息")
@Log(title = "医院信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody THospital tHospital)
@ -79,6 +85,7 @@ public class THospitalController extends BaseController
/**
*
*/
@ApiOperation("修改医院信息")
@Log(title = "医院信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody THospital tHospital)
@ -89,6 +96,7 @@ public class THospitalController extends BaseController
/**
*
*/
@ApiOperation("删除医院信息")
@Log(title = "医院信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)

@ -2,6 +2,12 @@ package com.ruoyi.web.controller.pc;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.system.domain.TPatientHospitalDoctor;
import com.ruoyi.system.domain.req.TRecordResultReq;
import com.ruoyi.system.domain.resp.TRecordResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -27,6 +33,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
* @author ruoyi
* @date 2022-08-03
*/
@Api("pc-就诊记录")
@RestController
@RequestMapping("/system/record")
public class TRecordController extends BaseController
@ -37,12 +44,12 @@ public class TRecordController extends BaseController
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:record:list')")
@ApiOperation("查询就诊记录列表")
@GetMapping("/list")
public TableDataInfo list(TRecord tRecord)
public TableDataInfo list(TRecordResultReq tRecord)
{
startPage();
List<TRecord> list = tRecordService.selectTRecordList(tRecord);
List<TRecordResp> list = tRecordService.selectTRecordListWithoutResult(tRecord);
return getDataTable(list);
}
@ -101,4 +108,19 @@ public class TRecordController extends BaseController
{
return toAjax(tRecordService.deleteTRecordByIds(ids));
}
@GetMapping("getInfo/{id}")
@ApiOperation("查询患者诊断记录信息")
public AjaxResult getInfoById(@PathVariable("id") Long id){
if(id == null){
return AjaxResult.error("未获取到id");
}
return AjaxResult.success(tRecordService.selectById(id));
}
@GetMapping("getHistoryList")
@ApiOperation("查询患者历史数据图表")
public AjaxResult getHistoryList(TRecord tRecord){
return null;
}
}

@ -5,7 +5,12 @@ import java.util.Set;
import com.ruoyi.system.domain.req.AppRegisterReq;
import io.swagger.annotations.ApiOperation;
import com.ruoyi.system.domain.TDoctor;
import com.ruoyi.system.domain.THospital;
import com.ruoyi.system.service.ITDoctorService;
import com.ruoyi.system.service.ITHospitalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -38,6 +43,12 @@ public class SysLoginController
@Autowired
private SysPermissionService permissionService;
@Autowired
private ITHospitalService itHospitalService;
@Autowired
private ITDoctorService itDoctorService;
/**
*
*
@ -84,6 +95,19 @@ public class SysLoginController
ajax.put("user", user);
ajax.put("roles", roles);
ajax.put("permissions", permissions);
//添加医生和医院标识返回
THospital tHospital = new THospital();
tHospital.setAdminId(user.getUserId());
List<THospital> tHospitals = itHospitalService.selectTHospitalList(tHospital);
if (!ObjectUtils.isEmpty(tHospitals)){
ajax.put("hospitalId", tHospitals.get(0).getId());
}
TDoctor tDoctor = new TDoctor();
tDoctor.setUserId(user.getUserId());
List<TDoctor> selectTDoctorList = itDoctorService.selectTDoctorList(tDoctor);
if (!ObjectUtils.isEmpty(selectTDoctorList)){
ajax.put("doctorId", selectTDoctorList.get(0).getId());
}
return ajax;
}

@ -1,32 +1,41 @@
package com.ruoyi.system.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import javax.validation.constraints.NotNull;
/**
* t_hospital
*
* @author ruoyi
* @date 2022-08-04
*/
@ApiModel(value = "THospital", description = "PC端医院实体")
public class THospital extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** ID */
@ApiModelProperty("id")
private Long id;
/** 名称 */
@ApiModelProperty("名称")
@Excel(name = "名称")
private String name;
/** 排序 */
@ApiModelProperty("排序")
@Excel(name = "排序")
private Long num;
/** 管理员ID */
@ApiModelProperty("管理员ID")
@Excel(name = "管理员ID")
private Long adminId;

@ -69,6 +69,14 @@ public class TRecord extends BaseEntity
@Excel(name = "响应时长")
private Long responseTime;
/** 响应时长 */
@Excel(name = "ai结果返回时间")
private Date aiResultReturnTime;
/** 响应时长 */
@Excel(name = "ai结果修改时间")
private Date aiResultModifyTime;
public void setId(Long id)
{
this.id = id;
@ -187,6 +195,26 @@ public class TRecord extends BaseEntity
return responseTime;
}
public Date getAiResultReturnTime()
{
return aiResultReturnTime;
}
public void setAiResultReturnTime(Date aiResultReturnTime)
{
this.aiResultReturnTime = aiResultReturnTime;
}
public Date getAiResultModifyTime()
{
return aiResultModifyTime;
}
public void setAiResultModifyTime(Date aiResultModifyTime)
{
this.aiResultModifyTime = aiResultModifyTime;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -205,6 +233,8 @@ public class TRecord extends BaseEntity
.append("imgSx", getImgSx())
.append("imgSm", getImgSm())
.append("responseTime", getResponseTime())
.append("aiResultReturnTime", getAiResultReturnTime())
.append("aiResultModifyTime", getAiResultModifyTime())
.toString();
}
}

@ -0,0 +1,64 @@
package com.ruoyi.system.domain.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* App
*
* @author gongzhenkun
* @date 2022/8/9 14:48
*/
@ApiModel(value = "AppPatientHospitalDoctor", description = "App端患者预约入参实体")
public class AppPatientHospitalDoctor implements Serializable
{
private static final long serialVersionUID = 1L;
/** 患者ID */
@NotNull(message = "patientId不为空")
@ApiModelProperty("patientId")
private Long patientId;
/** 医院ID */
@NotNull(message = "hospitalId不为空")
@ApiModelProperty("hospitalId")
private Long hospitalId;
/** 医生ID */
@NotNull(message = "doctorId不为空")
@ApiModelProperty("doctorId")
private Long doctorId;
public Long getPatientId()
{
return patientId;
}
public void setPatientId(Long patientId)
{
this.patientId = patientId;
}
public Long getHospitalId()
{
return hospitalId;
}
public void setHospitalId(Long hospitalId)
{
this.hospitalId = hospitalId;
}
public Long getDoctorId()
{
return doctorId;
}
public void setDoctorId(Long doctorId)
{
this.doctorId = doctorId;
}
}

@ -0,0 +1,45 @@
package com.ruoyi.system.domain.req;
import com.ruoyi.system.domain.TPatient;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
/**
* App
*
* @author gongzhenkun
* @date 2022/8/9 14:32
*/
@ApiModel(value = "AppPatientReq", description = "App端添加患者入参实体")
public class AppPatientReq extends TPatient
{
@NotNull(message = "doctorId不为空")
@ApiModelProperty("doctorId")
private Long doctorId;
@NotNull(message = "hospitalId不为空")
@ApiModelProperty("hospitalId")
private Long hospitalId;
public Long getDoctorId()
{
return doctorId;
}
public void setDoctorId(Long doctorId)
{
this.doctorId = doctorId;
}
public Long getHospitalId()
{
return hospitalId;
}
public void setHospitalId(Long hospitalId)
{
this.hospitalId = hospitalId;
}
}

@ -0,0 +1,156 @@
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;
import java.util.Date;
@ApiModel(value = "TRecordResultReq", description = "就诊分页查询入参实体")
public class TRecordResultReq
{
@ApiModelProperty("患者姓名")
private String name;
@ApiModelProperty("患者性别")
private String sex;
@ApiModelProperty("患者年龄")
private Integer age;
@ApiModelProperty("医生id")
private Long doctorId;
@ApiModelProperty("医院id")
private Long hospitalId;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date createTime;
@ApiModelProperty("注册日期排序asc 正序desc 倒序")
//预约时间排序
private String doctorOder;
//首诊时间排序
@ApiModelProperty("首诊时间排序asc 正序desc 倒序")
private String firstVisitOder;
@ApiModelProperty("状态")
private String status;
@ApiModelProperty("初诊日期开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
@ApiModelProperty("初诊日期结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getSex()
{
return sex;
}
public void setSex(String sex)
{
this.sex = sex;
}
public Integer getAge()
{
return age;
}
public void setAge(Integer age)
{
this.age = age;
}
public Long getDoctorId()
{
return doctorId;
}
public void setDoctorId(Long doctorId)
{
this.doctorId = doctorId;
}
public Long getHospitalId()
{
return hospitalId;
}
public void setHospitalId(Long hospitalId)
{
this.hospitalId = hospitalId;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
public String getDoctorOder()
{
return doctorOder;
}
public void setDoctorOder(String doctorOder)
{
this.doctorOder = doctorOder;
}
public String getFirstVisitOder()
{
return firstVisitOder;
}
public void setFirstVisitOder(String firstVisitOder)
{
this.firstVisitOder = firstVisitOder;
}
public Date getCreateTime()
{
return createTime;
}
public void setCreateTime(Date createTime)
{
this.createTime = createTime;
}
public Date getStartTime()
{
return startTime;
}
public void setStartTime(Date startTime)
{
this.startTime = startTime;
}
public Date getEndTime()
{
return endTime;
}
public void setEndTime(Date endTime)
{
this.endTime = endTime;
}
}

@ -0,0 +1,52 @@
package com.ruoyi.system.domain.resp;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
* @Author zhuqing
* @Date 2022/8/9
*/
@ApiModel(value = "PlatformDayPlanResp", description = "工作台今日就诊计划反参实体")
public class PlatformDayPlanResp {
/** 医院 */
@ApiModelProperty("name")
private String name;
/** 状态0预约 1就诊 */
@ApiModelProperty("状态0预约 1就诊")
private String status;
/** 创建时间 */
@JsonFormat(pattern = "HH:mm")
@ApiModelProperty("创建时间")
private Date createTime;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

@ -0,0 +1,349 @@
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;
import java.util.Date;
@ApiModel(value = "TRecordResp", description = "就诊记录分页查询反参实体")
public class TRecordResp
{
/** ID */
@ApiModelProperty("患者就诊记录id")
private Long id;
/** 患者 */
@Excel(name = "患者")
@ApiModelProperty("患者id")
private Long patientId;
/** 医生 */
@Excel(name = "医生")
@ApiModelProperty("医生id")
private Long doctorId;
/** 医院 */
@ApiModelProperty("医院id")
@Excel(name = "医院")
private Long hospitalId;
/** 状态0预约 1就诊 */
@Excel(name = "状态", readConverterExp = "0=预约,1=就诊")
@ApiModelProperty("状态0预约 1就诊")
private String status;
/** ai诊断结果 */
@Excel(name = "ai诊断结果")
@ApiModelProperty("ai诊断结果")
private String aiResult;
/** ai诊断结果无图片 */
@Excel(name = "ai诊断结果无图片")
@ApiModelProperty("ai诊断结果无图片")
private String aiResult2;
/** 医生诊断结果 */
@Excel(name = "医生诊断结果")
@ApiModelProperty("医生诊断结果")
private String updateResult;
/** 医生诊断结果,无图片 */
@Excel(name = "医生诊断结果,无图片")
@ApiModelProperty("医生诊断结果,无图片")
private String updateResult2;
/** 上传时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "上传时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty("上传时间")
private Date uploadTime;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("待诊时间")
private Date waitingTime;
/** 舌下 */
@Excel(name = "舌下")
@ApiModelProperty("舌下")
private String imgSx;
/** 舌上 */
@Excel(name = "舌上")
@ApiModelProperty("舌上")
private String imgSm;
/** 响应时长 */
@Excel(name = "响应时长")
@ApiModelProperty("响应时长")
private Long responseTime;
@Excel(name = "编号")
@ApiModelProperty("编号")
private String identifier;
/** 名称 */
@Excel(name = "名称")
@ApiModelProperty("患者名称")
private String patientName;
@ApiModelProperty("医生名称")
private String doctorName;
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
@ApiModelProperty("用户性别")
private String sex;
/** 年龄 */
@Excel(name = "年龄")
@ApiModelProperty("患者年龄")
private Integer age;
/** 基础疾病 */
@Excel(name = "基础疾病")
@ApiModelProperty("基础疾病")
private String disease;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("初诊时间")
private Date firstTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("ai结果返回时间")
private Date aiResultReturnTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("ai结果修改时间")
private Date aiResultModifyTime;
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public Long getPatientId()
{
return patientId;
}
public void setPatientId(Long patientId)
{
this.patientId = patientId;
}
public Long getDoctorId()
{
return doctorId;
}
public void setDoctorId(Long doctorId)
{
this.doctorId = doctorId;
}
public Long getHospitalId()
{
return hospitalId;
}
public void setHospitalId(Long hospitalId)
{
this.hospitalId = hospitalId;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
public String getAiResult()
{
return aiResult;
}
public void setAiResult(String aiResult)
{
this.aiResult = aiResult;
}
public String getAiResult2()
{
return aiResult2;
}
public void setAiResult2(String aiResult2)
{
this.aiResult2 = aiResult2;
}
public String getUpdateResult()
{
return updateResult;
}
public void setUpdateResult(String updateResult)
{
this.updateResult = updateResult;
}
public String getUpdateResult2()
{
return updateResult2;
}
public void setUpdateResult2(String updateResult2)
{
this.updateResult2 = updateResult2;
}
public Date getUploadTime()
{
return uploadTime;
}
public void setUploadTime(Date uploadTime)
{
this.uploadTime = uploadTime;
}
public String getImgSx()
{
return imgSx;
}
public void setImgSx(String imgSx)
{
this.imgSx = imgSx;
}
public String getImgSm()
{
return imgSm;
}
public void setImgSm(String imgSm)
{
this.imgSm = imgSm;
}
public Long getResponseTime()
{
return responseTime;
}
public void setResponseTime(Long responseTime)
{
this.responseTime = responseTime;
}
public String getIdentifier()
{
return identifier;
}
public void setIdentifier(String identifier)
{
this.identifier = identifier;
}
public String getPatientName()
{
return patientName;
}
public void setPatientName(String patientName)
{
this.patientName = patientName;
}
public String getDoctorName()
{
return doctorName;
}
public void setDoctorName(String doctorName)
{
this.doctorName = doctorName;
}
public String getSex()
{
return sex;
}
public void setSex(String sex)
{
this.sex = sex;
}
public Integer getAge()
{
return age;
}
public void setAge(Integer age)
{
this.age = age;
}
public String getDisease()
{
return disease;
}
public void setDisease(String disease)
{
this.disease = disease;
}
public Date getFirstTime()
{
return firstTime;
}
public void setFirstTime(Date firstTime)
{
this.firstTime = firstTime;
}
public Date getAiResultReturnTime()
{
return aiResultReturnTime;
}
public void setAiResultReturnTime(Date aiResultReturnTime)
{
this.aiResultReturnTime = aiResultReturnTime;
}
public Date getAiResultModifyTime()
{
return aiResultModifyTime;
}
public void setAiResultModifyTime(Date aiResultModifyTime)
{
this.aiResultModifyTime = aiResultModifyTime;
}
public Date getWaitingTime()
{
return waitingTime;
}
public void setWaitingTime(Date waitingTime)
{
this.waitingTime = waitingTime;
}
}

@ -0,0 +1,40 @@
package com.ruoyi.system.domain.resp;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
* @Author zhuqing
* @Date 2022/8/9
*/
@ApiModel(value = "WeekMonthPersonCountResp", description = "工作台今日就诊计划反参实体")
public class WeekMonthPersonCountResp {
/** 医院 */
@ApiModelProperty("count")
private int count;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("创建时间")
private Date createTime;
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

@ -1,7 +1,17 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.TPatientHospitalDoctor;
import com.ruoyi.system.domain.TPatient;
import com.ruoyi.system.domain.TRecord;
import com.ruoyi.system.domain.req.TRecordResultReq;
import com.ruoyi.system.domain.resp.PlatformDayPlanResp;
import com.ruoyi.system.domain.resp.TRecordResp;
import com.ruoyi.system.domain.resp.WeekMonthPersonCountResp;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
@ -9,8 +19,49 @@ import com.ruoyi.system.domain.TRecord;
* @author ruoyi
* @date 2022-08-03
*/
@Mapper
public interface TRecordMapper
{
/**
* --------------------------------------------------------------------
*/
/**
*
* @param hospitalId
* @param doctorId
* @return
*/
int selectEquCount(@Param("hospitalId") Long hospitalId,
@Param("doctorId")Long doctorId,
@Param("status")String status,
@Param("month")Long month,
@Param("week")Long week,
@Param("day")Long day);
/**
*
* @param hospitalId
* @param doctorId
* @return
*/
List<PlatformDayPlanResp> dayPlan(@Param("hospitalId") Long hospitalId,
@Param("doctorId")Long doctorId);
/**
* 1- 2-
* @param hospitalId
* @param doctorId
* @param weekMonth
* @return
*/
List<WeekMonthPersonCountResp> weekMonthPersonCount(@Param("hospitalId")Long hospitalId,
@Param("doctorId")Long doctorId,
@Param("weekMonth")Long weekMonth);
List<TPatient> ageCount(@Param("hospitalId")Long hospitalId,
@Param("doctorId")Long doctorId);
/**
*
*
@ -58,4 +109,16 @@ public interface TRecordMapper
* @return
*/
public int deleteTRecordByIds(Long[] ids);
List<TRecordResp> selectTRecordListWithoutResult(TRecordResultReq tRecord);
TRecordResp selectById(Long id);
/**
* id
*
* @param tPatientHospitalDoctor t
* @return {@code List<TRecord>}
*/
public List<TRecord> queryRecordListByPHDids(TPatientHospitalDoctor tPatientHospitalDoctor);
}

@ -1,7 +1,11 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.TPatientHospitalDoctor;
import com.ruoyi.system.domain.TRecord;
import com.ruoyi.system.domain.req.TRecordResultReq;
import com.ruoyi.system.domain.resp.TRecordResp;
/**
* Service
@ -58,4 +62,28 @@ public interface ITRecordService
* @return
*/
public int deleteTRecordById(Long id);
/**
*
*
* @param tRecord
* @return
*/
List<TRecordResp> selectTRecordListWithoutResult(TRecordResultReq tRecord);
/**
* id
*
* @param id
* @return
*/
TRecordResp selectById(Long id);
/**
* id
*
* @param tPatientHospitalDoctor t
* @return {@code List<TRecord>}
*/
public List<TRecord> queryRecordListByPHDids(TPatientHospitalDoctor tPatientHospitalDoctor);
}

@ -0,0 +1,72 @@
package com.ruoyi.system.service.impl;
import com.ruoyi.system.domain.TPatient;
import com.ruoyi.system.domain.resp.PlatformDayPlanResp;
import com.ruoyi.system.domain.resp.WeekMonthPersonCountResp;
import com.ruoyi.system.mapper.TRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author zhuqing
* @Date 2022/8/9
*/
@Component
public class PlatformService {
@Autowired
private TRecordMapper tRecordMapper;
/**
*
* @param hospitalId
* @param doctorId
* @return
*/
public Map<String, Integer> equCount(Long hospitalId, Long doctorId) {
//就诊总数
int all = tRecordMapper.selectEquCount(hospitalId, doctorId, "1", null, null,null);
//本月总数
int month = tRecordMapper.selectEquCount(hospitalId, doctorId, "1", 1L, null,null);
//本周总数
int week = tRecordMapper.selectEquCount(hospitalId, doctorId, "1", null, 1L,null);
//今日预约
int day = tRecordMapper.selectEquCount(hospitalId, doctorId, "0", null, null,1L);
Map<String, Integer> map = new HashMap<String, Integer>(){{
put("all",all);
put("month",month);
put("week",week);
put("day",day);
}};
return map;
}
/**
*
* @param hospitalId
* @param doctorId
* @return
*/
public List<PlatformDayPlanResp> dayPlan(Long hospitalId, Long doctorId) {
return tRecordMapper.dayPlan(hospitalId, doctorId);
}
/**
* /
* @param hospitalId
* @param doctorId
* @param weekMonth
* @return
*/
public List<WeekMonthPersonCountResp> weekMonthPersonCount(Long hospitalId, Long doctorId,Long weekMonth) {
return tRecordMapper.weekMonthPersonCount(hospitalId, doctorId,weekMonth);
}
public List<TPatient> ageCount(Long hospitalId, Long doctorId) {
return tRecordMapper.ageCount(hospitalId, doctorId);
}
}

@ -2,6 +2,9 @@ package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.TPatientHospitalDoctor;
import com.ruoyi.system.domain.req.TRecordResultReq;
import com.ruoyi.system.domain.resp.TRecordResp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TRecordMapper;
@ -93,4 +96,22 @@ public class TRecordServiceImpl implements ITRecordService
{
return tRecordMapper.deleteTRecordById(id);
}
@Override
public List<TRecordResp> selectTRecordListWithoutResult(TRecordResultReq tRecord)
{
return tRecordMapper.selectTRecordListWithoutResult(tRecord);
}
@Override
public TRecordResp selectById(Long id)
{
return tRecordMapper.selectById(id);
}
@Override
public List<TRecord> queryRecordListByPHDids(TPatientHospitalDoctor tPatientHospitalDoctor)
{
return tRecordMapper.queryRecordListByPHDids(tPatientHospitalDoctor);
}
}

@ -20,11 +20,124 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="imgSx" column="img_sx" />
<result property="imgSm" column="img_sm" />
<result property="responseTime" column="response_time" />
<result property="aiResultReturnTime" column="ai_result_return_time" />
<result property="aiResultModifyTime" column="ai_result_modify_time" />
</resultMap>
<sql id="selectTRecordVo">
select id, patient_id, doctor_id, hospital_id, status, ai_result, ai_result2, update_result, update_result2, create_time, update_time, upload_time, img_sx, img_sm, response_time from t_record
</sql>
<sql id="selectTRecordWithResult">
SELECT
tr.id,
tr.patient_id AS patientId,
tr.doctor_id AS doctorId,
tr.hospital_id AS hospitalId,
tr.STATUS,
tr.ai_result AS aiResult,
tr.ai_result2 AS aiResult2,
tr.update_result AS update_result,
tr.update_result2 AS updateResult2,
tr.update_time AS updateTime,
tr.upload_time AS uploadTime,
tr.create_time AS waitingTime,
tr.ai_result_return_time AS aiResultReturnTime,
tr.ai_result_modify_time AS aiResultModifyTime,
td.NAME AS doctorName,
tp.identifier,
tp.NAME AS patientName,
tp.sex,
tp.age,
tp.disease,
tp.img_sx AS imgSx,
tp.img_sm AS imgSm,
tp.create_time AS firstTime
FROM
t_record tr
LEFT JOIN t_doctor td ON tr.doctor_id = td.id
LEFT JOIN t_patient tp ON tr.patient_id = tp.id
</sql>
<sql id="selectTRecordWithOutResult">
SELECT
tr.id,
tr.patient_id AS patientId,
tr.doctor_id AS doctorId,
tr.hospital_id AS hospitalId,
tr.STATUS,
tr.ai_result2 AS aiResult2,
tr.update_result2 AS updateResult2,
tr.update_time AS updateTime,
tr.upload_time AS uploadTime,
tr.create_time AS waitingTime,
tr.ai_result_return_time AS aiResultReturnTime,
tr.ai_result_modify_time AS aiResultModifyTime,
td.NAME AS doctorName,
tp.identifier,
tp.NAME AS patientName,
tp.sex,
tp.age,
tp.disease,
tp.create_time AS firstTime
FROM
t_record tr
LEFT JOIN t_doctor td ON tr.doctor_id = td.id
LEFT JOIN t_patient tp ON tr.patient_id = tp.id
</sql>
<!--====================工作台相关接口=====================-->
<select id="selectEquCount" resultType="int">
select count(*) from t_record
<where>
1 = 1
<if test="doctorId != null "> and doctor_id = #{doctorId}</if>
<if test="hospitalId != null "> and hospital_id = #{hospitalId}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="month != null ">
and DATE_FORMAT(create_time,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m')
</if>
<if test="week != null ">
and YEARWEEK(date_format(create_time,'%Y-%m-%d'),1) = YEARWEEK(now(),1)
</if>
<if test="day != null ">
and TO_DAYS(create_time) = TO_DAYS(NOW())
</if>
</where>
</select>
<select id="dayPlan" resultType="com.ruoyi.system.domain.resp.PlatformDayPlanResp">
select
a.create_time as createTime,
if(a.status = '0','预约','就诊') as status,
b.name
from t_record a LEFT JOIN t_patient b on a.patient_id = b.id
where TO_DAYS(a.create_time) = TO_DAYS(NOW())
<if test="doctorId != null "> and a.doctor_id = #{doctorId}</if>
<if test="hospitalId != null "> and a.hospital_id = #{hospitalId}</if>
ORDER BY a.create_time desc
limit 5
</select>
<select id="weekMonthPersonCount" resultType="com.ruoyi.system.domain.resp.WeekMonthPersonCountResp">
select date_format(create_time, '%Y-%m-%d') createTime, count(*) count
from
<if test="weekMonth == 1 || weekMonth == null">
(select * from t_record where DATE_SUB(CURDATE(), INTERVAL 7 DAY) &lt;= date(create_time)) X
</if>
<if test="weekMonth == 2">
(select * from t_record where DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= date(create_time)) X
</if>
where 1 = 1
<if test="doctorId != null "> and X.doctor_id = #{doctorId}</if>
<if test="hospitalId != null "> and X.hospital_id = #{hospitalId}</if>
group by date_format(X.create_time, '%Y-%m-%d');
</select>
<select id="ageCount" resultType="com.ruoyi.system.domain.TPatient">
</select>
<!--====================工作台相关接口=====================-->
<select id="selectTRecordList" parameterType="TRecord" resultMap="TRecordResult">
<include refid="selectTRecordVo"/>
@ -44,6 +157,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="selectTRecordListWithoutResult" parameterType="TRecordResultReq" resultType="TRecordResp">
<include refid="selectTRecordWithOutResult"/>
<where>
<if test="name != null and name != ''"> and tp.name like concat('%', #{name}, '%')</if>
<if test="doctorId != null "> and tr.doctor_id = #{doctorId}</if>
<if test="hospitalId != null "> and tr.hospital_id = #{hospitalId}</if>
<if test="status != null and status != ''"> and tr.status = #{status}</if>
<if test="age !=null">and tp.age = #{age} </if>
<if test="sex !=null">and tp.sex = #{sex} </if>
<if test="startTime != null and endTime != null">
AND tp.create_time between DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i:%s') and DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test="doctorOder !=null and firstVisitOder!=null" >order by tr.create_time ${doctorOder}, tp.create_time ${firstVisitOder}</if>
</where>
</select>
<select id="selectTRecordById" parameterType="Long" resultMap="TRecordResult">
<include refid="selectTRecordVo"/>
where id = #{id}
@ -66,6 +195,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="imgSx != null">img_sx,</if>
<if test="imgSm != null">img_sm,</if>
<if test="responseTime != null">response_time,</if>
<if test="aiResultReturnTime != null">ai_result_return_time,</if>
<if test="aiResultModifyTime != null">ai_result_modify_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="patientId != null">#{patientId},</if>
@ -82,6 +213,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="imgSx != null">#{imgSx},</if>
<if test="imgSm != null">#{imgSm},</if>
<if test="responseTime != null">#{responseTime},</if>
<if test="aiResultReturnTime != null">#{aiResultReturnTime},</if>
<if test="aiResultModifyTime != null">#{aiResultModifyTime},</if>
</trim>
</insert>
@ -102,6 +235,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="imgSx != null">img_sx = #{imgSx},</if>
<if test="imgSm != null">img_sm = #{imgSm},</if>
<if test="responseTime != null">response_time = #{responseTime},</if>
<if test="aiResultReturnTime != null">ai_result_return_time = #{aiResultReturnTime},</if>
<if test="aiResultModifyTime != null">ai_result_modify_time = #{aiResultModifyTime},</if>
</trim>
where id = #{id}
</update>
@ -116,4 +251,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="selectById" parameterType="Long" resultType="TRecordResp">
<include refid="selectTRecordWithResult"/>
where id = #{id}
</select>
<select id="queryRecordListByPHDids" parameterType="TPatientHospitalDoctor" resultMap="TRecordResult">
<include refid="selectTRecordWithOutResult"/>
<where>
<if test="patientId != null and patientId != ''"> and patient_id = #{patientId}</if>
<if test="doctorId != null and doctorId != ''"> and doctor_id = #{doctorId}</if>
<if test="hospitalId != null and hospitalId != ''"> and hospital_id = #{hospitalId}</if>
</where>
</select>
</mapper>
Loading…
Cancel
Save