wangyuesongtao 7 年之前
父節點
當前提交
79dc464932
共有 45 個文件被更改,包括 2560 次插入37 次删除
  1. 668 0
      org.zsl.hnust Maven Webapp/.svn/pristine/01/015a0ee793d5062b3b55704bcd8f539055402bca.svn-base
  2. 102 0
      org.zsl.hnust Maven Webapp/.svn/pristine/07/07628acec6016d6d4a58445af0464ccc7743e57f.svn-base
  3. 661 0
      org.zsl.hnust Maven Webapp/.svn/pristine/16/165f09a32842fa40e713e3092e9e31a6e9b1e6d3.svn-base
  4. 72 0
      org.zsl.hnust Maven Webapp/.svn/pristine/6b/6b004fa372c0b0d334fc20a804153a96948a30b5.svn-base
  5. 32 0
      org.zsl.hnust Maven Webapp/.svn/pristine/77/7709aa20ce0e631c60e32211c756338700a8cc1a.svn-base
  6. 89 0
      org.zsl.hnust Maven Webapp/.svn/pristine/79/7992f51fe8ce5850e2dbe9baedd52040e80043ad.svn-base
  7. 347 0
      org.zsl.hnust Maven Webapp/.svn/pristine/8d/8df391cc1a0c5408f07810b5934e1f2083fc904d.svn-base
  8. 180 0
      org.zsl.hnust Maven Webapp/.svn/pristine/b2/b2e9677ce3d3ec230fb280a86a9da8d50d8cf916.svn-base
  9. 67 0
      org.zsl.hnust Maven Webapp/.svn/pristine/ea/ea93dc0772f5fc371d855e4559bf3a786a869cd2.svn-base
  10. 二進制
      org.zsl.hnust Maven Webapp/.svn/wc.db
  11. 45 0
      org.zsl.hnust Maven Webapp/logs/ssm.log
  12. 41 16
      org.zsl.hnust Maven Webapp/src/main/java/com/synyi/edc/controller/SqlbuilderController.java
  13. 6 0
      org.zsl.hnust Maven Webapp/src/main/java/com/synyi/edc/dao/ISqlbuilderDao.java
  14. 20 2
      org.zsl.hnust Maven Webapp/src/main/java/com/synyi/edc/pojo/Parameter.java
  15. 6 0
      org.zsl.hnust Maven Webapp/src/main/java/com/synyi/edc/service/ISqlbuilderService.java
  16. 8 0
      org.zsl.hnust Maven Webapp/src/main/java/com/synyi/edc/service/impl/SqlbuilderServiceImpl.java
  17. 76 2
      org.zsl.hnust Maven Webapp/src/main/java/com/synyi/edc/util/SqlBuilderUtils.java
  18. 9 0
      org.zsl.hnust Maven Webapp/src/main/resources/mapping/SqlbuilderMapper.xml
  19. 3 0
      org.zsl.hnust Maven Webapp/src/main/resources/接口列表.txt
  20. 92 8
      org.zsl.hnust Maven Webapp/src/test/java/Test.java
  21. 二進制
      org.zsl.hnust Maven Webapp/target/classes/com/synyi/edc/controller/SqlbuilderController.class
  22. 二進制
      org.zsl.hnust Maven Webapp/target/classes/com/synyi/edc/dao/ISqlbuilderDao.class
  23. 二進制
      org.zsl.hnust Maven Webapp/target/classes/com/synyi/edc/pojo/Parameter.class
  24. 二進制
      org.zsl.hnust Maven Webapp/target/classes/com/synyi/edc/service/ISqlbuilderService.class
  25. 二進制
      org.zsl.hnust Maven Webapp/target/classes/com/synyi/edc/service/impl/SqlbuilderServiceImpl.class
  26. 二進制
      org.zsl.hnust Maven Webapp/target/classes/com/synyi/edc/util/SqlBuilderUtils.class
  27. 9 0
      org.zsl.hnust Maven Webapp/target/classes/mapping/SqlbuilderMapper.xml
  28. 3 0
      org.zsl.hnust Maven Webapp/target/classes/接口列表.txt
  29. 1 1
      org.zsl.hnust Maven Webapp/target/m2e-jee/web-resources/META-INF/maven/com.synyi.edc/synyi-service/pom.properties
  30. 1 1
      org.zsl.hnust Maven Webapp/target/maven-archiver/pom.properties
  31. 3 3
      org.zsl.hnust Maven Webapp/target/surefire-reports/TEST-Test.xml
  32. 2 2
      org.zsl.hnust Maven Webapp/target/surefire-reports/TEST-org.zsl.testmybatis.Test.xml
  33. 1 1
      org.zsl.hnust Maven Webapp/target/surefire-reports/Test.txt
  34. 1 1
      org.zsl.hnust Maven Webapp/target/surefire-reports/org.zsl.testmybatis.Test.txt
  35. 二進制
      org.zsl.hnust Maven Webapp/target/synyi-service.war
  36. 二進制
      org.zsl.hnust Maven Webapp/target/synyi-service/WEB-INF/classes/com/synyi/edc/controller/SqlbuilderController.class
  37. 二進制
      org.zsl.hnust Maven Webapp/target/synyi-service/WEB-INF/classes/com/synyi/edc/dao/ISqlbuilderDao.class
  38. 二進制
      org.zsl.hnust Maven Webapp/target/synyi-service/WEB-INF/classes/com/synyi/edc/pojo/Parameter.class
  39. 二進制
      org.zsl.hnust Maven Webapp/target/synyi-service/WEB-INF/classes/com/synyi/edc/service/ISqlbuilderService.class
  40. 二進制
      org.zsl.hnust Maven Webapp/target/synyi-service/WEB-INF/classes/com/synyi/edc/service/impl/SqlbuilderServiceImpl.class
  41. 二進制
      org.zsl.hnust Maven Webapp/target/synyi-service/WEB-INF/classes/com/synyi/edc/util/SqlBuilderUtils.class
  42. 9 0
      org.zsl.hnust Maven Webapp/target/synyi-service/WEB-INF/classes/mapping/SqlbuilderMapper.xml
  43. 3 0
      org.zsl.hnust Maven Webapp/target/synyi-service/WEB-INF/classes/接口列表.txt
  44. 二進制
      org.zsl.hnust Maven Webapp/target/test-classes/Test.class
  45. 3 0
      org.zsl.hnust Maven Webapp/target/tomcat/logs/access_log.2018-08-09

File diff suppressed because it is too large
+ 668 - 0
org.zsl.hnust Maven Webapp/.svn/pristine/01/015a0ee793d5062b3b55704bcd8f539055402bca.svn-base


+ 102 - 0
org.zsl.hnust Maven Webapp/.svn/pristine/07/07628acec6016d6d4a58445af0464ccc7743e57f.svn-base

@@ -0,0 +1,102 @@
+package com.synyi.edc.service.impl;
+
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+
+import com.synyi.edc.dao.ISqlbuilderDao;
+import com.synyi.edc.pojo.Parameter;
+import com.synyi.edc.service.ISqlbuilderService;
+/**
+ * 连接数据库查询service
+ * @author wy
+ *
+ */
+@Service("sqlbuilderService")
+public class SqlbuilderServiceImpl implements ISqlbuilderService {
+	@Resource
+	private ISqlbuilderDao dao;
+	/**
+	 * 获取所有的医院列表
+	 */
+	@Override
+	public List<Parameter> getAllOrgInfo() {
+		// TODO Auto-generated method stub
+		return this.dao.getAllOrgInfo();
+	}
+	/**
+	 * 获取检验名称
+	 */
+	@Override
+	public List<Parameter> getAllLabInfo(Parameter labname) {
+		// TODO Auto-generated method stub
+		return this.dao.getAllLabInfo( labname);
+	}
+
+	/**
+     * 获取检验结果,文本结果和数字结果等suggestion列表
+     * @param par
+     * @return
+     */
+    public List<Parameter> getSuggestionList(Parameter par){
+    	return this.dao.getSuggestionList(par);
+    }
+    /**
+     * 根据药品名称 模糊穷举所有药品名称
+     * @param par 参数传递为 labName
+     * @return
+     */
+    public List<Parameter> getAllDrugInfo(Parameter par){
+    	return this.dao.getAllDrugInfo(par);
+    }
+    
+    /**
+     * 获取所有的药品大类名称
+     * @return
+     */
+	public List<Parameter> getAllDrugCategory(){
+		return this.dao.getAllDrugCategory();
+	}
+	/**
+	 * 根据药品名称获取模糊匹配的suggestion
+	 * @param param
+	 * @return
+	 */
+	public List<Parameter> getSuggestionByDrug(Parameter param){
+		return this.dao.getSuggestionByDrug(param);
+	}
+	/**
+	 * 根据药品父节点名称获取子节点药品名称
+	 * @param param
+	 * @return
+	 */
+	public List<Parameter> getChildDrug(Parameter param){
+		return this.dao.getChildDrug(param);
+	}
+	/**
+	 * 递归通过子类别将所有父类药品列出来
+	 * @param param
+	 * @return
+	 */
+	public List<Parameter> getParentPath(Parameter param){
+		return this.dao.getParentPath(param);
+	}
+	/**
+	 * 递归通过子类别将所有父类药品列出来并且所有父类的同类列出来
+	 * @param param
+	 * @return
+	 */
+	public List<Parameter> getAllDrugPathInfo(Parameter param){
+		return this.dao.getAllDrugPathInfo(param);
+	}
+	/**
+	 * 模糊匹配获取所有的手术名称
+	 * @param param
+	 * @return
+	 */
+	public List<Parameter> getAllOperationInfo(Parameter param){
+		return this.dao.getAllOperationInfo(param);
+	}
+}

+ 661 - 0
org.zsl.hnust Maven Webapp/.svn/pristine/16/165f09a32842fa40e713e3092e9e31a6e9b1e6d3.svn-base

