Browse Source

Icss后台维护,模板修改

wangyu 6 years atrás
parent
commit
be39965ea6

+ 20 - 0
icss-service/src/main/java/com/diagbot/service/impl/ModuleDiseaseMappingServiceImpl.java

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.entity.ModuleDiseaseMapping;
+import com.diagbot.mapper.ModuleDiseaseMappingMapper;
+import com.diagbot.service.ModuleDiseaseMappingService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 模板疾病映射表 服务实现类
+ * </p>
+ *
+ * @author wangyu
+ * @since 2019-03-15
+ */
+@Service
+public class ModuleDiseaseMappingServiceImpl extends ServiceImpl<ModuleDiseaseMappingMapper, ModuleDiseaseMapping> implements ModuleDiseaseMappingService {
+
+}

+ 134 - 0
icssman-service/src/main/java/com/diagbot/entity/ModuleDeptMapping.java

@@ -0,0 +1,134 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 模板科室映射表
+ * </p>
+ *
+ * @author wangyu
+ * @since 2019-03-15
+ */
+@TableName("icss_module_dept_mapping")
+public class ModuleDeptMapping implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 科室id
+     */
+    private Long deptId;
+
+    /**
+     * 模板id
+     */
+    private Long moduleId;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+    public String getIsDeleted() {
+        return isDeleted;
+    }
+
+    public void setIsDeleted(String isDeleted) {
+        this.isDeleted = isDeleted;
+    }
+    public Date getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(Date gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+    public Date getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(Date gmtModified) {
+        this.gmtModified = gmtModified;
+    }
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+    public String getModifier() {
+        return modifier;
+    }
+
+    public void setModifier(String modifier) {
+        this.modifier = modifier;
+    }
+    public Long getDeptId() {
+        return deptId;
+    }
+
+    public void setDeptId(Long deptId) {
+        this.deptId = deptId;
+    }
+    public Long getModuleId() {
+        return moduleId;
+    }
+
+    public void setModuleId(Long moduleId) {
+        this.moduleId = moduleId;
+    }
+
+    @Override
+    public String toString() {
+        return "ModuleDeptMapping{" +
+        "id=" + id +
+        ", isDeleted=" + isDeleted +
+        ", gmtCreate=" + gmtCreate +
+        ", gmtModified=" + gmtModified +
+        ", creator=" + creator +
+        ", modifier=" + modifier +
+        ", deptId=" + deptId +
+        ", moduleId=" + moduleId +
+        "}";
+    }
+}

+ 134 - 0
icssman-service/src/main/java/com/diagbot/entity/ModuleDiseaseMapping.java

@@ -0,0 +1,134 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 模板疾病映射表
+ * </p>
+ *
+ * @author wangyu
+ * @since 2019-03-15
+ */
+@TableName("icss_module_disease_mapping")
+public class ModuleDiseaseMapping implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 科室id
+     */
+    private Long disId;
+
+    /**
+     * 模板id
+     */
+    private Long moduleId;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+    public String getIsDeleted() {
+        return isDeleted;
+    }
+
+    public void setIsDeleted(String isDeleted) {
+        this.isDeleted = isDeleted;
+    }
+    public Date getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(Date gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+    public Date getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(Date gmtModified) {
+        this.gmtModified = gmtModified;
+    }
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+    public String getModifier() {
+        return modifier;
+    }
+
+    public void setModifier(String modifier) {
+        this.modifier = modifier;
+    }
+    public Long getDisId() {
+        return disId;
+    }
+
+    public void setDisId(Long disId) {
+        this.disId = disId;
+    }
+    public Long getModuleId() {
+        return moduleId;
+    }
+
+    public void setModuleId(Long moduleId) {
+        this.moduleId = moduleId;
+    }
+
+    @Override
+    public String toString() {
+        return "ModuleDiseaseMapping{" +
+        "id=" + id +
+        ", isDeleted=" + isDeleted +
+        ", gmtCreate=" + gmtCreate +
+        ", gmtModified=" + gmtModified +
+        ", creator=" + creator +
+        ", modifier=" + modifier +
+        ", disId=" + disId +
+        ", moduleId=" + moduleId +
+        "}";
+    }
+}

