소스 검색

质控条目和质控类型映射关系维护

zhoutg 5 년 전
부모
커밋
59cf606c3e

+ 22 - 0
mrman-service/src/main/java/com/diagbot/dto/QcEntryTypeDTO.java

@@ -0,0 +1,22 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: zhoutg
+ * @time: 2020/3/30 16:54
+ */
+@Getter
+@Setter
+public class QcEntryTypeDTO {
+    // 医院id
+    private Long hospitalId;
+    // 条目id
+    private Long entryId;
+    // 条目名称
+    private String entryName;
+    // 质控类型集
+    private String typeStr;
+}

+ 25 - 0
mrman-service/src/main/java/com/diagbot/dto/QcEntryTypeDetailDTO.java

@@ -0,0 +1,25 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: zhoutg
+ * @time: 2020/3/30 16:54
+ */
+@Getter
+@Setter
+public class QcEntryTypeDetailDTO {
+    // 医院id
+    private Long hospitalId;
+    // 条目id
+    private Long entryId;
+    // 条目名称
+    private String entryName;
+    // 已选择质控类型列表
+    private List<QcTypeSimpDTO> qcTypeSimpDTOList = new ArrayList<>();
+}

+ 24 - 0
mrman-service/src/main/java/com/diagbot/dto/QcTypeByEntryDTO.java

@@ -0,0 +1,24 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: zhoutg
+ * @time: 2020/3/30 16:54
+ */
+@Getter
+@Setter
+public class QcTypeByEntryDTO {
+    // 医院id
+    private Long hospitalId;
+    // 条目id
+    private Long entryId;
+    // 条目名称
+    private String entryName;
+    // 质控类型名称
+    private String typeName;
+    // 质控类型id
+    private Long typeId;
+}

+ 18 - 0
mrman-service/src/main/java/com/diagbot/dto/QcTypeSimpDTO.java

@@ -0,0 +1,18 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author: ztg
+ * @Date: 2018/10/24 16:11
+ */
+@Getter
+@Setter
+public class QcTypeSimpDTO {
+    // 质控id
+    private Long id;
+    // 质控类型名称
+    private String name;
+}

+ 119 - 15
mrman-service/src/main/java/com/diagbot/facade/QcCacesEntryFacade.java

@@ -7,22 +7,38 @@ import com.diagbot.dto.GetUpdateInfoDTO;
 import com.diagbot.dto.GetUpdateInfoDetialDTO;
 import com.diagbot.dto.QcCasesEntryAllDTO;
 import com.diagbot.dto.QcCasesEntrySimpleDTO;
+import com.diagbot.dto.QcEntryTypeDTO;
+import com.diagbot.dto.QcEntryTypeDetailDTO;
 import com.diagbot.dto.QcHospitalInfoAllDTO;
+import com.diagbot.dto.QcTypeByEntryDTO;
+import com.diagbot.dto.QcTypeSimpDTO;
 import com.diagbot.entity.CasesEntryHospital;
 import com.diagbot.entity.QcCasesEntry;
 import com.diagbot.entity.QcQuestionEntry;
 import com.diagbot.entity.QcTypeCasesEntry;
 import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.service.QcTypeCasesEntryService;
 import com.diagbot.service.impl.QcCasesEntryServiceImpl;
 import com.diagbot.util.BeanUtil;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.UserUtils;
 import com.diagbot.vo.GetUpdateInfoVO;
 import com.diagbot.vo.QcCasesEntryAllVO;
 import com.diagbot.vo.QcCasesEntryIndexVO;
 import com.diagbot.vo.QcEntryHospitalVO;