@@ -0,0 +1,661 @@
+package com.synyi.edc.util;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.util.CollectionUtils;
+
+import com.alibaba.fastjson.JSON;
+
+public class SqlBuilderUtils {
+
+	/**
+	 * sql生成分组方法
+	 * @param jsonStr
+	 * @param stepStr
+	 * @return
+	 */
+	public static String genGroupSql(String jsonStr,String stepStr){
+		Map<String,Map> temp1 = null;  //入排条件1
+		Map temp2 = null;  //入排条件2
+		List<Map> lis = (List)JSON.parse(jsonStr);
+		if(!CollectionUtils.isEmpty(lis)){
+			temp1 = lis.get(0);
+			if(lis.size()>1){
+				temp2 = lis.get(1);
+			}
+		}
+		
+		System.out.println(stepStr);
+		Map stepMap = (Map)JSON.parse(stepStr);;
+		
+		int maxValue = 0;
+		int minValue = 0;
+		int interval = 0;
+		
+		try{
+			if(StringUtils.isNotBlank((String)stepMap.get("maxValue"))){
+				maxValue = Integer.parseInt((String)stepMap.get("maxValue"));
+			}
+			if(StringUtils.isNotBlank((String)stepMap.get("minValue"))){
+				minValue = Integer.parseInt((String)stepMap.get("minValue"));
+			}
+			if(StringUtils.isNotBlank((String)stepMap.get("interval"))){
+				interval = Integer.parseInt((String)stepMap.get("interval"));
+			}
+		}catch(Exception e){}
+		
+		String groupType = stepMap.get("groupType")==null?"":(String)stepMap.get("groupType");
+		String event1 = (String)temp1.get("事件").get("event_type");
+		String event2 = temp2!=null?(String)((Map)temp2.get("事件")).get("event_type"):"";
+		
+		String returnSql = "";
+		switch(event1){
+			case "diagnosis":returnSql = "with temp1 as ("+event_diagnose(temp1,stepMap)+")";break;
+			case "laboratoryExamination":returnSql = "with temp1 as ("+event_lab(temp1,stepMap)+")";break;
+			case "drugUse":returnSql = "with temp1 as ("+event_drug(temp1,stepMap)+")";break;
+			case "operation":returnSql = "with temp1 as ("+event_operation(temp1,stepMap)+")";break;
+		}
+		
+		
+		if(!CollectionUtils.isEmpty(temp2)){
+			switch(event2){
+				case "diagnosis":returnSql += ", <br/> temp2 as ("+event_diagnose(temp2,stepMap)+")";break;
+				case "laboratoryExamination":returnSql += ", <br/> temp2 as ("+event_lab(temp2,stepMap)+")";break;
+				case "drugUse":returnSql += ", <br/> temp2 as ("+event_drug(temp2,stepMap)+")";break;
+				case "operation":returnSql += ", <br/> temp2 as ("+event_operation(temp2,stepMap)+")";break;
+			}
+			
+			String rel = (String)temp2.get("关系");
+			if("or".equals(rel)){
+				returnSql += " <br/> select ";
+				
+				if(StringUtils.isNotBlank(groupType)){
+					switch((String)stepMap.get("groupType")){
+						case "年龄段":returnSql += generateAgePart(minValue,maxValue,interval)+" 年龄段,";break;
+						case "年份":returnSql += "to_char(event_time,'yyyy') 年份,";break;
+						case "医院":returnSql += "t.org_code,org.org_name,";break;
+						case "就诊类型":returnSql += "visit_type,";break;
+						case "性别":returnSql += "case when c.sex_code in ('2','9') then '女' when c.sex_code ='1' then '男' else '未知' end 性别,";break;
+					}
+				}
+				
+				if("patientsNumber".equals((String)stepMap.get("queryType"))){
+					returnSql += "count(distinct t.patient_id) 人数";
+				}else{
+					returnSql += "count(t.patient_id) 人次";
+				}
+				returnSql += " <br/> from (select * from temp1 union all  select * from temp2 )t ";
+				if("性别".equals((String)stepMap.get("groupType"))||"年龄段".equals((String)stepMap.get("groupType"))){
+					returnSql += " join patient.patient_master_info c on t.patient_id=c.patient_id <br/>";
+				}
+				if("医院".equals((String)stepMap.get("groupType"))){
+					returnSql += " join mdm.organization org on t.org_code=org.org_code  <br/>";
+				}
+				if(StringUtils.isNotBlank(groupType)){
+					returnSql += " group by ";
+					switch((String)stepMap.get("groupType")){
+						case "年龄段":returnSql += generateAgePart(minValue,maxValue,interval);break;
+						case "年份":returnSql += "to_char(event_time,'yyyy') ";break;
+						case "医院":returnSql += "t.org_code,org.org_name";break;
+						case "就诊类型":returnSql += "visit_type";break;
+						case "性别":returnSql += "case when c.sex_code in ('2','9') then '女' when c.sex_code ='1' then '男' else '未知' end";break;
+					}
+				}
+			}else if("and".equals(rel)){
+				returnSql += "select count(1) 人数 from (select distinct temp1.patient_id from temp1)a join (select distinct temp2.patient_id from temp2 ) b on a.patient_id=b.patient_id";
+			}
+		}else{//只有temp1的情况
+			
+			returnSql += "<br/> select ";
+			if(StringUtils.isNotBlank(groupType)){
+				switch((String)stepMap.get("groupType")){
+					case "年龄段":returnSql += generateAgePart(minValue,maxValue,interval)+" 年龄段,";break;
+					case "年份":returnSql += "to_char(diag_time,'yyyy') 年份,";break;
+					case "医院":returnSql += "temp1.org_code,org.org_name,";break;
+					case "就诊类型":returnSql += "visit_type,";break;
+					case "性别":returnSql += "case when c.sex_code in ('2','9') then '女' when c.sex_code ='1' then '男' else '未知' end 性别,<br/>";break;
+				}
+			}
+			if("patientsNumber".equals((String)stepMap.get("queryType"))){
+				returnSql += "count(distinct temp1.patient_id) 人数";
+			}else{  //visitsNumber 人次
+				returnSql += "count(temp1.patient_id) 人次";
+			}
+			returnSql += " from temp1 ";
+			
+			if("性别".equals((String)stepMap.get("groupType"))||"年龄段".equals((String)stepMap.get("groupType"))){
+				returnSql += " join patient.patient_master_info c on temp1.patient_id=c.patient_id <br/> ";
+			}
+			if("医院".equals((String)stepMap.get("groupType"))){
+				returnSql += " join mdm.organization org on temp1.org_code=org.org_code  <br/>";
+			}
+			
+			if(StringUtils.isNotBlank(groupType)){
+				returnSql += "group by ";
+				
+				switch((String)stepMap.get("groupType")){
+					case "年龄段":returnSql += generateAgePart(minValue,maxValue,interval);break;
+					case "年份":returnSql += "to_char(diag_time,'yyyy') ";break;
+					case "医院":returnSql += "temp1.org_code,org.org_name";break;
+					case "就诊类型":returnSql += "visit_type";break;
+					case "性别":returnSql += "case when c.sex_code in ('2','9') then '女' when c.sex_code ='1' then '男' else '未知' end";break;
+				}
+			}
+		}
+		return returnSql;
+	}
+	/**
+	 * 按照年龄段分组方法
+	 * @param min  最小年龄
+	 * @param max  最大年龄
+	 * @param interval  年龄间隔
+	 * @return
+	 */
+	  public static String generateAgePart(int min,int max,int interval){
+	    	String str = " case";
+	    	
+	    	int temp = min;
+	    	for(int i=min;i<max;i+=interval){
+	    		if(i>min){
+	    			//System.out.println(temp+":"+i);
+	    			if(temp==min){
+	    				str += " when extract(year from age(diag_time,c.birth_date))  >="+temp +" and extract(year from age(diag_time,c.birth_date)) <"+i+" then '"+temp+"到"+i+"'<br/>";
+//	    			
+	    				}else if(i==max){
+//	    				str += " when extract(year from age(temp1.diag_time,c.birth_date)) <="+max+" then '"+temp+"到"+max+"' end  ";
+	    			}else{
+	    				str += " when extract(year from age(diag_time,c.birth_date)) <"+i+" then '"+temp+"到"+i+"'<br/>";
+	    			}	
+	    			temp = i;
+	    		}
+	    	}
+	    	str += " when extract(year from age(diag_time,c.birth_date)) <="+max+" then '"+temp+"到"+max+"' end <br/> ";
+	    //	System.out.println(str);
+	    	return str;
+	    }
+	/**
+	 * 按照事件  为  诊断 的sql语句生成方法
+	 * @param temp1
+	 * @param groupMap
+	 * @return
+	 */
+	  public static String event_diagnose(Map<String,Map> temp1,Map groupMap){
+	    	/*{"事件":{"diag_standard":"I21,I22,I23","event_type":"诊断"},"医院":{"org_code":"9983838x,111999441,2224589985,112445580"},
+			 * "就诊类型":{"visit_type":"门诊"},"时间":{"time_from":"绝对时间:2017-01-01","time_to":"绝对时间:2017-01-10"}}
+			 * 
+			 * {\"事件\":{\"diag_standard\":[\"I220\",\"I230\"],\"diag_primitive\":[\"I220\",\"I230\"],\"event_type\":\"diagnosis\"},
+			 * \"医院\":{\"org_code\":[\"111111\",\"222222\"]},\"就诊类型\":{\"visit_type\":\"hospitalization\"},\"时间\":{\"time_from\":\"2018-7-2\",\"time_to\":\"2018-8-12\"},
+			 * \"关系\":\"or\"}
+			 * 
+			 * */
+			String resultSql = "";
+			String condition = "";
+			//String eventType = "";
+			
+			for(String str:temp1.keySet()){
+				if("事件".equals(str)){  //"事件":{"diag_standard":"I21,I22,I23","event_type":"诊断"}
+					Map temp = temp1.get(str);
+					//if(temp.get("event_type").equals("diagnosis")){
+						//eventType = (String)temp.get("event_type");
+						//,diag_time,org_code,case when visit_type='O' then '门诊' when visit_type='I' then '住院' when is_emergency=true then '急诊' else '未知' end visit_type
+						resultSql += " select * from(select a.patient_id";
+								String groupType = groupMap.get("groupType")==null?"":(String)groupMap.get("groupType");
+								if(StringUtils.isNotBlank(groupType)){//"{\"groupType\":\"医院\",\"interval\":\"\",\"maxValue\":\"\",\"minValue\":\"\"}";
+									switch(groupType){
+										case "年龄段":resultSql += ",coalesce(a.diag_time,b.visit_time) diag_time";break;
+										case "年份":resultSql += ",coalesce(a.diag_time,b.visit_time) diag_time";break;
+										case "医院":resultSql += ",a.org_code";break;
+										case "就诊类型":resultSql += ",case when b.visit_type='O' then '门诊' when b.visit_type='I' then '住院' when is_emergency=true then '急诊' else '未知' end visit_type";break;
+										case "性别":resultSql += "";break;
+									}
+								}
+								
+								resultSql += ",jsonb_array_elements(diag_sycode_set) "+
+										"as sycode  <br/> from diag.patient_diagnose a ";
+								
+								String time_from = temp1.get("时间")==null?"":(String)temp1.get("时间").get("time_from");
+								String visit_type =  temp1.get("就诊类型")==null?"":(String)temp1.get("就诊类型").get("visit_type");
+								if(StringUtils.isNotBlank(time_from)||StringUtils.isNotBlank(visit_type)){
+									resultSql += " left join visit.visit_record b on a.visit_id = b.visit_id ";
+								}else{
+									if(StringUtils.isNotBlank(groupType)){
+										switch((String)groupMap.get("groupType")){
+											case "年龄段":resultSql += " left join visit.visit_record b on a.visit_id = b.visit_id ";break;
+											case "年份":resultSql += " left join visit.visit_record b on a.visit_id = b.visit_id ";break;
+											case "就诊类型":resultSql += " left join visit.visit_record b on a.visit_id = b.visit_id ";break;
+											//case "性别":resultSql += "";break;
+										}
+									}
+								}									
+								resultSql += "where 1=1 $condition$ ) t1  <br/> ";
+						
+						List<String> diag_list = (List)temp.get("diag_standard");
+						List<String> diag_primitive = (List)temp.get("diag_primitive");
+						if(diag_list!=null&&diag_list.size()>0){
+							resultSql += " join (select diag_code,diag_code2,diag_name from mdm.diagnose a where a.code_sys_id=30 <br/> ";
+							
+							if(diag_list.size()>1){
+								for(int i = 0;i<diag_list.size();i++){
+									String diag_c = diag_list.get(i);
+									if(i==0){
+										resultSql += " and ( diag_code2 like '"+diag_c+"%'";
+									}else if(i==diag_list.size()-1){
+										resultSql += " or diag_code2 like '"+diag_c+"%')";
+									}else{
+										resultSql += " or diag_code2 like '"+diag_c+"%'";
+									}
+								}
+							}else{
+								resultSql += " and diag_code2 like '"+diag_list.get(0)+"%'";
+							}
+							resultSql += " <br/> )t2 on replace(t1.sycode::varchar(50),'\"','')  =t2.diag_code";
+						}else if(diag_primitive!=null&&diag_primitive.size()>0){
+							
+							resultSql += " join (select diag_code,diag_code2,diag_name from mdm.diagnose a where a.code_sys_id=30 <br/> ";
+							
+							if(diag_primitive.size()>1){
+								for(int i = 0;i<diag_primitive.size();i++){
+									String diag_c = diag_primitive.get(i);
+									if(i==0){
+										resultSql += " and ( diag_name like '%"+diag_c+"%'";
+									}else if(i==diag_primitive.size()-1){
+										resultSql += " or diag_name like '%"+diag_c+"%')";
+									}else{
+										resultSql += " or diag_name like '%"+diag_c+"%'";
+									}
+								}
+							}else{
+								resultSql += " and diag_name like '%"+diag_primitive.get(0)+"%'";
+							}
+							resultSql += " <br/> )t2 on replace(t1.sycode::varchar(50),'\"','')  =t2.diag_code";
+						}
+					//}
+				}else if("医院".equals(str)){ //"医院":{"org_code":"9983838x,111999441,2224589985,112445580"}
+					Map temp = temp1.get(str);
+					try{
+						List<String> org_list = (List)temp.get("org_code");
+						if(!CollectionUtils.isEmpty(org_list)){
+							if(org_list.size()>1){
+								for(int i = 0;i<org_list.size();i++){
+									String org_code = org_list.get(i);
+									if(i==0){
+										condition += " and  a.org_code in ('"+org_code+"',";
+									}else if(i==org_list.size()-1){
+										condition += "'"+org_code+"')";
+									}else{
+										condition += "'"+org_code+"',";
+									}
+								}
+							}else{
+								condition += " and a.org_code = '"+org_list.get(0)+"'";
+							}
+						}
+					}catch(java.lang.ClassCastException e){}
+					
+				}else if("时间".equals(str)){//"时间":{"time_from":"绝对时间:2017-01-01","time_to":"绝对时间:2017-01-10","time_type":"诊断时间"}
+					Map temp = temp1.get(str);
+					String time_from = (String)temp.get("time_from");
+					String time_to = (String)temp.get("time_to"); 
+					condition += " <br/> ";
+					if(StringUtils.isNoneBlank(time_from)&&StringUtils.isNoneBlank(time_to)){
+						condition += " and coalesce(a.diag_time,b.visit_time) between '"+time_from +"' and '"+time_to+"'";
+					}
+					
+//					switch(eventType){
+//						case "诊断":condition+= "and coalesce(a.diag_time,b.visit_time) ";break;
+//						case "检验时间":condition+= "and report_time ";break;
+//						case "用药时间":condition+= "and drug_time ";break;
+//						case "手术时间":condition+= "and oper_time ";break;
+//					}
+				}else if("就诊类型".equals(str)){//"就诊类型":{"visit_type":"门诊"}
+					Map temp = temp1.get(str);
+					String visit_type = (String)temp.get("visit_type");
+					condition += " <br/> ";
+					switch(visit_type){
+						case "outpat":condition+= " and b.visit_type='O' ";break;
+						case "inpat":condition+= " and b.visit_type='I' ";break;
+						case "emergency":condition+= " and b.is_emergency=true ";break;
+					}
+				}
+			}
+			
+			resultSql = resultSql.replace("$condition$", condition);
+			return resultSql;
+	    }
+	  public static String event_lab(Map<String,Map> temp1,Map groupMap){
+	    	/*{"事件":{"diag_standard":"I21,I22,I23","event_type":"诊断"},"医院":{"org_code":"9983838x,111999441,2224589985,112445580"},
+			 * "就诊类型":{"visit_type":"门诊"},"时间":{"time_from":"绝对时间:2017-01-01","time_to":"绝对时间:2017-01-10"}}
+			 * 
+			 * {\"事件\":{\"diag_standard\":[\"I220\",\"I230\"],\"diag_primitive\":[\"I220\",\"I230\"],\"event_type\":\"diagnosis\"},
+			 * \"医院\":{\"org_code\":[\"111111\",\"222222\"]},\"就诊类型\":{\"visit_type\":\"hospitalization\"},\"时间\":{\"time_from\":\"2018-7-2\",\"time_to\":\"2018-8-12\"},
+			 * \"关系\":\"or\"}
+			 * 
+			 * */
+			String resultSql = "";
+			String condition = "";
+			//String eventType = "";
+			
+			for(String str:temp1.keySet()){
+				if("事件".equals(str)){  //"事件":{"diag_standard":"I21,I22,I23","event_type":"诊断"}
+					Map temp = temp1.get(str);
+					//if(temp.get("event_type").equals("diagnosis")){
+						//eventType = (String)temp.get("event_type");
+						//,diag_time,org_code,case when visit_type='O' then '门诊' when visit_type='I' then '住院' when is_emergency=true then '急诊' else '未知' end visit_type
+						resultSql += " select d.patient_id";
+								String groupType = groupMap.get("groupType")==null?"":(String)groupMap.get("groupType");
+								if(StringUtils.isNotBlank(groupType)){//"{\"groupType\":\"医院\",\"interval\":\"\",\"maxValue\":\"\",\"minValue\":\"\"}";
+									switch(groupType){
+										case "年龄段":resultSql += ",d.report_time event_time";break;
+										case "年份":resultSql += ",d.report_time event_time";break;
+										case "医院":resultSql += ",d.org_code";break;
+										case "就诊类型":resultSql += ",case when e.visit_type='O' then '门诊' when e.visit_type='I' then '住院' when is_emergency=true then '急诊' else '未知' end visit_type";break;
+										case "性别":resultSql += "";break;
+									}
+								}
+								
+								resultSql += " from lab.lab_report_result a join  mdm.mdm_map b on a.test_item_id=b.source_id"+
+												" <br/> join mdm.lis_item c on  b.map_id=c.item_id"+ 
+												" join lab.lab_report d on a.report_id=d.report_id ";
+								
+								String visit_type =  temp1.get("就诊类型")==null?"":(String)temp1.get("就诊类型").get("visit_type");
+								if(StringUtils.isNotBlank(visit_type)){
+									resultSql += " left join visit.visit_record e  <br/> on d.visit_id = e.visit_id ";
+								}								
+								resultSql += " where b.md_type = 'lis_item' and c.code_sys_id =197  $condition$  ";
+						
+			//{\"lab_standard\":[\"220\",\"230\"],\"character_result\":[\"偏高\",\"异常\"],\"exception_symbol\":[\"1\",\"2\"],\"number_result\":[\">=1\"],\"event_type\":\"lab\"}
+						List<String> lab_list = (List)temp.get("lab_standard");
+						List<String> character_result = (List)temp.get("character_result");
+						List<String> exception_symbol = (List)temp.get("exception_symbol");
+						List<String> number_result = (List)temp.get("number_result");
+						if(lab_list!=null&&lab_list.size()>0){
+							resultSql += " and c.item_id in (";
+							String tempLab = "";
+							for(String lab:lab_list){
+								tempLab += "'"+lab+"',";
+							}
+							resultSql += tempLab.substring(0,tempLab.length()-1)+")";
+							
+						}
+						if(character_result!=null&&character_result.size()>0){
+							resultSql += " and a.text_value in (";
+							String tempLab = "";
+							for(String lab:character_result){
+								tempLab += "'"+lab+"',";
+							}
+							resultSql += tempLab.substring(0,tempLab.length()-1)+")";
+						}
+						if(exception_symbol!=null&&exception_symbol.size()>0){
+							resultSql += " and a.abnormal_flag_name in (";
+							String tempLab = "";
+							for(String lab:exception_symbol){
+								tempLab += "'"+lab+"',";
+							}
+							resultSql += tempLab.substring(0,tempLab.length()-1)+")";
+						}
+						if(number_result!=null&&number_result.size()>0){
+							resultSql += " and a.numerical_value "+number_result.get(0);
+						}
+					//}
+				}else if("医院".equals(str)){ //"医院":{"org_code":"9983838x,111999441,2224589985,112445580"}
+					Map temp = temp1.get(str);
+					try{
+						List<String> org_list = (List)temp.get("org_code");
+						if(!CollectionUtils.isEmpty(org_list)){
+							if(org_list.size()>1){
+								for(int i = 0;i<org_list.size();i++){
+									String org_code = org_list.get(i);
+									if(i==0){
+										condition += " and  d.org_code in ('"+org_code+"',";
+									}else if(i==org_list.size()-1){
+										condition += "'"+org_code+"')";
+									}else{
+										condition += "'"+org_code+"',";
+									}
+								}
+							}else{
+								condition += " and d.org_code = '"+org_list.get(0)+"'";
+							}
+						}
+					}catch(java.lang.ClassCastException e){}
+					
+				}else if("时间".equals(str)){//"时间":{"time_from":"绝对时间:2017-01-01","time_to":"绝对时间:2017-01-10","time_type":"诊断时间"}
+					Map temp = temp1.get(str);
+					String time_from = (String)temp.get("time_from");
+					String time_to = (String)temp.get("time_to");
+					condition += " <br/> ";
+					if(StringUtils.isNoneBlank(time_from)&&StringUtils.isNoneBlank(time_to)){
+						condition += " and d.report_time between '"+time_from +"' and '"+time_to+"'";
+					}
+					
+//					switch(eventType){
+//						case "诊断":condition+= "and coalesce(a.diag_time,b.visit_time) ";break;
+//						case "检验时间":condition+= "and report_time ";break;
+//						case "用药时间":condition+= "and drug_time ";break;
+//						case "手术时间":condition+= "and oper_time ";break;
+//					}
+				}else if("就诊类型".equals(str)){//"就诊类型":{"visit_type":"门诊"}
+					Map temp = temp1.get(str);
+					String visit_type = (String)temp.get("visit_type");
+					condition += " <br/> ";
+					switch(visit_type){
+						case "outpat":condition+= " and e.visit_type='O' ";break;
+						case "inpat":condition+= " and e.visit_type='I' ";break;
+						case "emergency":condition+= " and e.is_emergency=true ";break;
+					}
+				}
+			}
+			
+			resultSql = resultSql.replace("$condition$", condition);
+			return resultSql;
+	    }
+	  
+	  public static String event_drug(Map<String,Map> temp1,Map groupMap){
+	    	/*{\"事件\":{\"drug_standard\":[\"220\",\"230\"],\"drug_category\":[\"330\",\"543\"],\"event_type\":\"drug\"},\"医院\":{\"org_code\":[\"111111\",\"222222\"]},
+	    	 * \"就诊类型\":{\"visit_type\":\"inpat\"},\"时间\":{\"time_from\":\"2018-7-2\",\"time_to\":\"2018-8-12\"},\"关系\":\"or\"},
+			 * 
+			 * */
+			String resultSql1 = "";
+			String resultSql2 = "";
+			String condition1 = "";
+			String condition2 = "";
+			//String eventType = "";
+			
+			for(String str:temp1.keySet()){
+				if("事件".equals(str)){  //"事件":{"diag_standard":"I21,I22,I23","event_type":"诊断"}
+					Map temp = temp1.get(str);
+					//if(temp.get("event_type").equals("diagnosis")){
+						//eventType = (String)temp.get("event_type");
+						//,diag_time,org_code,case when visit_type='O' then '门诊' when visit_type='I' then '住院' when is_emergency=true then '急诊' else '未知' end visit_type
+						resultSql1 += " select t1.patient_id";
+						resultSql2 += " select t1.patient_id";
+								String groupType = groupMap.get("groupType")==null?"":(String)groupMap.get("groupType");
+								if(StringUtils.isNotBlank(groupType)){//"{\"groupType\":\"医院\",\"interval\":\"\",\"maxValue\":\"\",\"minValue\":\"\"}";
+									switch(groupType){
+										case "年龄段":resultSql1 += ",t1.begin_time event_time";resultSql2 += " , t4.recipe_time event_time";break;
+										case "年份":resultSql1 += ",t1.begin_time event_time";resultSql2 += ",t4.recipe_time event_time";break;
+										case "医院":resultSql1 += ",t1.org_code";resultSql2 += ",t1.org_code";break;
+										case "就诊类型":resultSql1 += ",'住院' visit_type";resultSql2 += ",'门诊' visit_type";break;
+										case "性别":resultSql1 += "";break;
+									}
+								}
+								
+								List<String> drug_category = (List)temp.get("drug_category");
+								
+								resultSql1 += " FROM orders.inpat_drug_order t1  join mdm.mdm_map t2 on t1.drug_id=t2.source_id "+
+												" <br/> join mdm.drug t3 on t2.map_id=t3.drug_id";
+								
+								resultSql2 += " FROM orders.outpat_recipe_detail t1 join mdm.mdm_map t2 on t1.drug_id=t2.source_id  "+
+										" <br/> join mdm.drug t3 on t2.map_id=t3.drug_id join orders.outpat_recipe t4 on t1.recipe_id=t4.recipe_id ";
+								
+								if(drug_category!=null&&drug_category.size()>0){
+									
+									String tempLab = " in (";
+									for(String cat:drug_category){
+										tempLab += "'"+cat+"',";
+									}
+									tempLab = tempLab.substring(0,tempLab.length()-1)+")";
+									
+									resultSql1 +=" join ( <br/> with RECURSIVE  temp1 as (  select id from drug_new where id "+tempLab+" union ALL "+
+											" select d.id from drug_new d ,temp1 where d.parent=temp1.id )select * from temp1) ca <br/> on  t3.drug_code=ca.id";
+									resultSql2 +=" join ( <br/> with RECURSIVE  temp1 as (  select id from drug_new where id "+tempLab+" union ALL "+
+											" select d.id from drug_new d ,temp1 where d.parent=temp1.id )select * from temp1) ca <br/> on  t3.drug_code=ca.id";
+								}
+								
+								resultSql1 += " where t2.md_type='drug' and t3.code_sys_id = 51  $condition$  <br/> ";
+								resultSql2 += " where t2.md_type='drug' and t3.code_sys_id = 51  $condition$  <br/> ";
+						
+			//{\"lab_standard\":[\"220\",\"230\"],\"character_result\":[\"偏高\",\"异常\"],\"exception_symbol\":[\"1\",\"2\"],\"number_result\":[\">=1\"],\"event_type\":\"lab\"}
+						List<String> lab_list = (List)temp.get("drug_standard");
+						
+						if(lab_list!=null&&lab_list.size()>0){
+							resultSql1 += " and t3.drug_id in (";
+							resultSql2 += " and t3.drug_id in (";
+							String tempLab = "";
+							for(String lab:lab_list){
+								tempLab += "'"+lab+"',";
+							}
+							resultSql1 += tempLab.substring(0,tempLab.length()-1)+")";
+							resultSql2 += tempLab.substring(0,tempLab.length()-1)+")";
+						}
+						
+						
+					//}
+				}else if("医院".equals(str)){ //"医院":{"org_code":"9983838x,111999441,2224589985,112445580"}
+					Map temp = temp1.get(str);
+					try{
+						List<String> org_list = (List)temp.get("org_code");
+						if(!CollectionUtils.isEmpty(org_list)){
+							if(org_list.size()>1){
+								for(int i = 0;i<org_list.size();i++){
+									String org_code = org_list.get(i);
+									if(i==0){
+										condition1 += " and  t1.org_code in ('"+org_code+"',";
+										condition2 += " and  t1.org_code in ('"+org_code+"',";
+									}else if(i==org_list.size()-1){
+										condition1 += "'"+org_code+"')";
+										condition2 += "'"+org_code+"')";
+									}else{
+										condition1 += "'"+org_code+"',";
+										condition2 += "'"+org_code+"',";
+									}
+								}
+							}else{
+								condition1 += " and t1.org_code = '"+org_list.get(0)+"'";
+								condition2 += " and t1.org_code = '"+org_list.get(0)+"'";
+							}
+						}
+					}catch(java.lang.ClassCastException e){}
+					
+				}else if("时间".equals(str)){//"时间":{"time_from":"绝对时间:2017-01-01","time_to":"绝对时间:2017-01-10","time_type":"诊断时间"}
+					Map temp = temp1.get(str);
+					String time_from = (String)temp.get("time_from");
+					String time_to = (String)temp.get("time_to");
+					if(StringUtils.isNoneBlank(time_from)&&StringUtils.isNoneBlank(time_to)){
+						condition1 += " and t1.begin_time between '"+time_from +"' and '"+time_to+"'";
+						condition2 += " and t4.recipe_time between '"+time_from +"' and '"+time_to+"'";
+					}
+					
+//					switch(eventType){
+//						case "诊断":condition+= "and coalesce(a.diag_time,b.visit_time) ";break;
+//						case "检验时间":condition+= "and report_time ";break;
+//						case "用药时间":condition+= "and drug_time ";break;
+//						case "手术时间":condition+= "and oper_time ";break;
+//					}
+				}
+			}
+			
+			resultSql1 = resultSql1.replace("$condition$", condition1);
+			resultSql2 = resultSql2.replace("$condition$", condition2);
+			
+			String returnSql = "";
+			Map temp = temp1.get("就诊类型");
+			String visit_type = (String)temp.get("visit_type");
+			if("inpat".equals(visit_type)){
+				returnSql = resultSql1;
+			}else if("outpat".equals(visit_type)){
+				returnSql+= resultSql2;
+			}else{
+				returnSql+= resultSql1 +" union all "+ resultSql2;
+			}
+			
+			
+			return returnSql;
+	    }
+	  public static String event_operation(Map<String,Map> temp1,Map groupMap){
+			String resultSql = "";
+			String condition = "";
+			//String eventType = "";
+			
+			for(String str:temp1.keySet()){
+				if("事件".equals(str)){  //"事件":{"diag_standard":"I21,I22,I23","event_type":"诊断"}
+					Map temp = temp1.get(str);
+						resultSql += " select t1.patient_id";
+								String groupType = groupMap.get("groupType")==null?"":(String)groupMap.get("groupType");
+								if(StringUtils.isNotBlank(groupType)){//"{\"groupType\":\"医院\",\"interval\":\"\",\"maxValue\":\"\",\"minValue\":\"\"}";
+									switch(groupType){
+										case "年龄段":resultSql += ",t2.operation_time event_time";break;
+										case "年份":resultSql += ",t2.operation_time event_time";break;
+										case "医院":resultSql += ",t2.org_code";break;
+										case "就诊类型":resultSql += ",'住院' visit_type";break;
+										case "性别":resultSql += "";break;
+									}
+								}
+								
+								resultSql += " from cases.case_base t1 join cases.case_operation t2 on t1.case_id=t2.case_id " ;
+								
+								resultSql += "where 1=1 $condition$  <br/> ";
+						
+			//{\"lab_standard\":[\"220\",\"230\"],\"character_result\":[\"偏高\",\"异常\"],\"exception_symbol\":[\"1\",\"2\"],\"number_result\":[\">=1\"],\"event_type\":\"lab\"}
+						List<String> opeartion_standard = (List)temp.get("opeartion_standard");
+						if(opeartion_standard!=null&&opeartion_standard.size()>0){
+							resultSql += " and t2.operation_code in (";
+							String tempLab = "";
+							for(String lab:opeartion_standard){
+								tempLab += "'"+lab+"',";
+							}
+							resultSql += tempLab.substring(0,tempLab.length()-1)+")";
+						}
+					//}
+				}else if("医院".equals(str)){ //"医院":{"org_code":"9983838x,111999441,2224589985,112445580"}
+					Map temp = temp1.get(str);
+					try{
+						List<String> org_list = (List)temp.get("org_code");
+						if(!CollectionUtils.isEmpty(org_list)){
+							if(org_list.size()>1){
+								for(int i = 0;i<org_list.size();i++){
+									String org_code = org_list.get(i);
+									if(i==0){
+										condition += " and  t2.org_code in ('"+org_code+"',";
+									}else if(i==org_list.size()-1){
+										condition += "'"+org_code+"')";
+									}else{
+										condition += "'"+org_code+"',";
+									}
+								}
+							}else{
+								condition += " and t2.org_code = '"+org_list.get(0)+"'";
+							}
+						}
+					}catch(java.lang.ClassCastException e){}
+					
+				}else if("时间".equals(str)){//"时间":{"time_from":"绝对时间:2017-01-01","time_to":"绝对时间:2017-01-10","time_type":"诊断时间"}
+					Map temp = temp1.get(str);
+					String time_from = (String)temp.get("time_from");
+					String time_to = (String)temp.get("time_to");
+					condition += " <br/> ";
+					if(StringUtils.isNoneBlank(time_from)&&StringUtils.isNoneBlank(time_to)){
+						condition += " and t2.operation_time between '"+time_from +"' and '"+time_to+"'";
+					}
+					
+				}else if("就诊类型".equals(str)){//"就诊类型":{"visit_type":"门诊"}
+					
+				}
+			}
+			
+			resultSql = resultSql.replace("$condition$", condition);
+			return resultSql;
+	    }
+}

