Ver código fonte

投诉与建议

lighter 2 anos atrás
pai
commit
67e6682a16

+ 12 - 2
src/main/java/thyyxxk/webserver/controller/outpatient/complaints/ComplaintsController.java

@@ -1,10 +1,15 @@
 package thyyxxk.webserver.controller.outpatient.complaints;
 
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.outpatient.complaints.request.ComplaintsInquiry;
+import thyyxxk.webserver.entity.outpatient.complaints.response.ComplaintsAndSuggestions;
 import thyyxxk.webserver.service.outpatient.complaints.ComplaintsService;
 
+import java.util.List;
+
 @RestController
 @RequestMapping("/complaints")
 public class ComplaintsController {
@@ -14,4 +19,9 @@ public class ComplaintsController {
     public ComplaintsController(ComplaintsService service) {
         this.service = service;
     }
+
+    @PostMapping("/selectAllComplaints")
+    public ResultVo<List<ComplaintsAndSuggestions>> selectAllComplaints(@RequestBody @Validated ComplaintsInquiry inquiry) {
+        return service.selectAllComplaints(inquiry);
+    }
 }

+ 0 - 1
src/main/java/thyyxxk/webserver/controller/outpatient/triage/TriageController.java

@@ -5,7 +5,6 @@ import thyyxxk.webserver.config.auth.PassToken;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.dictionary.CodeName;
 import thyyxxk.webserver.entity.outpatient.triage.*;
-import thyyxxk.webserver.entity.triage.*;
 import thyyxxk.webserver.service.outpatient.triage.TriageService;
 import thyyxxk.webserver.utils.ResultVoUtil;
 

+ 8 - 0
src/main/java/thyyxxk/webserver/dao/his/outpatient/complaints/ComplaintsDao.java

@@ -1,7 +1,15 @@
 package thyyxxk.webserver.dao.his.outpatient.complaints;
 
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import thyyxxk.webserver.entity.outpatient.complaints.request.ComplaintsInquiry;
+import thyyxxk.webserver.entity.outpatient.complaints.response.ComplaintsAndSuggestions;
+
+import java.util.List;
 
 @Mapper
 public interface ComplaintsDao {
+    @Select("select * from t_complaints_and_suggestions where create_datetime>=#{start} " +
+            "and create_datetime<=#{end} ${extraStatement}")
+    List<ComplaintsAndSuggestions> selectAllComplaints(ComplaintsInquiry inquiry);
 }

+ 0 - 1
src/main/java/thyyxxk/webserver/dao/his/outpatient/triage/TriageDao.java

@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.*;
 import thyyxxk.webserver.entity.dictionary.CodeName;
 import thyyxxk.webserver.entity.outpatient.triage.*;
-import thyyxxk.webserver.entity.triage.*;
 
 import java.util.List;
 

+ 19 - 0
src/main/java/thyyxxk/webserver/entity/outpatient/complaints/request/ComplaintsInquiry.java

@@ -0,0 +1,19 @@
+package thyyxxk.webserver.entity.outpatient.complaints.request;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+@Data
+public class ComplaintsInquiry {
+    @NotBlank(message = "开始日期不能为空!")
+    private String start;
+    @NotBlank(message = "结束日期不能为空!")
+    private String end;
+    private String extraStatement;
+    private Integer replied;
+
+    public Integer getReplied() {
+        return null == replied ? -1 : replied;
+    }
+}

+ 4 - 0
src/main/java/thyyxxk/webserver/entity/outpatient/complaints/response/ComplaintsAndSuggestions.java

@@ -14,4 +14,8 @@ public class ComplaintsAndSuggestions {
     private String contact;
     private String name;
     private Date createDatetime;
+    private Integer replied;
+    private String response;
+    private String handleStaff;
+    private Date handleDatetime;
 }

+ 29 - 1
src/main/java/thyyxxk/webserver/service/outpatient/complaints/ComplaintsService.java

@@ -2,14 +2,42 @@ package thyyxxk.webserver.service.outpatient.complaints;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.dao.his.outpatient.complaints.ComplaintsDao;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.outpatient.complaints.request.ComplaintsInquiry;
+import thyyxxk.webserver.entity.outpatient.complaints.response.ComplaintsAndSuggestions;
+import thyyxxk.webserver.service.redislike.RedisLikeService;
+import thyyxxk.webserver.utils.ResultVoUtil;
+
+import java.util.List;
 
 @Service
 public class ComplaintsService {
     private final ComplaintsDao dao;
+    private final RedisLikeService redis;
 
     @Autowired
-    public ComplaintsService(ComplaintsDao dao) {
+    public ComplaintsService(ComplaintsDao dao, RedisLikeService redis) {
         this.dao = dao;
+        this.redis = redis;
+    }
+
+    public ResultVo<List<ComplaintsAndSuggestions>> selectAllComplaints(ComplaintsInquiry inquiry) {
+        String statement = "";
+        if (inquiry.getReplied() == 0) {
+            statement = "and replied=0";
+        } else if (inquiry.getReplied() == 1) {
+            statement = "and replied=1";
+        }
+        inquiry.setExtraStatement(statement);
+        List<ComplaintsAndSuggestions> list = dao.selectAllComplaints(inquiry);
+        if (list.isEmpty()) {
+            return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
+        }
+        for (ComplaintsAndSuggestions item : list) {
+            item.setHandleStaff(redis.getEmployeeName(item.getHandleStaff()));
+        }
+        return ResultVoUtil.success(list);
     }
 }

+ 0 - 1
src/main/java/thyyxxk/webserver/service/outpatient/triage/TriageService.java

@@ -14,7 +14,6 @@ import thyyxxk.webserver.dao.his.outpatient.triage.TriageDao;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.dictionary.CodeName;
 import thyyxxk.webserver.entity.outpatient.triage.*;
-import thyyxxk.webserver.entity.triage.*;
 import thyyxxk.webserver.utils.ResultVoUtil;
 import thyyxxk.webserver.utils.StringUtil;
 import thyyxxk.webserver.utils.TokenUtil;