|
|
@@ -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);
|
|
|
}
|
|
|
}
|