+ 72 - 0
org.zsl.hnust Maven Webapp/.svn/pristine/6b/6b004fa372c0b0d334fc20a804153a96948a30b5.svn-base

@@ -0,0 +1,72 @@
+package com.synyi.edc.dao;
+
+import java.util.List;
+
+import com.synyi.edc.pojo.Parameter;
+/**
+ * sqlbuilder 语句生成dao
+ * @author wy
+ *
+ */
+public interface ISqlbuilderDao {
+	/**
+	 * 获取所有的医院列表
+	 * @return
+	 */
+    List<Parameter> getAllOrgInfo();
+    /**
+     * 根据检查名称 模糊穷举所有检查名称
+     * @param par 参数传递为 labName
+     * @return
+     */
+    List<Parameter> getAllLabInfo(Parameter par);
+    /**
+     * 获取检验结果,文本结果和数字结果等suggestion列表
+     * @param par
+     * @return
+     */
+    List<Parameter> getSuggestionList(Parameter par);
+    
+    /**
+     * 根据药品名称 模糊穷举所有药品名称
+     * @param par 参数传递为 labName
+     * @return
+     */
+    List<Parameter> getAllDrugInfo(Parameter par);
+    
+    /**
+     * 获取所有的药品大类名称
+     * @return
+     */
+	public List<Parameter> getAllDrugCategory();
+	/**
+	 * 根据药品名称获取模糊匹配的suggestion
+	 * @param param
+	 * @return
+	 */
+	public List<Parameter> getSuggestionByDrug(Parameter param);
+	/**
+	 * 根据药品父节点名称获取子节点药品名称
+	 * @param param
+	 * @return
+	 */
+	public List<Parameter> getChildDrug(Parameter param);
+	/**
+	 * 递归通过子类别将所有父类药品列出来
+	 * @param param
+	 * @return
+	 */
+	public List<Parameter> getParentPath(Parameter param);
+	/**
+	 * 递归通过子类别将所有父类药品列出来并且所有父类的同类列出来
+	 * @param param
+	 * @return
+	 */
+	public List<Parameter> getAllDrugPathInfo(Parameter param);
+	/**
+	 * 模糊匹配获取所有的手术名称
+	 * @param param
+	 * @return
+	 */
+	public List<Parameter> getAllOperationInfo(Parameter param);
+}

