Commit 1ee475ae9f1be43f16fd56abe690a5cf0b72f800

Authored by fangcheng
1 parent d6e1b20452
Exists in master

版本颜色列表、机构高危、诊断版本

Showing 8 changed files with 193 additions and 140 deletions

parent/base.common/src/main/java/com/lyms/base/common/dao/conf/HighriskConfMapper.java View file @ 1ee475a
... ... @@ -2,6 +2,7 @@
2 2  
3 3 import java.io.Serializable;
4 4 import java.util.List;
  5 +import java.util.Map;
5 6  
6 7 import org.springframework.stereotype.Repository;
7 8  
... ... @@ -42,6 +43,8 @@
42 43 * <li>修改时间:
43 44 */
44 45 public List<HighriskConf> selectBySource(String sourceId);
  46 +
  47 + public List<Map<String, String>> getColorListByVersion(Serializable versionId);
45 48  
46 49 }
parent/base.common/src/main/java/com/lyms/base/common/dao/conf/HighriskConfMapper.xml View file @ 1ee475a
... ... @@ -31,6 +31,13 @@
31 31 select <include refid="Base_Column_List" /> from HIGHRISK_CONF where SOURCE_ID=#{sourceId}
32 32 </select>
33 33  
  34 + <!-- 根据版本获取所有高危颜色-->
  35 + <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}
  38 + and c.ENABLE = 1 GROUP BY COLORTEXT)
  39 + </select>
  40 +
34 41  
35 42 </mapper>
parent/base.common/src/main/java/com/lyms/base/common/dao/organ/SysOrganizationsConfMapper.java View file @ 1ee475a
  1 +package com.lyms.base.common.dao.organ;
  2 +
  3 +import com.lyms.base.common.entity.organ.SysOrganizationsConf;
  4 +import com.baomidou.mybatisplus.mapper.BaseMapper;
  5 +import org.springframework.stereotype.Repository;
  6 +import java.io.Serializable;
  7 +/**
  8 + * <p>
  9 + * Mapper接口
  10 + * </p>
  11 + *
  12 + * @author fangcheng
  13 + * @since 2017-03-31
  14 + */
  15 +@Repository
  16 +public interface SysOrganizationsConfMapper extends BaseMapper<SysOrganizationsConf> {
  17 +
  18 + public Integer deleteLogicById(Serializable id);
  19 +
  20 +}
parent/base.common/src/main/java/com/lyms/base/common/dao/sys/SysDictMapper.xml View file @ 1ee475a
... ... @@ -16,7 +16,7 @@
16 16 ID AS id, PID AS pid, TYPECODE AS typecode, TXT AS txt, ENABLE AS enable
17 17 </sql>
18 18  
19   - <!-- 根据uid获取用户的权限列表-->
  19 + <!-- 根据typecode获取字典列表-->
20 20 <select id="getDictListByTypeCode" resultType="SysDict">
21 21 select <include refid="Base_Column_List"></include> from SYS_DICT t where t.PID in
22 22 (select id from SYS_DICT where TYPECODE = #{typeCode})
parent/base.common/src/main/java/com/lyms/base/common/service/conf/HighriskConfService.java View file @ 1ee475a
... ... @@ -2,6 +2,7 @@
2 2  
3 3 import java.io.Serializable;
4 4 import java.util.List;
  5 +import java.util.Map;
5 6  
6 7 import com.lyms.base.common.entity.conf.HighriskConf;
7 8 import com.lyms.exception.SystemException;
... ... @@ -67,6 +68,17 @@
67 68 * <li>修改时间:
68 69 */
69 70 public List<HighriskConf> getHighriskConfBySourceId(String sourceId);
  71 +
  72 + /**
  73 + * <li>@Description:TODO(方法描述)
  74 + * <li>@param versionid
  75 + * <li>@return
  76 + * <li>创建人:方承
  77 + * <li>创建时间:2017年3月31日
  78 + * <li>修改人:
  79 + * <li>修改时间:
  80 + */
  81 + public List<Map<String,String>> getColorListByVersion(Serializable versionId);
70 82  
71 83 }
parent/base.common/src/main/java/com/lyms/base/common/service/conf/impl/HighriskConfServiceImpl.java View file @ 1ee475a
... ... @@ -2,6 +2,7 @@
2 2  
3 3 import java.io.Serializable;
4 4 import java.util.List;
  5 +import java.util.Map;
5 6  
6 7 import org.apache.commons.lang3.StringUtils;
7 8 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -88,6 +89,11 @@
88 89 return null;
89 90 return confMapper.selectBySource(sourceId);
90 91 }
  92 +
  93 + @Override
  94 + public List<Map<String, String>> getColorListByVersion(Serializable versionId) {
  95 + return confMapper.getColorListByVersion(versionId);
  96 + }
