From 390f4a406eb09c15733dd801dc3cb574722d1c0f Mon Sep 17 00:00:00 2001 From: gongzhenkun <1658878546@qq.com> Date: Tue, 9 Aug 2022 14:45:39 +0800 Subject: [PATCH] =?UTF-8?q?app=E6=96=B0=E5=A2=9E=E6=82=A3=E8=80=85?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/api/AppController.java | 16 ++++++- .../system/domain/req/AppPatientReq.java | 45 +++++++++++++++++++ 2 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/req/AppPatientReq.java 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 2854d5e..e38b24d 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 @@ -4,6 +4,7 @@ import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.system.domain.*; +import com.ruoyi.system.domain.req.AppPatientReq; import com.ruoyi.system.domain.req.TRecordResultReq; import com.ruoyi.system.service.*; import io.swagger.annotations.Api; @@ -144,8 +145,19 @@ public class AppController extends BaseController */ @ApiOperation("添加患者") @PostMapping("/addPatient") - public AjaxResult addPatient(TPatient tPatient) { - return AjaxResult.success(tPatientService.insertTPatient(tPatient)); + 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 tPatientHospitalDoctors = itPatientHospitalDoctorService.selectTPatientHospitalDoctorList(tPatientHospitalDoctor); + if (tPatientHospitalDoctors.isEmpty()) + { + itPatientHospitalDoctorService.insertTPatientHospitalDoctor(tPatientHospitalDoctor); + } + return AjaxResult.success(); } 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 new file mode 100644 index 0000000..4152214 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/AppPatientReq.java @@ -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; + } +}