|
@@ -8,9 +8,7 @@ import thyyxxk.webserver.dao.his.dictionary.HisWjwMatchDao;
|
|
|
import thyyxxk.webserver.entity.dictionary.HisWjwMatchEntity;
|
|
|
import thyyxxk.webserver.utils.StringUtil;
|
|
|
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
@Slf4j
|
|
|
@Service
|
|
@@ -24,23 +22,66 @@ public class HisWjwMatchService {
|
|
|
|
|
|
public Map<String, List<HisWjwMatchEntity>> selectMatchableDataByLabel(String label) {
|
|
|
String histable, wjwtable;
|
|
|
- if (label.equals("anaesthesia")) {
|
|
|
- histable = "zd_anaesthesia";
|
|
|
- wjwtable = "t_wjw_anaesthesia";
|
|
|
+ int type;
|
|
|
+ switch (label) {
|
|
|
+ case "department":
|
|
|
+ histable = "zd_unit_code";
|
|
|
+ wjwtable = "t_wjw_dept";
|
|
|
+ type = 1;
|
|
|
+ break;
|
|
|
+ case "anaesthesia":
|
|
|
+ histable = "zd_anaesthesia";
|
|
|
+ wjwtable = "t_wjw_anaesthesia";
|
|
|
+ type = 1;
|
|
|
+ break;
|
|
|
+ case "diagnose":
|
|
|
+ histable = "zd_icd_code_new";
|
|
|
+ wjwtable = "t_si_dl_dss_dns";
|
|
|
+ type = 2;
|
|
|
+ break;
|
|
|
+ case "surgery":
|
|
|
+ default:
|
|
|
+ histable = "zd_icd9_cm3";
|
|
|
+ wjwtable = "t_si_dl_oprtn";
|
|
|
+ type = 3;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ List<HisWjwMatchEntity> hisList;
|
|
|
+ List<HisWjwMatchEntity> wjwList;
|
|
|
+ if (type == 1) {
|
|
|
+ hisList = dao.selectHisData(histable);
|
|
|
+ wjwList = dao.selectWjwData(wjwtable);
|
|
|
} else {
|
|
|
- histable = "zd_unit_code";
|
|
|
- wjwtable = "t_wjw_dept";
|
|
|
+ hisList = dao.selectNationTempData(histable);
|
|
|
+ wjwList = new ArrayList<>();
|
|
|
}
|
|
|
- List<HisWjwMatchEntity> hisList = dao.selectHisData(histable);
|
|
|
- List<HisWjwMatchEntity> wjwList = dao.selectWjwData(wjwtable);
|
|
|
Map<String, List<HisWjwMatchEntity>> result = new HashMap<>();
|
|
|
result.put("hisList", hisList);
|
|
|
result.put("wjwList", wjwList);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ public List<HisWjwMatchEntity> fetchSimilarities(String label, String name, String key) {
|
|
|
+ String table,codeColumn,nameColumn;
|
|
|
+ if (label.equals("diagnose")) {
|
|
|
+ table = "t_si_dl_dss_dns";
|
|
|
+ codeColumn = "diagnosis_code";
|
|
|
+ nameColumn = "diagnosis_name";
|
|
|
+ } else {
|
|
|
+ table = "t_si_dl_oprtn";
|
|
|
+ codeColumn = "surgical_operation_code";
|
|
|
+ nameColumn = "operation_operation_name";
|
|
|
+ }
|
|
|
+ List<HisWjwMatchEntity> list = dao.selectMedInsData(table, codeColumn, nameColumn, key);
|
|
|
+ list.forEach(item -> {
|
|
|
+ item.setSimilarity(StringUtil.getSimilarDegree(name, item.getName()));
|
|
|
+ });
|
|
|
+ list.sort(Comparator.comparingDouble(HisWjwMatchEntity::getSimilarity).reversed());
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
public String executeMatchAction(HisWjwMatchEntity entity) {
|
|
|
- log.info("匹配卫健委字典:{}", JSONObject.toJSONString(entity));
|
|
|
+ log.info("匹配卫健委/国临字典:{}", JSONObject.toJSONString(entity));
|
|
|
dao.executeMatchAction(entity);
|
|
|
return StringUtil.isBlank(entity.getWjwCode()) ? "撤销匹配成功" : "匹配成功";
|
|
|
}
|