Explorar el Código

常用标签维护——获取科室信息修改

wangyu hace 6 años
padre
commit
15965d8c80

+ 4 - 6
icssman-service/src/main/java/com/diagbot/facade/DeptInfoFacade.java

@@ -1,7 +1,7 @@
 package com.diagbot.facade;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.DeptInfoDTO;
 import com.diagbot.entity.DeptInfo;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.exception.CommonErrorCode;
@@ -105,11 +105,9 @@ public class DeptInfoFacade extends DeptInfoServiceImpl {
      * 常用标签维护获取科室名称
      * @return
      */
-    public List<DeptInfo> getAllDeptInfo(){
-        QueryWrapper<DeptInfo> queryWrapper =new QueryWrapper();
-        queryWrapper.eq("is_deleted",IsDeleteEnum.N.getKey());
-        List<DeptInfo> deptInfoList = this.list(queryWrapper);
-        if (ListUtil.isEmpty(deptInfoList)){
+    public List<DeptInfoDTO> getAllDeptInfo(){
+        List<DeptInfoDTO> deptInfoList = this.getDeptName();
+        if(ListUtil.isEmpty(deptInfoList)){
             throw new CommonException(CommonErrorCode.FAIL,
                     "获取科室名称失败");
         }

+ 11 - 0
icssman-service/src/main/java/com/diagbot/facade/QuestionInfoFacade.java

@@ -2,6 +2,7 @@ package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.diagbot.dto.GetQuestionInfoDTO;
 import com.diagbot.dto.QuestionIndexDTO;
 import com.diagbot.entity.QuestionDetail;
 import com.diagbot.entity.QuestionInfo;
@@ -16,6 +17,7 @@ import com.diagbot.util.DateUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.util.UserUtils;
+import com.diagbot.vo.GetQuestionInfoVO;
 import com.diagbot.vo.QuestionSaveVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
@@ -181,4 +183,13 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
         queryWrapper.eq("name",questionInfo.getName());
         return this.getOne(queryWrapper);
     }
+
+    public List<GetQuestionInfoDTO> getQuestiongInfosByName(GetQuestionInfoVO getQuestionInfoVO){
+        List<GetQuestionInfoDTO> getQuestionInfoDTOS = this.getQuestiongInfosByName(getQuestionInfoVO);
+        if(ListUtil.isEmpty(getQuestionInfoDTOS)){
+            throw new CommonException(CommonErrorCode.FAIL,
+                    "获取科室信息失败");
+        }
+        return getQuestionInfoDTOS;
+    }
 }

+ 6 - 0
icssman-service/src/main/java/com/diagbot/mapper/DeptInfoMapper.java

@@ -33,4 +33,10 @@ public interface DeptInfoMapper extends BaseMapper<DeptInfo> {
      * @return
      */
     public List<DeptInfoDTO> getDeptInfos(@Param("deptCode") String deptCode,@Param("hospitalCode") String hospitalCode);
+
+    /**
+     * 获取科室名称
+     * @return
+     */
+    public List<DeptInfoDTO> getDeptName();
 }

+ 6 - 0
icssman-service/src/main/java/com/diagbot/service/DeptInfoService.java

@@ -32,4 +32,10 @@ public interface DeptInfoService extends IService<DeptInfo> {
      * @return
      */
     public List<DeptInfoDTO> getDeptInfos(String deptCode, String hospitalCode);
+
+    /**
+     * 获取科室名称
+     * @return
+     */
+    public List<DeptInfoDTO> getDeptName();
 }

+ 5 - 0
icssman-service/src/main/java/com/diagbot/service/impl/DeptInfoServiceImpl.java

@@ -31,4 +31,9 @@ public class DeptInfoServiceImpl extends ServiceImpl<DeptInfoMapper, DeptInfo> i
     public List<DeptInfoDTO> getDeptInfos(String deptCode, String hospitalCode) {
         return baseMapper.getDeptInfos(deptCode,hospitalCode);
     }
+
+    @Override
+    public List<DeptInfoDTO> getDeptName() {
+        return baseMapper.getDeptName();
+    }
 }

+ 5 - 5
icssman-service/src/main/java/com/diagbot/web/QuestionUsualController.java

@@ -3,9 +3,9 @@ package com.diagbot.web;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.DeptInfoDTO;
 import com.diagbot.dto.GetQuestionInfoDTO;
 import com.diagbot.dto.RespDTO;
-import com.diagbot.entity.DeptInfo;
 import com.diagbot.entity.QuestionUsual;
 import com.diagbot.facade.DeptInfoFacade;
 import com.diagbot.facade.QuestionInfoFacade;
@@ -93,8 +93,8 @@ public class QuestionUsualController {
             notes = "")
     @PostMapping("/getDeptName")
     @SysLogger("getDeptName")
-    public RespDTO<List<DeptInfo>> getDeptName() {
-        List<DeptInfo> data = deptInfoFacade.getAllDeptInfo();
+    public RespDTO<List<DeptInfoDTO>> getDeptName() {
+        List<DeptInfoDTO> data = deptInfoFacade.getAllDeptInfo();
         return RespDTO.onSuc(data);
     }
 
@@ -103,8 +103,8 @@ public class QuestionUsualController {
                     "deptId: 科室id,如果是添加不用填,如果是修改,必填<br>")
     @PostMapping("/getQuestionInfo")
     @SysLogger("getQuestionInfo")
-    public RespDTO<List<DeptInfo>> getQuestionInfo(@Valid @RequestBody GetQuestionInfoVO getQuestionInfoVO) {
-        List<GetQuestionInfoDTO> data = questionInfoFacade.getQuestiongInfoByName(getQuestionInfoVO);
+    public RespDTO<List<GetQuestionInfoDTO>> getQuestionInfo(@Valid @RequestBody GetQuestionInfoVO getQuestionInfoVO) {
+        List<GetQuestionInfoDTO> data = questionInfoFacade.getQuestiongInfosByName(getQuestionInfoVO);
         return RespDTO.onSuc(data);
     }
 }

+ 21 - 0
icssman-service/src/main/resources/mapper/DeptInfoMapper.xml

@@ -28,4 +28,25 @@
         WHERE a.is_deleted = 'N' AND b.is_deleted = 'N'
         AND b.`code` = #{deptCode} AND b.hospital_code = #{hospitalCode}
     </select>
+
+    <select id="getDeptName" resultType="com.diagbot.dto.DeptInfoDTO">
+        SELECT
+	      *
+        FROM
+	      `icss_dept_info` a
+        WHERE
+	      a.id NOT IN (
+		    SELECT
+			  b.dept_id
+		    FROM
+			  icss_question_usual b
+		    WHERE
+			  b.id IN (
+				SELECT
+					c.id
+				FROM
+					`icss_dept_info` c
+			)
+	)
+    </select>
 </mapper>