+ 32 - 0
org.zsl.hnust Maven Webapp/.svn/pristine/77/7709aa20ce0e631c60e32211c756338700a8cc1a.svn-base

@@ -0,0 +1,32 @@
+sql语句生成接口
+http://172.16.0.217:8080/synyi-service/api/sqlbuilder/generate?eventData=&groupData=&queryType=
+
+获取所有医院列表接口  
+http://172.16.0.217:8080/synyi-service/sqlbuilder/getAllOrg
+
+查询检验名称接口 返回穷举模糊匹配检验名称   POST 形式
+http://172.16.0.217:8080/synyi-service/sqlbuilder/getAlllabInfo?labName=
+
+获取检验结果,文本结果和数字结果等suggestion列表   POST 形式
+http://172.16.0.217:8080/synyi-service/sqlbuilder/getSuggestionList?itemId='1','2','3','4'
+
+查询药品名称接口 返回穷举模糊匹配药品名称   POST 形式
+http://172.16.0.217:8080/synyi-service/sqlbuilder/getAllDrugInfo?drugName=c
+
+查询药品名称所有的大类   POST 形式
+http://172.16.0.217:8080/synyi-service/sqlbuilder/getAllDrugCategory
+
+查询药品名称接口 返回穷举模糊匹配药品名称   POST 形式
+http://172.16.0.217:8080/synyi-service/sqlbuilder/getSuggestionByDrug?drugName=v
+
+根据药品父节点名称获取子节点药品名称   POST 形式
+http://172.16.0.217:8080/synyi-service/sqlbuilder/getChildDrug?drugId=drg000001
+
+递归通过任一药品名称或药品种类将所有父类药品path列出来   POST 形式
+http://172.16.0.217:8080/synyi-service/sqlbuilder/getParentPath?drugId=drg013923
+
+递归通过子类别将所有父类药品列出来并且所有父类的同类列出来   POST 形式
+http://172.16.0.217:8080/synyi-service/sqlbuilder/getAllDrugPathInfo?drugId=drg013923
+
+模糊匹配获取所有的手术名称   POST 形式
+http://172.16.0.217:8080/synyi-service/sqlbuilder/getAllOperationInfo?operationName=1

+ 89 - 0
org.zsl.hnust Maven Webapp/.svn/pristine/79/7992f51fe8ce5850e2dbe9baedd52040e80043ad.svn-base

