|
@@ -28,10 +28,7 @@ import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
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.util.*;
|
|
|
|
|
@@ -53,7 +50,8 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
|
private ScaleRepository scaleRepository;
|
|
|
@Autowired
|
|
|
private KnowledgeMapper knowledgeMapper;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private BiRepository biRepository;
|
|
|
private List<BaseNode> baseNodes;
|
|
|
private String user = "teamdata";
|
|
|
private String password = "jiO2rfnYhg";
|
|
@@ -399,7 +397,7 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
|
List<String> bigdataDiagList = new LinkedList<>();//大数据诊断
|
|
|
if (bigdataDiagFeature.size() > 0) {
|
|
|
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());
|
|
|
} else if (fe.getDesc() == null) {
|
|
|
bigdataDiagList.add(fe.getFeatureName());
|
|
@@ -1443,7 +1441,7 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
|
if(StringUtils.isNotEmpty(disName)){
|
|
|
diseaseRepository.mergeDis(disName,disId,0);
|
|
|
}else {
|
|
|
- respDTO = RespDTO.onError("在数据库中没有找到"+disId+"对应的疾病!!");
|
|
|
+ respDTO = RespDTO.onError("在数据库中没有找到这个疾病!!");
|
|
|
}
|
|
|
|
|
|
//获取每个诊断依据的全部数据
|
|
@@ -1465,8 +1463,8 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
|
Statement st = null;
|
|
|
ResultSet rs = null;
|
|
|
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();
|
|
|
rs = st.executeQuery(sql);
|
|
|
while (rs.next()){
|
|
@@ -1475,6 +1473,7 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
|
code = rs.getString("code");
|
|
|
standard = rs.getString("standard");
|
|
|
relation = rs.getString("relation");
|
|
|
+ unique_name = rs.getString("unique_name");
|
|
|
result = rs.getString("result");
|
|
|
formula = rs.getString("formula");
|
|
|
name = Type.getName(Integer.parseInt(type));
|
|
@@ -1483,6 +1482,7 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
|
content.put("code",code);
|
|
|
content.put("standard",standard);
|
|
|
content.put("relation",relation);
|
|
|
+ content.put("unique_name",unique_name);
|
|
|
content.put("result",result);
|
|
|
content.put("formula",formula);
|
|
|
contentList.add(content);
|
|
@@ -1706,6 +1706,15 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
|
}else if(ni.contains("任七")){
|
|
|
path = 7;
|
|
|
rel = "任七";
|
|
|
+ }else if(ni.contains("任八")){
|
|
|
+ path = 8;
|
|
|
+ rel = "任八";
|
|
|
+ }else if(ni.contains("任九")){
|
|
|
+ path = 9;
|
|
|
+ rel = "任九";
|
|
|
+ }else if(ni.contains("任十")){
|
|
|
+ path = 10;
|
|
|
+ rel = "任十";
|
|
|
}else {
|
|
|
path = 1;
|
|
|
rel = "任一";
|
|
@@ -1790,6 +1799,7 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
|
String typeName = row.get("typeName");//类型对应的中文名
|
|
|
String standard = row.get("standard");//标准词
|
|
|
String relation = row.get("relation");//关联词
|
|
|
+ String unique_name = row.get("unique_name");//公表项
|
|
|
String result = row.get("result");//结果
|
|
|
if(StringUtils.isNotEmpty(type)){
|
|
|
String[] split =null;
|
|
@@ -1958,48 +1968,35 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
|
}
|
|
|
} else if("3".equals(type)){ //处理化验
|
|
|
String lis = "";
|
|
|
- //查找化验大项的标准词
|
|
|
- standWord = searchStandWord(standard,type,ciKu);
|
|
|
- if(StringUtils.isNotEmpty(standWord)){
|
|
|
- if(StringUtils.isNotEmpty(relation) && standard.equals(relation)){
|
|
|
- lis = standWord;
|
|
|
- }else if(StringUtils.isNotEmpty(standard) && StringUtils.isEmpty(relation)){
|
|
|
- lis = standWord;
|
|
|
- }else if(StringUtils.isNotEmpty(standard)&& StringUtils.isNotEmpty(relation)&&!standard.equals(relation)){
|
|
|
- type = "subLis";
|
|
|
- if(StringUtils.isNotEmpty(searchStandWord(relation,type,ciKu))){
|
|
|
- //查找化验小项的标准词
|
|
|
- lis = standWord+"--"+searchStandWord(relation,type,ciKu);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //创建公表名
|
|
|
+ if(StringUtils.isNotEmpty(unique_name)){
|
|
|
+ //创建化验公表项
|
|
|
+ diseaseRepository.mergePublicLIS_1(unique_name);
|
|
|
+ //疾病和化验公表项创建推荐关系
|
|
|
+ diseaseRepository.mergeRelationLIS_1(disId,unique_name);
|
|
|
+ lis =standard;
|
|
|
+ //创建大项名
|
|
|
diseaseRepository.mergePublicLIS(lis);
|
|
|
- //疾病推荐化验公表名
|
|
|
+ //疾病推荐化验大项名
|
|
|
diseaseRepository.mergeRelationLIS(disId,lis);
|
|
|
//处理化验结果
|
|
|
- if(StringUtils.isNotEmpty(result)){
|
|
|
+ if(StringUtils.isNotEmpty(result) && StringUtils.isNotEmpty(unique_name)){
|
|
|
lisResultSplit = result.split("、");
|
|
|
if(lisResultSplit != null && lisResultSplit.length>0){
|
|
|
- //化验结果找标准词
|
|
|
for (String lisRs:lisResultSplit) {
|
|
|
if(StringUtils.isNotEmpty(lisRs)){
|
|
|
- lisResult = searchStandWord(lisRs,"resultLis",ciKu);
|
|
|
- if(StringUtils.isNotEmpty(lisResult)){
|
|
|
- //创建化验结果节点
|
|
|
- diseaseRepository.mergeLISRESULT(lisResult);
|
|
|
- //公表名和化验结果创建关系
|
|
|
- diseaseRepository.mergeRelationPublicLIS(lis,lisResult);
|
|
|
- //化验结果和对应的codeCondition创建关系
|
|
|
- diseaseRepository.mergeRelationCondiLisRes(disName+code,lisResult);
|
|
|
- }
|
|
|
-
|
|
|
+ //创建化验结果节点
|
|
|
+ diseaseRepository.mergeLISRESULT(lisRs);
|
|
|
+ //大项和化验结果创建关系
|
|
|
+ diseaseRepository.mergeRelationPublicLIS(lis,lisRs);
|
|
|
+ //化验结果和对应的codeCondition创建关系
|
|
|
+ diseaseRepository.mergeRelationCondiLisRes(disName+code,lisRs);
|
|
|
+ //化验大项和化验公表项创建关系
|
|
|
+// diseaseRepository.mergeRelationPublicAndLIS(lis,unique_name);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
}else if("4".equals(type)){ //辅检
|
|
|
//查找辅检的标准词
|
|
|
standWord = searchStandWord(standard,type,ciKu);
|
|
@@ -2076,7 +2073,7 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
|
connect.close();
|
|
|
respDTO = RespDTO.onSuc(true);
|
|
|
}else {
|
|
|
- respDTO = RespDTO.onError(disId +" 删除失败!!!");
|
|
|
+ respDTO = RespDTO.onError(" 删除失败!!!");
|
|
|
}
|
|
|
} catch (SQLException e) {
|
|
|
e.printStackTrace();
|
|
@@ -2124,6 +2121,7 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
|
if(disList != null && disList.size()>0){
|
|
|
for (Long disId:disList) {
|
|
|
respDTO = this.updateNeo(respDTO, disId, connect, ciKu);
|
|
|
+ this.updateDate(connect,disId);
|
|
|
|
|
|
}
|
|
|
}
|
|
@@ -2134,8 +2132,46 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
|
|
|
|
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+";";
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<BiDetail> neoBi() {
|
|
|
+ List<BiDetail> biDetailList = new ArrayList<>();
|
|
|
+ Long disCount = biRepository.diagnoseCount();
|
|
|
+ Long childCount = biRepository.childCount();
|
|
|
+ Long scaleCount = biRepository.scaleCount();
|
|
|
+ BiDetail dis = new BiDetail();
|
|
|
+ dis.setModuleName("疾病");
|
|
|
+ dis.setItemName("图谱推送的疾病");
|
|
|
+ dis.setCount(disCount);
|
|
|
+ BiDetail child = new BiDetail();
|
|
|
+ child.setModuleName("疾病");
|
|
|
+ child.setItemName("图谱推送的儿科疾病");
|
|
|
+ child.setCount(childCount);
|
|
|
+ BiDetail scale = new BiDetail();
|
|
|
+ scale.setModuleName("量表");
|
|
|
+ scale.setItemName("量表总数");
|
|
|
+ scale.setCount(scaleCount);
|
|
|
+ biDetailList.add(dis);
|
|
|
+ biDetailList.add(child);
|
|
|
+ biDetailList.add(scale);
|
|
|
+ return biDetailList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void updateDate(Connection connection,Long disId) throws SQLException {
|
|
|
+ String sql = "UPDATE `kl_diagnose` set neo_update='1970-01-01 12:00:00' where id=?";
|
|
|
+ PreparedStatement preparedStatement =null;
|
|
|
+ try {
|
|
|
+ connection.setAutoCommit(false);
|
|
|
+ preparedStatement = connection.prepareStatement(sql);
|
|
|
+ preparedStatement.setLong(1,disId);
|
|
|
+ int i = preparedStatement.executeUpdate();
|
|
|
+ connection.commit();
|
|
|
+ } catch (SQLException e) {
|
|
|
+ connection.rollback();
|
|
|
+ e.printStackTrace();
|
|
|
+ }finally {
|
|
|
+ preparedStatement.close();
|
|
|
+ }
|
|
|
}
|
|
|
public List<Long> getDisList(Connection connection){
|
|
|
List<Long> disIds = new ArrayList<>();
|
|
@@ -2214,6 +2250,7 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
public Pageable getPageable(PageVo pageVo) {
|
|
|
if (pageVo.getSize() > 0) {
|
|
|
if (pageVo.getSort_key() != null && pageVo.getSort_direct() != null) {
|