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; + } +}