@@ -0,0 +1,89 @@
+<?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.synyi.edc.dao.ISqlbuilderDao" >
+  <resultMap id="BaseResultMap" type="com.synyi.edc.pojo.Parameter" >
+    <result column="org_code" property="orgCode" jdbcType="VARCHAR" />
+    <result column="org_name" property="orgName" jdbcType="VARCHAR" />
+    <result column="item_id" property="itemId" jdbcType="VARCHAR" />
+    <result column="item_name" property="itemName" jdbcType="VARCHAR" />
+    
+    <result column="test_item_name" property="testItemName" jdbcType="VARCHAR" />
+    <result column="text_value" property="textValue" jdbcType="VARCHAR" />
+    <result column="numerical_value" property="numericalValue" jdbcType="VARCHAR" />
+    <result column="reference_range" property="referenceRange" jdbcType="VARCHAR" />
+    <result column="abnormal_flag_name" property="abnormalFlagName" jdbcType="VARCHAR" />
+    
+    <result column="drug_id" property="drugId" jdbcType="VARCHAR" />
+    <result column="drug_name" property="drugName" jdbcType="VARCHAR" />
+    <result column="parent" property="parent" jdbcType="VARCHAR" />
+    
+    <result column="operation_code" property="operationCode" jdbcType="VARCHAR" />
+    <result column="operation_name" property="operationName" jdbcType="VARCHAR" />
+    
+  </resultMap>
+  <select id="getAllOrgInfo" resultMap="BaseResultMap"  >
+    select 
+    org_code,org_name from mdm.organization
+  </select>
+  <select id="getAllLabInfo" resultMap="BaseResultMap"  parameterType="com.synyi.edc.pojo.Parameter">
+    select item_id,item_name from mdm.lis_item where code_sys_id =197 
+   	<if test="labName != null and labName != ''">
+   		and item_name like '%${labName}%'  
+   	</if>
+  </select>
+  
+  <select id="getSuggestionList" resultMap="BaseResultMap"  parameterType="com.synyi.edc.pojo.Parameter">
+    select distinct c.item_name,text_value,numerical_value,reference_range,abnormal_flag_name from  
+								lab.lab_report_result a join  mdm.mdm_map b on a.test_item_id=b.source_id 
+											 join mdm.lis_item c on  b.map_id=c.item_id 
+		where b.md_type = 'lis_item' and c.code_sys_id =197 
+   	<if test="itemId != null and itemId != ''">
+   		and c.item_id in (${itemId})
+   	</if>
+  </select>
+  
+   <select id="getChildDrug" resultMap="BaseResultMap"  parameterType="com.synyi.edc.pojo.Parameter">
+    select id drug_id,parent, standard_ch drug_name from drug_new where parent = '${drugId}'
+  </select>
+  <select id="getAllDrugInfo" resultMap="BaseResultMap"  parameterType="com.synyi.edc.pojo.Parameter">
+    select drug_id,case when regular_name is null then trade_name else regular_name end drug_name
+  from mdm.drug t where t.code_sys_id = 51  
+   	<if test="drugName != null and drugName != ''">
+   		and (regular_name like '%${drugName}%'  or trade_name like '%${drugName}%')
+   	</if>
+  </select>
+  
+  <select id="getAllOperationInfo" resultMap="BaseResultMap"  parameterType="com.synyi.edc.pojo.Parameter">
+    select distinct operation_code,operation_name from cases.case_operation
+   	<if test="operationName != null and operationName != ''">
+   		where operation_name like '%${operationName}%'
+   	</if>
+  </select>
+  <select id="getSuggestionByDrug" resultMap="BaseResultMap"  parameterType="com.synyi.edc.pojo.Parameter">
+    select id drug_id, standard_ch drug_name from drug_new 
+   	<if test="drugName != null and drugName != ''">
+   		where original_name like '%${drugName}%' or standard_ch like '%${drugName}%'
+   	</if>
+  </select>
+   <select id="getAllDrugCategory" resultMap="BaseResultMap" >
+    select id drug_id,standard_ch drug_name from drug_new where parent = 'drg000001'
+  </select>
+  <select id="getAllDrugPathInfo" resultMap="BaseResultMap"  parameterType="com.synyi.edc.pojo.Parameter">
+  	<foreach collection="strList" item="str" index="idx">
+ 		<if test="idx+1 != strSize">
+ 			select id drug_id,parent,standard_ch drug_name from drug_new where parent = '${str}' union all
+ 		</if>		
+ 		<if test="idx+1 == strSize">
+ 			select id drug_id,parent,standard_ch drug_name from drug_new where parent = '${str}' 
+ 		</if>
+	</foreach>
+  </select>
+  
+  <select id="getParentPath" resultMap="BaseResultMap" >
+    with RECURSIVE  temp1 as (
+	select * from drug_new where id ='${drugId}'
+	union ALL
+	select d.* from drug_new d ,temp1 where temp1.parent=d.id
+	)select id drug_id,parent,standard_ch drug_name from temp1 where id != 'drg000001'
+  </select>
+</mapper>

+ 347 - 0
org.zsl.hnust Maven Webapp/.svn/pristine/8d/8df391cc1a0c5408f07810b5934e1f2083fc904d.svn-base

@@ -0,0 +1,347 @@
+package com.synyi.edc.controller;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import com.alibaba.fastjson.JSONObject;
+import com.synyi.edc.pojo.Parameter;
+import com.synyi.edc.service.ISqlbuilderService;
+import com.synyi.edc.util.SqlBuilderUtils;
+/**
+ * sql语句生成主要contorller
+ * @author wy
+ *
+ */
+@Controller
+@RequestMapping("/sqlbuilder")
+public class SqlbuilderController {
+	private Logger log = Logger.getLogger(SqlbuilderController.class);
+	
+	@Resource
+	private ISqlbuilderService sqlbuilderService;
+	
+	
+	@RequestMapping("/toIndex")
+	public String toJ(HttpServletRequest request,Model model){
+//		int userId = Integer.parseInt(request.getParameter("id"));
+//		User user = this.userService.getUserById(userId);
+//		model.addAttribute("user", user);
+		return "index";
+	}
+	/**
+	 * sql生成方法
+	 * @param request
+	 * @param model
+	 * @param param
+	 * @param res
+	 * @return
+	 */
+	@RequestMapping("/generate")
+	public String generate(HttpServletRequest request,Model model,Parameter param,HttpServletResponse res){
+		log.info("generate方法参数传递:"+param);
+		String jsonStr = param.getEventData();
+    	String stepStr = param.getGroupData();
+    	
+    	String returnSql = SqlBuilderUtils.genGroupSql(jsonStr,stepStr);
+		log.info("生成sql:"+returnSql);
+		
+		printJson(res,returnSql);
+		 return null;
+	}
+	
+	/**
+	 * 打印返回参数
+	 * @param res
+	 * @param str
+	 */
+	public void printJson(HttpServletResponse res,String str){
+		
+		res.setContentType("text/plain");
+		 res.setCharacterEncoding("utf-8");
+		 res.setHeader("Access-Control-Allow-Origin", "*");  
+		 res.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");  
+		 res.setHeader("Access-Control-Max-Age", "3600");  
+		 res.setHeader("Access-Control-Allow-Headers", "x-requested-with");  
+		 PrintWriter pw = null;
+		try {
+			pw = res.getWriter();
+			 pw.write(str);
+		} catch (IOException e) {
+			e.printStackTrace();
+		}finally{
+			 pw.flush();
+			 pw.close();
+		}
+	}
+	/**
+	 * 获取所有的医院列表
+	 * @param request
+	 * @param model
+	 * @param res
+	 * @return
+	 */
+	@RequestMapping("/getAllOrg")
+	public String getAllOrg(HttpServletRequest request,Model model,HttpServletResponse res){
+		
+		List<Parameter> par = sqlbuilderService.getAllOrgInfo();
+		List list = new ArrayList();
+		for(Parameter p:par){
+			Map map1 = new HashMap();
+			map1.put("value", p.getOrgCode());
+			map1.put("label", p.getOrgName());
+			list.add(map1);
+		}
+		log.info("getAllOrg方法返回数据:"+list);
+		String jsonString = JSONObject.toJSON(list).toString();
+		printJson(res,jsonString);
+		return null;
+	}
+	/**
+	 * 模糊匹配获取所有的检查名称
+	 * @param request
+	 * @param model
+	 * @param res
+	 * @param param
+	 * @return
+	 */
+	@RequestMapping("/getAlllabInfo")
+	public String getAllLabInfo(HttpServletRequest request,Model model,HttpServletResponse res,Parameter param){
+		log.info("getAllLabInfo方法参数传递:"+param);
+		List<Parameter> par = sqlbuilderService.getAllLabInfo(param);
+		List list = new ArrayList();
+		for(Parameter p:par){
+			Map map1 = new HashMap();
+			map1.put("value", p.getItemId());
+			map1.put("label", p.getItemName());
+			list.add(map1);
+		}
+		log.info("getAllLabInfo方法返回数据:"+list);
+		String jsonString = JSONObject.toJSON(list).toString();
+		printJson(res,jsonString);
+		return null;
+	}
+	
+	/**
+	 * 获取检验结果,文本结果和数字结果等suggestion列表
+	 * @param request
+	 * @param model
+	 * @param res
+	 * @param param
+	 * @return
+	 */
+	@RequestMapping("/getSuggestionList")
+	public String getSuggestionList(HttpServletRequest request,Model model,HttpServletResponse res,Parameter param){
+		log.info("getSuggestionList方法参数传递:"+param);
+		List<Parameter> par = sqlbuilderService.getSuggestionList(param);
+		List list = new ArrayList();
+		for(Parameter p:par){
+			//c.item_name,text_value,numerical_value,reference_range,abnormal_flag_name
+			Map map1 = new HashMap();
+			map1.put("itemName", p.getItemName());
+			map1.put("textValue", p.getTextValue());
+			map1.put("numericalValue", p.getNumericalValue());
+			map1.put("referenceRange", p.getReferenceRange());
+			map1.put("abnormalFlagName", p.getAbnormalFlagName());
+			list.add(map1);
+		}
+		log.info("getSuggestionList方法返回数据:"+list);
+		String jsonString = JSONObject.toJSON(list).toString();
+		printJson(res,jsonString);
+		return null;
+	}
+	
+	/**
+	 * 模糊匹配获取所有的药品名称
+	 * @param request
+	 * @param model
+	 * @param res
+	 * @param param
+	 * @return
+	 */
+	@RequestMapping("/getAllDrugInfo")
+	public String getAllDrugInfo(HttpServletRequest request,Model model,HttpServletResponse res,Parameter param){
+		log.info("getAllDrugInfo方法参数传递:"+param);
+		List<Parameter> par = sqlbuilderService.getAllDrugInfo(param);
+		List list = new ArrayList();
+		for(Parameter p:par){
+			Map map1 = new HashMap();
+			map1.put("value", p.getDrugId());
+			map1.put("label", p.getDrugName());
+			list.add(map1);
+		}
+		log.info("getAllDrugInfo方法返回数据:"+list);
+		String jsonString = JSONObject.toJSON(list).toString();
+		printJson(res,jsonString);
+		return null;
+	}
+	/**
+	 * 获取所有的药品大类名称
+	 * @param request
+	 * @param model
+	 * @param res
+	 * @param param
+	 * @return
+	 */
+	@RequestMapping("/getAllDrugCategory")
+	public String getAllDrugCategory(HttpServletRequest request,Model model,HttpServletResponse res){
+		
+		List<Parameter> par = sqlbuilderService.getAllDrugCategory();
+		List list = new ArrayList();
+		for(Parameter p:par){
+			Map map1 = new HashMap();
+			map1.put("value", p.getDrugId());
+			map1.put("label", p.getDrugName());
+			list.add(map1);
+		}
+		log.info("getAllDrugCategory方法返回数据:"+list);
+		String jsonString = JSONObject.toJSON(list).toString();
+		printJson(res,jsonString);
+		return null;
+	}
+	/**
+	 * 根据药品名称获取模糊匹配的suggestion
+	 * @param request
+	 * @param model
+	 * @param res
+	 * @param param
+	 * @return
+	 */
+	@RequestMapping("/getSuggestionByDrug")
+	public String getSuggestionByDrug(HttpServletRequest request,Model model,HttpServletResponse res,Parameter param){
+		log.info("getSuggestionByDrug方法参数传递:"+param);
+		List<Parameter> par = sqlbuilderService.getSuggestionByDrug(param);
+		List list = new ArrayList();
+		for(Parameter p:par){
+			Map map1 = new HashMap();
+			map1.put("value", p.getDrugId());
+			map1.put("label", p.getDrugName());
+			list.add(map1);
+		}
+		log.info("getSuggestionByDrug方法返回数据:"+list);
+		String jsonString = JSONObject.toJSON(list).toString();
+		printJson(res,jsonString);
+		return null;
+	}
+	/**
+	 * 根据药品父节点名称获取子节点药品名称
+	 * @param request
+	 * @param model
+	 * @param res
+	 * @param param
+	 * @return
+	 */
+	@RequestMapping("/getChildDrug")
+	public String getChildDrug(HttpServletRequest request,Model model,HttpServletResponse res,Parameter param){
+		log.info("getChildDrug方法参数传递:"+param);
+		List<Parameter> par = sqlbuilderService.getChildDrug(param);
+		List list = new ArrayList();
+		for(Parameter p:par){
+			Map map1 = new HashMap();
+			map1.put("value", p.getDrugId());
+			map1.put("label", p.getDrugName());
+			map1.put("parent", p.getParent());
+			list.add(map1);
+		}
+		log.info("getChildDrug方法返回数据:"+list);
+		String jsonString = JSONObject.toJSON(list).toString();
+		printJson(res,jsonString);
+		return null;
+	}
+	
+	/**
+	 * 递归通过子类别将所有父类药品列出来
+	 * @param request
+	 * @param model
+	 * @param res
+	 * @param param
+	 * @return
+	 */
+	@RequestMapping("/getParentPath")
+	public String getParentPath(HttpServletRequest request,Model model,HttpServletResponse res,Parameter param){
+		log.info("getParentPath方法参数传递:"+param);
+		List<Parameter> par = sqlbuilderService.getParentPath(param);
+		List list = new ArrayList();
+		for(Parameter p:par){
+			Map map1 = new HashMap();
+			map1.put("value", p.getDrugId());
+			map1.put("label", p.getDrugName());
+			map1.put("parent", p.getParent());
+			list.add(map1);
+		}
+		log.info("getParentPath方法返回数据:"+list);
+		String jsonString = JSONObject.toJSON(list).toString();
+		printJson(res,jsonString);
+		return null;
+	}
+	
+	/**
+	 * 递归通过子类别将所有父类药品列出来并且所有父类的同类列出来
+	 * @param request
+	 * @param model
+	 * @param res
+	 * @param param
+	 * @return
+	 */
+	@RequestMapping("/getAllDrugPathInfo")
+	public String getAllDrugPathInfo(HttpServletRequest request,Model model,HttpServletResponse res,Parameter param){
+		log.info("getAllDrugPathInfo方法参数传递:"+param);
+		List<Parameter> par = sqlbuilderService.getParentPath(param);
+		List<String> strList = new ArrayList();
+		for(Parameter p:par){
+			strList.add(p.getDrugId());
+		}
+		param.setStrList(strList);
+		param.setStrSize(strList.size());
+		List<Parameter> pathInfo = sqlbuilderService.getAllDrugPathInfo(param);
+		List list = new ArrayList();
+		for(Parameter p:pathInfo){
+			Map map1 = new HashMap();
+			map1.put("value", p.getDrugId());
+			map1.put("label", p.getDrugName());
+			map1.put("parent", p.getParent());
+			list.add(map1);
+		}
+		log.info("getAllDrugPathInfo方法返回数据:"+list);
+		String jsonString = JSONObject.toJSON(list).toString();
+		printJson(res,jsonString);
+		return null;
+	}
+	/**
+	 * 模糊匹配获取所有的手术名称
+	 * @param request
+	 * @param model
+	 * @param res
+	 * @param param
+	 * @return
+	 */
+	@RequestMapping("/getAllOperationInfo")
+	public String getAllOperationInfo(HttpServletRequest request,Model model,HttpServletResponse res,Parameter param){
+		log.info("getAllOperationInfo方法参数传递:"+param);
+		List<Parameter> par = sqlbuilderService.getAllOperationInfo(param);
+		List list = new ArrayList();
+		for(Parameter p:par){
+			Map map1 = new HashMap();
+			map1.put("value", p.getOperationCode());
+			map1.put("label", p.getOperationName());
+			list.add(map1);
+		}
+		log.info("getAllOperationInfo方法返回数据:"+list);
+		String jsonString = JSONObject.toJSON(list).toString();
+		printJson(res,jsonString);
+		return null;
+	}
+	
+}

