Commit ce8e60d1194595a889727365972022cc3d0bd19c

Authored by fangcheng
1 parent cffa813e80
Exists in master

病史接口开发

Showing 5 changed files with 21 additions and 9 deletions

parent/hospital.mac/src/main/java/com/lyms/hospital/entity/history/HistorySource.java View file @ ce8e60d
... ... @@ -3,6 +3,8 @@
3 3 import com.baomidou.mybatisplus.annotations.TableId;
4 4 import com.baomidou.mybatisplus.annotations.TableField;
5 5 import com.baomidou.mybatisplus.annotations.TableName;
  6 +import com.lyms.util.InstanceUtils;
  7 +
6 8 import java.io.Serializable;
7 9 import java.util.List;
8 10  
... ... @@ -59,7 +61,7 @@
59 61 * 子级别元素
60 62 */
61 63 @TableField(exist=false)
62   - private List<HistorySource> children;
  64 + private List<HistorySource> children = InstanceUtils.newArrayList();
63 65  
64 66 public String getId() {
65 67 return id;
parent/hospital.mac/src/main/java/com/lyms/hospital/service/history/impl/HistorySourceServiceImpl.java View file @ ce8e60d
... ... @@ -31,8 +31,8 @@
31 31 List<HistorySource> dataList = null;
32 32 EntityWrapper<HistorySource> ew = new EntityWrapper<HistorySource>();
33 33 ew.where("enable=1");
34   - if(null != historyPatientType){
35   - ew.and("type={}", "'"+historyPatientType+"'");
  34 + if(historyPatientType.length > 0){
  35 + ew.and("type={0}", "'"+historyPatientType[0]+"'");
36 36 }
37 37 dataList = selectList(ew);
38 38 return dataList;
39 39  
... ... @@ -47,13 +47,11 @@
47 47 if("1".equals(historySource.getLevel())){
48 48 firstdataList.add(historySource);
49 49 firstLevelData.put(historySource.getId(), historySource);
50   - dbdataList.remove(historySource);
51 50 }
52 51 }
53 52 for(HistorySource historySource : dbdataList){
54 53 if("2".equals(historySource.getLevel())){
55 54 firstLevelData.get(historySource.getPid()).getChildren().add(historySource);
56   - dbdataList.remove(historySource);
57 55 }
58 56 }
59 57 return firstdataList;
parent/hospital.web/src/test/java/test/hospital/BaseServiceTest.java View file @ ce8e60d
... ... @@ -5,10 +5,21 @@
5 5 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
6 6 import org.springframework.test.context.web.WebAppConfiguration;
7 7  
  8 +import com.alibaba.fastjson.JSONObject;
  9 +
8 10 @RunWith(SpringJUnit4ClassRunner.class)
9 11 @WebAppConfiguration
10 12 @ContextConfiguration(locations = { "classpath:app-context.xml" })
11 13 public class BaseServiceTest {
  14 +
  15 + protected void outPrint(Object obj) {
  16 + System.err.println(obj);
  17 + }
  18 +
  19 + protected void outJson(Object obj) {
  20 + System.err.println(JSONObject.toJSONString(obj));
  21 + }
  22 +
12 23  
13 24 }
parent/hospital.web/src/test/java/test/hospital/BaseTest.java View file @ ce8e60d
... ... @@ -18,7 +18,7 @@
18 18  
19 19 @RunWith(SpringJUnit4ClassRunner.class)
20 20 @WebAppConfiguration
21   -@ContextConfiguration(locations = { "classpath:app-context.xml", "classpath:dev/xml/app-*.xml"
  21 +@ContextConfiguration(locations = { "classpath:app-context.xml"
22 22  
23 23 // ,
24 24 // "classpath:app-datasource.xml",
parent/hospital.web/src/test/java/test/hospital/history/HistoryTest.java View file @ ce8e60d
... ... @@ -3,11 +3,12 @@
3 3 import org.junit.Test;
4 4 import org.springframework.beans.factory.annotation.Autowired;
5 5  
  6 +import com.lyms.hospital.constants.HistoryPatientType;
6 7 import com.lyms.hospital.service.history.HistorySourceService;
7 8  
8   -import test.hospital.BaseTest;
  9 +import test.hospital.BaseServiceTest;
9 10  
10   -public class HistoryTest extends BaseTest{
  11 +public class HistoryTest extends BaseServiceTest{
11 12  
12 13 @Autowired
13 14 private HistorySourceService historySourceService;
... ... @@ -22,7 +23,7 @@
22 23 */
23 24 @Test
24 25 public void testHistorySource(){
25   - outJson(historySourceService.selectStructureByType());
  26 + outJson(historySourceService.selectStructureByType(HistoryPatientType.JWS.getCode()));
26 27 }
27 28 }