|
@@ -28,10 +28,7 @@ import org.springframework.data.domain.Sort;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
-import java.sql.Connection;
|
|
|
|
-import java.sql.ResultSet;
|
|
|
|
-import java.sql.SQLException;
|
|
|
|
-import java.sql.Statement;
|
|
|
|
|
|
+import java.sql.*;
|
|
import java.text.NumberFormat;
|
|
import java.text.NumberFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
@@ -57,7 +54,7 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
private List<BaseNode> baseNodes;
|
|
private List<BaseNode> baseNodes;
|
|
private String user = "root";
|
|
private String user = "root";
|
|
private String password = "lantone";
|
|
private String password = "lantone";
|
|
- private String url = "jdbc:mysql://192.168.2.241:3306/med?useUnicode=true&characterEncoding=UTF-8";
|
|
|
|
|
|
+ private String url = "jdbc:mysql://192.168.2.236:3306/med?useUnicode=true&characterEncoding=UTF-8";
|
|
private Pageable pageable;
|
|
private Pageable pageable;
|
|
/**
|
|
/**
|
|
* 处理症状节点相关的申请
|
|
* 处理症状节点相关的申请
|
|
@@ -399,7 +396,7 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
List<String> bigdataDiagList = new LinkedList<>();//大数据诊断
|
|
List<String> bigdataDiagList = new LinkedList<>();//大数据诊断
|
|
if (bigdataDiagFeature.size() > 0) {
|
|
if (bigdataDiagFeature.size() > 0) {
|
|
for (FeatureRate fe : bigdataDiagFeature) {
|
|
for (FeatureRate fe : bigdataDiagFeature) {
|
|
- if ("neo4j".equals(fe.getSource()) && fe.getDesc().contains("确诊")) {
|
|
|
|
|
|
+ if ("neo4j".equals(fe.getSource()) && (fe.getDesc().contains("确诊") || fe.getDesc().contains("拟诊"))) {
|
|
neo4jDiagList.add(fe.getFeatureName());
|
|
neo4jDiagList.add(fe.getFeatureName());
|
|
} else if (fe.getDesc() == null) {
|
|
} else if (fe.getDesc() == null) {
|
|
bigdataDiagList.add(fe.getFeatureName());
|
|
bigdataDiagList.add(fe.getFeatureName());
|
|
@@ -1465,8 +1462,8 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
Statement st = null;
|
|
Statement st = null;
|
|
ResultSet rs = null;
|
|
ResultSet rs = null;
|
|
try {
|
|
try {
|
|
- String type, code ,standard,relation,result,formula,name;
|
|
|
|
- String sql = "SELECT diagnose_id,dis_name,`type`,`code`,standard,relation,result,formula FROM `kl_diagnose_detail` where diagnose_id = "+disId+" and is_deleted = 'N'";
|
|
|
|
|
|
+ String type, code ,standard,relation,unique_name,result,formula,name;
|
|
|
|
+ String sql = "SELECT diagnose_id,dis_name,`type`,`code`,standard,relation,unique_name,result,formula FROM `kl_diagnose_detail` where diagnose_id = "+disId+" and is_deleted = 'N'";
|
|
st = connection.createStatement();
|
|
st = connection.createStatement();
|
|
rs = st.executeQuery(sql);
|
|
rs = st.executeQuery(sql);
|
|
while (rs.next()){
|
|
while (rs.next()){
|
|
@@ -1475,6 +1472,7 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
code = rs.getString("code");
|
|
code = rs.getString("code");
|
|
standard = rs.getString("standard");
|
|
standard = rs.getString("standard");
|
|
relation = rs.getString("relation");
|
|
relation = rs.getString("relation");
|
|
|
|
+ unique_name = rs.getString("unique_name");
|
|
result = rs.getString("result");
|
|
result = rs.getString("result");
|
|
formula = rs.getString("formula");
|
|
formula = rs.getString("formula");
|
|
name = Type.getName(Integer.parseInt(type));
|
|
name = Type.getName(Integer.parseInt(type));
|
|
@@ -1483,6 +1481,7 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
content.put("code",code);
|
|
content.put("code",code);
|
|
content.put("standard",standard);
|
|
content.put("standard",standard);
|
|
content.put("relation",relation);
|
|
content.put("relation",relation);
|
|
|
|
+ content.put("unique_name",unique_name);
|
|
content.put("result",result);
|
|
content.put("result",result);
|
|
content.put("formula",formula);
|
|
content.put("formula",formula);
|
|
contentList.add(content);
|
|
contentList.add(content);
|
|
@@ -1569,9 +1568,9 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
ResultSet rs = null;
|
|
ResultSet rs = null;
|
|
try {
|
|
try {
|
|
String tongName, type, isConcept,stand;
|
|
String tongName, type, isConcept,stand;
|
|
- String sql = "SELECT name, type_id,is_concept,IF(is_concept=1,a.name,(select lib_name from kl_concept b where b.id = a.concept_id) ) lib_name \n" +
|
|
|
|
- "from kl_library_info a where a.is_deleted = 'N'\n" +
|
|
|
|
- "and type_id in (1,5,12,13,14,16,17,18,35,70)";
|
|
|
|
|
|
+ String sql = "SELECT a.name,a.type_id,a.is_concept, b.lib_name from kl_library_info a, kl_concept b\n" +
|
|
|
|
+ " where a.is_deleted = 'N' and b.is_deleted = 'N' and a.concept_id = b.id\n" +
|
|
|
|
+ " and a.type_id in (1,5,12,13,14,16,17,18,35,70)";
|
|
st = connection.createStatement();
|
|
st = connection.createStatement();
|
|
rs = st.executeQuery(sql);
|
|
rs = st.executeQuery(sql);
|
|
Map<String,String> detail =null;
|
|
Map<String,String> detail =null;
|
|
@@ -1706,6 +1705,15 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
}else if(ni.contains("任七")){
|
|
}else if(ni.contains("任七")){
|
|
path = 7;
|
|
path = 7;
|
|
rel = "任七";
|
|
rel = "任七";
|
|
|
|
+ }else if(ni.contains("任八")){
|
|
|
|
+ path = 8;
|
|
|
|
+ rel = "任八";
|
|
|
|
+ }else if(ni.contains("任九")){
|
|
|
|
+ path = 9;
|
|
|
|
+ rel = "任九";
|
|
|
|
+ }else if(ni.contains("任十")){
|
|
|
|
+ path = 10;
|
|
|
|
+ rel = "任十";
|
|
}else {
|
|
}else {
|
|
path = 1;
|
|
path = 1;
|
|
rel = "任一";
|
|
rel = "任一";
|
|
@@ -1790,6 +1798,7 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
String typeName = row.get("typeName");//类型对应的中文名
|
|
String typeName = row.get("typeName");//类型对应的中文名
|
|
String standard = row.get("standard");//标准词
|
|
String standard = row.get("standard");//标准词
|
|
String relation = row.get("relation");//关联词
|
|
String relation = row.get("relation");//关联词
|
|
|
|
+ String unique_name = row.get("unique_name");//公表项
|
|
String result = row.get("result");//结果
|
|
String result = row.get("result");//结果
|
|
if(StringUtils.isNotEmpty(type)){
|
|
if(StringUtils.isNotEmpty(type)){
|
|
String[] split =null;
|
|
String[] split =null;
|
|
@@ -1957,9 +1966,22 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else if("3".equals(type)){ //处理化验
|
|
} else if("3".equals(type)){ //处理化验
|
|
- String lis = "";
|
|
|
|
|
|
+ String lis = "";//大项
|
|
|
|
+ if(StringUtils.isNotEmpty(unique_name)){
|
|
|
|
+ //创建化验公表项
|
|
|
|
+ diseaseRepository.mergePublicLIS_1(unique_name);
|
|
|
|
+ //疾病和化验公表项创建推荐关系
|
|
|
|
+ diseaseRepository.mergeRelationLIS_1(disId,unique_name);
|
|
|
|
+ if(StringUtils.isNotEmpty(result)){
|
|
|
|
+ lis = standard;
|
|
|
|
+
|
|
|
|
+ }else {
|
|
|
|
+ lis = unique_name;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
//查找化验大项的标准词
|
|
//查找化验大项的标准词
|
|
- standWord = searchStandWord(standard,type,ciKu);
|
|
|
|
|
|
+ /* standWord = searchStandWord(standard,type,ciKu);
|
|
if(StringUtils.isNotEmpty(standWord)){
|
|
if(StringUtils.isNotEmpty(standWord)){
|
|
if(StringUtils.isNotEmpty(relation) && standard.equals(relation)){
|
|
if(StringUtils.isNotEmpty(relation) && standard.equals(relation)){
|
|
lis = standWord;
|
|
lis = standWord;
|
|
@@ -1971,22 +1993,30 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
//查找化验小项的标准词
|
|
//查找化验小项的标准词
|
|
lis = standWord+"--"+searchStandWord(relation,type,ciKu);
|
|
lis = standWord+"--"+searchStandWord(relation,type,ciKu);
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
+
|
|
|
|
|
|
- //创建公表名
|
|
|
|
|
|
+ //创建大项名
|
|
diseaseRepository.mergePublicLIS(lis);
|
|
diseaseRepository.mergePublicLIS(lis);
|
|
- //疾病推荐化验公表名
|
|
|
|
|
|
+ //疾病推荐化验大项名
|
|
diseaseRepository.mergeRelationLIS(disId,lis);
|
|
diseaseRepository.mergeRelationLIS(disId,lis);
|
|
//处理化验结果
|
|
//处理化验结果
|
|
- if(StringUtils.isNotEmpty(result)){
|
|
|
|
|
|
+ if(StringUtils.isNotEmpty(result) && StringUtils.isNotEmpty(unique_name)){
|
|
lisResultSplit = result.split("、");
|
|
lisResultSplit = result.split("、");
|
|
if(lisResultSplit != null && lisResultSplit.length>0){
|
|
if(lisResultSplit != null && lisResultSplit.length>0){
|
|
//化验结果找标准词
|
|
//化验结果找标准词
|
|
for (String lisRs:lisResultSplit) {
|
|
for (String lisRs:lisResultSplit) {
|
|
if(StringUtils.isNotEmpty(lisRs)){
|
|
if(StringUtils.isNotEmpty(lisRs)){
|
|
- lisResult = searchStandWord(lisRs,"resultLis",ciKu);
|
|
|
|
|
|
+ //创建化验结果节点
|
|
|
|
+ diseaseRepository.mergeLISRESULT(lisRs);
|
|
|
|
+ //大项和化验结果创建关系
|
|
|
|
+ diseaseRepository.mergeRelationPublicLIS(lis,lisRs);
|
|
|
|
+ //化验结果和对应的codeCondition创建关系
|
|
|
|
+ diseaseRepository.mergeRelationCondiLisRes(disName+code,lisRs);
|
|
|
|
+ //化验大项和化验公表项创建关系
|
|
|
|
+ diseaseRepository.mergeRelationPublicAndLIS(lis,unique_name);
|
|
|
|
+ /*lisResult = searchStandWord(lisRs,"resultLis",ciKu);
|
|
if(StringUtils.isNotEmpty(lisResult)){
|
|
if(StringUtils.isNotEmpty(lisResult)){
|
|
//创建化验结果节点
|
|
//创建化验结果节点
|
|
diseaseRepository.mergeLISRESULT(lisResult);
|
|
diseaseRepository.mergeLISRESULT(lisResult);
|
|
@@ -1994,7 +2024,7 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
diseaseRepository.mergeRelationPublicLIS(lis,lisResult);
|
|
diseaseRepository.mergeRelationPublicLIS(lis,lisResult);
|
|
//化验结果和对应的codeCondition创建关系
|
|
//化验结果和对应的codeCondition创建关系
|
|
diseaseRepository.mergeRelationCondiLisRes(disName+code,lisResult);
|
|
diseaseRepository.mergeRelationCondiLisRes(disName+code,lisResult);
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -2124,7 +2154,7 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
if(disList != null && disList.size()>0){
|
|
if(disList != null && disList.size()>0){
|
|
for (Long disId:disList) {
|
|
for (Long disId:disList) {
|
|
respDTO = this.updateNeo(respDTO, disId, connect, ciKu);
|
|
respDTO = this.updateNeo(respDTO, disId, connect, ciKu);
|
|
-
|
|
|
|
|
|
+ this.updateDate(connect,disId);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
connect.close();
|
|
connect.close();
|
|
@@ -2134,8 +2164,16 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
|
|
|
|
return respDTO;
|
|
return respDTO;
|
|
}
|
|
}
|
|
- public void updateDate(Connection connection,Long disId){
|
|
|
|
- String sql = "UPDATE `kl_diagnose` set neo_update='1970-01-01 12:00:00' where id="+disId+";";
|
|
|
|
|
|
+ public void updateDate(Connection connection,Long disId) {
|
|
|
|
+ String sql = "UPDATE `kl_diagnose` set neo_update='1970-01-01 12:00:00' where id=?";
|
|
|
|
+ try {
|
|
|
|
+ PreparedStatement preparedStatement = connection.prepareStatement(sql);
|
|
|
|
+ preparedStatement.setLong(1,disId);
|
|
|
|
+ int i = preparedStatement.executeUpdate();
|
|
|
|
+ preparedStatement.close();
|
|
|
|
+ } catch (SQLException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
public List<Long> getDisList(Connection connection){
|
|
public List<Long> getDisList(Connection connection){
|
|
List<Long> disIds = new ArrayList<>();
|
|
List<Long> disIds = new ArrayList<>();
|