+ 180 - 0
org.zsl.hnust Maven Webapp/.svn/pristine/b2/b2e9677ce3d3ec230fb280a86a9da8d50d8cf916.svn-base

@@ -0,0 +1,180 @@
+package com.synyi.edc.pojo;
+
+import java.util.List;
+
+/**
+ * 参数传递和返回对象pojo
+ * @author wy
+ *
+ */
+public class Parameter {
+	
+	private static final long serialVersionUID = 1L;
+//	private String type; //条件类型
+//	private String beginDate;
+//	private String endDate;
+//	private String orgArray;
+//	private String orgType; //三种类型   1  全部医院 2 部分医院 3 某家医院
+	private String labName; //检验名称
+	
+	private String queryType; 
+	
+	private String eventData;
+	private String groupData;
+	
+	private String orgName;//医院名称
+	
+	private String itemId; //检查id
+	private String itemName; //检查名称
+	
+	private String testItemName;
+	private String numericalValue;
+	private String referenceRange;
+	private String abnormalFlagName;
+	private String textValue;
+	private String drugName;
+	private String drugId;
+	private String parent;
+	private List<String> strList;
+	private int strSize;
+	private String operationCode;
+	private String operationName;
+	
+	
+	public String getOperationCode() {
+		return operationCode;
+	}
+	public void setOperationCode(String operationCode) {
+		this.operationCode = operationCode;
+	}
+	public String getOperationName() {
+		return operationName;
+	}
+	public void setOperationName(String operationName) {
+		this.operationName = operationName;
+	}
+	public int getStrSize() {
+		return strSize;
+	}
+	public void setStrSize(int strSize) {
+		this.strSize = strSize;
+	}
+	public List<String> getStrList() {
+		return strList;
+	}
+	public void setStrList(List<String> strList) {
+		this.strList = strList;
+	}
+	public String getParent() {
+		return parent;
+	}
+	public void setParent(String parent) {
+		this.parent = parent;
+	}
+	public String getDrugId() {
+		return drugId;
+	}
+	public void setDrugId(String drugId) {
+		this.drugId = drugId;
+	}
+	public String getDrugName() {
+		return drugName;
+	}
+	public void setDrugName(String drugName) {
+		this.drugName = drugName;
+	}
+	public String getTestItemName() {
+		return testItemName;
+	}
+	public void setTestItemName(String testItemName) {
+		this.testItemName = testItemName;
+	}
+	public String getNumericalValue() {
+		return numericalValue;
+	}
+	public void setNumericalValue(String numericalValue) {
+		this.numericalValue = numericalValue;
+	}
+	public String getReferenceRange() {
+		return referenceRange;
+	}
+	public void setReferenceRange(String referenceRange) {
+		this.referenceRange = referenceRange;
+	}
+	public String getAbnormalFlagName() {
+		return abnormalFlagName;
+	}
+	public void setAbnormalFlagName(String abnormalFlagName) {
+		this.abnormalFlagName = abnormalFlagName;
+	}
+	public String getTextValue() {
+		return textValue;
+	}
+	public void setTextValue(String textValue) {
+		this.textValue = textValue;
+	}
+	public String getItemId() {
+		return itemId;
+	}
+	public void setItemId(String itemId) {
+		this.itemId = itemId;
+	}
+	public String getItemName() {
+		return itemName;
+	}
+	public void setItemName(String itemName) {
+		this.itemName = itemName;
+	}
+	public String getLabName() {
+		return labName;
+	}
+	public void setLabName(String labName) {
+		this.labName = labName;
+	}
+	public String getOrgName() {
+		return orgName;
+	}
+	public void setOrgName(String orgName) {
+		this.orgName = orgName;
+	}
+	public String getOrgCode() {
+		return orgCode;
+	}
+	public void setOrgCode(String orgCode) {
+		this.orgCode = orgCode;
+	}
+	private String orgCode;
+	
+	
+	public String getQueryType() {
+		return queryType;
+	}
+	public void setQueryType(String queryType) {
+		this.queryType = queryType;
+	}
+	public String getEventData() {
+		return eventData;
+	}
+	public void setEventData(String eventData) {
+		this.eventData = eventData;
+	}
+	public String getGroupData() {
+		return groupData;
+	}
+	public void setGroupData(String groupData) {
+		this.groupData = groupData;
+	}
+	@Override
+	public String toString() {
+		return "Parameter [labName=" + labName + ", queryType=" + queryType
+				+ ", eventData=" + eventData + ", groupData=" + groupData
+				+ ", orgName=" + orgName + ", itemName=" + itemName
+				+ ", drugName=" + drugName + ", operationName=" + operationName
+				+ ", orgCode=" + orgCode + "]";
+	}
+	 
+	
+ 
+ 
+
+}

+ 67 - 0
org.zsl.hnust Maven Webapp/.svn/pristine/ea/ea93dc0772f5fc371d855e4559bf3a786a869cd2.svn-base

@@ -0,0 +1,67 @@
+package com.synyi.edc.service;
+
+import java.util.List;
+
+import com.synyi.edc.pojo.Parameter;
+/**
+ * 查询数据库接口
+ * @author wy
+ *
+ */
+public interface ISqlbuilderService {
+	/**
+	 * 获取所有的医院列表
+	 */
+	public List<Parameter> getAllOrgInfo();
+	/**
+	 * 获取检验名称
+	 */
+	public List<Parameter> getAllLabInfo(Parameter labname);
+	/**
+     * 获取检验结果,文本结果和数字结果等suggestion列表
+     * @param par
+     * @return
+     */
+    public List<Parameter> getSuggestionList(Parameter par);
+    /**
+     * 根据药品名称 模糊穷举所有药品名称
+     * @param par 参数传递为 labName
+     * @return
+     */
+    public List<Parameter> getAllDrugInfo(Parameter par);
+    /**
+     * 获取所有的药品大类名称
+     * @return
+     */
+	public List<Parameter> getAllDrugCategory();
+	/**
+	 * 根据药品名称获取模糊匹配的suggestion
+	 * @param param
+	 * @return
+	 */
+	public List<Parameter> getSuggestionByDrug(Parameter param);
+	/**
+	 * 根据药品父节点名称获取子节点药品名称
+	 * @param param
+	 * @return
+	 */
+	public List<Parameter> getChildDrug(Parameter param);
+	/**
+	 * 递归通过子类别将所有父类药品列出来
+	 * @param param
+	 * @return
+	 */
+	public List<Parameter> getParentPath(Parameter param);
+	/**
+	 * 递归通过子类别将所有父类药品列出来并且所有父类的同类列出来
+	 * @param param
+	 * @return
+	 */
+	public List<Parameter> getAllDrugPathInfo(Parameter param);
+	/**
+	 * 模糊匹配获取所有的手术名称
+	 * @param param
+	 * @return
+	 */
+	public List<Parameter> getAllOperationInfo(Parameter param);
+}

二進制
org.zsl.hnust Maven Webapp/.svn/wc.db


+ 45 - 0
org.zsl.hnust Maven Webapp/logs/ssm.log

@@ -4056,3 +4056,48 @@ Caused by: java.lang.IllegalArgumentException: Mapped Statements collection alre
 [INFO] [2018-08-08 15:44:37][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/toIndex.*] onto handler 'sqlbuilderController'
 [INFO] [2018-08-08 15:44:37][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/toIndex/] onto handler 'sqlbuilderController'
 [INFO] [2018-08-08 15:44:37][org.springframework.web.servlet.DispatcherServlet]FrameworkServlet 'SpringMVC': initialization completed in 432 ms
+[INFO] [2018-08-09 10:39:46][org.springframework.web.context.ContextLoader]Root WebApplicationContext: initialization started
+[INFO] [2018-08-09 10:39:46][org.springframework.web.context.support.XmlWebApplicationContext]Refreshing Root WebApplicationContext: startup date [Thu Aug 09 10:39:46 CST 2018]; root of context hierarchy
+[INFO] [2018-08-09 10:39:46][org.springframework.beans.factory.xml.XmlBeanDefinitionReader]Loading XML bean definitions from class path resource [spring-mybatis.xml]
+[INFO] [2018-08-09 10:39:47][org.springframework.beans.factory.config.PropertyPlaceholderConfigurer]Loading properties file from class path resource [jdbc.properties]
+[INFO] [2018-08-09 10:39:47][org.springframework.web.context.ContextLoader]Root WebApplicationContext: initialization completed in 1543 ms
+[INFO] [2018-08-09 10:39:47][org.springframework.web.servlet.DispatcherServlet]FrameworkServlet 'SpringMVC': initialization started
+[INFO] [2018-08-09 10:39:47][org.springframework.web.context.support.XmlWebApplicationContext]Refreshing WebApplicationContext for namespace 'SpringMVC-servlet': startup date [Thu Aug 09 10:39:47 CST 2018]; parent: Root WebApplicationContext
+[INFO] [2018-08-09 10:39:47][org.springframework.beans.factory.xml.XmlBeanDefinitionReader]Loading XML bean definitions from class path resource [spring-mvc.xml]
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/generate] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/generate.*] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/generate/] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/toIndex] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/toIndex.*] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/toIndex/] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getChildDrug] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getChildDrug.*] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getChildDrug/] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getAllOrg] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getAllOrg.*] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getAllOrg/] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getAllDrugInfo] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getAllDrugInfo.*] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getAllDrugInfo/] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getSuggestionList] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getSuggestionList.*] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getSuggestionList/] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getAllDrugCategory] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getAllDrugCategory.*] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getAllDrugCategory/] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getAlllabInfo] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getAlllabInfo.*] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getAlllabInfo/] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getAllDrugPathInfo] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getAllDrugPathInfo.*] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getAllDrugPathInfo/] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getAllOperationInfo] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getAllOperationInfo.*] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getAllOperationInfo/] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getSuggestionByDrug] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getSuggestionByDrug.*] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getSuggestionByDrug/] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getParentPath] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getParentPath.*] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping]Mapped URL path [/sqlbuilder/getParentPath/] onto handler 'sqlbuilderController'
+[INFO] [2018-08-09 10:39:48][org.springframework.web.servlet.DispatcherServlet]FrameworkServlet 'SpringMVC': initialization completed in 792 ms

+ 41 - 16
org.zsl.hnust Maven Webapp/src/main/java/com/synyi/edc/controller/SqlbuilderController.java

