From 30e7d66dea807eb7cee4bf63ca20efd3527c1383 Mon Sep 17 00:00:00 2001 From: gongzhenkun <1658878546@qq.com> Date: Mon, 8 Aug 2022 17:14:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/api/AppController.java | 59 +++++++++++++++++-- 1 file changed, 53 insertions(+), 6 deletions(-) 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 c3641d5..49959cd 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 @@ -2,19 +2,19 @@ package com.ruoyi.web.controller.api; 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.TDoctor; import com.ruoyi.system.domain.THospital; +import com.ruoyi.system.domain.TPatientHospitalDoctor; import com.ruoyi.system.domain.TRecord; -import com.ruoyi.system.service.ITHospitalService; -import com.ruoyi.system.service.ITRecordService; +import com.ruoyi.system.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; 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 javax.annotation.Resource; import java.util.List; /** @@ -32,6 +32,12 @@ public class AppController extends BaseController @Autowired private ITHospitalService tHospitalService; + @Resource + private ITDoctorService tDoctorService; + + @Resource + private ITPatientHospitalDoctorService itPatientHospitalDoctorService; + /** * 完成AI诊断 @@ -40,8 +46,8 @@ public class AppController extends BaseController @GetMapping("/ai/finish") public AjaxResult finish(Long id) { - TRecord record= tRecordService.selectTRecordById(id); - if(record!=null) + TRecord record = tRecordService.selectTRecordById(id); + if (record != null) { record.setStatus("1"); } @@ -54,4 +60,45 @@ public class AppController extends BaseController List tHospitals = tHospitalService.selectTHospitalList(new THospital()); return AjaxResult.success(tHospitals); } + + + /** + * 医生信息获取 + * + * @param doctorId 医生id + * @return {@code AjaxResult} + */ + @ApiOperation("医生信息获取") + @GetMapping("/doctorInformation") + public AjaxResult doctorInformation(Long doctorId) + { + TDoctor tDoctor = tDoctorService.selectTDoctorById(doctorId); + return AjaxResult.success(tDoctor); + } + + /** + * 病人预约 + * + * @param tPatientHospitalDoctor tPatientHospitalDoctor + * @return {@code AjaxResult} + */ + @ApiOperation("患者预约") + @GetMapping("/getDoctorInfo") + public AjaxResult patientsToMakeAnAppointment(TPatientHospitalDoctor tPatientHospitalDoctor) + { + // 患者预约,新增t_record中的一条记录;判断关联表是否存在当前关系 + 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 tPHDs = itPatientHospitalDoctorService.selectTPatientHospitalDoctorList(tPatientHospitalDoctor); + if (tPHDs.isEmpty()) + { + itPatientHospitalDoctorService.insertTPatientHospitalDoctor(tPatientHospitalDoctor); + } + return AjaxResult.success(); + } }