Переглянути джерело

修复查询医保诊断list超界的问题

lighter 4 роки тому
батько
коміт
e0b27c4998

+ 1 - 17
src/main/java/thyyxxk/webserver/controller/yibao/DictionaryController.java

@@ -46,22 +46,6 @@ public class DictionaryController {
     @PassToken
     @PostMapping("/searchYbDiag")
     public ResultVo<List<PureCodeName>> searchYbDiag(@RequestBody SearchDataParam param) {
-        ResultVo<List<PureCodeName>> res;
-        if (param.getMedType().equals(MedType.MATERNITY_HOSPITALIZATION.getCode())) {
-            res = service.getMaternDiagsForFrontSheet(param);
-        } else if (param.getMedType().equals(MedType.SINGLE_DISEASE_HOSPITALIZATION.getCode())) {
-            res = service.getSingleDssForFrontSheet(param);
-        } else {
-            res = service.executeSearch(param);
-        }
-        if (res.getCode() != ExceptionEnum.SUCCESS.getCode()) {
-            return res;
-        }
-        int start = param.getPage() * 10;
-        int end = param.getPage() * 10 + 10;
-        // todo 诊断搜索 这里使用编码 和 中文名称的时候 会报 下面这个错误
-        //  ervlet.service() for servlet [dispatcherServlet] in context with path [] threw exception
-        //  [Request processing failed; nested exception is java.lang.IllegalArgumentException: fromIndex(10) > toIndex(1)] with root cause
-        return ResultVoUtil.success(res.getData().subList(start, Math.min(res.getData().size(), end)));
+        return service.searchYbDiag(param);
     }
 }

+ 0 - 6
src/main/java/thyyxxk/webserver/dao/his/yibao/DictionaryDao.java

@@ -11,12 +11,6 @@ import java.util.List;
 @Mapper
 public interface DictionaryDao {
 
-    @Select("SELECT rtrim(code) code, rtrim(name) name FROM zd_visit_type")
-    List<PureCodeName> getVisitType();
-
-    @Select("SELECT rtrim(code) code,rtrim(name) name FROM zy_zd_responce_type WHERE (isnull(del_flag,0)) = 0")
-    List<PureCodeName> getResponceType();
-
     @Select("SELECT RTRIM(code) AS code,rtrim(name) name FROM a_employee_mi WHERE isnull(del_flag,0)!=1 and py_code LIKE #{content}")
     List<PureCodeName> searchPhysicianByPinyin(String content);
 

+ 20 - 0
src/main/java/thyyxxk/webserver/service/yibao/DictionaryService.java

@@ -1,8 +1,10 @@
 package thyyxxk.webserver.service.yibao;
 
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
+import thyyxxk.webserver.constants.sidicts.MedType;
 import thyyxxk.webserver.dao.his.yibao.DictionaryDao;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.dictionary.PureCodeName;
@@ -16,6 +18,7 @@ import java.util.List;
 /**
  * @author dj
  */
+@Slf4j
 @Service
 public class DictionaryService {
     private final DictionaryDao dao;
@@ -122,4 +125,21 @@ public class DictionaryService {
         }
         return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER);
     }
+
+    public ResultVo<List<PureCodeName>> searchYbDiag(SearchDataParam param) {
+        log.info("searchYbDiag: {}", param);
+        ResultVo<List<PureCodeName>> res;
+        if (param.getMedType().equals(MedType.MATERNITY_HOSPITALIZATION.getCode())) {
+            res = getMaternDiagsForFrontSheet(param);
+        } else if (param.getMedType().equals(MedType.SINGLE_DISEASE_HOSPITALIZATION.getCode())) {
+            res = getSingleDssForFrontSheet(param);
+        } else {
+            res = executeSearch(param);
+        }
+        if (res.getCode() != ExceptionEnum.SUCCESS.getCode()) {
+            return res;
+        }
+        return ResultVoUtil.success(res.getData().subList((param.getPage() - 1) * 10,
+                Math.min(res.getData().size(), param.getPage() * 10)));
+    }
 }