+ 39 - 0
icssman-service/src/main/java/com/diagbot/facade/ModuleDeptMappingFacade.java

@@ -0,0 +1,39 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.entity.ModuleDeptMapping;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.service.impl.ModuleDeptMappingServiceImpl;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2019/3/15 9:27
+ */
+@Component
+public class ModuleDeptMappingFacade extends ModuleDeptMappingServiceImpl {
+
+    /**
+     * 根据科室id获取模板id
+     *
+     * @param deptId
+     * @return
+     */
+    public List<ModuleDeptMapping> getModuleIdByDept(Long deptId){
+        QueryWrapper<ModuleDeptMapping> moduleDeptMappingQueryWrapper = new QueryWrapper();
+        moduleDeptMappingQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("dept_id", deptId);
+        return this.list(moduleDeptMappingQueryWrapper);
+    }
+
+    public ModuleDeptMapping geModuleDeptInfo(Long deptId,Long moduleId){
+        QueryWrapper<ModuleDeptMapping> moduleDeptMappingQueryWrapper = new QueryWrapper<>();
+        moduleDeptMappingQueryWrapper.eq("is_deleted",IsDeleteEnum.N.getKey())
+                .eq("dept_id",deptId)
+                .eq("module_id",moduleId);
+        return this.getOne(moduleDeptMappingQueryWrapper);
+    }
+}

+ 52 - 0
icssman-service/src/main/java/com/diagbot/facade/ModuleDetailFacade.java

@@ -2,7 +2,9 @@ package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.diagbot.entity.ModuleDeptMapping;
 import com.diagbot.entity.ModuleDetail;
+import com.diagbot.entity.ModuleDiseaseMapping;
 import com.diagbot.entity.QuestionInfo;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.TagTypeEnum;
