|
@ -9,11 +9,10 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.util.*;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
/**
|
|
|
* Created by progr1mmer on 2018/3/13.
|
|
|
* @author progr1mmer
|
|
|
* @date Created on 2018/3/13.
|
|
|
*/
|
|
|
@Service
|
|
|
public class ProfileInspectionService extends ProfileBasicService {
|
|
@ -24,11 +23,15 @@ public class ProfileInspectionService extends ProfileBasicService {
|
|
|
typeMap.put("HDSD00_79", "inspect");
|
|
|
typeMap.put("HDSD00_77", "examine");
|
|
|
Map<String, String> nameMap = new HashMap<>();
|
|
|
nameMap.put("HDSD00_79", "EHR_002883"); //检查名称
|
|
|
nameMap.put("HDSD00_77", "EHR_000352"); //检验项目
|
|
|
//检查名称
|
|
|
nameMap.put("HDSD00_79", "EHR_002883");
|
|
|
//检验项目
|
|
|
nameMap.put("HDSD00_77", "EHR_000352");
|
|
|
Map<String, String> numMap = new HashMap<>();
|
|
|
numMap.put("HDSD00_79", "EHR_000316"); //检查报告单号
|
|
|
numMap.put("HDSD00_77", "EHR_000363"); //检验报告单号
|
|
|
//检查报告单号
|
|
|
numMap.put("HDSD00_79", "EHR_000316");
|
|
|
//检验报告单号
|
|
|
numMap.put("HDSD00_77", "EHR_000363");
|
|
|
for (String dataset : typeMap.keySet()) {
|
|
|
String query = "{\"q\":\"demographic_id:" + demographicId + "\"}";
|
|
|
query = SimpleSolrQueryUtil.getQuery(filter, date, query);
|
|
@ -82,9 +85,11 @@ public class ProfileInspectionService extends ProfileBasicService {
|
|
|
List<Map<String, Object>> subList = subEnvelop.getDetailModelList();
|
|
|
for (int i = 0; i < subList.size(); i ++) {
|
|
|
Map<String, Object> item = subList.get(i);
|
|
|
if (!StringUtils.isEmpty(item.get("EHR_002883"))) { //检查名称
|
|
|
//检查名称
|
|
|
if (!StringUtils.isEmpty(item.get("EHR_002883"))) {
|
|
|
String name = item.get("EHR_002883").toString();
|
|
|
String result = item.get("EHR_000347") == null ? "-" : item.get("EHR_000347").toString(); //影像结论
|
|
|
//影像结论
|
|
|
String result = item.get("EHR_000347") == null ? "-" : item.get("EHR_000347").toString();
|
|
|
if (dataMap.containsKey(name)) {
|
|
|
Integer count = dataMap.get(name);
|
|
|
dataMap.put(name, count + 1);
|
|
@ -104,7 +109,8 @@ public class ProfileInspectionService extends ProfileBasicService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else if (!StringUtils.isEmpty(item.get("EHR_000352"))) { //检验项目
|
|
|
//检验项目
|
|
|
} else if (!StringUtils.isEmpty(item.get("EHR_000352"))) {
|
|
|
String name = item.get("EHR_000352").toString();
|
|
|
if (dataMap.containsKey(name)) {
|
|
|
Integer count = dataMap.get(name);
|
|
@ -151,18 +157,23 @@ public class ProfileInspectionService extends ProfileBasicService {
|
|
|
List<Map<String, Object>> subList = subData.getDetailModelList();
|
|
|
if (subList.size() > 0) {
|
|
|
Map<String, Object> temp = subList.get(0);
|
|
|
String reportNo = temp.get("EHR_000363").toString(); //检验报告单号
|
|
|
//检验报告单号
|
|
|
String reportNo = temp.get("EHR_000363").toString();
|
|
|
subQ = "{\"q\":\"rowkey:" + profileId.split("\\$")[0] + "$HDSD00_75$*" + "\"}";
|
|
|
subData = resource.getSubData(subQ, 1, 1000, null);
|
|
|
List<Map<String, Object>> subItems = subData.getDetailModelList();
|
|
|
subItems.forEach(item -> {
|
|
|
if (reportNo.equals(item.get("EHR_006339"))) { //子项所属的报告单号
|
|
|
//子项所属的报告单号
|
|
|
if (reportNo.equals(item.get("EHR_006339"))) {
|
|
|
//结果值
|
|
|
if (item.get("EHR_000387") != null) {
|
|
|
String result = item.get("EHR_000387").toString(); //结果值
|
|
|
//结果值
|
|
|
String result = item.get("EHR_000387").toString();
|
|
|
if (item.get("EHR_000391") != null && item.get("EHR_000390")!= null) {
|
|
|
String low = item.get("EHR_000391").toString(); //下限
|
|
|
String high = item.get("EHR_000390").toString(); //上限
|
|
|
//下限
|
|
|
String low = item.get("EHR_000391").toString();
|
|
|
//上限
|
|
|
String high = item.get("EHR_000390").toString();
|
|
|
if (NumberValidationUtils.isRealNumber(result) && NumberValidationUtils.isRealNumber(low) && NumberValidationUtils.isRealNumber(high)) {
|
|
|
Double _result = Double.parseDouble(result);
|
|
|
Double _row = Double.parseDouble(low);
|
|
@ -207,21 +218,27 @@ public class ProfileInspectionService extends ProfileBasicService {
|
|
|
Envelop subEnvelop = resource.getSubData(subQ, 1, 1000, null);
|
|
|
List<Map<String, Object>> subList = subEnvelop.getDetailModelList();
|
|
|
for (Map<String, Object> subItem : subList) {
|
|
|
if (name.equals(subItem.get("EHR_000352"))) { //检验项目
|
|
|
String reportNo = subItem.get("EHR_000363").toString(); //检验报告单号
|
|
|
//检验项目
|
|
|
if (name.equals(subItem.get("EHR_000352"))) {
|
|
|
//检验报告单号
|
|
|
String reportNo = subItem.get("EHR_000363").toString();
|
|
|
subQ = "{\"q\":\"rowkey:" + masterItem.get(ResourceCells.ROWKEY) + "$HDSD00_75$*" + "\"}";
|
|
|
subEnvelop = resource.getSubData(subQ, 1, 1000, null);
|
|
|
List<Map<String, Object>> subItems = subEnvelop.getDetailModelList();
|
|
|
subItems.forEach(item -> {
|
|
|
if (reportNo.equals(item.get("EHR_006339"))) { //子项所属的报告单号
|
|
|
String itemName = item.get("EHR_000394").toString(); //子项名称
|
|
|
//子项所属的报告单号
|
|
|
if (reportNo.equals(item.get("EHR_006339"))) {
|
|
|
//子项名称
|
|
|
String itemName = item.get("EHR_000394").toString();
|
|
|
data.add(itemName);
|
|
|
//结果值
|
|
|
if (item.get("EHR_000387") != null) { //结果值
|
|
|
if (item.get("EHR_000387") != null) {
|
|
|
String result = item.get("EHR_000387").toString();
|
|
|
if (item.get("EHR_000391") != null && item.get("EHR_000390")!= null) {
|
|
|
String low = item.get("EHR_000391").toString(); //上限
|
|
|
String high = item.get("EHR_000390").toString(); //下限
|
|
|
//上限
|
|
|
String low = item.get("EHR_000391").toString();
|
|
|
//下限
|
|
|
String high = item.get("EHR_000390").toString();
|
|
|
if (NumberValidationUtils.isRealNumber(result) && NumberValidationUtils.isRealNumber(low) && NumberValidationUtils.isRealNumber(high)) {
|
|
|
Double _result = Double.parseDouble(result);
|
|
|
Double _row = Double.parseDouble(low);
|
|
@ -252,11 +269,14 @@ public class ProfileInspectionService extends ProfileBasicService {
|
|
|
unknownMap.put(itemName, 1);
|
|
|
}
|
|
|
}
|
|
|
} else if (item.get("EHR_000382") != null) { //参考值备注
|
|
|
//参考值备注
|
|
|
} else if (item.get("EHR_000382") != null) {
|
|
|
String range = item.get("EHR_000382").toString();
|
|
|
//上限
|
|
|
if (range.split("-").length == 2) {
|
|
|
String low = range.split("-")[0]; //上限
|
|
|
String high = range.split("-")[1]; //下限
|
|
|
String low = range.split("-")[0];
|
|
|
//下限
|
|
|
String high = range.split("-")[1];
|
|
|
if (NumberValidationUtils.isRealNumber(result) && NumberValidationUtils.isRealNumber(low) && NumberValidationUtils.isRealNumber(high)) {
|
|
|
Double _result = Double.parseDouble(result);
|
|
|
Double _row = Double.parseDouble(low);
|