91 97  
92 98 }
parent/hospital.web/src/test/java/test/hospital/highrisk/HighriskVersionTest.java View file @ 1ee475a
  1 +package test.hospital.highrisk;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.apache.commons.collections.CollectionUtils;
  6 +import org.apache.commons.lang3.builder.ToStringBuilder;
  7 +import org.junit.Assert;
  8 +import org.junit.Before;
  9 +import org.junit.Test;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +
  12 +import com.lyms.base.common.entity.conf.HighriskConf;
  13 +import com.lyms.base.common.entity.conf.HighriskSource;
  14 +import com.lyms.base.common.entity.conf.HighriskVersion;
  15 +import com.lyms.base.common.service.conf.HighriskConfService;
  16 +import com.lyms.base.common.service.conf.HighriskSourceService;
  17 +import com.lyms.base.common.service.conf.HighriskVersionService;
  18 +
  19 +import test.hospital.BaseServiceTest;
  20 +
  21 +public class HighriskVersionTest extends BaseServiceTest {
  22 +
  23 + @Autowired
  24 + private HighriskVersionService highriskVersionService;
  25 +
  26 + @Autowired
  27 + private HighriskSourceService highriskSourceService;
  28 +
  29 + @Autowired
  30 + private HighriskConfService highriskConfService;
  31 +
  32 + private HighriskVersion version = null;
  33 +
  34 + @Before
  35 + public void init() {
  36 + version = new HighriskVersion();
  37 + version.setName("center-1.0");
  38 + }
  39 +
  40 + /**
  41 + * <li>@Description: 启用 / 禁用版本号
  42 + * <li>
  43 + * <li>创建人:maliang
  44 + * <li>创建时间:2017年3月29日
  45 + * <li>修改人:
  46 + * <li>修改时间:
  47 + */
  48 + @Test
  49 + public void enable() {
  50 + String id = "0EDDB06729CE48FF84CC6188231A6ECE";
  51 + boolean tag = highriskVersionService.enable(id);
  52 + Assert.assertTrue(tag);
  53 + }
  54 +
  55 + /**
  56 + *
  57 + * <li>@Description:创建资源
  58 + * <li>@return
  59 + * <li>创建人:maliang
  60 + * <li>创建时间:2017年3月29日
  61 + * <li>修改人:
  62 + * <li>修改时间:
  63 + */
  64 + public String createSource() {
  65 + HighriskSource source = new HighriskSource();
  66 + source.setName("高危资源");
  67 + source.setType("1");
  68 + return highriskSourceService.createHighriskSource(source);
  69 + }
  70 +
  71 + /**
  72 + * <li>@Description:创建版本测试
  73 + * <li>
  74 + * <li>创建人:maliang
  75 + * <li>创建时间:2017年3月29日
  76 + * <li>修改人:
  77 + * <li>修改时间:
  78 + */
  79 + public String createVersion() {
  80 + String id = highriskVersionService.createVersion(version);
  81 + return id;
  82 + }
  83 +
  84 + // @Transactional
  85 + @Test
  86 + public void createConfig() {
  87 + HighriskConf highriskConf = new HighriskConf();
  88 + highriskConf.setSourceId(createSource());
  89 + highriskConf.setVersionId(createVersion());
  90 + highriskConf.setColorcode("ys001");
  91 + highriskConf.setColortext("颜色编码1");
  92 + highriskConf.setGrade(5D);
  93 + highriskConf.setGrouporder(1);
  94 + highriskConf.setName("颜色");
  95 + highriskConf.setItemorder(1);
  96 +
  97 + highriskConfService.createHighriskConf(highriskConf);
  98 + }
  99 +
  100 + /**
  101 + * <li>@Description:根据source ID获取高危信息
  102 + * <li>
  103 + * <li>创建人:maliang
  104 + * <li>创建时间:2017年3月29日
  105 + * <li>修改人:
  106 + * <li>修改时间:
  107 + */
  108 + @Test
  109 + public void getConfigBySourceId() {
  110 + String id = "0CFB58C5748247008D5C3421DDB753ED";
  111 + List<HighriskConf> configs = highriskConfService.getHighriskConfBySourceId(id);
  112 + System.out.println(ToStringBuilder.reflectionToString(configs));
  113 + this.print(configs);
  114 + }
  115 +
  116 + /**
  117 + * <li>@Description:根据version ID获取高危信息
  118 + * <li>
  119 + * <li>创建人:maliang
  120 + * <li>创建时间:2017年3月29日
  121 + * <li>修改人:
  122 + * <li>修改时间:
  123 + */
  124 + @Test
  125 + public void getConfigByVersionId() {
  126 + String id = "71839AE8C94B4ACA9A694DD93338CD00";
  127 + List<HighriskConf> configs = highriskConfService.getHighriskConfByVersionId(id);
  128 + this.print(configs);
  129 + }
  130 +
  131 + private void print(List<HighriskConf> configs) {
  132 + if (CollectionUtils.isEmpty(configs))
  133 + return;
  134 + for (HighriskConf conf : configs) {
  135 + System.out.println(conf.getName());
  136 + }
  137 + }
  138 +
  139 + @Test
  140 + public void getColorListByVersion(){
  141 + outJson(highriskConfService.getColorListByVersion("71839AE8C94B4ACA9A694DD93338CD00"));
  142 + }
  143 +
  144 +}
