diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java index 82ddfc3..5ee236b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java @@ -6,7 +6,9 @@ import com.ruoyi.common.core.domain.AjaxResult; 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.AppRecordReq; import com.ruoyi.system.domain.req.TRecordResultReq; +import com.ruoyi.system.domain.resp.TRecordResp; import com.ruoyi.system.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -82,8 +84,7 @@ public class AppController extends BaseController @GetMapping("/doctor/info") public AjaxResult doctorInformation(Long doctorId) { - TDoctor tDoctor = tDoctorService.selectTDoctorById(doctorId); - return AjaxResult.success(tDoctor); + return AjaxResult.success(tDoctorService.selectAppDoctorDetailById(doctorId)); } /** @@ -99,6 +100,7 @@ public class AppController extends BaseController // 患者预约,新增t_record中的一条记录;判断关联表是否存在当前关系 TPatientHospitalDoctor tPatientHospitalDoctor = new TPatientHospitalDoctor(); BeanUtils.copyProperties(appPatientHospitalDoctor, tPatientHospitalDoctor); + tPatientHospitalDoctor.setPatientId(getUserId()); TRecord tRecord = new TRecord(); tRecord.setHospitalId(tPatientHospitalDoctor.getHospitalId()); tRecord.setPatientId(tPatientHospitalDoctor.getPatientId()); @@ -129,6 +131,7 @@ public class AppController extends BaseController @GetMapping(value = "/config/ai/refreshtime") @Log(title = "获取AI结果刷新时间接口") + @ApiOperation("获取AI结果刷新时间接口") public AjaxResult getConfigKey() { String configKey="t.ai.refreshtime"; @@ -142,25 +145,29 @@ public class AppController extends BaseController */ @ApiOperation("诊断记录上传") @PostMapping("/record/diagnostic/upload") - public AjaxResult diagnosticRecordsUploaded(TRecord tRecord) { + public AjaxResult diagnosticRecordsUploaded(AppRecordReq appRecordReq) { + TRecord tRecord = new TRecord(); + BeanUtils.copyProperties(appRecordReq, tRecord); return AjaxResult.success(tRecordService.updateTRecord(tRecord)); } /** * 添加病人 * - * @param tPatient t病人 + * @param appPatientReq App端添加患者入参实体 * @return {@code AjaxResult} */ @ApiOperation("添加患者") @PostMapping("/patient/add") - public AjaxResult addPatient(AppPatientReq tPatient) + public AjaxResult addPatient(AppPatientReq appPatientReq) { + TPatient tPatient = new TPatient(); + BeanUtils.copyProperties(appPatientReq, tPatient); tPatientService.insertTPatient(tPatient); TPatientHospitalDoctor tPatientHospitalDoctor = new TPatientHospitalDoctor(); - tPatientHospitalDoctor.setHospitalId(tPatient.getHospitalId()); - tPatientHospitalDoctor.setDoctorId(tPatient.getDoctorId()); - tPatientHospitalDoctor.setPatientId(tPatient.getId()); + tPatientHospitalDoctor.setHospitalId(appPatientReq.getHospitalId()); + tPatientHospitalDoctor.setDoctorId(appPatientReq.getDoctorId()); + tPatientHospitalDoctor.setPatientId(appPatientReq.getId()); List tPatientHospitalDoctors = itPatientHospitalDoctorService.selectTPatientHospitalDoctorList(tPatientHospitalDoctor); if (tPatientHospitalDoctors.isEmpty()) { @@ -169,6 +176,20 @@ public class AppController extends BaseController return AjaxResult.success(); } + /** + * 修改患者 + * + * @param appPatientReq App端添加患者入参实体 + * @return {@code AjaxResult} + */ + @ApiOperation("患者信息修改") + @PostMapping("/patient/modify") + public AjaxResult patientsWithModified(AppPatientReq appPatientReq) { + TPatient tPatient = new TPatient(); + BeanUtils.copyProperties(appPatientReq, tPatient); + return AjaxResult.success(tPatientService.updateTPatient(tPatient)); + } + /** * 诊断记录列表 * @@ -180,7 +201,7 @@ public class AppController extends BaseController public AjaxResult diagnosisOfRecordList(AppPatientHospitalDoctor appPatientHospitalDoctor) { TPatientHospitalDoctor tPatientHospitalDoctor = new TPatientHospitalDoctor(); BeanUtils.copyProperties(appPatientHospitalDoctor, tPatientHospitalDoctor); - List tRecords = tRecordService.queryRecordListByPHDids(tPatientHospitalDoctor); + List tRecords = tRecordService.queryRecordListByPHDids(tPatientHospitalDoctor); return AjaxResult.success(tRecords); } @@ -191,12 +212,11 @@ public class AppController extends BaseController * @return {@code AjaxResult} */ @ApiOperation("患者诊断记录信息详情") - @GetMapping("/record/info") - public AjaxResult patientsWithDiagnosisOfRecordInformationDetails(Long id) { + @GetMapping("/record/info/{id}") + public AjaxResult patientsWithDiagnosisOfRecordInformationDetails(@PathVariable("id") Long id) { return AjaxResult.success(tRecordService.selectById(id)); } - /** * 患者已诊列表 * @@ -206,11 +226,10 @@ public class AppController extends BaseController @ApiOperation("患者已诊列表") @GetMapping("/record/diagnosedList") public AjaxResult patientsDiagnosedList(TRecordResultReq recordResultReq) { - recordResultReq.setStatus("0"); + recordResultReq.setStatus("1"); return AjaxResult.success(tRecordService.selectTRecordListWithoutResult(recordResultReq)); } - /** * 病人等待名单 * @@ -220,7 +239,7 @@ public class AppController extends BaseController @ApiOperation("患者候诊列表") @GetMapping("/record/waitingList") public AjaxResult patientsWaitingList(TRecordResultReq recordResultReq) { - recordResultReq.setStatus("2"); + recordResultReq.setStatus("0"); return AjaxResult.success(tRecordService.selectTRecordListWithoutResult(recordResultReq)); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/TRecordController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/TRecordController.java index e2b6e98..1ee70c4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/TRecordController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/TRecordController.java @@ -1,13 +1,19 @@ package com.ruoyi.web.controller.pc; -import java.util.List; +import java.util.*; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; import javax.servlet.http.HttpServletResponse; -import com.ruoyi.system.domain.TPatientHospitalDoctor; +import com.alibaba.fastjson.JSONObject; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.req.TRecordResultReq; +import com.ruoyi.system.domain.resp.RecordHistoryDataResp; import com.ruoyi.system.domain.resp.TRecordResp; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.apache.commons.collections.CollectionUtils; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -118,9 +124,9 @@ public class TRecordController extends BaseController return AjaxResult.success(tRecordService.selectById(id)); } - @GetMapping("getHistoryList") + @GetMapping("getHistoryRecordList") @ApiOperation("查询患者历史数据图表") - public AjaxResult getHistoryList(TRecord tRecord){ - return null; + public AjaxResult getHistoryRecordList(TRecord tRecord){ + return tRecordService.getHistoryList(tRecord); } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/AppPatientHospitalDoctor.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/AppPatientHospitalDoctor.java index b966230..94f43c7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/AppPatientHospitalDoctor.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/AppPatientHospitalDoctor.java @@ -13,52 +13,36 @@ import java.io.Serializable; * @date 2022/8/9 14:48 */ @ApiModel(value = "AppPatientHospitalDoctor", description = "App端患者预约入参实体") -public class AppPatientHospitalDoctor implements Serializable -{ +public class AppPatientHospitalDoctor implements Serializable { private static final long serialVersionUID = 1L; - /** 患者ID */ - @NotNull(message = "patientId不为空") - @ApiModelProperty("patientId") - private Long patientId; - - /** 医院ID */ + /** + * 医院ID + */ @NotNull(message = "hospitalId不为空") @ApiModelProperty("hospitalId") private Long hospitalId; - /** 医生ID */ + /** + * 医生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() - { + public Long getHospitalId() { return hospitalId; } - public void setHospitalId(Long hospitalId) - { + public void setHospitalId(Long hospitalId) { this.hospitalId = hospitalId; } - public Long getDoctorId() - { + public Long getDoctorId() { return doctorId; } - public void setDoctorId(Long doctorId) - { + public void setDoctorId(Long doctorId) { this.doctorId = doctorId; } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/AppPatientReq.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/AppPatientReq.java index 4152214..2e08f18 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/AppPatientReq.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/AppPatientReq.java @@ -1,11 +1,8 @@ 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端添加患者入参实体 * @@ -13,33 +10,186 @@ import javax.validation.constraints.NotNull; * @date 2022/8/9 14:32 */ @ApiModel(value = "AppPatientReq", description = "App端添加患者入参实体") -public class AppPatientReq extends TPatient -{ - @NotNull(message = "doctorId不为空") +public class AppPatientReq { + /** + * 医生id + */ @ApiModelProperty("doctorId") private Long doctorId; - @NotNull(message = "hospitalId不为空") + /** + * 医院Id + */ @ApiModelProperty("hospitalId") private Long hospitalId; - public Long getDoctorId() - { + /** + * ID + */ + @ApiModelProperty("patientId") + private Long id; + + /** + * 腾讯openid + */ + @ApiModelProperty("腾讯openid") + private String openId; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String identifier; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 电话 + */ + @ApiModelProperty("电话") + private String phone; + + /** + * 用户性别(0男 1女 2未知) + */ + @ApiModelProperty("用户性别: 0=男,1=女,2=未知") + private String sex; + + /** + * 年龄 + */ + @ApiModelProperty("年龄") + private Integer age; + + /** + * 身高 + */ + @ApiModelProperty("身高") + private Integer height; + + /** + * 体重 + */ + @ApiModelProperty("体重") + private Integer weight; + + /** + * 婚姻状态(0未婚 1已婚 2未知) + */ + @ApiModelProperty("婚姻状态: 0=未婚,1=已婚,2=未知") + private String marriage; + + /** + * 基础疾病 + */ + @ApiModelProperty("基础疾病") + private String disease; + + public Long getDoctorId() { return doctorId; } - public void setDoctorId(Long doctorId) - { + public void setDoctorId(Long doctorId) { this.doctorId = doctorId; } - public Long getHospitalId() - { + public Long getHospitalId() { return hospitalId; } - public void setHospitalId(Long hospitalId) - { + public void setHospitalId(Long hospitalId) { this.hospitalId = hospitalId; } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getOpenId() { + return openId; + } + + public void setOpenId(String openId) { + this.openId = openId; + } + + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + 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 Integer getHeight() { + return height; + } + + public void setHeight(Integer height) { + this.height = height; + } + + public Integer getWeight() { + return weight; + } + + public void setWeight(Integer weight) { + this.weight = weight; + } + + public String getMarriage() { + return marriage; + } + + public void setMarriage(String marriage) { + this.marriage = marriage; + } + + public String getDisease() { + return disease; + } + + public void setDisease(String disease) { + this.disease = disease; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/AppRecordReq.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/AppRecordReq.java new file mode 100644 index 0000000..8a4a942 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/AppRecordReq.java @@ -0,0 +1,229 @@ +package com.ruoyi.system.domain.req; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.io.Serializable; +import java.util.Date; + +/** + * App端诊断记录上传入参实体 + * + * @author gongzhenkun + * @date 2022/8/9 17:02 + */ +@ApiModel(value = "AppRecordReq", description = "App端诊断记录上传入参实体") +public class AppRecordReq implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private Long id; + + /** + * 患者 + */ + @ApiModelProperty("患者") + private Long patientId; + + /** + * 医生 + */ + @ApiModelProperty("医生") + private Long doctorId; + + /** + * 医院 + */ + @ApiModelProperty("医院") + private Long hospitalId; + + /** + * 状态(0预约 1就诊) + */ + @ApiModelProperty("状态 0=预约,1=就诊") + private String status; + + /** + * ai诊断结果 + */ + @ApiModelProperty("ai诊断结果") + private String aiResult; + + /** + * ai诊断结果,无图片 + */ + @ApiModelProperty("ai诊断结果,无图片") + private String aiResult2; + + /** + * 医生诊断结果 + */ + @ApiModelProperty("医生诊断结果") + private String updateResult; + + /** + * 医生诊断结果,无图片 + */ + @ApiModelProperty("医生诊断结果,无图片") + private String updateResult2; + + /** + * 上传时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty("上传时间") + private Date uploadTime; + + /** + * 舌下 + */ + @ApiModelProperty("舌下") + private String imgSx; + + /** + * 舌上 + */ + @ApiModelProperty("舌上") + private String imgSm; + + /** + * 响应时长 + */ + @ApiModelProperty("响应时长") + private Long responseTime; + + /** + * 响应时长 + */ + @ApiModelProperty("ai结果返回时间") + private Date aiResultReturnTime; + + /** + * 响应时长 + */ + @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 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; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/AppDoctorResp.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/AppDoctorResp.java new file mode 100644 index 0000000..e0ba830 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/AppDoctorResp.java @@ -0,0 +1,226 @@ +package com.ruoyi.system.domain.resp; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.io.Serializable; + +/** + * App端医生信息反参实体 + * + * @author gongzhenkun + * @date 2022/8/9 17:39 + */ +@ApiModel(value = "AppDoctorResp", description = "App端医生信息反参实体") +public class AppDoctorResp implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private Long id; + + /** + * 用户ID + */ + @ApiModelProperty("用户ID") + private Long userId; + + /** + * 编号 + */ + @ApiModelProperty("编号") + private String identifier; + + /** + * 名称 + */ + @ApiModelProperty("名称") + private String name; + + /** + * 电话 + */ + @ApiModelProperty("电话") + private String phone; + + /** + * 用户性别(0男 1女 2未知) + */ + @ApiModelProperty("用户性别: 0=男,1=女,2=未知") + private String sex; + + /** + * 年龄 + */ + @ApiModelProperty("年龄") + private Integer age; + + /** + * 婚姻状态(0未婚 1已婚 2未知) + */ + @ApiModelProperty("婚姻状态: 0=未婚,1=已婚,2=未知") + private String marriage; + + /** + * 职称 + */ + @ApiModelProperty("职称") + private String title; + + /** + * 专长 + */ + @ApiModelProperty("专长") + private String speciality; + + /** + * 简介 + */ + @ApiModelProperty("简介") + private String introduction; + + /** + * 职业医师照片路径 + */ + @ApiModelProperty("职业医师照片路径") + private String medicalLicense; + + /** + * 二维码base64 + */ + @ApiModelProperty("二维码base64") + private String qrCode; + + /** + * 医院 + */ + @ApiModelProperty("医院Id") + private Long hospitalId; + + /** + * 医院 + */ + @ApiModelProperty("医院名称") + private String hospitalName; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + 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 getMarriage() { + return marriage; + } + + public void setMarriage(String marriage) { + this.marriage = marriage; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getSpeciality() { + return speciality; + } + + public void setSpeciality(String speciality) { + this.speciality = speciality; + } + + public String getIntroduction() { + return introduction; + } + + public void setIntroduction(String introduction) { + this.introduction = introduction; + } + + public String getMedicalLicense() { + return medicalLicense; + } + + public void setMedicalLicense(String medicalLicense) { + this.medicalLicense = medicalLicense; + } + + public String getQrCode() { + return qrCode; + } + + public void setQrCode(String qrCode) { + this.qrCode = qrCode; + } + + public String getHospitalName() { + return hospitalName; + } + + public void setHospitalName(String hospitalName) { + this.hospitalName = hospitalName; + } + + public Long getHospitalId() { + return hospitalId; + } + + public void setHospitalId(Long hospitalId) { + this.hospitalId = hospitalId; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/RecordHistoryDataResp.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/RecordHistoryDataResp.java new file mode 100644 index 0000000..0241d7a --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/resp/RecordHistoryDataResp.java @@ -0,0 +1,57 @@ +package com.ruoyi.system.domain.resp; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +public class RecordHistoryDataResp +{ + private List shezhiList; + private List shetaiList; + private List shexiaList; + private List dateList; + + public RecordHistoryDataResp() + { + } + + public List getShezhiList() + { + return shezhiList; + } + + public void setShezhiList(List shezhiList) + { + this.shezhiList = shezhiList; + } + + public List getShetaiList() + { + return shetaiList; + } + + public void setShetaiList(List shetaiList) + { + this.shetaiList = shetaiList; + } + + public List getShexiaList() + { + return shexiaList; + } + + public void setShexiaList(List shexiaList) + { + this.shexiaList = shexiaList; + } + + public List getDateList() + { + return dateList; + } + + public void setDateList(List dateList) + { + this.dateList = dateList; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TDoctorMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TDoctorMapper.java index 6978432..2a60247 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TDoctorMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TDoctorMapper.java @@ -3,6 +3,7 @@ package com.ruoyi.system.mapper; import java.util.List; import com.ruoyi.system.domain.TDoctor; import com.ruoyi.system.domain.req.PcTDoctorQueryByPageReq; +import com.ruoyi.system.domain.resp.AppDoctorResp; import com.ruoyi.system.domain.resp.PcTDoctorQueryByPageResp; import org.apache.ibatis.annotations.Param; @@ -81,5 +82,12 @@ public interface TDoctorMapper */ int queryPatintCountByDoctor(@Param("hospitalId")Long hospitalId, @Param("doctorId")Long doctorId); + /** + * 查询医生信息 + * + * @param id 医生信息主键 + * @return 医生信息 + */ + public AppDoctorResp selectAppDoctorDetailById(Long id); } 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 20b4152..01f05db 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 @@ -120,5 +120,5 @@ public interface TRecordMapper * @param tPatientHospitalDoctor t病人医院医生 * @return {@code List} */ - public List queryRecordListByPHDids(TPatientHospitalDoctor tPatientHospitalDoctor); + public List queryRecordListByPHDids(TPatientHospitalDoctor tPatientHospitalDoctor); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITDoctorService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITDoctorService.java index 055d95a..fb47d16 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITDoctorService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITDoctorService.java @@ -3,6 +3,7 @@ package com.ruoyi.system.service; import java.util.List; import com.ruoyi.system.domain.TDoctor; import com.ruoyi.system.domain.req.PcTDoctorQueryByPageReq; +import com.ruoyi.system.domain.resp.AppDoctorResp; import com.ruoyi.system.domain.resp.PcTDoctorQueryByPageResp; /** @@ -62,4 +63,12 @@ public interface ITDoctorService public int deleteTDoctorById(Long id); List queryByPage(PcTDoctorQueryByPageReq pcTDoctorQueryByPageReq); + + /** + * 查询医生信息 + * + * @param id 医生信息主键 + * @return 医生信息 + */ + public AppDoctorResp selectAppDoctorDetailById(Long id); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITRecordService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITRecordService.java index 8512ded..499e206 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITRecordService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITRecordService.java @@ -2,6 +2,7 @@ package com.ruoyi.system.service; import java.util.List; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.system.domain.TPatientHospitalDoctor; import com.ruoyi.system.domain.TRecord; import com.ruoyi.system.domain.req.TRecordResultReq; @@ -85,5 +86,13 @@ public interface ITRecordService * @param tPatientHospitalDoctor t病人医院医生 * @return {@code List} */ - public List queryRecordListByPHDids(TPatientHospitalDoctor tPatientHospitalDoctor); + public List queryRecordListByPHDids(TPatientHospitalDoctor tPatientHospitalDoctor); + + /** + * + * 查询患者历史数据图表 + * @param tRecord 患者记录 + * @return {@code AjaxResult} + */ + AjaxResult getHistoryList(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 2959d9d..edf4104 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 @@ -3,6 +3,7 @@ package com.ruoyi.system.service.impl; import java.util.List; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.system.domain.req.PcTDoctorQueryByPageReq; +import com.ruoyi.system.domain.resp.AppDoctorResp; import com.ruoyi.system.domain.resp.PcTDoctorQueryByPageResp; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -102,4 +103,15 @@ public class TDoctorServiceImpl implements ITDoctorService pcTDoctorQueryByPageResps.stream().forEach(a -> a.setCountPatints(tDoctorMapper.queryPatintCountByDoctor(pcTDoctorQueryByPageReq.getHospitalId(),a.getId()))); return pcTDoctorQueryByPageResps; } + + /** + * 查询医生信息 + * + * @param id 医生信息主键 + * @return 医生信息 + */ + @Override + public AppDoctorResp selectAppDoctorDetailById(Long id) { + return tDoctorMapper.selectAppDoctorDetailById(id); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordServiceImpl.java index 658960d..3e42c5d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordServiceImpl.java @@ -1,10 +1,17 @@ package com.ruoyi.system.service.impl; -import java.util.List; +import java.util.*; +import java.util.stream.Collectors; + +import com.alibaba.fastjson.JSONObject; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.TPatientHospitalDoctor; import com.ruoyi.system.domain.req.TRecordResultReq; +import com.ruoyi.system.domain.resp.RecordHistoryDataResp; import com.ruoyi.system.domain.resp.TRecordResp; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.system.mapper.TRecordMapper; @@ -110,8 +117,60 @@ public class TRecordServiceImpl implements ITRecordService } @Override - public List queryRecordListByPHDids(TPatientHospitalDoctor tPatientHospitalDoctor) + public List queryRecordListByPHDids(TPatientHospitalDoctor tPatientHospitalDoctor) { return tRecordMapper.queryRecordListByPHDids(tPatientHospitalDoctor); } + + @Override + public AjaxResult getHistoryList(TRecord tRecord) + { + List tRecords = tRecordMapper.selectTRecordList(tRecord); + tRecords.removeIf(o->"0".equals(o.getStatus())); + if (CollectionUtils.isEmpty(tRecords)){ + return AjaxResult.success(); + } + List records = tRecords.stream().sorted(Comparator.comparing(TRecord::getCreateTime)).collect(Collectors.toList()); + List jsonKeyList = new ArrayList(){{ + add("shemian-sz_avg_red"); + add("st_avg_yellow"); + add("sx_vein_color"); + }}; + RecordHistoryDataResp recordHistoryDataRespMap = getDataList(records,jsonKeyList); + return AjaxResult.success(recordHistoryDataRespMap); + } + + private RecordHistoryDataResp getDataList(List records, List jsonKeyList) + { + + RecordHistoryDataResp recordHistoryDataResp = new RecordHistoryDataResp(); + List dateList = records.stream().map(TRecord::getCreateTime).collect(Collectors.toList()); + recordHistoryDataResp.setDateList(dateList); + List result = records.stream().map(tRecord -> { + JSONObject jsonObject; + if(StringUtils.isEmpty(tRecord.getUpdateResult2())){ + jsonObject = JSONObject.parseObject(tRecord.getAiResult2()); + }else { + jsonObject = JSONObject.parseObject(tRecord.getUpdateResult2()); + } + return jsonObject; + }).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(result)){ + List shezhiList = new LinkedList<>(); + List shetaiList = new LinkedList<>(); + List shexiaList = new LinkedList<>(); + String[] keys0 = jsonKeyList.get(0).split("-"); + String key1 = jsonKeyList.get(1); + String key2 = jsonKeyList.get(2); + result.forEach(jsonObject -> { + shezhiList.add(jsonObject.getJSONObject("data").getJSONObject("shezhi").getJSONObject(keys0[0]).getInteger(keys0[1])); + shetaiList.add(jsonObject.getJSONObject("data").getJSONObject("shetai").getInteger(key1)); + shexiaList.add(jsonObject.getJSONObject("data").getJSONObject("shexia").getInteger(key2)); + }); + recordHistoryDataResp.setShezhiList(shezhiList); + recordHistoryDataResp.setShetaiList(shetaiList); + recordHistoryDataResp.setShexiaList(shexiaList); + } + return recordHistoryDataResp; + } } diff --git a/ruoyi-system/src/main/resources/mapper/system/TDoctorMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TDoctorMapper.xml index 302c25b..afa30b9 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TDoctorMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TDoctorMapper.xml @@ -179,4 +179,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml index a27682c..db84bc0 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TRecordMapper.xml @@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - 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 + select id, patient_id, doctor_id, hospital_id, status,ai_result2,update_result2, create_time, update_time, upload_time,response_time from t_record SELECT @@ -155,6 +155,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and img_sm = #{imgSm} and response_time = #{responseTime} + - and patient_id = #{patientId}