@@ -44,6 +46,10 @@ public class ModuleDetailFacade extends ModuleDetailServiceImpl {
     @Autowired
     @Qualifier("questionInfoServiceImpl")
     private QuestionInfoService questionInfoService;
+    @Autowired
+    private ModuleDiseaseMappingFacade moduleDiseaseMappingFacade;
+    @Autowired
+    private ModuleDeptMappingFacade moduleDeptMappingFacade;
     /**
      * 根据questionId删除明细
      *
@@ -161,6 +167,52 @@ public class ModuleDetailFacade extends ModuleDetailServiceImpl {
         }
         //添加模板明细
         moduleDetailService.saveBatch(moduleDetailList);
+        //判断是否根据科室划分
+        if(addModuleInfoVO.getDiseaseType() == 1){
+            ModuleDeptMapping moduleDeptMapping = moduleDeptMappingFacade.geModuleDeptInfo(addModuleInfoVO.getDeptId(),moduleId);
+            if(null != moduleDeptMapping){
+                //添加过删除
+                UpdateWrapper<ModuleDeptMapping> moduleDeptMappingUpdateWrapper = new UpdateWrapper<>();
+                moduleDeptMappingUpdateWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("module_id",moduleId)
+                        .eq("dept_id",addModuleInfoVO.getDeptId())
+                        .set("is_deleted",IsDeleteEnum.Y.getKey())
+                        .set("modifier",userId)
+                        .set("gmt_modified",now);
+                moduleDeptMappingFacade.update(new ModuleDeptMapping(),moduleDeptMappingUpdateWrapper);
+            }
+                ModuleDeptMapping moduleDept = new ModuleDeptMapping();
+                moduleDept.setGmtCreate(DateUtil.now());
+                moduleDept.setGmtModified(DateUtil.now());
+                moduleDept.setCreator(userId);
+                moduleDept.setModifier(userId);
+                moduleDept.setDeptId(addModuleInfoVO.getDeptId());
+                moduleDept.setModuleId(moduleId);
+                moduleDeptMappingFacade.save(moduleDept);
+        }
+        //判断是否是慢病模板
+        if(addModuleInfoVO.getDiseaseType() == 0){
+            ModuleDiseaseMapping moduleDiseaseMapping = moduleDiseaseMappingFacade.geModuleDiseaseInfo(addModuleInfoVO.getDisId(),moduleId);
+            if(null != moduleDiseaseMapping){
+                //添加过删除
+                UpdateWrapper<ModuleDiseaseMapping> moduleDiseaseMappingUpdateWrapper = new UpdateWrapper<>();
+                moduleDiseaseMappingUpdateWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("module_id",moduleId)
+                        .eq("dis_id",addModuleInfoVO.getDisId())
+                        .set("is_deleted",IsDeleteEnum.Y.getKey())
+                        .set("modifier",userId)
+                        .set("gmt_modified",now);
+                moduleDiseaseMappingFacade.update(new ModuleDiseaseMapping(),moduleDiseaseMappingUpdateWrapper);
+            }
+            ModuleDiseaseMapping moduleDiseMapping = new ModuleDiseaseMapping();
+            moduleDiseMapping.setGmtCreate(DateUtil.now());
+            moduleDiseMapping.setGmtModified(DateUtil.now());
+            moduleDiseMapping.setCreator(userId);
+            moduleDiseMapping.setModifier(userId);
+            moduleDiseMapping.setDisId(addModuleInfoVO.getDisId());
+            moduleDiseMapping.setModuleId(moduleId);
+            moduleDiseaseMappingFacade.save(moduleDiseMapping);
+        }
         return true;
     }
 }

+ 39 - 0
icssman-service/src/main/java/com/diagbot/facade/ModuleDiseaseMappingFacade.java

@@ -0,0 +1,39 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.entity.ModuleDiseaseMapping;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.service.impl.ModuleDiseaseMappingServiceImpl;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2019/3/15 14:20
+ */
+@Component
+public class ModuleDiseaseMappingFacade extends ModuleDiseaseMappingServiceImpl {
+
+    /**
+     * 根据疾病id获取模板id
+     *
+     * @param diseaseId
+     * @return
+     */
+    public List<ModuleDiseaseMapping> getModuleIdByDisease(Long diseaseId){
+        QueryWrapper<ModuleDiseaseMapping> moduleDiseaseMappingQueryWrapper = new QueryWrapper();
+        moduleDiseaseMappingQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("dis_id", diseaseId);
+        return this.list(moduleDiseaseMappingQueryWrapper);
+    }
+
+    public ModuleDiseaseMapping geModuleDiseaseInfo(Long disId, Long moduleId){
+        QueryWrapper<ModuleDiseaseMapping> moduleDiseaseMappingQueryWrapper = new QueryWrapper<>();
+        moduleDiseaseMappingQueryWrapper.eq("is_deleted",IsDeleteEnum.N.getKey())
+                .eq("dis_id",disId)
+                .eq("module_id",moduleId);
+        return this.getOne(moduleDiseaseMappingQueryWrapper);
+    }
+}

+ 0 - 1
icssman-service/src/main/java/com/diagbot/facade/ModuleInfoFacade.java

@@ -106,7 +106,6 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
         moduleInfo.setModifier(userId);
         moduleInfo.setGmtCreate(now);
         moduleInfo.setGmtModified(now);
-        moduleInfo.setType(addModulInfoVO.getType());
         this.save(moduleInfo);
         Long moduleId = moduleInfo.getId();
         return moduleDetailFacade.saveOrUpdateInfos(addModulInfoVO, moduleId);

+ 16 - 0
icssman-service/src/main/java/com/diagbot/mapper/ModuleDeptMappingMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.entity.ModuleDeptMapping;
+
+/**
+ * <p>
+ * 模板科室映射表 Mapper 接口
+ * </p>
+ *
+ * @author wangyu
+ * @since 2019-03-15
+ */
+public interface ModuleDeptMappingMapper extends BaseMapper<ModuleDeptMapping> {
+
+}

+ 16 - 0
icssman-service/src/main/java/com/diagbot/mapper/ModuleDiseaseMappingMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.entity.ModuleDiseaseMapping;
+
+/**
+ * <p>
+ * 模板疾病映射表 Mapper 接口
+ * </p>
+ *
+ * @author wangyu
+ * @since 2019-03-15
+ */
+public interface ModuleDiseaseMappingMapper extends BaseMapper<ModuleDiseaseMapping> {
+
+}

+ 16 - 0
icssman-service/src/main/java/com/diagbot/service/ModuleDeptMappingService.java

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.entity.ModuleDeptMapping;
+
+/**
+ * <p>
+ * 模板科室映射表 服务类
+ * </p>
+ *
+ * @author wangyu
+ * @since 2019-03-15
+ */
+public interface ModuleDeptMappingService extends IService<ModuleDeptMapping> {
+
+}

+ 16 - 0
icssman-service/src/main/java/com/diagbot/service/ModuleDiseaseMappingService.java

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.entity.ModuleDiseaseMapping;
+
+/**
+ * <p>
+ * 模板疾病映射表 服务类
+ * </p>
+ *
+ * @author wangyu
+ * @since 2019-03-15
+ */
+public interface ModuleDiseaseMappingService extends IService<ModuleDiseaseMapping> {
+
+}

+ 20 - 0
icssman-service/src/main/java/com/diagbot/service/impl/ModuleDeptMappingServiceImpl.java

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.entity.ModuleDeptMapping;
+import com.diagbot.mapper.ModuleDeptMappingMapper;
+import com.diagbot.service.ModuleDeptMappingService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 模板科室映射表 服务实现类
+ * </p>
+ *
+ * @author wangyu
+ * @since 2019-03-15
+ */
+@Service
+public class ModuleDeptMappingServiceImpl extends ServiceImpl<ModuleDeptMappingMapper, ModuleDeptMapping> implements ModuleDeptMappingService {
+
+}

+ 20 - 0
icssman-service/src/main/java/com/diagbot/service/impl/ModuleDiseaseMappingServiceImpl.java

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.entity.ModuleDiseaseMapping;
+import com.diagbot.mapper.ModuleDiseaseMappingMapper;
+import com.diagbot.service.ModuleDiseaseMappingService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 模板疾病映射表 服务实现类
+ * </p>
+ *
+ * @author wangyu
+ * @since 2019-03-15
+ */
+@Service
+public class ModuleDiseaseMappingServiceImpl extends ServiceImpl<ModuleDiseaseMappingMapper, ModuleDiseaseMapping> implements ModuleDiseaseMappingService {
+
+}

+ 8 - 2
icssman-service/src/main/java/com/diagbot/vo/AddModuleInfoVO.java

@@ -14,12 +14,18 @@ import java.util.List;
 @Getter
 @Setter
 public class AddModuleInfoVO {
-    @NotNull(message="模板名称")
+    @NotNull(message="模板名称不能为空")
     private String name;
-    @NotNull(message="模板类型")
+    @NotNull(message="模板归属不能为空")
     private int type;
     //特殊标签归属类型
     private Integer textType;
     //标签id
     private List<AddModuleDetailVO> modelDetils;
+    //模板类型(慢病,普通,通用)
+    private Long diseaseType;
+    //疾病id
+    private Long disId;
+    //科室id
+    private Long deptId;
 }

+ 17 - 0
icssman-service/src/main/resources/mapper/ModuleDeptMappingMapper.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.ModuleDeptMappingMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.ModuleDeptMapping">
+        <id column="id" property="id" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
+        <result column="dept_id" property="deptId" />
+        <result column="module_id" property="moduleId" />
+    </resultMap>
+
+</mapper>

+ 17 - 0
icssman-service/src/main/resources/mapper/ModuleDiseaseMappingMapper.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.ModuleDiseaseMappingMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.ModuleDiseaseMapping">
+        <id column="id" property="id" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
+        <result column="dis_id" property="disId" />
+        <result column="module_id" property="moduleId" />
+    </resultMap>
+
+</mapper>