@@ -51,7 +51,7 @@ public class SqlbuilderController {
 	 */
 	@RequestMapping("/generate")
 	public String generate(HttpServletRequest request,Model model,Parameter param,HttpServletResponse res){
-		log.info("参数传递:"+param);
+		log.info("generate方法参数传递:"+param);
 		String jsonStr = param.getEventData();
     	String stepStr = param.getGroupData();
     	
@@ -104,7 +104,7 @@ public class SqlbuilderController {
 			map1.put("label", p.getOrgName());
 			list.add(map1);
 		}
-		
+		log.info("getAllOrg方法返回数据:"+list);
 		String jsonString = JSONObject.toJSON(list).toString();
 		printJson(res,jsonString);
 		return null;
@@ -119,7 +119,7 @@ public class SqlbuilderController {
 	 */
 	@RequestMapping("/getAlllabInfo")
 	public String getAllLabInfo(HttpServletRequest request,Model model,HttpServletResponse res,Parameter param){
-		
+		log.info("getAllLabInfo方法参数传递:"+param);
 		List<Parameter> par = sqlbuilderService.getAllLabInfo(param);
 		List list = new ArrayList();
 		for(Parameter p:par){
@@ -128,7 +128,7 @@ public class SqlbuilderController {
 			map1.put("label", p.getItemName());
 			list.add(map1);
 		}
-		
+		log.info("getAllLabInfo方法返回数据:"+list);
 		String jsonString = JSONObject.toJSON(list).toString();
 		printJson(res,jsonString);
 		return null;
@@ -144,7 +144,7 @@ public class SqlbuilderController {
 	 */
 	@RequestMapping("/getSuggestionList")
 	public String getSuggestionList(HttpServletRequest request,Model model,HttpServletResponse res,Parameter param){
-		
+		log.info("getSuggestionList方法参数传递:"+param);
 		List<Parameter> par = sqlbuilderService.getSuggestionList(param);
 		List list = new ArrayList();
 		for(Parameter p:par){
@@ -157,7 +157,7 @@ public class SqlbuilderController {
 			map1.put("abnormalFlagName", p.getAbnormalFlagName());
 			list.add(map1);
 		}
-		
+		log.info("getSuggestionList方法返回数据:"+list);
 		String jsonString = JSONObject.toJSON(list).toString();
 		printJson(res,jsonString);
 		return null;
@@ -173,7 +173,7 @@ public class SqlbuilderController {
 	 */
 	@RequestMapping("/getAllDrugInfo")
 	public String getAllDrugInfo(HttpServletRequest request,Model model,HttpServletResponse res,Parameter param){
-		
+		log.info("getAllDrugInfo方法参数传递:"+param);
 		List<Parameter> par = sqlbuilderService.getAllDrugInfo(param);
 		List list = new ArrayList();
 		for(Parameter p:par){
@@ -182,7 +182,7 @@ public class SqlbuilderController {
 			map1.put("label", p.getDrugName());
 			list.add(map1);
 		}
-		
+		log.info("getAllDrugInfo方法返回数据:"+list);
 		String jsonString = JSONObject.toJSON(list).toString();
 		printJson(res,jsonString);
 		return null;
@@ -206,7 +206,7 @@ public class SqlbuilderController {
 			map1.put("label", p.getDrugName());
 			list.add(map1);
 		}
-		
+		log.info("getAllDrugCategory方法返回数据:"+list);
 		String jsonString = JSONObject.toJSON(list).toString();
 		printJson(res,jsonString);
 		return null;
@@ -221,7 +221,7 @@ public class SqlbuilderController {
 	 */
 	@RequestMapping("/getSuggestionByDrug")
 	public String getSuggestionByDrug(HttpServletRequest request,Model model,HttpServletResponse res,Parameter param){
-		
+		log.info("getSuggestionByDrug方法参数传递:"+param);
 		List<Parameter> par = sqlbuilderService.getSuggestionByDrug(param);
 		List list = new ArrayList();
 		for(Parameter p:par){
@@ -230,7 +230,7 @@ public class SqlbuilderController {
 			map1.put("label", p.getDrugName());
 			list.add(map1);
 		}
-		
+		log.info("getSuggestionByDrug方法返回数据:"+list);
 		String jsonString = JSONObject.toJSON(list).toString();
 		printJson(res,jsonString);
 		return null;
@@ -245,7 +245,7 @@ public class SqlbuilderController {
 	 */
 	@RequestMapping("/getChildDrug")
 	public String getChildDrug(HttpServletRequest request,Model model,HttpServletResponse res,Parameter param){
-		
+		log.info("getChildDrug方法参数传递:"+param);
 		List<Parameter> par = sqlbuilderService.getChildDrug(param);
 		List list = new ArrayList();
 		for(Parameter p:par){
@@ -255,7 +255,7 @@ public class SqlbuilderController {
 			map1.put("parent", p.getParent());
 			list.add(map1);
 		}
-		
+		log.info("getChildDrug方法返回数据:"+list);
 		String jsonString = JSONObject.toJSON(list).toString();
 		printJson(res,jsonString);
 		return null;
@@ -271,7 +271,7 @@ public class SqlbuilderController {
 	 */
 	@RequestMapping("/getParentPath")
 	public String getParentPath(HttpServletRequest request,Model model,HttpServletResponse res,Parameter param){
-		
+		log.info("getParentPath方法参数传递:"+param);
 		List<Parameter> par = sqlbuilderService.getParentPath(param);
 		List list = new ArrayList();
 		for(Parameter p:par){
@@ -281,7 +281,7 @@ public class SqlbuilderController {
 			map1.put("parent", p.getParent());
 			list.add(map1);
 		}
-		
+		log.info("getParentPath方法返回数据:"+list);
 		String jsonString = JSONObject.toJSON(list).toString();
 		printJson(res,jsonString);
 		return null;
@@ -297,7 +297,7 @@ public class SqlbuilderController {
 	 */
 	@RequestMapping("/getAllDrugPathInfo")
 	public String getAllDrugPathInfo(HttpServletRequest request,Model model,HttpServletResponse res,Parameter param){
-		
+		log.info("getAllDrugPathInfo方法参数传递:"+param);
 		List<Parameter> par = sqlbuilderService.getParentPath(param);
 		List<String> strList = new ArrayList();
 		for(Parameter p:par){
@@ -314,6 +314,31 @@ public class SqlbuilderController {
 			map1.put("parent", p.getParent());
 			list.add(map1);
 		}
+		log.info("getAllDrugPathInfo方法返回数据:"+list);
+		String jsonString = JSONObject.toJSON(list).toString();
+		printJson(res,jsonString);
+		return null;
+	}
+	/**
+	 * 模糊匹配获取所有的手术名称
+	 * @param request
+	 * @param model
+	 * @param res
+	 * @param param
+	 * @return
+	 */
+	@RequestMapping("/getAllOperationInfo")
+	public String getAllOperationInfo(HttpServletRequest request,Model model,HttpServletResponse res,Parameter param){
+		log.info("getAllOperationInfo方法参数传递:"+param);
+		List<Parameter> par = sqlbuilderService.getAllOperationInfo(param);
+		List list = new ArrayList();
+		for(Parameter p:par){
+			Map map1 = new HashMap();
+			map1.put("value", p.getOperationCode());
+			map1.put("label", p.getOperationName());
+			list.add(map1);
+		}
+		log.info("getAllOperationInfo方法返回数据:"+list);
 		String jsonString = JSONObject.toJSON(list).toString();
 		printJson(res,jsonString);
 		return null;

+ 6 - 0
org.zsl.hnust Maven Webapp/src/main/java/com/synyi/edc/dao/ISqlbuilderDao.java

@@ -63,4 +63,10 @@ public interface ISqlbuilderDao {
 	 * @return
 	 */
 	public List<Parameter> getAllDrugPathInfo(Parameter param);
+	/**
+	 * 模糊匹配获取所有的手术名称
+	 * @param param
+	 * @return
+	 */
+	public List<Parameter> getAllOperationInfo(Parameter param);
 }

+ 20 - 2
org.zsl.hnust Maven Webapp/src/main/java/com/synyi/edc/pojo/Parameter.java

@@ -37,8 +37,22 @@ public class Parameter {
 	private String parent;
 	private List<String> strList;
 	private int strSize;
+	private String operationCode;
+	private String operationName;
 	
 	
+	public String getOperationCode() {
+		return operationCode;
+	}
+	public void setOperationCode(String operationCode) {
+		this.operationCode = operationCode;
+	}
+	public String getOperationName() {
+		return operationName;
+	}
+	public void setOperationName(String operationName) {
+		this.operationName = operationName;
+	}
 	public int getStrSize() {
 		return strSize;
 	}
@@ -152,9 +166,13 @@ public class Parameter {
 	}
 	@Override
 	public String toString() {
-		return "Parameter [queryType=" + queryType + ", eventData=" + eventData
-				+ ", groupData=" + groupData + "]";
+		return "Parameter [labName=" + labName + ", queryType=" + queryType
+				+ ", eventData=" + eventData + ", groupData=" + groupData
+				+ ", orgName=" + orgName + ", itemName=" + itemName
+				+ ", drugName=" + drugName + ", operationName=" + operationName
+				+ ", orgCode=" + orgCode + "]";
 	}
+	 
 	
  
  

+ 6 - 0
org.zsl.hnust Maven Webapp/src/main/java/com/synyi/edc/service/ISqlbuilderService.java

@@ -58,4 +58,10 @@ public interface ISqlbuilderService {
 	 * @return
 	 */
 	public List<Parameter> getAllDrugPathInfo(Parameter param);
+	/**
+	 * 模糊匹配获取所有的手术名称
+	 * @param param
+	 * @return
+	 */
+	public List<Parameter> getAllOperationInfo(Parameter param);
 }

+ 8 - 0
org.zsl.hnust Maven Webapp/src/main/java/com/synyi/edc/service/impl/SqlbuilderServiceImpl.java

@@ -91,4 +91,12 @@ public class SqlbuilderServiceImpl implements ISqlbuilderService {
 	public List<Parameter> getAllDrugPathInfo(Parameter param){
 		return this.dao.getAllDrugPathInfo(param);
 	}
+	/**
+	 * 模糊匹配获取所有的手术名称
+	 * @param param
+	 * @return
+	 */
+	public List<Parameter> getAllOperationInfo(Parameter param){
+		return this.dao.getAllOperationInfo(param);
+	}
 }

+ 76 - 2
org.zsl.hnust Maven Webapp/src/main/java/com/synyi/edc/util/SqlBuilderUtils.java

@@ -55,7 +55,7 @@ public class SqlBuilderUtils {
 			case "diagnosis":returnSql = "with temp1 as ("+event_diagnose(temp1,stepMap)+")";break;
 			case "laboratoryExamination":returnSql = "with temp1 as ("+event_lab(temp1,stepMap)+")";break;
 			case "drugUse":returnSql = "with temp1 as ("+event_drug(temp1,stepMap)+")";break;
-			case "operation":returnSql = "with temp1 as ("+event_lab(temp1,stepMap)+")";break;
+			case "operation":returnSql = "with temp1 as ("+event_operation(temp1,stepMap)+")";break;
 		}
 		
 		
@@ -64,7 +64,7 @@ public class SqlBuilderUtils {
 				case "diagnosis":returnSql += ", <br/> temp2 as ("+event_diagnose(temp2,stepMap)+")";break;
 				case "laboratoryExamination":returnSql += ", <br/> temp2 as ("+event_lab(temp2,stepMap)+")";break;
 				case "drugUse":returnSql += ", <br/> temp2 as ("+event_drug(temp2,stepMap)+")";break;
-				case "operation":returnSql += ", <br/> temp2 as ("+event_lab(temp2,stepMap)+")";break;
+				case "operation":returnSql += ", <br/> temp2 as ("+event_operation(temp2,stepMap)+")";break;
 			}
 			
 			String rel = (String)temp2.get("关系");
@@ -584,4 +584,78 @@ public class SqlBuilderUtils {
 			
 			return returnSql;
 	    }
+	  public static String event_operation(Map<String,Map> temp1,Map groupMap){
+			String resultSql = "";
+			String condition = "";
+			//String eventType = "";
+			
+			for(String str:temp1.keySet()){
+				if("事件".equals(str)){  //"事件":{"diag_standard":"I21,I22,I23","event_type":"诊断"}
+					Map temp = temp1.get(str);
+						resultSql += " select t1.patient_id";
+								String groupType = groupMap.get("groupType")==null?"":(String)groupMap.get("groupType");
+								if(StringUtils.isNotBlank(groupType)){//"{\"groupType\":\"医院\",\"interval\":\"\",\"maxValue\":\"\",\"minValue\":\"\"}";
+									switch(groupType){
+										case "年龄段":resultSql += ",t2.operation_time event_time";break;
+										case "年份":resultSql += ",t2.operation_time event_time";break;
+										case "医院":resultSql += ",t2.org_code";break;
+										case "就诊类型":resultSql += ",'住院' visit_type";break;
+										case "性别":resultSql += "";break;
+									}
+								}
+								
+								resultSql += " from cases.case_base t1 join cases.case_operation t2 on t1.case_id=t2.case_id " ;
+								
+								resultSql += "where 1=1 $condition$  <br/> ";
+						
+			//{\"lab_standard\":[\"220\",\"230\"],\"character_result\":[\"偏高\",\"异常\"],\"exception_symbol\":[\"1\",\"2\"],\"number_result\":[\">=1\"],\"event_type\":\"lab\"}
+						List<String> opeartion_standard = (List)temp.get("opeartion_standard");
+						if(opeartion_standard!=null&&opeartion_standard.size()>0){
+							resultSql += " and t2.operation_code in (";
+							String tempLab = "";
+							for(String lab:opeartion_standard){
+								tempLab += "'"+lab+"',";
+							}
+							resultSql += tempLab.substring(0,tempLab.length()-1)+")";
+						}
+					//}
+				}else if("医院".equals(str)){ //"医院":{"org_code":"9983838x,111999441,2224589985,112445580"}
+					Map temp = temp1.get(str);
+					try{
+						List<String> org_list = (List)temp.get("org_code");
+						if(!CollectionUtils.isEmpty(org_list)){
+							if(org_list.size()>1){
+								for(int i = 0;i<org_list.size();i++){
+									String org_code = org_list.get(i);
+									if(i==0){
+										condition += " and  t2.org_code in ('"+org_code+"',";
+									}else if(i==org_list.size()-1){
+										condition += "'"+org_code+"')";
+									}else{
+										condition += "'"+org_code+"',";
+									}
+								}
+							}else{
+								condition += " and t2.org_code = '"+org_list.get(0)+"'";
+							}
+						}
+					}catch(java.lang.ClassCastException e){}
+					
+				}else if("时间".equals(str)){//"时间":{"time_from":"绝对时间:2017-01-01","time_to":"绝对时间:2017-01-10","time_type":"诊断时间"}
+					Map temp = temp1.get(str);
+					String time_from = (String)temp.get("time_from");
+					String time_to = (String)temp.get("time_to");
+					condition += " <br/> ";
+					if(StringUtils.isNoneBlank(time_from)&&StringUtils.isNoneBlank(time_to)){
+						condition += " and t2.operation_time between '"+time_from +"' and '"+time_to+"'";
+					}
+					
+				}else if("就诊类型".equals(str)){//"就诊类型":{"visit_type":"门诊"}
+					
+				}
+			}
+			
+			resultSql = resultSql.replace("$condition$", condition);
+			return resultSql;
+	    }
 }

+ 9 - 0
org.zsl.hnust Maven Webapp/src/main/resources/mapping/SqlbuilderMapper.xml

@@ -17,6 +17,9 @@
     <result column="drug_name" property="drugName" jdbcType="VARCHAR" />
     <result column="parent" property="parent" jdbcType="VARCHAR" />
     
+    <result column="operation_code" property="operationCode" jdbcType="VARCHAR" />
+    <result column="operation_name" property="operationName" jdbcType="VARCHAR" />
+    
   </resultMap>
   <select id="getAllOrgInfo" resultMap="BaseResultMap"  >
     select 
@@ -50,6 +53,12 @@
    	</if>
   </select>
   
+  <select id="getAllOperationInfo" resultMap="BaseResultMap"  parameterType="com.synyi.edc.pojo.Parameter">
+    select distinct operation_code,operation_name from cases.case_operation
+   	<if test="operationName != null and operationName != ''">
+   		where operation_name like '%${operationName}%'
+   	</if>
+  </select>
   <select id="getSuggestionByDrug" resultMap="BaseResultMap"  parameterType="com.synyi.edc.pojo.Parameter">
     select id drug_id, standard_ch drug_name from drug_new 
    	<if test="drugName != null and drugName != ''">

+ 3 - 0
org.zsl.hnust Maven Webapp/src/main/resources/接口列表.txt

@@ -27,3 +27,6 @@ http://172.16.0.217:8080/synyi-service/sqlbuilder/getParentPath?drugId=drg013923
 
 递归通过子类别将所有父类药品列出来并且所有父类的同类列出来   POST 形式
 http://172.16.0.217:8080/synyi-service/sqlbuilder/getAllDrugPathInfo?drugId=drg013923
+
+模糊匹配获取所有的手术名称   POST 形式
+http://172.16.0.217:8080/synyi-service/sqlbuilder/getAllOperationInfo?operationName=1

File diff suppressed because it is too large
+ 92 - 8
org.zsl.hnust Maven Webapp/src/test/java/Test.java


二進制
org.zsl.hnust Maven Webapp/target/classes/com/synyi/edc/controller/SqlbuilderController.class


二進制
org.zsl.hnust Maven Webapp/target/classes/com/synyi/edc/dao/ISqlbuilderDao.class


二進制
org.zsl.hnust Maven Webapp/target/classes/com/synyi/edc/pojo/Parameter.class


二進制
org.zsl.hnust Maven Webapp/target/classes/com/synyi/edc/service/ISqlbuilderService.class


二進制
org.zsl.hnust Maven Webapp/target/classes/com/synyi/edc/service/impl/SqlbuilderServiceImpl.class


二進制
org.zsl.hnust Maven Webapp/target/classes/com/synyi/edc/util/SqlBuilderUtils.class


+ 9 - 0
org.zsl.hnust Maven Webapp/target/classes/mapping/SqlbuilderMapper.xml

@@ -17,6 +17,9 @@
     <result column="drug_name" property="drugName" jdbcType="VARCHAR" />
     <result column="parent" property="parent" jdbcType="VARCHAR" />
     
+    <result column="operation_code" property="operationCode" jdbcType="VARCHAR" />
+    <result column="operation_name" property="operationName" jdbcType="VARCHAR" />
+    
   </resultMap>
   <select id="getAllOrgInfo" resultMap="BaseResultMap"  >
     select 
@@ -50,6 +53,12 @@
    	</if>
   </select>
   
+  <select id="getAllOperationInfo" resultMap="BaseResultMap"  parameterType="com.synyi.edc.pojo.Parameter">
+    select distinct operation_code,operation_name from cases.case_operation
+   	<if test="operationName != null and operationName != ''">
+   		where operation_name like '%${operationName}%'
+   	</if>
+  </select>
   <select id="getSuggestionByDrug" resultMap="BaseResultMap"  parameterType="com.synyi.edc.pojo.Parameter">
     select id drug_id, standard_ch drug_name from drug_new 
    	<if test="drugName != null and drugName != ''">

+ 3 - 0
org.zsl.hnust Maven Webapp/target/classes/接口列表.txt

@@ -27,3 +27,6 @@ http://172.16.0.217:8080/synyi-service/sqlbuilder/getParentPath?drugId=drg013923
 
 递归通过子类别将所有父类药品列出来并且所有父类的同类列出来   POST 形式
 http://172.16.0.217:8080/synyi-service/sqlbuilder/getAllDrugPathInfo?drugId=drg013923
+
+模糊匹配获取所有的手术名称   POST 形式
+http://172.16.0.217:8080/synyi-service/sqlbuilder/getAllOperationInfo?operationName=1

+ 1 - 1
org.zsl.hnust Maven Webapp/target/m2e-jee/web-resources/META-INF/maven/com.synyi.edc/synyi-service/pom.properties

@@ -1,5 +1,5 @@
 #Generated by Maven Integration for Eclipse
-#Wed Aug 08 15:45:05 CST 2018
+#Thu Aug 09 11:13:26 CST 2018
 version=1.0
 groupId=com.synyi.edc
 m2e.projectName=synyi-service

+ 1 - 1
org.zsl.hnust Maven Webapp/target/maven-archiver/pom.properties

@@ -1,5 +1,5 @@
 #Generated by Maven
-#Wed Aug 08 15:20:41 CST 2018
+#Thu Aug 09 11:02:13 CST 2018
 version=1.0
 groupId=com.synyi.edc
 artifactId=synyi-service

File diff suppressed because it is too large
+ 3 - 3
org.zsl.hnust Maven Webapp/target/surefire-reports/TEST-Test.xml


File diff suppressed because it is too large
+ 2 - 2
org.zsl.hnust Maven Webapp/target/surefire-reports/TEST-org.zsl.testmybatis.Test.xml


+ 1 - 1
org.zsl.hnust Maven Webapp/target/surefire-reports/Test.txt

@@ -1,4 +1,4 @@
 -------------------------------------------------------------------------------
 Test set: Test
 -------------------------------------------------------------------------------
-Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec
+Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec

+ 1 - 1
org.zsl.hnust Maven Webapp/target/surefire-reports/org.zsl.testmybatis.Test.txt

@@ -1,4 +1,4 @@
 -------------------------------------------------------------------------------
 Test set: org.zsl.testmybatis.Test
 -------------------------------------------------------------------------------
-Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec
+Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec

二進制
org.zsl.hnust Maven Webapp/target/synyi-service.war


二進制
org.zsl.hnust Maven Webapp/target/synyi-service/WEB-INF/classes/com/synyi/edc/controller/SqlbuilderController.class


二進制
org.zsl.hnust Maven Webapp/target/synyi-service/WEB-INF/classes/com/synyi/edc/dao/ISqlbuilderDao.class


二進制
org.zsl.hnust Maven Webapp/target/synyi-service/WEB-INF/classes/com/synyi/edc/pojo/Parameter.class


二進制
org.zsl.hnust Maven Webapp/target/synyi-service/WEB-INF/classes/com/synyi/edc/service/ISqlbuilderService.class


二進制
org.zsl.hnust Maven Webapp/target/synyi-service/WEB-INF/classes/com/synyi/edc/service/impl/SqlbuilderServiceImpl.class


二進制
org.zsl.hnust Maven Webapp/target/synyi-service/WEB-INF/classes/com/synyi/edc/util/SqlBuilderUtils.class


+ 9 - 0
org.zsl.hnust Maven Webapp/target/synyi-service/WEB-INF/classes/mapping/SqlbuilderMapper.xml

@@ -17,6 +17,9 @@
     <result column="drug_name" property="drugName" jdbcType="VARCHAR" />
     <result column="parent" property="parent" jdbcType="VARCHAR" />
     
+    <result column="operation_code" property="operationCode" jdbcType="VARCHAR" />
+    <result column="operation_name" property="operationName" jdbcType="VARCHAR" />
+    
   </resultMap>
   <select id="getAllOrgInfo" resultMap="BaseResultMap"  >
     select 
@@ -50,6 +53,12 @@
    	</if>
   </select>
   
+  <select id="getAllOperationInfo" resultMap="BaseResultMap"  parameterType="com.synyi.edc.pojo.Parameter">
+    select distinct operation_code,operation_name from cases.case_operation
+   	<if test="operationName != null and operationName != ''">
+   		where operation_name like '%${operationName}%'
+   	</if>
+  </select>
   <select id="getSuggestionByDrug" resultMap="BaseResultMap"  parameterType="com.synyi.edc.pojo.Parameter">
     select id drug_id, standard_ch drug_name from drug_new 
    	<if test="drugName != null and drugName != ''">

+ 3 - 0
org.zsl.hnust Maven Webapp/target/synyi-service/WEB-INF/classes/接口列表.txt

@@ -27,3 +27,6 @@ http://172.16.0.217:8080/synyi-service/sqlbuilder/getParentPath?drugId=drg013923
 
 递归通过子类别将所有父类药品列出来并且所有父类的同类列出来   POST 形式
 http://172.16.0.217:8080/synyi-service/sqlbuilder/getAllDrugPathInfo?drugId=drg013923
+
+模糊匹配获取所有的手术名称   POST 形式
+http://172.16.0.217:8080/synyi-service/sqlbuilder/getAllOperationInfo?operationName=手术

二進制
org.zsl.hnust Maven Webapp/target/test-classes/Test.class


+ 3 - 0
org.zsl.hnust Maven Webapp/target/tomcat/logs/access_log.2018-08-09

@@ -0,0 +1,3 @@
+0:0:0:0:0:0:0:1 - - [09/Aug/2018:10:40:40 +0800] "GET /synyi-service/sqlbuilder/getAllOperationInfo?operationName=???? HTTP/1.1" 200 12 http-bio-8080-exec-1 672
+0:0:0:0:0:0:0:1 - - [09/Aug/2018:10:40:48 +0800] "GET /synyi-service/sqlbuilder/getAllOperationInfo?operationName=1 HTTP/1.1" 200 44 http-bio-8080-exec-3 50
+0:0:0:0:0:0:0:1 - - [09/Aug/2018:10:40:52 +0800] "GET /synyi-service/sqlbuilder/getAllOperationInfo?operationName=2 HTTP/1.1" 200 44 http-bio-8080-exec-4 47