Commit e1e4b243e273373a6572879cfc06f93bda09a98b

Authored by fangcheng
1 parent fd3558e8ba
Exists in master

添加病史

Showing 10 changed files with 161 additions and 17 deletions

parent/hospital.mac/src/main/java/com/lyms/hospital/constants/HistoryPatientType.java View file @ e1e4b24
  1 +package com.lyms.hospital.constants;
  2 +
  3 +/**
  4 + * <li>@ClassName: 病史分类
  5 + * <li>@Description: TODO(类描述)
  6 + * <li>@author 方承
  7 + * <li>@date 2017年3月29日
  8 + * <li>
  9 + */
  10 +public enum HistoryPatientType {
  11 +
  12 + JWS("JWS"),
  13 + JZS("JZS");
  14 +
  15 + private String code;
  16 +
  17 + private HistoryPatientType(String code) {
  18 + this.code = code;
  19 + }
  20 +
  21 + public String getCode() {
  22 + return code;
  23 + }
  24 +
  25 +}
parent/hospital.mac/src/main/java/com/lyms/hospital/dao/history/HistorySourceMapper.java View file @ e1e4b24
... ... @@ -10,7 +10,7 @@
10 10 * </p>
11 11 *
12 12 * @author fangcheng
13   - * @since 2017-03-28
  13 + * @since 2017-03-29
14 14 */
15 15 @Repository
16 16 public interface HistorySourceMapper extends BaseMapper<HistorySource> {
parent/hospital.mac/src/main/java/com/lyms/hospital/dao/history/HistorySourceMapper.xml View file @ e1e4b24
... ... @@ -8,13 +8,14 @@
8 8 <result column="PID" property="pid" />
9 9 <result column="NAME" property="name" />
10 10 <result column="TYPE" property="type" />
  11 + <result column="ITEMORDER" property="itemorder" />
11 12 <result column="LEVEL" property="level" />
12 13 <result column="ENABLE" property="enable" />
13 14 </resultMap>
14 15  
15 16 <!-- 通用查询结果列 -->
16 17 <sql id="Base_Column_List">
17   - ID AS id, PID AS pid, NAME AS name, TYPE AS type, LEVEL AS level, ENABLE AS enable
  18 + ID AS id, PID AS pid, NAME AS name, TYPE AS type, ITEMORDER AS itemorder, LEVEL AS level, ENABLE AS enable
18 19 </sql>
19 20 </mapper>
parent/hospital.mac/src/main/java/com/lyms/hospital/entity/history/HistorySource.java View file @ e1e4b24
... ... @@ -4,6 +4,7 @@
4 4 import com.baomidou.mybatisplus.annotations.TableField;
5 5 import com.baomidou.mybatisplus.annotations.TableName;
6 6 import java.io.Serializable;
  7 +import java.util.List;
7 8  
8 9 /**
9 10 * <p>
... ... @@ -11,7 +12,7 @@
11 12 * </p>
12 13 *
13 14 * @author fangcheng
14   - * @since 2017-03-28
  15 + * @since 2017-03-29
15 16 */
16 17 @TableName("HISTORY_SOURCE")
17 18 public class HistorySource implements Serializable {
... ... @@ -39,6 +40,11 @@
39 40 @TableField(value="TYPE")
40 41 private String type;
41 42 /**
  43 + *
  44 + */
  45 + @TableField(value="ITEMORDER")
  46 + private String itemorder;
  47 + /**
42 48 * 本记录层级,1,2,3
43 49 */
44 50 @TableField(value="LEVEL")
... ... @@ -47,9 +53,14 @@
47 53 * 是否启用,默认1启用
48 54 */
49 55 @TableField(value="ENABLE")
50   - private String enable;
51   -
52   -
  56 + private Integer enable;
  57 +
  58 + /**
  59 + * 子级别元素
  60 + */
  61 + @TableField(exist=false)
  62 + private List<HistorySource> children;
  63 +
53 64 public String getId() {
54 65 return id;
55 66 }
... ... @@ -82,6 +93,14 @@
82 93 this.type = type;
83 94 }
84 95  
  96 + public String getItemorder() {
  97 + return itemorder;
  98 + }
  99 +
  100 + public void setItemorder(String itemorder) {
  101 + this.itemorder = itemorder;
  102 + }
  103 +
85 104 public String getLevel() {
86 105 return level;
87 106 }
88 107  
89 108  
... ... @@ -90,13 +109,23 @@
90 109 this.level = level;
91 110 }
92 111  
93   - public String getEnable() {
  112 + public Integer getEnable() {
94 113 return enable;
95 114 }
96 115  
97   - public void setEnable(String enable) {
  116 + public void setEnable(Integer enable) {
98 117 this.enable = enable;
99 118 }
  119 +
  120 + public List<HistorySource> getChildren() {
  121 + return children;
  122 + }
  123 +
  124 + public void setChildren(List<HistorySource> children) {
  125 + this.children = children;
  126 + }
  127 +
  128 +
100 129  
101 130 }
parent/hospital.mac/src/main/java/com/lyms/hospital/service/history/HistorySourceService.java View file @ e1e4b24
... ... @@ -3,6 +3,7 @@
3 3 import com.lyms.hospital.entity.history.HistorySource;
4 4 import com.lyms.web.service.BaseService;
5 5 import java.io.Serializable;
  6 +import java.util.List;
6 7  
7 8 /**
8 9 * <p>
... ... @@ -20,6 +21,30 @@
20 21 * <li>@return 大于0修改成功,否则为失败
21 22 */
22 23 public Integer deleteLogicById(Serializable id);
  24 +
  25 +
  26 + /**
  27 + * <li>@Description:根据参数类型获取所有病史基础数据,不传入参数获取所有
  28 + * <li>@param types HistoryPatientType
  29 + * <li>@return
  30 + * <li>创建人:方承
  31 + * <li>创建时间:2017年3月29日
  32 + * <li>修改人:
  33 + * <li>修改时间:
  34 + */
  35 +public List<HistorySource> selectByType(String ...HistoryPatientType);
  36 +
  37 +
  38 +/**
  39 + * <li>@Description:根据参数类型获取所有病史的结构型数据(有层次结构的数据),不传入参数获取所有
  40 + * <li>@param HistoryPatientType
  41 + * <li>@return
  42 + * <li>创建人:方承
  43 + * <li>创建时间:2017年3月29日
  44 + * <li>修改人:
  45 + * <li>修改时间:
  46 + */
  47 +public List<HistorySource> selectStructureByType(String ...HistoryPatientType);
23 48  
24 49 }
parent/hospital.mac/src/main/java/com/lyms/hospital/service/history/impl/HistorySourceServiceImpl.java View file @ e1e4b24
... ... @@ -3,9 +3,13 @@
3 3 import com.lyms.hospital.entity.history.HistorySource;
4 4 import com.lyms.hospital.dao.history.HistorySourceMapper;
5 5 import com.lyms.hospital.service.history.HistorySourceService;
  6 +import com.lyms.util.InstanceUtils;
  7 +import com.baomidou.mybatisplus.mapper.EntityWrapper;
