From 0e6a6c089f455cc7fde79ea69cbcdf1b83a46892 Mon Sep 17 00:00:00 2001 From: Wtd <1658714322@qq.com> Date: Fri, 3 Nov 2023 15:39:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E8=A1=A8=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DepartmentController.java | 10 +++++++++ .../patient/controller/PatientController.java | 16 ++++++++++++++ .../patient/controller/ReviewController.java | 19 +++++++++++++---- .../february/patient/mapper/ReviewMapper.java | 2 ++ .../patient/service/ReviewService.java | 2 ++ .../service/impl/ReviewServiceImpl.java | 9 ++++++++ .../resources/mapper/patient/ReviewMapper.xml | 21 +++++++++++++++++++ 7 files changed, 75 insertions(+), 4 deletions(-) diff --git a/february-patient-server/src/main/java/com/february/patient/controller/DepartmentController.java b/february-patient-server/src/main/java/com/february/patient/controller/DepartmentController.java index 556faff..9ccdc3e 100644 --- a/february-patient-server/src/main/java/com/february/patient/controller/DepartmentController.java +++ b/february-patient-server/src/main/java/com/february/patient/controller/DepartmentController.java @@ -14,11 +14,21 @@ import org.springframework.web.bind.annotation.RestController; * @author: Mr.Wang * @create: 2023-11-02 21:53 **/ + +/** + * 科室 + */ @RestController @RequestMapping("/department") public class DepartmentController { @Autowired private DepartmentService departmentService; + + /** + * 查询科室信息 + * @param departmentId + * @return + */ @PostMapping("/findById") public Department findById(@RequestParam Integer departmentId){ return departmentService.findById(departmentId); diff --git a/february-patient-server/src/main/java/com/february/patient/controller/PatientController.java b/february-patient-server/src/main/java/com/february/patient/controller/PatientController.java index 74d7bbd..c4ff606 100644 --- a/february-patient-server/src/main/java/com/february/patient/controller/PatientController.java +++ b/february-patient-server/src/main/java/com/february/patient/controller/PatientController.java @@ -13,15 +13,31 @@ import java.util.List; * @author: Mr.Wang * @create: 2023-11-02 18:58 **/ + +/** + * 病友圈 + */ @RestController @RequestMapping("/patient") public class PatientController { @Autowired private PatientService patientService; + + /** + * 查看病友圈详情 + * @param patientCircleDetailId + * @return + */ @PostMapping("/circleDetail") public PatientCircleDetail circleDetail(@RequestParam Integer patientCircleDetailId){ return patientService.circleDetail(patientCircleDetailId); } + + /** + * 关键字及病症名称查询 + * @param title + * @return + */ @PostMapping("/findByName") public List findByName(@RequestParam String title){ return patientService.findByName(title); diff --git a/february-patient-server/src/main/java/com/february/patient/controller/ReviewController.java b/february-patient-server/src/main/java/com/february/patient/controller/ReviewController.java index 4cc3ae6..48a0840 100644 --- a/february-patient-server/src/main/java/com/february/patient/controller/ReviewController.java +++ b/february-patient-server/src/main/java/com/february/patient/controller/ReviewController.java @@ -3,10 +3,7 @@ package com.february.patient.controller; import com.february.patient.domain.Review; import com.february.patient.service.ReviewService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -16,13 +13,27 @@ import java.util.List; * @author: Mr.Wang * @create: 2023-11-02 20:43 **/ + +/** + * 评论 + */ @RestController @RequestMapping("/review") public class ReviewController { @Autowired private ReviewService reviewService; + + /** + * 所有评论信息 + * @param patientCircleDetailId + * @return + */ @PostMapping("/findReviewListByPatientCircleDetailId") public List findReviewListByPatientCircleDetailId(@RequestParam Integer patientCircleDetailId){ return reviewService.findReviewListByPatientCircleDetailId(patientCircleDetailId); } + @PostMapping("/addReview") + public void addReview(@RequestBody Review review){ + reviewService.addReview(review); + } } diff --git a/february-patient-server/src/main/java/com/february/patient/mapper/ReviewMapper.java b/february-patient-server/src/main/java/com/february/patient/mapper/ReviewMapper.java index dcfc985..428b4ac 100644 --- a/february-patient-server/src/main/java/com/february/patient/mapper/ReviewMapper.java +++ b/february-patient-server/src/main/java/com/february/patient/mapper/ReviewMapper.java @@ -13,4 +13,6 @@ import java.util.List; **/ public interface ReviewMapper { List findReviewListByPatientCircleDetailId(@Param("patientCircleDetailId") Integer patientCircleDetailId); + + void addReview(Review review); } diff --git a/february-patient-server/src/main/java/com/february/patient/service/ReviewService.java b/february-patient-server/src/main/java/com/february/patient/service/ReviewService.java index cc6f2d0..11c9ffa 100644 --- a/february-patient-server/src/main/java/com/february/patient/service/ReviewService.java +++ b/february-patient-server/src/main/java/com/february/patient/service/ReviewService.java @@ -12,4 +12,6 @@ import java.util.List; **/ public interface ReviewService { List findReviewListByPatientCircleDetailId(Integer patientCircleDetailId); + + void addReview(Review review); } diff --git a/february-patient-server/src/main/java/com/february/patient/service/impl/ReviewServiceImpl.java b/february-patient-server/src/main/java/com/february/patient/service/impl/ReviewServiceImpl.java index fe74d12..03b6cc2 100644 --- a/february-patient-server/src/main/java/com/february/patient/service/impl/ReviewServiceImpl.java +++ b/february-patient-server/src/main/java/com/february/patient/service/impl/ReviewServiceImpl.java @@ -6,6 +6,7 @@ import com.february.patient.service.ReviewService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Date; import java.util.List; /** @@ -22,4 +23,12 @@ public class ReviewServiceImpl implements ReviewService { public List findReviewListByPatientCircleDetailId(Integer patientCircleDetailId) { return reviewMapper.findReviewListByPatientCircleDetailId(patientCircleDetailId); } + + @Override + public void addReview(Review review) { + review.setReviewDate(new Date()); + review.setGoodNum(0); + review.setBadNum(0); + reviewMapper.addReview(review); + } } diff --git a/february-patient-server/src/main/resources/mapper/patient/ReviewMapper.xml b/february-patient-server/src/main/resources/mapper/patient/ReviewMapper.xml index feca142..da49f04 100644 --- a/february-patient-server/src/main/resources/mapper/patient/ReviewMapper.xml +++ b/february-patient-server/src/main/resources/mapper/patient/ReviewMapper.xml @@ -13,6 +13,27 @@ + +-- INSERT INTO `patientcircle`.`t_review` (`review_id`, `review_img`, `review_name`, `review_content`, `review_date`, `good_num`, `bad_num`, `patient_circle_detail_id`) +-- VALUES (1, '医生用户照片', '小楠楠', '一般会慢慢恢复', '2023-11-08', 99, 5, 1); + insert into t_review ( + review_img, + review_name, + review_content, + review_date, + good_num, + bad_num, + patient_circle_detail_id + )values ( + #{reviewImg}, + #{reviewName}, + #{reviewContent}, + #{reviewDate}, + #{goodNum}, + #{badNum}, + #{patientCircleDetailId} + ) +