Commit 71efc84afa44d5a5171866bea65f20deea7f7902
1 parent
ca31018dec
Exists in
master
缓存、高危、诊断添加
Showing 23 changed files with 299 additions and 172 deletions
- parent/base.common/src/main/java/com/lyms/base/common/dao/conf/DiagnoseConfMapper.java
- parent/base.common/src/main/java/com/lyms/base/common/dao/conf/DiagnoseConfMapper.xml
- parent/base.common/src/main/java/com/lyms/base/common/dao/conf/HighriskConfMapper.java
- parent/base.common/src/main/java/com/lyms/base/common/dao/conf/HighriskConfMapper.xml
- parent/base.common/src/main/java/com/lyms/base/common/entity/conf/DiagnoseConf.java
- parent/base.common/src/main/java/com/lyms/base/common/entity/conf/HighriskConf.java
- parent/base.common/src/main/java/com/lyms/base/common/entity/organ/SysOrganizationsConf.java
- parent/base.common/src/main/java/com/lyms/base/common/service/conf/DiagnoseConfService.java
- parent/base.common/src/main/java/com/lyms/base/common/service/conf/HighriskConfService.java
- parent/base.common/src/main/java/com/lyms/base/common/service/conf/impl/DiagnoseConfServiceImpl.java
- parent/base.common/src/main/java/com/lyms/base/common/service/conf/impl/HighriskConfServiceImpl.java
- parent/base.common/src/main/java/com/lyms/base/common/service/organ/SysOrganizationsConfService.java
- parent/base.common/src/main/java/com/lyms/base/common/service/organ/impl/SysOrganizationsConfServiceImpl.java
- parent/hospital.web/src/main/java/com/lyms/hospital/controller/LoginController.java
- parent/hospital.web/src/main/java/com/lyms/hospital/controller/conf/DiagnoseConfController.java
- parent/hospital.web/src/main/java/com/lyms/hospital/controller/conf/DiagnoseSourceController.java
- parent/hospital.web/src/main/java/com/lyms/hospital/controller/conf/DiagnoseVersionController.java
- parent/hospital.web/src/main/java/com/lyms/hospital/controller/conf/HighriskConfController.java
- parent/hospital.web/src/main/java/com/lyms/hospital/controller/conf/HighriskSourceController.java
- parent/hospital.web/src/main/java/com/lyms/hospital/controller/conf/HighriskVersionController.java
- parent/hospital.web/src/main/resources/xml/app-cache.xml
- parent/hospital.web/src/main/resources/xml/app-shiro.xml
- parent/hospital.web/src/test/java/test/hospital/highrisk/HighriskVersionTest.java
parent/base.common/src/main/java/com/lyms/base/common/dao/conf/DiagnoseConfMapper.java
View file @
71efc84
1 | 1 | package com.lyms.base.common.dao.conf; |
2 | 2 | |
3 | 3 | import java.io.Serializable; |
4 | +import java.util.List; | |
4 | 5 | |
6 | +import org.apache.ibatis.annotations.Param; | |
5 | 7 | import org.springframework.stereotype.Repository; |
6 | 8 | |
7 | 9 | import com.baomidou.mybatisplus.mapper.BaseMapper; |
... | ... | @@ -18,7 +20,19 @@ |
18 | 20 | @Repository |
19 | 21 | public interface DiagnoseConfMapper extends BaseMapper<DiagnoseConf> { |
20 | 22 | |
21 | - public Integer deleteLogicById(Serializable id); | |
23 | + public Integer deleteLogicById(Serializable id); | |
24 | + | |
25 | + /** | |
26 | + * <li>@Description:根据version和type获取诊断配置项 | |
27 | + * <li>@param versionId | |
28 | + * <li>@param type | |
29 | + * <li>@return | |
30 | + * <li>创建人:方承 | |
31 | + * <li>创建时间:2017年5月9日 | |
32 | + * <li>修改人: | |
33 | + * <li>修改时间: | |
34 | + */ | |
35 | + public List<DiagnoseConf> selectByVersionAndType(@Param("versionId") String versionId,@Param("type") String type); | |
22 | 36 | |
23 | 37 | } |
parent/base.common/src/main/java/com/lyms/base/common/dao/conf/DiagnoseConfMapper.xml
View file @
71efc84
... | ... | @@ -8,6 +8,7 @@ |
8 | 8 | <result column="SOURCE_ID" property="sourceId" /> |
9 | 9 | <result column="VERSION_ID" property="versionId" /> |
10 | 10 | <result column="NAME" property="name" /> |
11 | + <result column="TYPE" property="type" /> | |
11 | 12 | <result column="SIMPLE_CODE" property="simpleCode" /> |
12 | 13 | <result column="GROUPNAME" property="groupname" /> |
13 | 14 | <result column="GROUPORDER" property="grouporder" /> |
14 | 15 | |
... | ... | @@ -17,7 +18,11 @@ |
17 | 18 | |
18 | 19 | <!-- 通用查询结果列 --> |
19 | 20 | <sql id="Base_Column_List"> |
20 | - ID AS id, SOURCE_ID AS sourceId, VERSION_ID AS versionId, NAME AS name, SIMPLE_CODE as simpleCode,GROUPNAME AS groupname, GROUPORDER AS grouporder, ITEMORDER AS itemorder, ENABLE AS enable | |
21 | + ID AS id, SOURCE_ID AS sourceId, VERSION_ID AS versionId, TYPE AS type,NAME AS name, SIMPLE_CODE as simpleCode,GROUPNAME AS groupname, GROUPORDER AS grouporder, ITEMORDER AS itemorder, ENABLE AS enable | |
21 | 22 | </sql> |
23 | + | |
24 | + <select id="selectByVersionAndType" resultMap="BaseResultMap"> | |
25 | + select <include refid="Base_Column_List" /> from DIAGNOSE_CONF where VERSION_ID=#{versionId} and type=#{type} and ENABLE = 1 order by grouporder,itemorder asc | |
26 | + </select> | |
22 | 27 | </mapper> |
parent/base.common/src/main/java/com/lyms/base/common/dao/conf/HighriskConfMapper.java
View file @
71efc84
... | ... | @@ -4,6 +4,7 @@ |
4 | 4 | import java.util.List; |
5 | 5 | import java.util.Map; |
6 | 6 | |
7 | +import org.apache.ibatis.annotations.Param; | |
7 | 8 | import org.springframework.stereotype.Repository; |
8 | 9 | |
9 | 10 | import com.baomidou.mybatisplus.mapper.BaseMapper; |
... | ... | @@ -31,7 +32,7 @@ |
31 | 32 | * <li>修改人: |
32 | 33 | * <li>修改时间: |
33 | 34 | */ |
34 | - public List<HighriskConf> selectByVersion(String versionId); | |
35 | + public List<HighriskConf> selectByVersionAndType(@Param("versionId") Serializable versionId,@Param("type") String type); | |
35 | 36 | |
36 | 37 | /** |
37 | 38 | * <li>@Description:根据资源ID获取对应的配置信息 |
... | ... | @@ -44,7 +45,7 @@ |
44 | 45 | */ |
45 | 46 | public List<HighriskConf> selectBySource(String sourceId); |
46 | 47 | |
47 | - public List<Map<String, String>> getColorListByVersion(Serializable versionId); | |
48 | + public List<Map<String, String>> getColorListByVersion(@Param("versionId") Serializable versionId,@Param("type") String type); | |
48 | 49 | |
49 | 50 | } |
parent/base.common/src/main/java/com/lyms/base/common/dao/conf/HighriskConfMapper.xml
View file @
71efc84
... | ... | @@ -8,6 +8,7 @@ |
8 | 8 | <result column="SOURCE_ID" property="sourceId" /> |
9 | 9 | <result column="VERSION_ID" property="versionId" /> |
10 | 10 | <result column="NAME" property="name" /> |
11 | + <result column="TYPE" property="type" /> | |
11 | 12 | <result column="COLORCODE" property="colorcode" /> |
12 | 13 | <result column="COLORTEXT" property="colortext" /> |
13 | 14 | <result column="GROUPORDER" property="grouporder" /> |
14 | 15 | |
... | ... | @@ -18,12 +19,12 @@ |
18 | 19 | |
19 | 20 | <!-- 通用查询结果列 --> |
20 | 21 | <sql id="Base_Column_List"> |
21 | - ID AS id, SOURCE_ID AS sourceId, VERSION_ID AS versionId, NAME AS name, COLORCODE AS colorcode, COLORTEXT AS colortext, GROUPORDER AS grouporder, ITEMORDER AS itemorder, GRADE AS grade, ENABLE AS enable | |
22 | + ID AS id, SOURCE_ID AS sourceId, VERSION_ID AS versionId,TYPE AS type, NAME AS name, COLORCODE AS colorcode, COLORTEXT AS colortext, GROUPORDER AS grouporder, ITEMORDER AS itemorder, GRADE AS grade, ENABLE AS enable | |
22 | 23 | </sql> |
23 | 24 | |
24 | 25 | <!-- 根据版本号获取高危区域配置和信息 --> |
25 | - <select id="selectByVersion" resultMap="BaseResultMap"> | |
26 | - select <include refid="Base_Column_List" /> from HIGHRISK_CONF where VERSION_ID=#{versionId} | |
26 | + <select id="selectByVersionAndType" resultMap="BaseResultMap"> | |
27 | + select <include refid="Base_Column_List" /> from HIGHRISK_CONF where VERSION_ID=#{versionId} and type=#{type} and ENABLE = 1 order by grouporder,itemorder asc | |
27 | 28 | </select> |
28 | 29 | |
29 | 30 | <!-- 根据资源ID获取区域高危配置信息 --> |
... | ... | @@ -33,8 +34,8 @@ |
33 | 34 | |
34 | 35 | <!-- 根据版本获取所有高危颜色--> |
35 | 36 | <select id="getColorListByVersion" resultType="Map"> |
36 | - SELECT COLORCODE,COLORTEXT FROM HIGHRISK_CONF c WHERE COLORCODE IN( | |
37 | - SELECT MAX(COLORCODE) FROM HIGHRISK_CONF where c.VERSION_ID = #{versionId} | |
37 | + SELECT DISTINCT COLORCODE,COLORTEXT FROM HIGHRISK_CONF c WHERE COLORCODE IN( | |
38 | + SELECT MAX(COLORCODE) FROM HIGHRISK_CONF where c.VERSION_ID = #{versionId} and type=#{type} | |
38 | 39 | and c.ENABLE = 1 GROUP BY COLORTEXT) |
39 | 40 | </select> |
40 | 41 |
parent/base.common/src/main/java/com/lyms/base/common/entity/conf/DiagnoseConf.java
View file @
71efc84
... | ... | @@ -41,6 +41,12 @@ |
41 | 41 | |
42 | 42 | |
43 | 43 | /** |
44 | + * 诊断所属划分:0所有,1妇女,2男性,3儿童 | |
45 | + */ | |
46 | + @TableField(value="TYPE") | |
47 | + private String type; | |
48 | + | |
49 | + /** | |
44 | 50 | * 自定义高危显示名 |
45 | 51 | */ |
46 | 52 | @TableField(value="SIMPLE_CODE") |
... | ... | @@ -140,5 +146,13 @@ |
140 | 146 | this.simpleCode = simpleCode; |
141 | 147 | } |
142 | 148 | |
149 | + public String getType() { | |
150 | + return type; | |
151 | + } | |
152 | + | |
153 | + public void setType(String type) { | |
154 | + this.type = type; | |
155 | + } | |
156 | + | |
143 | 157 | } |
parent/base.common/src/main/java/com/lyms/base/common/entity/conf/HighriskConf.java
View file @
71efc84
... | ... | @@ -43,6 +43,11 @@ |
43 | 43 | @TableField(value = "NAME") |
44 | 44 | private String name; |
45 | 45 | /** |
46 | + * 诊断所属划分:0所有,1妇女,2男性,3儿童 | |
47 | + */ | |
48 | + @TableField(value="TYPE") | |
49 | + private String type; | |
50 | + /** | |
46 | 51 | * 自定义高危颜色编码 |
47 | 52 | */ |
48 | 53 | @TableField(value = "COLORCODE") |
... | ... | @@ -153,5 +158,13 @@ |
153 | 158 | this.enable = enable; |
154 | 159 | } |
155 | 160 | |
161 | + public String getType() { | |
162 | + return type; | |
163 | + } | |
164 | + | |
165 | + public void setType(String type) { | |
166 | + this.type = type; | |
167 | + } | |
168 | + | |
156 | 169 | } |
parent/base.common/src/main/java/com/lyms/base/common/entity/organ/SysOrganizationsConf.java
View file @
71efc84
... | ... | @@ -32,12 +32,12 @@ |
32 | 32 | * 高危版本 |
33 | 33 | */ |
34 | 34 | @TableField(value="HIGHRISK_VERSION") |
35 | - private Integer highriskVersion; | |
35 | + private String highriskVersion; | |
36 | 36 | /** |
37 | 37 | * 诊断版本 |
38 | 38 | */ |
39 | 39 | @TableField(value="DIAGNOSE_VERSION") |
40 | - private Integer diagnoseVersion; | |
40 | + private String diagnoseVersion; | |
41 | 41 | |
42 | 42 | |
43 | 43 | public String getId() { |
44 | 44 | |
45 | 45 | |
46 | 46 | |
... | ... | @@ -56,19 +56,19 @@ |
56 | 56 | this.orgId = orgId; |
57 | 57 | } |
58 | 58 | |
59 | - public Integer getHighriskVersion() { | |
59 | + public String getHighriskVersion() { | |
60 | 60 | return highriskVersion; |
61 | 61 | } |
62 | 62 | |
63 | - public void setHighriskVersion(Integer highriskVersion) { | |
63 | + public void setHighriskVersion(String highriskVersion) { | |
64 | 64 | this.highriskVersion = highriskVersion; |
65 | 65 | } |
66 | 66 | |
67 | - public Integer getDiagnoseVersion() { | |
67 | + public String getDiagnoseVersion() { | |
68 | 68 | return diagnoseVersion; |
69 | 69 | } |
70 | 70 | |
71 | - public void setDiagnoseVersion(Integer diagnoseVersion) { | |
71 | + public void setDiagnoseVersion(String diagnoseVersion) { | |
72 | 72 | this.diagnoseVersion = diagnoseVersion; |
73 | 73 | } |
74 | 74 |
parent/base.common/src/main/java/com/lyms/base/common/service/conf/DiagnoseConfService.java
View file @
71efc84
1 | 1 | package com.lyms.base.common.service.conf; |
2 | 2 | |
3 | 3 | import com.lyms.base.common.entity.conf.DiagnoseConf; |
4 | +import com.lyms.base.common.entity.conf.HighriskConf; | |
4 | 5 | import com.lyms.web.service.BaseService; |
5 | 6 | import java.io.Serializable; |
7 | +import java.util.List; | |
6 | 8 | |
7 | 9 | /** |
8 | 10 | * <p> |
9 | 11 | |
... | ... | @@ -14,12 +16,24 @@ |
14 | 16 | */ |
15 | 17 | public interface DiagnoseConfService extends BaseService<DiagnoseConf> { |
16 | 18 | |
17 | - /** | |
19 | + /** | |
18 | 20 | * <li>@Description:逻辑删除,ifDel = 1 为删除,否则为没有删除 |
19 | 21 | * <li>@param id 删除主键id |
20 | 22 | * <li>@return 大于0修改成功,否则为失败 |
21 | 23 | */ |
22 | - public Integer deleteLogicById(Serializable id); | |
23 | - | |
24 | + public Integer deleteLogicById(Serializable id); | |
25 | + | |
26 | + /** | |
27 | + * <li>@Description:根据机构Id和type获取该机构的诊断配置项 | |
28 | + * <li>@param orgId | |
29 | + * <li>@param type | |
30 | + * <li>@return | |
31 | + * <li>创建人:方承 | |
32 | + * <li>创建时间:2017年5月9日 | |
33 | + * <li>修改人: | |
34 | + * <li>修改时间: | |
35 | + */ | |
36 | + public List<DiagnoseConf> getDiagnoseConfByOrgId(String orgId, String type); | |
37 | + | |
24 | 38 | } |
parent/base.common/src/main/java/com/lyms/base/common/service/conf/HighriskConfService.java
View file @
71efc84
... | ... | @@ -56,7 +56,7 @@ |
56 | 56 | * <li>修改人: |
57 | 57 | * <li>修改时间: |
58 | 58 | */ |
59 | - public List<HighriskConf> getHighriskConfByVersionId(String versionId); | |
59 | + public List<HighriskConf> getHighriskConfByVersionId(String versionId,String type); | |
60 | 60 | |
61 | 61 | /** |
62 | 62 | * <li>@Description:根据资源ID 获取区域版本配置信息 |
... | ... | @@ -78,7 +78,30 @@ |
78 | 78 | * <li>修改人: |
79 | 79 | * <li>修改时间: |
80 | 80 | */ |
81 | - public List<Map<String,String>> getColorListByVersion(Serializable versionId); | |
81 | + public List<Map<String,String>> getColorListByVersion(Serializable versionId,String type); | |
82 | + | |
83 | + /** | |
84 | + * <li>@Description:TODO(方法描述) | |
85 | + * <li>@param versionid | |
86 | + * <li>@return | |
87 | + * <li>创建人:方承 | |
88 | + * <li>创建时间:2017年3月31日 | |
89 | + * <li>修改人: | |
90 | + * <li>修改时间: | |
91 | + */ | |
92 | + public List<Map<String,String>> getColorListByOrgId(Serializable orgId,String type); | |
93 | + | |
94 | + | |
95 | + /** | |
96 | + * <li>@Description:根据机构Id和type获取该机构的高危配置项 | |
97 | + * <li>@param orgId | |
98 | + * <li>@return | |
99 | + * <li>创建人:方承 | |
100 | + * <li>创建时间:2017年5月9日 | |
101 | + * <li>修改人: | |
102 | + * <li>修改时间: | |
103 | + */ | |
104 | + public List<HighriskConf> getHighriskConfByOrgId(Serializable orgId,String type); | |
82 | 105 | |
83 | 106 | } |
parent/base.common/src/main/java/com/lyms/base/common/service/conf/impl/DiagnoseConfServiceImpl.java
View file @
71efc84
1 | 1 | package com.lyms.base.common.service.conf.impl; |
2 | 2 | |
3 | 3 | import com.lyms.base.common.entity.conf.DiagnoseConf; |
4 | +import com.lyms.base.common.entity.conf.HighriskConf; | |
5 | +import com.lyms.base.common.entity.organ.SysOrganizationsConf; | |
4 | 6 | import com.lyms.base.common.enums.SyncParamEnum; |
5 | 7 | import com.lyms.base.common.dao.conf.DiagnoseConfMapper; |
6 | 8 | import com.lyms.base.common.service.conf.DiagnoseConfService; |
9 | +import com.lyms.base.common.service.organ.SysOrganizationsConfService; | |
7 | 10 | import com.lyms.base.common.utils.SyncComponent; |
8 | 11 | import com.lyms.util.StrUtils; |
9 | 12 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
10 | 13 | |
14 | +import org.apache.commons.lang3.StringUtils; | |
11 | 15 | import org.springframework.beans.factory.annotation.Autowired; |
16 | +import org.springframework.cache.annotation.Cacheable; | |
12 | 17 | import org.springframework.stereotype.Service; |
13 | 18 | import java.io.Serializable; |
19 | +import java.util.List; | |
14 | 20 | |
15 | 21 | /** |
16 | 22 | * <p> |
... | ... | @@ -25,6 +31,11 @@ |
25 | 31 | |
26 | 32 | @Autowired |
27 | 33 | private SyncComponent syncComponent; |
34 | + | |
35 | + @Autowired | |
36 | + private SysOrganizationsConfService sysOrganizationsConfService; | |
37 | + | |
38 | + private static final String SYS_DEFAULT_VERSION ="sys_tempate_v1"; | |
28 | 39 | |
29 | 40 | public Integer deleteLogicById(Serializable id){ |
30 | 41 | Integer tag = baseMapper.deleteLogicById(id); |
... | ... | @@ -54,5 +65,22 @@ |
54 | 65 | } |
55 | 66 | return tag; |
56 | 67 | } |
68 | + | |
69 | + @Override | |
70 | + @Cacheable(value = "hospital.conf:diagnose", key = "'getDiagnoseConfByOrgId_' + #orgId + '_' + #type") | |
71 | + public List<DiagnoseConf> getDiagnoseConfByOrgId(String orgId, String type) { | |
72 | + SysOrganizationsConf conf = sysOrganizationsConfService.getConfByOrgId(orgId); | |
73 | + if(conf != null && StrUtils.isNotEmpty(conf.getHighriskVersion())){ | |
74 | + return getDiagnoseConfByVersionId(conf.getHighriskVersion(),type); | |
75 | + } | |
76 | + return getDiagnoseConfByVersionId(SYS_DEFAULT_VERSION,type); | |
77 | + } | |
78 | + | |
79 | + public List<DiagnoseConf> getDiagnoseConfByVersionId(String versionId,String type) { | |
80 | + if (StringUtils.isBlank(versionId)) | |
81 | + return null; | |
82 | + return baseMapper.selectByVersionAndType(versionId, type); | |
83 | + } | |
84 | + | |
57 | 85 | } |
parent/base.common/src/main/java/com/lyms/base/common/service/conf/impl/HighriskConfServiceImpl.java
View file @
71efc84
... | ... | @@ -6,15 +6,18 @@ |
6 | 6 | |
7 | 7 | import org.apache.commons.lang3.StringUtils; |
8 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
9 | +import org.springframework.cache.annotation.Cacheable; | |
9 | 10 | import org.springframework.stereotype.Service; |
10 | 11 | import org.springframework.transaction.annotation.Transactional; |
11 | 12 | |
12 | 13 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
13 | 14 | import com.lyms.base.common.dao.conf.HighriskConfMapper; |
14 | 15 | import com.lyms.base.common.entity.conf.HighriskConf; |
16 | +import com.lyms.base.common.entity.organ.SysOrganizationsConf; | |
15 | 17 | import com.lyms.base.common.enums.StatusEnum; |
16 | 18 | import com.lyms.base.common.enums.SyncParamEnum; |
17 | 19 | import com.lyms.base.common.service.conf.HighriskConfService; |
20 | +import com.lyms.base.common.service.organ.SysOrganizationsConfService; | |
18 | 21 | import com.lyms.base.common.utils.SyncComponent; |
19 | 22 | import com.lyms.exception.SystemException; |
20 | 23 | import com.lyms.util.StrUtils; |
21 | 24 | |
... | ... | @@ -30,9 +33,15 @@ |
30 | 33 | @Service |
31 | 34 | public class HighriskConfServiceImpl extends ServiceImpl<HighriskConfMapper, HighriskConf> |
32 | 35 | implements HighriskConfService { |
36 | + | |
37 | + | |
38 | + private static final String SYS_DEFAULT_VERSION ="sys_tempate_v1"; | |
33 | 39 | |
34 | 40 | @Autowired |
35 | 41 | private HighriskConfMapper confMapper; |
42 | + | |
43 | + @Autowired | |
44 | + private SysOrganizationsConfService sysOrganizationsConfService; | |
36 | 45 | |
37 | 46 | @Autowired |
38 | 47 | private SyncComponent syncComponent; |
39 | 48 | |
... | ... | @@ -105,10 +114,10 @@ |
105 | 114 | } |
106 | 115 | |
107 | 116 | @Override |
108 | - public List<HighriskConf> getHighriskConfByVersionId(String versionId) { | |
117 | + public List<HighriskConf> getHighriskConfByVersionId(String versionId,String type) { | |
109 | 118 | if (StringUtils.isBlank(versionId)) |
110 | 119 | return null; |
111 | - return confMapper.selectByVersion(versionId); | |
120 | + return confMapper.selectByVersionAndType(versionId,type); | |
112 | 121 | } |
113 | 122 | |
114 | 123 | @Override |
115 | 124 | |
116 | 125 | |
... | ... | @@ -117,11 +126,32 @@ |
117 | 126 | return null; |
118 | 127 | return confMapper.selectBySource(sourceId); |
119 | 128 | } |
129 | + | |
130 | + @Override | |
131 | + @Cacheable(value = "hospital.conf:highrisk", key = "'getColorListByOrgId_' + #orgId + '_' + #type" ) | |
132 | + public List<Map<String, String>> getColorListByOrgId(Serializable orgId,String type) { | |
133 | + SysOrganizationsConf conf = sysOrganizationsConfService.getConfByOrgId(orgId); | |
134 | + if(conf != null && StrUtils.isNotEmpty(conf.getHighriskVersion())){ | |
135 | + return getColorListByVersion(conf.getHighriskVersion(),type); | |
136 | + } | |
137 | + return getColorListByVersion(SYS_DEFAULT_VERSION,type); | |
138 | + } | |
120 | 139 | |
121 | 140 | @Override |
122 | - public List<Map<String, String>> getColorListByVersion(Serializable versionId) { | |
123 | - return confMapper.getColorListByVersion(versionId); | |
141 | + public List<Map<String, String>> getColorListByVersion(Serializable versionId,String type) { | |
142 | + return confMapper.getColorListByVersion(versionId,type); | |
124 | 143 | } |
144 | + | |
145 | + @Override | |
146 | + @Cacheable(value = "hospital.conf:highrisk", key = "'getHighriskConfByOrgId_' + #orgId + '_' + #type") | |
147 | + public List<HighriskConf> getHighriskConfByOrgId(Serializable orgId,String type) { | |
148 | + SysOrganizationsConf conf = sysOrganizationsConfService.getConfByOrgId(orgId); | |
149 | + if(conf != null && StrUtils.isNotEmpty(conf.getHighriskVersion())){ | |
150 | + return getHighriskConfByVersionId(conf.getHighriskVersion(),type); | |
151 | + } | |
152 | + return getHighriskConfByVersionId(SYS_DEFAULT_VERSION,type); | |
153 | + } | |
154 | + | |
125 | 155 | |
126 | 156 | } |
parent/base.common/src/main/java/com/lyms/base/common/service/organ/SysOrganizationsConfService.java
View file @
71efc84
... | ... | @@ -15,12 +15,23 @@ |
15 | 15 | */ |
16 | 16 | public interface SysOrganizationsConfService extends BaseService<SysOrganizationsConf> { |
17 | 17 | |
18 | - /** | |
18 | + /** | |
19 | 19 | * <li>@Description:逻辑删除,ifDel = 1 为删除,否则为没有删除 |
20 | 20 | * <li>@param id 删除主键id |
21 | 21 | * <li>@return 大于0修改成功,否则为失败 |
22 | 22 | */ |
23 | - public Integer deleteLogicById(Serializable id); | |
24 | - | |
23 | + public Integer deleteLogicById(Serializable id); | |
24 | + | |
25 | + /** | |
26 | + * <li>@Description:根据机构id获取高危、诊断版本配置 | |
27 | + * <li>@param id | |
28 | + * <li>@return | |
29 | + * <li>创建人:方承 | |
30 | + * <li>创建时间:2017年5月9日 | |
31 | + * <li>修改人: | |
32 | + * <li>修改时间: | |
33 | + */ | |
34 | + public SysOrganizationsConf getConfByOrgId(Serializable orgId); | |
35 | + | |
25 | 36 | } |
parent/base.common/src/main/java/com/lyms/base/common/service/organ/impl/SysOrganizationsConfServiceImpl.java
View file @
71efc84
... | ... | @@ -4,6 +4,7 @@ |
4 | 4 | |
5 | 5 | import org.springframework.stereotype.Service; |
6 | 6 | |
7 | +import com.baomidou.mybatisplus.mapper.EntityWrapper; | |
7 | 8 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
8 | 9 | import com.lyms.base.common.dao.organ.SysOrganizationsConfMapper; |
9 | 10 | import com.lyms.base.common.entity.organ.SysOrganizationsConf; |
... | ... | @@ -23,6 +24,14 @@ |
23 | 24 | public Integer deleteLogicById(Serializable id){ |
24 | 25 | return baseMapper.deleteLogicById(id); |
25 | 26 | } |
27 | + | |
28 | + @Override | |
29 | + public SysOrganizationsConf getConfByOrgId(Serializable orgId) { | |
30 | + SysOrganizationsConf searchConf = new SysOrganizationsConf(); | |
31 | + searchConf.setOrgId(orgId.toString()); | |
32 | + SysOrganizationsConf conf = baseMapper.selectOne(searchConf); | |
33 | + return conf; | |
34 | + } | |
26 | 35 | |
27 | 36 | } |
parent/hospital.web/src/main/java/com/lyms/hospital/controller/LoginController.java
View file @
71efc84
... | ... | @@ -14,17 +14,11 @@ |
14 | 14 | import org.apache.shiro.authc.UnknownAccountException; |
15 | 15 | import org.apache.shiro.authc.UsernamePasswordToken; |
16 | 16 | import org.springframework.beans.factory.annotation.Autowired; |
17 | -import org.springframework.web.bind.annotation.RequestBody; | |
18 | 17 | import org.springframework.web.bind.annotation.RequestMapping; |
19 | -import org.springframework.web.bind.annotation.RequestMethod; | |
20 | 18 | import org.springframework.web.bind.annotation.RequestParam; |
21 | 19 | import org.springframework.web.bind.annotation.ResponseBody; |
22 | 20 | import org.springframework.web.bind.annotation.RestController; |
23 | 21 | |
24 | -import com.alibaba.druid.support.json.JSONUtils; | |
25 | -import com.alibaba.fastjson.JSON; | |
26 | -import com.alibaba.fastjson.JSONObject; | |
27 | -import com.lyms.annotation.TokenRequired; | |
28 | 22 | import com.lyms.base.common.entity.organ.Organizations; |
29 | 23 | import com.lyms.base.common.entity.role.Permissions; |
30 | 24 | import com.lyms.base.common.entity.role.Roles; |
31 | 25 | |
... | ... | @@ -34,12 +28,9 @@ |
34 | 28 | import com.lyms.base.common.service.role.RolesService; |
35 | 29 | import com.lyms.base.common.service.user.UsersService; |
36 | 30 | import com.lyms.constants.Constants; |
37 | -import com.lyms.hospital.service.token.TokenService; | |
38 | 31 | import com.lyms.shiro.ShiroWebUtils; |
39 | 32 | import com.lyms.util.DateTimeUtils; |
40 | 33 | import com.lyms.util.InstanceUtils; |
41 | -import com.lyms.util.MD5Utils; | |
42 | -import com.lyms.util.StrUtils; | |
43 | 34 | import com.lyms.web.bean.AjaxResult; |
44 | 35 | import com.lyms.web.controller.BaseController; |
45 | 36 | |
46 | 37 | |
47 | 38 | |
... | ... | @@ -60,53 +51,8 @@ |
60 | 51 | @Autowired |
61 | 52 | private RolesService rolesService; |
62 | 53 | @Autowired |
63 | - private TokenService tokenService; | |
64 | - @Autowired | |
65 | 54 | private PermissionsService permissionsService; |
66 | - | |
67 | - @ApiOperation(value = "测试登录", notes = "测试登录说明") | |
68 | - @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "用户ID", required = true, dataType = "Long"), | |
69 | - @ApiImplicitParam(name = "user", value = "用户详细实体user", required = true, dataType = "User") }) | |
70 | - @RequestMapping(value = "/testLogin", method = RequestMethod.GET) | |
71 | - public String testLogin() { | |
72 | - // request.getSession().setAttribute("abc", "123"); | |
73 | - return "abc"; | |
74 | - } | |
75 | - | |
76 | - | |
77 | - /** | |
78 | - * <li>@Description:测试@RequestBody | |
79 | - * <li>@param reqJson | |
80 | - * <li>@param users | |
81 | - * <li>@return | |
82 | - * <li>创建人:方承 | |
83 | - * <li>创建时间:2017年3月28日 | |
84 | - * <li>修改人: | |
85 | - * <li>修改时间: | |
86 | - */ | |
87 | - @RequestMapping(value = "/testPostJson", method = RequestMethod.POST) | |
88 | - @ResponseBody | |
89 | - public String testPostJson(@RequestBody String reqJson){ | |
90 | - Users u = getRequestUsersEntity(reqJson); | |
91 | - System.out.println(JSON.toJSONString(u)); | |
92 | - return "1"; | |
93 | - } | |
94 | 55 | |
95 | - /** | |
96 | - * <li>@Description:设置业务实体 | |
97 | - * <li>@param reqJson | |
98 | - * <li>@param users | |
99 | - * <li>创建人:方承 | |
100 | - * <li>创建时间:2017年3月28日 | |
101 | - * <li>修改人: | |
102 | - * <li>修改时间: | |
103 | - */ | |
104 | - private Users getRequestUsersEntity(String reqJson){ | |
105 | - //users.setId(reqJson.getString("id")); | |
106 | - return JSON.parseObject(reqJson, Users.class); | |
107 | - } | |
108 | - | |
109 | - | |
110 | 56 | @RequestMapping(value = "/tokens") |
111 | 57 | @ApiOperation(value = "登录接口", notes = "登录接口") |
112 | 58 | @ApiImplicitParams({ @ApiImplicitParam(name = "account", value = "用户account", required = true, dataType = "String"), |
... | ... | @@ -117,7 +63,6 @@ |
117 | 63 | @RequestParam(value = "password", required = false) String password, |
118 | 64 | AjaxResult ajaxResult, |
119 | 65 | HttpServletResponse response) { |
120 | - System.out.println(JSONObject.toJSON(ShiroWebUtils.getCurrentUser())); | |
121 | 66 | ajaxResult.setSuccess(false); |
122 | 67 | if (StringUtils.isEmpty(account) && (StringUtils.isEmpty(code) || StringUtils.isEmpty(password))) { |
123 | 68 | ajaxResult.setMessage("登录账户或者验证码为空,请输入!"); |
124 | 69 | |
125 | 70 | |
... | ... | @@ -139,15 +84,14 @@ |
139 | 84 | return ajaxResult; |
140 | 85 | } |
141 | 86 | } |
142 | - System.out.println(ShiroWebUtils.getCurrentUser()); | |
143 | 87 | Users users = ShiroWebUtils.getCurrentUser(); |
144 | 88 | //Organizations organizations = organizationsService.selectById( users.getOrgId()); |
145 | 89 | Map<String, Object> result = InstanceUtils.newHashMap(); |
146 | - String token = tokenService.createToken(users); | |
90 | + //String token = tokenService.createToken(users); | |
147 | 91 | List<Roles> roles = rolesService.selectBatchIds(usersService.getRoleIdListByUserid(users.getId())); |
148 | 92 | List<Permissions> permissions = permissionsService.getUserPermission(users.getId(),null); |
149 | 93 | Organizations org = organizationsService.selectById(users.getOrgId()); |
150 | - result.put("token", token); | |
94 | + //result.put("token", token); | |
151 | 95 | users.setLastLoginTime(DateTimeUtils.getNow()); |
152 | 96 | result.put("user",users); |
153 | 97 | result.put("roles",roles); |
... | ... | @@ -163,13 +107,5 @@ |
163 | 107 | return ajaxResult; |
164 | 108 | } |
165 | 109 | |
166 | - | |
167 | - @RequestMapping(value = "/tokensCheck", method = RequestMethod.POST) | |
168 | - @ResponseBody | |
169 | - public AjaxResult usersLogin( | |
170 | - HttpServletResponse response) { | |
171 | - System.out.println(1111111); | |
172 | - return null; | |
173 | - } | |
174 | 110 | } |
parent/hospital.web/src/main/java/com/lyms/hospital/controller/conf/DiagnoseConfController.java
View file @
71efc84
1 | 1 | package com.lyms.hospital.controller.conf; |
2 | 2 | |
3 | +import java.util.List; | |
4 | + | |
5 | +import org.springframework.beans.factory.annotation.Autowired; | |
3 | 6 | import org.springframework.stereotype.Controller; |
4 | 7 | import org.springframework.web.bind.annotation.RequestMapping; |
8 | +import org.springframework.web.bind.annotation.ResponseBody; | |
5 | 9 | |
10 | +import com.lyms.base.common.entity.conf.DiagnoseConf; | |
11 | +import com.lyms.base.common.entity.user.Users; | |
12 | +import com.lyms.base.common.service.conf.DiagnoseConfService; | |
13 | +import com.lyms.shiro.ShiroWebUtils; | |
14 | +import com.lyms.web.bean.AjaxResult; | |
6 | 15 | import com.lyms.web.controller.BaseController; |
7 | 16 | |
8 | 17 | /** |
9 | 18 | |
... | ... | @@ -16,6 +25,18 @@ |
16 | 25 | @Controller |
17 | 26 | @RequestMapping("/diagnoseConf") |
18 | 27 | public class DiagnoseConfController extends BaseController { |
28 | + | |
29 | + @Autowired | |
30 | + private DiagnoseConfService diagnoseConfService; | |
19 | 31 | |
32 | + | |
33 | + @RequestMapping(value = "/getDiagnoseConf") | |
34 | + @ResponseBody | |
35 | + public AjaxResult getDiagnoseConf() { | |
36 | + String type = getParameter("type") == null ? "1" : getParameter("type"); | |
37 | + Users user = ShiroWebUtils.getCurrentUser(); | |
38 | + List<DiagnoseConf> conf = diagnoseConfService.getDiagnoseConfByOrgId(user.getOrgId(), type); | |
39 | + return AjaxResult.returnSuccess(conf); | |
40 | + } | |
20 | 41 | } |
parent/hospital.web/src/main/java/com/lyms/hospital/controller/conf/DiagnoseSourceController.java
View file @
71efc84
1 | -package com.lyms.hospital.controller.conf; | |
2 | - | |
3 | -import org.springframework.stereotype.Controller; | |
4 | -import org.springframework.web.bind.annotation.RequestMapping; | |
5 | - | |
6 | -import com.lyms.web.controller.BaseController; | |
7 | - | |
8 | -/** | |
9 | - * <p> | |
10 | - * 诊断项定义资源表 前端控制器 | |
11 | - * </p> | |
12 | - * | |
13 | - * @author fangcheng | |
14 | - * @since 2017-03-30 | |
15 | - */ | |
16 | -@Controller | |
17 | -@RequestMapping("/diagnoseSource") | |
18 | -public class DiagnoseSourceController extends BaseController { | |
19 | - | |
20 | -} |
parent/hospital.web/src/main/java/com/lyms/hospital/controller/conf/DiagnoseVersionController.java
View file @
71efc84
1 | -package com.lyms.hospital.controller.conf; | |
2 | - | |
3 | -import org.springframework.stereotype.Controller; | |
4 | -import org.springframework.web.bind.annotation.RequestMapping; | |
5 | - | |
6 | -import com.lyms.web.controller.BaseController; | |
7 | - | |
8 | -/** | |
9 | - * <p> | |
10 | - * 诊断版本表 前端控制器 | |
11 | - * </p> | |
12 | - * | |
13 | - * @author fangcheng | |
14 | - * @since 2017-03-30 | |
15 | - */ | |
16 | -@Controller | |
17 | -@RequestMapping("/diagnoseVersion") | |
18 | -public class DiagnoseVersionController extends BaseController { | |
19 | - | |
20 | -} |
parent/hospital.web/src/main/java/com/lyms/hospital/controller/conf/HighriskConfController.java
View file @
71efc84
1 | 1 | package com.lyms.hospital.controller.conf; |
2 | 2 | |
3 | +import java.util.List; | |
4 | +import java.util.Map; | |
5 | + | |
6 | +import org.springframework.beans.factory.annotation.Autowired; | |
7 | +import org.springframework.stereotype.Controller; | |
8 | +import org.springframework.web.bind.annotation.RequestMapping; | |
9 | +import org.springframework.web.bind.annotation.ResponseBody; | |
10 | + | |
11 | +import com.lyms.base.common.entity.conf.HighriskConf; | |
12 | +import com.lyms.base.common.entity.user.Users; | |
13 | +import com.lyms.base.common.service.conf.HighriskConfService; | |
14 | +import com.lyms.shiro.ShiroWebUtils; | |
15 | +import com.lyms.web.bean.AjaxResult; | |
3 | 16 | import com.lyms.web.controller.BaseController; |
4 | 17 | |
5 | 18 | /** |
6 | - * | |
7 | - * @author maliang | |
8 | - * @since 2017-03-28 | |
19 | + * <li>@ClassName: 高危配置 | |
20 | + * <li>@Description: TODO(类描述) | |
21 | + * <li>@author 方承 | |
22 | + * <li>@date 2017年5月9日 | |
23 | + * <li> | |
9 | 24 | */ |
25 | +@Controller | |
26 | +@RequestMapping("/highriskConf") | |
10 | 27 | public class HighriskConfController extends BaseController { |
11 | 28 | |
29 | + | |
30 | + @Autowired | |
31 | + private HighriskConfService highriskConfService; | |
32 | + | |
33 | + @RequestMapping(value = "/getHighriskConf") | |
34 | + @ResponseBody | |
35 | + public AjaxResult getHighriskConf() { | |
36 | + String type = getParameter("type") == null ? "1" : getParameter("type"); | |
37 | + Users user = ShiroWebUtils.getCurrentUser(); | |
38 | + List<HighriskConf> conf = highriskConfService.getHighriskConfByOrgId(user.getOrgId(),type); | |
39 | + return AjaxResult.returnSuccess(conf); | |
40 | + } | |
41 | + | |
42 | + @RequestMapping(value = "/getHighriskColorList") | |
43 | + @ResponseBody | |
44 | + public AjaxResult getHighriskColorList() { | |
45 | + String type = getParameter("type") == null ? "1" : getParameter("type"); | |
46 | + Users user = ShiroWebUtils.getCurrentUser(); | |
47 | + List<Map<String,String>> conf = highriskConfService.getColorListByOrgId(user.getOrgId(),type); | |
48 | + return AjaxResult.returnSuccess(conf); | |
49 | + } | |
12 | 50 | } |
parent/hospital.web/src/main/java/com/lyms/hospital/controller/conf/HighriskSourceController.java
View file @
71efc84
parent/hospital.web/src/main/java/com/lyms/hospital/controller/conf/HighriskVersionController.java
View file @
71efc84
1 | -package com.lyms.hospital.controller.conf; | |
2 | - | |
3 | -import org.springframework.beans.factory.annotation.Autowired; | |
4 | -import org.springframework.web.bind.annotation.RequestMapping; | |
5 | -import org.springframework.web.bind.annotation.RestController; | |
6 | - | |
7 | -import com.lyms.base.common.service.conf.HighriskVersionService; | |
8 | -import com.lyms.web.controller.BaseController; | |
9 | - | |
10 | -/** | |
11 | - * 高危版本 | |
12 | - * | |
13 | - * @author maliang | |
14 | - * @since 2017-03-28 | |
15 | - */ | |
16 | -@RestController | |
17 | -@RequestMapping(value = "/highrisk/version") | |
18 | -public class HighriskVersionController extends BaseController { | |
19 | - | |
20 | -// @Autowired | |
21 | -// private HighriskVersionService highriskVersionService; | |
22 | - | |
23 | -} |
parent/hospital.web/src/main/resources/xml/app-cache.xml
View file @
71efc84
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<beans xmlns="http://www.springframework.org/schema/beans" | |
3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cache="http://www.springframework.org/schema/cache" | |
4 | + xmlns:p="http://www.springframework.org/schema/p" | |
5 | + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd | |
6 | + http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-4.0.xsd"> | |
7 | + | |
8 | + <cache:annotation-driven /> | |
9 | + | |
10 | + <bean name="cacheManager" class="com.lyms.spring.redis.ExtendedRedisCacheManager"> | |
11 | + <constructor-arg name="redisOperations" ref="redisTemplate" /> | |
12 | + <constructor-arg name="cacheNames"> | |
13 | + <set> | |
14 | + <value>hospital.conf:highrisk</value> | |
15 | + <value>hospital.conf:diagnose</value> | |
16 | + </set> | |
17 | + </constructor-arg> | |
18 | + <!-- 默认缓存名字 --> | |
19 | + <property name="defaultCacheName" value="hospital.defaultCache" /> | |
20 | + <!-- 是否在容器启动时初始化 --> | |
21 | + <property name="loadRemoteCachesOnStartup" value="true" /> | |
22 | + <!-- 是否使用前缀 --> | |
23 | + <property name="usePrefix" value="true" /> | |
24 | + <!-- 前缀命名,仅当usePrefix为true时才生效 --> | |
25 | + <property name="cachePrefix"> | |
26 | + <bean class="org.springframework.data.redis.cache.DefaultRedisCachePrefix"> | |
27 | + <constructor-arg name="delimiter" value=":" /> | |
28 | + </bean> | |
29 | + </property> | |
30 | + <!-- 缓存名字和有效期的分隔符 --> | |
31 | + <property name="separator" value="#" /> | |
32 | + <!-- 默认有效期1h --> | |
33 | + <property name="defaultExpiration" value="3600" /> | |
34 | + <!-- 多个缓存有效期,一般的单个工程可以省略此项 --> | |
35 | + <!-- <property name="expires"> | |
36 | + <map> | |
37 | + <entry key="user" value="1800" /> | |
38 | + </map> | |
39 | + </property> --> | |
40 | + </bean> | |
41 | + | |
42 | +</beans> |
parent/hospital.web/src/main/resources/xml/app-shiro.xml
View file @
71efc84
parent/hospital.web/src/test/java/test/hospital/highrisk/HighriskVersionTest.java
View file @
71efc84
... | ... | @@ -124,7 +124,7 @@ |
124 | 124 | @Test |
125 | 125 | public void getConfigByVersionId() { |
126 | 126 | String id = "71839AE8C94B4ACA9A694DD93338CD00"; |
127 | - List<HighriskConf> configs = highriskConfService.getHighriskConfByVersionId(id); | |
127 | + List<HighriskConf> configs = highriskConfService.getHighriskConfByVersionId(id,"1"); | |
128 | 128 | this.print(configs); |
129 | 129 | } |
130 | 130 | |
... | ... | @@ -138,7 +138,7 @@ |
138 | 138 | |
139 | 139 | @Test |
140 | 140 | public void getColorListByVersion(){ |
141 | - outJson(highriskConfService.getColorListByVersion("71839AE8C94B4ACA9A694DD93338CD00")); | |
141 | + outJson(highriskConfService.getColorListByVersion("71839AE8C94B4ACA9A694DD93338CD00","1")); | |
142 | 142 | } |
143 | 143 | |
144 | 144 | } |