+import com.diagbot.vo.QcEntryTypeIndexVO;
+import com.diagbot.vo.QcEntryTypePageVO;
+import com.diagbot.vo.QcEntryTypeSaveVO;
+import com.diagbot.vo.QcEntryTypeVO;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -44,6 +60,9 @@ public class QcCacesEntryFacade extends QcCasesEntryServiceImpl {
     QcQuestionEntryFacade qcQuestionEntryFacade;
     @Autowired
     QcTypeCasesEntryFacade qcTypeCasesEntryFacade;
+    @Autowired
+    @Qualifier("qcTypeCasesEntryServiceImpl")
+    QcTypeCasesEntryService qcTypeCasesEntryService;
 
     /**
      * 分页获取病例条目
@@ -51,7 +70,7 @@ public class QcCacesEntryFacade extends QcCasesEntryServiceImpl {
      * @param qcCasesEntryAllVO
      * @return
      */
-    public IPage<QcCasesEntryAllDTO> getAll(QcCasesEntryAllVO qcCasesEntryAllVO){
+    public IPage<QcCasesEntryAllDTO> getAll(QcCasesEntryAllVO qcCasesEntryAllVO) {
         return this.getAllQcCasesEntry(qcCasesEntryAllVO);
     }
 
@@ -61,7 +80,7 @@ public class QcCacesEntryFacade extends QcCasesEntryServiceImpl {
      * @param qcCasesEntryIndexVO
      * @return
      */
-    public IPage<QcCasesEntryAllDTO> getAllQcCasesEntryIndexFac(QcCasesEntryIndexVO qcCasesEntryIndexVO){
+    public IPage<QcCasesEntryAllDTO> getAllQcCasesEntryIndexFac(QcCasesEntryIndexVO qcCasesEntryIndexVO) {
         return this.getAllQcCasesEntryIndex(qcCasesEntryIndexVO);
     }
 
@@ -71,25 +90,25 @@ public class QcCacesEntryFacade extends QcCasesEntryServiceImpl {
      * @param getUpdateInfoVO
      * @return
      */
-    public List<GetUpdateInfoDTO>  getUpdateInfo(GetUpdateInfoVO getUpdateInfoVO){
+    public List<GetUpdateInfoDTO> getUpdateInfo(GetUpdateInfoVO getUpdateInfoVO) {
         QueryWrapper<QcCasesEntry> qcCasesEntryQueryWrapper = new QueryWrapper<>();
         qcCasesEntryQueryWrapper
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("id",getUpdateInfoVO.getId());
+                .eq("id", getUpdateInfoVO.getId());
         QcCasesEntry qcCasesEntry = qcCacesEntryFacade.getOne(qcCasesEntryQueryWrapper);
         QueryWrapper<CasesEntryHospital> casesEntryHospitalQueryWrapper = new QueryWrapper<>();
         casesEntryHospitalQueryWrapper
-                .eq("is_deleted",IsDeleteEnum.N.getKey())
-                .eq("cases_entry_id",qcCasesEntry.getId())
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("cases_entry_id", qcCasesEntry.getId())
                 .groupBy("hospital_id");
         List<CasesEntryHospital> casesEntryHospitals = casesEntryHospitalFacade.list(casesEntryHospitalQueryWrapper);
         List<GetUpdateInfoDTO> getUpdateInfoDTOS = new ArrayList<>();
         GetUpdateInfoDTO getUpdateInfoDTO = new GetUpdateInfoDTO();
         List<GetUpdateInfoDetialDTO> getUpdateInfoDetialDTOS = new ArrayList<>();
         GetUpdateInfoDetialDTO getUpdateInfoDetialDTO = new GetUpdateInfoDetialDTO();
-        BeanUtil.copyProperties(qcCasesEntry,getUpdateInfoDTO);
-        Map<Long,String> hospitalNameMap = qcHospitalInfoFacade.getHospitalInfoAll().stream().collect(Collectors.toMap(QcHospitalInfoAllDTO::getId,qcHospitalInfoAllDTO -> qcHospitalInfoAllDTO.getName()));
-        for (CasesEntryHospital casesEntryHospital: casesEntryHospitals) {
+        BeanUtil.copyProperties(qcCasesEntry, getUpdateInfoDTO);
+        Map<Long, String> hospitalNameMap = qcHospitalInfoFacade.getHospitalInfoAll().stream().collect(Collectors.toMap(QcHospitalInfoAllDTO::getId, qcHospitalInfoAllDTO -> qcHospitalInfoAllDTO.getName()));
+        for (CasesEntryHospital casesEntryHospital : casesEntryHospitals) {
             getUpdateInfoDetialDTO = new GetUpdateInfoDetialDTO();
             getUpdateInfoDetialDTO.setHospitalName(hospitalNameMap.get(casesEntryHospital.getHospitalId()));
             getUpdateInfoDetialDTO.setMsg(casesEntryHospital.getMsg());
@@ -108,24 +127,24 @@ public class QcCacesEntryFacade extends QcCasesEntryServiceImpl {
      * @param getUpdateInfoVO
      * @return
      */
-    public Boolean deleteQcCasesEntry(GetUpdateInfoVO getUpdateInfoVO){
-       //删除条目
+    public Boolean deleteQcCasesEntry(GetUpdateInfoVO getUpdateInfoVO) {
+        //删除条目
         QueryWrapper<QcCasesEntry> qcCasesEntryQueryWrapper = new QueryWrapper<>();
-        qcCasesEntryQueryWrapper.eq("id",getUpdateInfoVO.getId());
+        qcCasesEntryQueryWrapper.eq("id", getUpdateInfoVO.getId());
         boolean res = this.remove(qcCasesEntryQueryWrapper);
         //删除明细
         QueryWrapper<CasesEntryHospital> casesEntryHospitalQueryWrapper = new QueryWrapper<>();
-        casesEntryHospitalQueryWrapper.eq("cases_entry_id",getUpdateInfoVO.getId());
+        casesEntryHospitalQueryWrapper.eq("cases_entry_id", getUpdateInfoVO.getId());
         casesEntryHospitalFacade.remove(casesEntryHospitalQueryWrapper);
         //删除模块
         UpdateWrapper<QcQuestionEntry> qcQuescQuestionInfoUpdate = new UpdateWrapper<>();
         qcQuescQuestionInfoUpdate
-                .eq("cases_entry_id",getUpdateInfoVO.getId());
+                .eq("cases_entry_id", getUpdateInfoVO.getId());
         qcQuestionEntryFacade.remove(qcQuescQuestionInfoUpdate);
         //删除质控类型
         UpdateWrapper<QcTypeCasesEntry> qcTypeCasesEntryUpdateWrapper = new UpdateWrapper<>();
         qcTypeCasesEntryUpdateWrapper
-                .eq("case_entry_id",getUpdateInfoVO.getId());
+                .eq("case_entry_id", getUpdateInfoVO.getId());
         qcTypeCasesEntryFacade.remove(qcTypeCasesEntryUpdateWrapper);
         return res;
 
@@ -134,4 +153,89 @@ public class QcCacesEntryFacade extends QcCasesEntryServiceImpl {
     public List<QcCasesEntrySimpleDTO> getEntryByHospitalFac(QcEntryHospitalVO qcEntryHospitalVO) {
         return this.getEntryByHospital(qcEntryHospitalVO);
     }
+
+
+    /********************************质控条目和质控类型关系映射开始******************************************/
+    /**
+     * 质控条目和质控类型关系映射【分页】
+     *
+     * @param qcEntryTypePageVO
+     * @returnFac
+     */
+    public IPage<QcEntryTypeDTO> entryTypePageFac(QcEntryTypePageVO qcEntryTypePageVO) {
+        return this.entryTypePage(qcEntryTypePageVO);
+    }
+
+    /**
+     * 质控条目和质控类型关系映射【明细】
+     *
+     * @param qcEntryTypeVO
+     * @returnFac
+     */
+    public QcEntryTypeDetailDTO getByIdFac(QcEntryTypeVO qcEntryTypeVO) {
+        QcEntryTypeDetailDTO res = new QcEntryTypeDetailDTO();
+        List<QcTypeByEntryDTO> qcEntryTypeDTOList = entryTypeDetail(qcEntryTypeVO);
+        if (ListUtil.isNotEmpty(qcEntryTypeDTOList)) {
+            BeanUtil.copyProperties(qcEntryTypeDTOList.get(0), res);
+            List<QcTypeSimpDTO> qcTypeSimpDTOList = new ArrayList<>();
+            qcEntryTypeDTOList.forEach(r -> {
+                QcTypeSimpDTO qcTypeSimpDTO = new QcTypeSimpDTO();
+                qcTypeSimpDTO.setId(r.getTypeId());
+                qcTypeSimpDTO.setName(r.getTypeName());
+                qcTypeSimpDTOList.add(qcTypeSimpDTO);
+            });
+            res.setQcTypeSimpDTOList(qcTypeSimpDTOList);
+        } else {
+            QcCasesEntry qcCasesEntry = this.getOne(new QueryWrapper<QcCasesEntry>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("id", qcEntryTypeVO.getEntryId())
+            );
+            if (qcCasesEntry == null) {
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "当前质控条目不存在");
+            }
+            res.setEntryName(qcCasesEntry.getName());
+            res.setHospitalId(qcEntryTypeVO.getHospitalId());
+            res.setEntryId(qcEntryTypeVO.getEntryId());
+        }
+        return res;
+    }
+
+    /**
+     * 根据医院和条目检索未被选择的质控类型
+     *
+     * @param qcEntryTypeIndexVO
+     * @return
+     */
+    public List<QcTypeSimpDTO> indexFac(QcEntryTypeIndexVO qcEntryTypeIndexVO){
+        return indexQcType(qcEntryTypeIndexVO);
+    }
+
+    /**
+     * 保存
+     * @param qcEntryTypeSaveVO
+     * @return
+     */
+    public Boolean saveOrUpdate(QcEntryTypeSaveVO qcEntryTypeSaveVO) {
+        // 删除映射关系
+        this.deleteQcTypeEntry(qcEntryTypeSaveVO);
+        // 新增映射关系
+        if (ListUtil.isNotEmpty(qcEntryTypeSaveVO.getTypeIdList())) {
+            List<QcTypeCasesEntry> list = new ArrayList<>();
+            Date now = DateUtil.now();
+            String person = UserUtils.getCurrentPrincipleID();
+            for (Long id : qcEntryTypeSaveVO.getTypeIdList()) {
+                QcTypeCasesEntry qcTypeCasesEntry = new QcTypeCasesEntry();
+                qcTypeCasesEntry.setTypeId(id);
+                qcTypeCasesEntry.setCaseEntryId(qcEntryTypeSaveVO.getEntryId());
+                qcTypeCasesEntry.setGmtCreate(now);
+                qcTypeCasesEntry.setGmtModified(now);
+                qcTypeCasesEntry.setCreator(person);
+                qcTypeCasesEntry.setModifier(person);
+                list.add(qcTypeCasesEntry);
+            }
+            qcTypeCasesEntryService.saveBatch(list);
+        }
+        return true;
+    }
+    /********************************质控条目和质控类型关系映射结束******************************************/
 }

+ 15 - 0
mrman-service/src/main/java/com/diagbot/mapper/QcCasesEntryMapper.java

@@ -5,10 +5,17 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.QcCasesEntryAllDTO;
 import com.diagbot.dto.QcCasesEntryDTO;
 import com.diagbot.dto.QcCasesEntrySimpleDTO;
+import com.diagbot.dto.QcEntryTypeDTO;
+import com.diagbot.dto.QcTypeByEntryDTO;
+import com.diagbot.dto.QcTypeSimpDTO;
 import com.diagbot.entity.QcCasesEntry;
 import com.diagbot.vo.QcCasesEntryAllVO;
 import com.diagbot.vo.QcCasesEntryIndexVO;
 import com.diagbot.vo.QcEntryHospitalVO;
+import com.diagbot.vo.QcEntryTypeIndexVO;
+import com.diagbot.vo.QcEntryTypePageVO;
+import com.diagbot.vo.QcEntryTypeSaveVO;
+import com.diagbot.vo.QcEntryTypeVO;
 import com.diagbot.vo.QcTypeIndexVO;
 import org.apache.ibatis.annotations.Param;
 
@@ -41,4 +48,12 @@ public interface QcCasesEntryMapper extends BaseMapper<QcCasesEntry> {
     public List<QcCasesEntrySimpleDTO> index(QcTypeIndexVO qcTypeIndexVO);
 
     public List<QcCasesEntrySimpleDTO> getEntryByHospital(QcEntryHospitalVO qcEntryHospitalVO);
+
+    public IPage<QcEntryTypeDTO> entryTypePage(QcEntryTypePageVO qcEntryTypePageVO);
+
+    public List<QcTypeByEntryDTO> entryTypeDetail(QcEntryTypeVO qcEntryTypeVO);
+
+    public List<QcTypeSimpDTO> indexQcType(QcEntryTypeIndexVO qcEntryTypeIndexVO);
+
+    public void deleteQcTypeEntry(QcEntryTypeSaveVO qcEntryTypeSaveVO);
 }

+ 15 - 0
mrman-service/src/main/java/com/diagbot/service/QcCasesEntryService.java

@@ -5,10 +5,17 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.diagbot.dto.QcCasesEntryAllDTO;
 import com.diagbot.dto.QcCasesEntryDTO;
 import com.diagbot.dto.QcCasesEntrySimpleDTO;
+import com.diagbot.dto.QcEntryTypeDTO;
+import com.diagbot.dto.QcTypeByEntryDTO;
+import com.diagbot.dto.QcTypeSimpDTO;
 import com.diagbot.entity.QcCasesEntry;
 import com.diagbot.vo.QcCasesEntryAllVO;
 import com.diagbot.vo.QcCasesEntryIndexVO;
 import com.diagbot.vo.QcEntryHospitalVO;
+import com.diagbot.vo.QcEntryTypeIndexVO;
+import com.diagbot.vo.QcEntryTypePageVO;
+import com.diagbot.vo.QcEntryTypeSaveVO;
+import com.diagbot.vo.QcEntryTypeVO;
 import com.diagbot.vo.QcTypeIndexVO;
 
 import java.util.List;
@@ -41,4 +48,12 @@ public interface QcCasesEntryService extends IService<QcCasesEntry> {
     public List<QcCasesEntrySimpleDTO> index(QcTypeIndexVO qcTypeIndexVO);
 
     public List<QcCasesEntrySimpleDTO> getEntryByHospital(QcEntryHospitalVO qcEntryHospitalVO);
+
+    public IPage<QcEntryTypeDTO> entryTypePage(QcEntryTypePageVO qcEntryTypePageVO);
+
+    public List<QcTypeByEntryDTO> entryTypeDetail(QcEntryTypeVO qcEntryTypeVO);
+
+    public List<QcTypeSimpDTO> indexQcType(QcEntryTypeIndexVO qcEntryTypeIndexVO);
+
+    public void deleteQcTypeEntry(QcEntryTypeSaveVO qcEntryTypeSaveVO);
 }

+ 28 - 0
mrman-service/src/main/java/com/diagbot/service/impl/QcCasesEntryServiceImpl.java

@@ -5,12 +5,19 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.dto.QcCasesEntryAllDTO;
 import com.diagbot.dto.QcCasesEntryDTO;
 import com.diagbot.dto.QcCasesEntrySimpleDTO;
+import com.diagbot.dto.QcEntryTypeDTO;
+import com.diagbot.dto.QcTypeByEntryDTO;
+import com.diagbot.dto.QcTypeSimpDTO;
 import com.diagbot.entity.QcCasesEntry;
 import com.diagbot.mapper.QcCasesEntryMapper;
 import com.diagbot.service.QcCasesEntryService;
 import com.diagbot.vo.QcCasesEntryAllVO;
 import com.diagbot.vo.QcCasesEntryIndexVO;
 import com.diagbot.vo.QcEntryHospitalVO;
+import com.diagbot.vo.QcEntryTypeIndexVO;
+import com.diagbot.vo.QcEntryTypePageVO;
+import com.diagbot.vo.QcEntryTypeSaveVO;
+import com.diagbot.vo.QcEntryTypeVO;
 import com.diagbot.vo.QcTypeIndexVO;
 import org.springframework.stereotype.Service;
 
@@ -56,4 +63,25 @@ public class QcCasesEntryServiceImpl extends ServiceImpl<QcCasesEntryMapper, QcC
     public List<QcCasesEntrySimpleDTO> getEntryByHospital(QcEntryHospitalVO qcEntryHospitalVO) {
         return baseMapper.getEntryByHospital(qcEntryHospitalVO);
     }
+
+    @Override
+    public IPage<QcEntryTypeDTO> entryTypePage(QcEntryTypePageVO qcEntryTypePageVO) {
+        return baseMapper.entryTypePage(qcEntryTypePageVO);
+    }
+
+    @Override
+    public List<QcTypeByEntryDTO> entryTypeDetail(QcEntryTypeVO qcEntryTypeVO) {
+        return baseMapper.entryTypeDetail(qcEntryTypeVO);
+    }
+
+    @Override
+    public List<QcTypeSimpDTO> indexQcType(QcEntryTypeIndexVO qcEntryTypeIndexVO) {
+        return baseMapper.indexQcType(qcEntryTypeIndexVO);
+    }
+
+    @Override
+    public void deleteQcTypeEntry(QcEntryTypeSaveVO qcEntryTypeSaveVO) {
+        baseMapper.deleteQcTypeEntry(qcEntryTypeSaveVO);
+    }
+
 }

+ 18 - 0
mrman-service/src/main/java/com/diagbot/vo/QcEntryTypeIndexVO.java

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhoutg
+ * @time: 2018/11/29 15:09
+ */
+@Getter
+@Setter
+public class QcEntryTypeIndexVO {
+    // 医院id
+    private Long hospitalId;
+    // 条目Id
+    private Long entryId;
+}

+ 22 - 0
mrman-service/src/main/java/com/diagbot/vo/QcEntryTypePageVO.java

@@ -0,0 +1,22 @@
+package com.diagbot.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description: 质控条目与质控类型关系映射列表入参
+ * @Author: ztg
+ * @Date: 2018/12/13 10:07
+ */
+@Getter
+@Setter
+public class QcEntryTypePageVO extends Page {
+
+    // 医院id
+    private Long hospitalId;
+    // 条目名称
+    private String entryName;
+    // 质控类型名称
+    private String typeName;
+}

+ 22 - 0
mrman-service/src/main/java/com/diagbot/vo/QcEntryTypeSaveVO.java

@@ -0,0 +1,22 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: zhoutg
+ * @time: 2018/8/6 10:16
+ */
+@Getter
+@Setter
+public class QcEntryTypeSaveVO {
+    // 医院id
+    private Long hospitalId;
+    // 条目id
+    private Long entryId;
+    // 质控类型id列表
+    private List<Long> typeIdList;
+}

+ 18 - 0
mrman-service/src/main/java/com/diagbot/vo/QcEntryTypeVO.java

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: zhoutg
+ * @time: 2018/8/6 10:16
+ */
+@Getter
+@Setter
+public class QcEntryTypeVO {
+    // 条目id
+    private Long entryId;
+    // 医院id
+    private Long hospitalId;
+}

+ 94 - 0
mrman-service/src/main/java/com/diagbot/web/QcEntryTypeController.java

@@ -0,0 +1,94 @@
+package com.diagbot.web;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.QcEntryTypeDTO;
+import com.diagbot.dto.QcEntryTypeDetailDTO;
+import com.diagbot.dto.QcTypeSimpDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.QcCacesEntryFacade;
+import com.diagbot.vo.QcEntryTypeIndexVO;
+import com.diagbot.vo.QcEntryTypePageVO;
+import com.diagbot.vo.QcEntryTypeSaveVO;
+import com.diagbot.vo.QcEntryTypeVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 质控条目与质控类型映射 前端控制器
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-05-14
+ */
+@RestController
+@RequestMapping("/qc/qcEntryType")
+@SuppressWarnings("unchecked")
+@Api(value = "质控条目与质控类型关系映射相关API", tags = { "质控条目与质控类型关系映射相关API" })
+public class QcEntryTypeController {
+
+    @Autowired
+    QcCacesEntryFacade qcCacesEntryFacade;
+
+    @ApiOperation(value = "保存[by:zhoutg]",
+            notes = "// 医院id\n" +
+                    " Long hospitalId;\n" +
+                    "// 条目id\n" +
+                    " Long entryId;\n" +
+                    "// 质控类型id列表\n" +
+                    " List<Long> typeIdList;")
+    @PostMapping("/saveOrUpdate")
+    @SysLogger("saveOrUpdate")
+    @Transactional
+    public RespDTO<Boolean> saveOrUpdate(@RequestBody QcEntryTypeSaveVO qcEntryTypeSaveVO) {
+        qcCacesEntryFacade.saveOrUpdate(qcEntryTypeSaveVO);
+        return RespDTO.onSuc(true);
+    }
+
+    @ApiOperation(value = "分页列表[by:zhoutg]",
+            notes = " // 医院id\n" +
+                    " Long hospitalId;\n" +
+                    "// 条目名称\n" +
+                    " String entryName;\n" +
+                    "// 质控类型名称\n" +
+                    " String typeName;")
+    @PostMapping("/page")
+    @SysLogger("page")
+    public RespDTO<IPage<QcEntryTypeDTO>> list(@RequestBody QcEntryTypePageVO qcEntryTypePageVO) {
+        IPage<QcEntryTypeDTO> data = qcCacesEntryFacade.entryTypePageFac(qcEntryTypePageVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "根据医院和条目检索未被选择的质控类型[by:zhoutg]",
+            notes = "// 医院id\n" +
+                    " Long hospitalId;\n" +
+                    "// 条目Id\n" +
+                    " Long entryId;")
+    @PostMapping("/index")
+    @SysLogger("index")
+    public RespDTO<List<QcTypeSimpDTO>> index(@RequestBody QcEntryTypeIndexVO qcEntryTypeIndexVO) {
+        List<QcTypeSimpDTO>data = qcCacesEntryFacade.indexFac(qcEntryTypeIndexVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "根据entryId和医院id返回内容[by:zhoutg]",
+            notes = "// 条目id\n" +
+                    " Long entryId;\n" +
+                    "// 医院id\n" +
+                    " Long hospitalId;")
+    @PostMapping("/getById")
+    @SysLogger("getById")
+    public RespDTO<QcEntryTypeDetailDTO> getById(@RequestBody QcEntryTypeVO qcEntryTypeVO) {
+        QcEntryTypeDetailDTO data = qcCacesEntryFacade.getByIdFac(qcEntryTypeVO);
+        return RespDTO.onSuc(data);
+    }
+}

+ 113 - 0
mrman-service/src/main/resources/mapper/QcCasesEntryMapper.xml

@@ -147,4 +147,117 @@
         AND t2.hospital_id = #{hospitalId}
         ORDER BY t3.order_no,t1.order_no
     </select>
+
+    <select id="entryTypePage" resultType="com.diagbot.dto.QcEntryTypeDTO">
+        SELECT
+            *
+        FROM
+            (
+                SELECT
+                    a1.entry_id,
+                    a1.entry_name,
+                    a1.hospital_id,
+                    GROUP_CONCAT(b1. NAME) type_str
+                FROM
+                    (
+                        SELECT
+                            t1.id entry_id,
+                            t1.`name` entry_name,
+                            t2.hospital_id
+                        FROM
+                            qc_cases_entry t1,
+                            qc_cases_entry_hospital t2
+                        WHERE
+                            t1.is_deleted = 'N'
+                        AND t2.is_deleted = 'N'
+                        AND t1.id = t2.cases_entry_id
+                    ) a1
+                LEFT JOIN (
+                    SELECT
+                        a1. NAME,
+                        a2.case_entry_id,
+                        a1.hospital_id
+                    FROM
+                        qc_type a1,
+                        qc_type_cases_entry a2
+                    WHERE
+                        a1.is_deleted = 'N'
+                    AND a2.is_deleted = 'N'
+                    AND a1.id = a2.type_id
+                ) b1 ON a1.entry_id = b1.case_entry_id
+                AND a1.hospital_id = b1.hospital_id
+                GROUP BY
+                    a1.entry_id,
+                    a1.entry_name,
+                    a1.hospital_id
+            ) t
+        <where>
+            <if test="hospitalId != null">
+                and t.hospital_id = #{hospitalId}
+            </if>
+            <if test="entryName != null and entryName != ''">
+                and t.entry_name like concat('%', #{entryName}, '%')
+            </if>
+            <if test="typeName != null and typeName != ''">
+                and t.type_str like concat('%', #{typeName}, '%')
+            </if>
+        </where>
+    </select>
+
+    <select id="entryTypeDetail" resultType="com.diagbot.dto.QcTypeByEntryDTO">
+        SELECT
+            t1.id entry_id,
+            t1.`name` entry_name,
+            t2.hospital_id,
+            t4.NAME type_name,
+            t4.id type_id
+        FROM
+            qc_cases_entry t1,
+            qc_cases_entry_hospital t2,
+            qc_type_cases_entry t3,
+            qc_type t4
+        WHERE
+            t1.is_deleted = 'N'
+        AND t2.is_deleted = 'N'
+        AND t3.is_deleted = 'N'
+        AND t4.is_deleted = 'N'
+        AND t1.id = t2.cases_entry_id
+        AND t1.id = t3.case_entry_id
+        AND t3.type_id = t4.id
+        AND t2.hospital_id = t4.hospital_id
+        AND t2.hospital_id = #{hospitalId}
+        AND t1.id = #{entryId}
+        ORDER BY
+            t4.id
+    </select>
+
+    <select id="indexQcType" resultType="com.diagbot.dto.QcTypeSimpDTO">
+        SELECT
+            *
+        FROM
+            `qc_type` t1
+        WHERE
+            t1.is_deleted = 'N'
+        AND t1.hospital_id = #{hospitalId}
+        AND t1.id NOT IN (
+            SELECT DISTINCT
+                type_id
+            FROM
+                qc_type_cases_entry t2
+            WHERE
+                t2.is_deleted = 'N'
+            AND t2.case_entry_id = #{entryId}
+        )
+    </select>
+    
+    <delete id="deleteQcTypeEntry">
+        DELETE t2
+        FROM
+            qc_type t1,
+            qc_type_cases_entry t2
+        WHERE
+            t1.hospital_id = #{hospitalId}
+        AND t1.id = t2.type_id
+        AND t2.case_entry_id = #{entryId}
+    </delete>
 </mapper>