parent/hospital.web/src/test/java/test/hospital/service/HighriskVersionTest.java View file @ 1ee475a
1   -package test.hospital.service;
2   -
3   -import java.util.List;
4   -
5   -import org.apache.commons.collections.CollectionUtils;
6   -import org.apache.commons.lang3.builder.ToStringBuilder;
7   -import org.junit.Assert;
8   -import org.junit.Before;
9   -import org.junit.Test;
10   -import org.springframework.beans.factory.annotation.Autowired;
11   -
12   -import com.lyms.base.common.entity.conf.HighriskConf;
13   -import com.lyms.base.common.entity.conf.HighriskSource;
14   -import com.lyms.base.common.entity.conf.HighriskVersion;
15   -import com.lyms.base.common.service.conf.HighriskConfService;
16   -import com.lyms.base.common.service.conf.HighriskSourceService;
17   -import com.lyms.base.common.service.conf.HighriskVersionService;
18   -
19   -import test.hospital.BaseServiceTest;
20   -
21   -public class HighriskVersionTest extends BaseServiceTest {
22   -
23   - @Autowired
24   - private HighriskVersionService highriskVersionService;
25   -
26   - @Autowired
27   - private HighriskSourceService highriskSourceService;
28   -
29   - @Autowired
30   - private HighriskConfService highriskConfService;
31   -
32   - private HighriskVersion version = null;
33   -
34   - @Before
35   - public void init() {
36   - version = new HighriskVersion();
37   - version.setName("center-1.0");
38   - }
39   -
40   - /**
41   - * <li>@Description: 启用 / 禁用版本号
42   - * <li>
43   - * <li>创建人:maliang
44   - * <li>创建时间:2017年3月29日
45   - * <li>修改人:
46   - * <li>修改时间:
47   - */
48   - @Test
49   - public void enable() {
50   - String id = "0EDDB06729CE48FF84CC6188231A6ECE";
51   - boolean tag = highriskVersionService.enable(id);
52   - Assert.assertTrue(tag);
53   - }
54   -
55   - /**
56   - *
57   - * <li>@Description:创建资源
58   - * <li>@return
59   - * <li>创建人:maliang
60   - * <li>创建时间:2017年3月29日
61   - * <li>修改人:
62   - * <li>修改时间:
63   - */
64   - public String createSource() {
65   - HighriskSource source = new HighriskSource();
66   - source.setName("高危资源");
67   - source.setType("1");
68   - return highriskSourceService.createHighriskSource(source);
69   - }
70   -
71   - /**
72   - * <li>@Description:创建版本测试
73   - * <li>
74   - * <li>创建人:maliang
75   - * <li>创建时间:2017年3月29日
76   - * <li>修改人:
77   - * <li>修改时间:
78   - */
79   - public String createVersion() {
80   - String id = highriskVersionService.createVersion(version);
81   - return id;
82   - }
83   -
84   - // @Transactional
85   - @Test
86   - public void createConfig() {
87   - HighriskConf highriskConf = new HighriskConf();
88   - highriskConf.setSourceId(createSource());
89   - highriskConf.setVersionId(createVersion());
90   - highriskConf.setColorcode("ys001");
91   - highriskConf.setColortext("颜色编码1");
92   - highriskConf.setGrade(5D);
93   - highriskConf.setGrouporder(1);
94   - highriskConf.setName("颜色");
95   - highriskConf.setItemorder(1);
96   -
97   - highriskConfService.createHighriskConf(highriskConf);
98   - }
99   -
100   - /**
101   - * <li>@Description:根据source ID获取高危信息
102   - * <li>
103   - * <li>创建人:maliang
104   - * <li>创建时间:2017年3月29日
105   - * <li>修改人:
106   - * <li>修改时间:
107   - */
108   - @Test
109   - public void getConfigBySourceId() {
110   - String id = "0CFB58C5748247008D5C3421DDB753ED";
111   - List<HighriskConf> configs = highriskConfService.getHighriskConfBySourceId(id);
112   - System.out.println(ToStringBuilder.reflectionToString(configs));
113   - this.print(configs);
114   - }
115   -
116   - /**
117   - * <li>@Description:根据version ID获取高危信息
118   - * <li>
119   - * <li>创建人:maliang
120   - * <li>创建时间:2017年3月29日
121   - * <li>修改人:
122   - * <li>修改时间:
123   - */
124   - @Test
125   - public void getConfigByVersionId() {
126   - String id = "71839AE8C94B4ACA9A694DD93338CD00";
127   - List<HighriskConf> configs = highriskConfService.getHighriskConfByVersionId(id);
128   - this.print(configs);
129   - }
130   -
131   - private void print(List<HighriskConf> configs) {
132   - if (CollectionUtils.isEmpty(configs))
133   - return;
134   - for (HighriskConf conf : configs) {
135   - System.out.println(conf.getName());
136   - }
137   - }
138   -
139   -}