6 8 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
7 9 import org.springframework.stereotype.Service;
8 10 import java.io.Serializable;
  11 +import java.util.List;
  12 +import java.util.Map;
9 13  
10 14 /**
11 15 * <p>
... ... @@ -21,5 +25,38 @@
21 25 public Integer deleteLogicById(Serializable id){
22 26 return baseMapper.deleteLogicById(id);
23 27 }
  28 +
  29 + @Override
  30 + public List<HistorySource> selectByType(String... historyPatientType) {
  31 + List<HistorySource> dataList = null;
  32 + EntityWrapper<HistorySource> ew = new EntityWrapper<HistorySource>();
  33 + ew.where("enable=1");
  34 + if(null != historyPatientType){
  35 + ew.and("type={}", "'"+historyPatientType+"'");
  36 + }
  37 + dataList = selectList(ew);
  38 + return dataList;
  39 + }
  40 +
  41 + @Override
  42 + public List<HistorySource> selectStructureByType(String... HistoryPatientType) {
  43 + List<HistorySource> dbdataList = selectByType(HistoryPatientType);
  44 + List<HistorySource> firstdataList = InstanceUtils.newArrayList();
  45 + Map<String,HistorySource> firstLevelData = InstanceUtils.newHashMap();
  46 + for(HistorySource historySource : dbdataList){
  47 + if("1".equals(historySource.getLevel())){
  48 + firstdataList.add(historySource);
  49 + firstLevelData.put(historySource.getId(), historySource);
  50 + dbdataList.remove(historySource);
  51 + }
  52 + }
  53 + for(HistorySource historySource : dbdataList){
  54 + if("2".equals(historySource.getLevel())){
  55 + firstLevelData.get(historySource.getPid()).getChildren().add(historySource);
  56 + dbdataList.remove(historySource);
  57 + }
  58 + }
  59 + return firstdataList;
  60 + }
24 61 }
parent/hospital.web/src/main/java/com/lyms/hospital/controller/LoginController.java View file @ e1e4b24
... ... @@ -43,7 +43,7 @@
43 43 */
44 44 @RequestMapping(value = "/testPostJson", method = RequestMethod.POST)
45 45 @ResponseBody
46   - public String testPostJson(@RequestBody JSONObject reqJson){
  46 + public String testPostJson(@RequestBody String reqJson){
47 47 Users u = getRequestUsersEntity(reqJson);
48 48 System.out.println(JSON.toJSONString(u));
49 49 return "1";
50 50  
... ... @@ -58,9 +58,9 @@
58 58 * <li>修改人:
59 59 * <li>修改时间:
60 60 */
61   - private Users getRequestUsersEntity(JSONObject reqJson){
  61 + private Users getRequestUsersEntity(String reqJson){
62 62 //users.setId(reqJson.getString("id"));
63   - return JSON.parseObject(reqJson.toJSONString(), Users.class);
  63 + return JSON.parseObject(reqJson, Users.class);
64 64 }
65 65 }
parent/hospital.web/src/main/java/com/lyms/hospital/controller/conf/HighriskVersionController.java View file @ e1e4b24
... ... @@ -17,8 +17,8 @@
17 17 @RequestMapping(value = "/highrisk/version")
18 18 public class HighriskVersionController extends BaseController {
19 19  
20   - @Autowired
21   - private HighriskVersionService highriskVersionService;
  20 +// @Autowired
  21 +// private HighriskVersionService highriskVersionService;
22 22  
23 23 }
parent/hospital.web/src/test/java/test/hospital/history/HistoryTest.java View file @ e1e4b24
  1 +package test.hospital.history;
  2 +
  3 +import org.junit.Test;
  4 +import org.springframework.beans.factory.annotation.Autowired;
  5 +
  6 +import com.lyms.hospital.service.history.HistorySourceService;
  7 +
  8 +import test.hospital.BaseTest;
  9 +
  10 +public class HistoryTest extends BaseTest{
  11 +
  12 + @Autowired
  13 + private HistorySourceService historySourceService;
  14 +
  15 + /**
  16 + * <li>@Description:测试病史基础数据
  17 + * <li>
  18 + * <li>创建人:方承
  19 + * <li>创建时间:2017年3月29日
  20 + * <li>修改人:
  21 + * <li>修改时间:
  22 + */
  23 + @Test
  24 + public void testHistorySource(){
  25 + outJson(historySourceService.selectStructureByType());
  26 + }
  27 +}
parent/mybatis-plus/src/test/java/com/baomidou/mybatisplus/test/generator/MysqlGenerator.java View file @ e1e4b24
... ... @@ -44,15 +44,15 @@
44 44  
45 45 private static void customSet(GlobalConfig gc, StrategyConfig strategy, PackageConfig pc) {
46 46 gc.setOutputDir("E://mybatis-plus-generate");
47   - gc.setAuthor("maliang");
  47 + gc.setAuthor("fangcheng");
48 48  
49 49 // strategy.setInclude(new String[] {
50 50 // "SYS_USERS","SYS_USER_ROLE_MAPS","SYS_ROLES" }); // 需要生成的表
51   - strategy.setInclude(new String[] { "HIGHRISK_VERSION" }); // 需要生成的表
  51 + strategy.setInclude(new String[] { "HISTORY_SOURCE"}); // 需要生成的表
52 52 // pc.setParent("com.lyms.hospital");
53   - pc.setParent("com.lyms.base.common");
  53 + pc.setParent("com.lyms.hospital");
54 54  
55   - pc.setFunctionName("conf"); // com.lyms.hospital.web.controller.sys
  55 + pc.setFunctionName("history"); // com.lyms.hospital.web.controller.sys
56 56 // 加在controller后面
57 57 // pc.setModuleName("sys"); //com.lyms.hospital.sys.controller
58 58 // 加在controller前面