|
@ -31,7 +31,6 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.NumberFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
@ -68,6 +67,8 @@ public class BaseStatistsService {
|
|
|
@Autowired
|
|
|
private TjDataSaveService dataSaveService;
|
|
|
|
|
|
private BasesicUtil basesicUtil = new BasesicUtil();
|
|
|
|
|
|
private static String orgHealthCategory = "orgHealthCategory";
|
|
|
public static String orgHealthCategoryCode = "orgHealthCategoryCode";
|
|
|
public static String resultField = "result";
|
|
@ -145,9 +146,6 @@ public class BaseStatistsService {
|
|
|
|
|
|
public List<Map<String, Object>> addition(String dimension, List<Map<String, Object>> firstList, List<Map<String, Object>> secondList,int operation){
|
|
|
List<Map<String, Object>> addResultList = new ArrayList<>();
|
|
|
NumberFormat nf = NumberFormat.getInstance();
|
|
|
nf.setGroupingUsed(false);
|
|
|
nf.setMaximumFractionDigits(2);
|
|
|
List<Map<String, Object>> otherList = new ArrayList<>();
|
|
|
otherList = secondList;
|
|
|
String [] moleDimensions = dimension.split(";");
|
|
@ -191,7 +189,7 @@ public class BaseStatistsService {
|
|
|
}else if(operation == 2){ //2 减法
|
|
|
point = first.subtract(second).doubleValue();
|
|
|
}
|
|
|
map.put(resultField,nf.format(point));
|
|
|
map.put(resultField, basesicUtil.decimalPointHandle(point));
|
|
|
addResultList.add(map);
|
|
|
pflag = false;
|
|
|
otherList.remove(secondMap);
|
|
@ -199,7 +197,7 @@ public class BaseStatistsService {
|
|
|
}
|
|
|
}
|
|
|
if(pflag){
|
|
|
map.put(resultField, nf.format(firstResultVal));
|
|
|
map.put(resultField, basesicUtil.decimalPointHandle(firstResultVal));
|
|
|
addResultList.add(map);
|
|
|
}
|
|
|
}
|
|
@ -221,7 +219,7 @@ public class BaseStatistsService {
|
|
|
point = -secondResultVal;
|
|
|
}
|
|
|
}
|
|
|
map.put(resultField, nf.format(point));
|
|
|
map.put(resultField, basesicUtil.decimalPointHandle(point));
|
|
|
addResultList.add(map);
|
|
|
}
|
|
|
}
|
|
@ -382,15 +380,12 @@ public class BaseStatistsService {
|
|
|
divisionResultList.add(map);
|
|
|
} else {
|
|
|
double point = 0;
|
|
|
NumberFormat df = NumberFormat.getInstance();
|
|
|
df.setGroupingUsed(false);
|
|
|
df.setMaximumFractionDigits(2);
|
|
|
if (operation == 1) {
|
|
|
point = (moleResultVal / denominatorVal) * operationValue;
|
|
|
} else if (operation == 2) {
|
|
|
point = (moleResultVal / denominatorVal) / operationValue;
|
|
|
}
|
|
|
map.put(resultField, df.format(point));
|
|
|
map.put(resultField, basesicUtil.decimalPointHandle(point));
|
|
|
divisionResultList.add(map);
|
|
|
}
|
|
|
}
|
|
@ -447,9 +442,6 @@ public class BaseStatistsService {
|
|
|
}
|
|
|
if(moleKeyVal.equals(dimenKeyVal)){
|
|
|
double point = 0;
|
|
|
NumberFormat df = NumberFormat.getInstance();
|
|
|
df.setGroupingUsed(false);
|
|
|
df.setMaximumFractionDigits(2);
|
|
|
float dimeResultVal = Float.valueOf(denoMap.get(resultField).toString());
|
|
|
if(dimeResultVal != 0){
|
|
|
if(operation == 1){
|
|
@ -458,7 +450,7 @@ public class BaseStatistsService {
|
|
|
point = (moleResultVal/dimeResultVal) / operationValue;
|
|
|
}
|
|
|
}
|
|
|
map.put(resultField,df.format(point));
|
|
|
map.put(resultField, basesicUtil.decimalPointHandle(point));
|
|
|
divisionResultList.add(map);
|
|
|
break;
|
|
|
}
|
|
@ -622,9 +614,6 @@ public class BaseStatistsService {
|
|
|
//获取该节点下所有末节点的结果和
|
|
|
public Map<String,Object> getParentAllChildren(List<String> quotaCodes, Map<String,Object> mapCategory,Map<String,Object> returnMap, List<Map<String, Object>> dimenListResult, double parentResult ){
|
|
|
try {
|
|
|
NumberFormat df = NumberFormat.getInstance();
|
|
|
df.setGroupingUsed(false);
|
|
|
df.setMaximumFractionDigits(2);
|
|
|
boolean childrenFlag = false;
|
|
|
if(mapCategory.get("children") != null){
|
|
|
List<Map<String,Object>> childrenOrgHealthCategoryList = (List<Map<String, Object>>) mapCategory.get("children");
|
|
@ -647,14 +636,14 @@ public class BaseStatistsService {
|
|
|
if(returnMap.get(resultField) != null){
|
|
|
oldResult = Double.parseDouble(returnMap.get(resultField).toString());
|
|
|
}
|
|
|
returnMap.put(resultField,df.format(result + oldResult));
|
|
|
returnMap.put(resultField, basesicUtil.decimalPointHandle(result + oldResult));
|
|
|
for(String quotaCode : quotaCodes){
|
|
|
double quotaResult = Double.parseDouble(dimenMap.get(quotaCode).toString());
|
|
|
double oldQuotaResult = 0;
|
|
|
if( returnMap.get(quotaCode) != null ){
|
|
|
oldQuotaResult = Double.parseDouble(returnMap.get(quotaCode).toString());
|
|
|
}
|
|
|
returnMap.put(quotaCode,df.format(quotaResult + oldQuotaResult));
|
|
|
returnMap.put(quotaCode, basesicUtil.decimalPointHandle(quotaResult + oldQuotaResult));
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
@ -743,10 +732,7 @@ public class BaseStatistsService {
|
|
|
dataMap.put(firstColumnField,map.get("text"));
|
|
|
}
|
|
|
if(key.equals("SUM(result)")){
|
|
|
NumberFormat nf = NumberFormat.getInstance();
|
|
|
nf.setGroupingUsed(false);
|
|
|
nf.setMaximumFractionDigits(2);
|
|
|
dataMap.put(resultField, nf.format(map.get(key)));
|
|
|
dataMap.put(resultField, basesicUtil.decimalPointHandle(map.get(key)));
|
|
|
}
|
|
|
}
|
|
|
resultList.add(dataMap);
|
|
@ -792,10 +778,7 @@ public class BaseStatistsService {
|
|
|
dataMap.put(map.get(orgHealthCategoryCode).toString(),map.get(orgHealthCategoryCode));
|
|
|
}
|
|
|
if(key.equals("SUM(result)")){
|
|
|
NumberFormat nf = NumberFormat.getInstance();
|
|
|
nf.setGroupingUsed(false);
|
|
|
nf.setMaximumFractionDigits(2);
|
|
|
dataMap.put(resultField, nf.format(map.get(key)));
|
|
|
dataMap.put(resultField, basesicUtil.decimalPointHandle(map.get(key)));
|
|
|
}
|
|
|
if(key.equals(quotaDateField)){
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
@ -868,10 +851,7 @@ public class BaseStatistsService {
|
|
|
dataMap.put(firstColumnField,map.get("text"));
|
|
|
}
|
|
|
if(key.equals("SUM(result)")){
|
|
|
NumberFormat nf = NumberFormat.getInstance();
|
|
|
nf.setGroupingUsed(false);
|
|
|
nf.setMaximumFractionDigits(2);
|
|
|
dataMap.put(resultField, nf.format(map.get(key)));
|
|
|
dataMap.put(resultField, basesicUtil.decimalPointHandle(map.get(key)));
|
|
|
}
|
|
|
}
|
|
|
resultList.add(dataMap);
|
|
@ -1221,9 +1201,6 @@ public class BaseStatistsService {
|
|
|
}
|
|
|
}
|
|
|
double point = 0;
|
|
|
NumberFormat df = NumberFormat.getInstance();
|
|
|
df.setGroupingUsed(false);
|
|
|
df.setMaximumFractionDigits(2);
|
|
|
int operation = Integer.valueOf(esConfig.getPercentOperation());
|
|
|
int operationValue = Integer.valueOf(esConfig.getPercentOperationValue());
|
|
|
if(denoTotal - 0 != 0){
|
|
@ -1236,7 +1213,7 @@ public class BaseStatistsService {
|
|
|
}
|
|
|
}
|
|
|
Map<String, Object> totalMap = new HashMap<>();
|
|
|
totalMap.put(resultField,df.format(point));
|
|
|
totalMap.put(resultField, basesicUtil.decimalPointHandle(point));
|
|
|
totalMap.put(dimension,"合计");
|
|
|
totalMap.put(firstColumnField,"合计");
|
|
|
result.add(totalMap);
|
|
@ -1326,12 +1303,9 @@ public class BaseStatistsService {
|
|
|
String sum = "0";
|
|
|
String sql = "select sum(result) from medical_service_index where quotaCode='HC041047'";
|
|
|
List<Map<String, Object>> listData = elasticsearchUtil.excuteDataModel(sql);
|
|
|
NumberFormat nf = NumberFormat.getInstance();
|
|
|
nf.setGroupingUsed(false);
|
|
|
nf.setMaximumFractionDigits(2);
|
|
|
if (null != listData && listData.size() > 0 && listData.get(0).size() > 0) {
|
|
|
for (Map<String, Object> map : listData) {
|
|
|
sum = nf.format(map.get("SUM(result)"));
|
|
|
sum = basesicUtil.decimalPointHandle(map.get("SUM(result)"));
|
|
|
}
|
|
|
}
|
|
|
return sum;
|
|
@ -1345,12 +1319,9 @@ public class BaseStatistsService {
|
|
|
int sum = 0;
|
|
|
String sql = "select sum(result) from medical_service_index where quotaCode='HC041008'";
|
|
|
List<Map<String, Object>> listData = singleDiseaseService.parseIntegerValue(sql);
|
|
|
NumberFormat nf = NumberFormat.getInstance();
|
|
|
nf.setGroupingUsed(false);
|
|
|
nf.setMaximumFractionDigits(2);
|
|
|
if (null != listData && listData.size() > 0 && listData.get(0).size() > 0) {
|
|
|
for (Map<String, Object> map : listData) {
|
|
|
String value = nf.format(map.get("SUM(result)"));
|
|
|
String value = basesicUtil.decimalPointHandle(map.get("SUM(result)"));
|
|
|
sum += Integer.parseInt(value);
|
|
|
}
|
|
|
}
|
|
@ -1365,12 +1336,9 @@ public class BaseStatistsService {
|
|
|
String sum = "0";
|
|
|
String sql = "select sum(result) from medical_service_index where quotaCode='HC041068'";
|
|
|
List<Map<String, Object>> listData = elasticsearchUtil.excuteDataModel(sql);
|
|
|
NumberFormat nf = NumberFormat.getInstance();
|
|
|
nf.setGroupingUsed(false);
|
|
|
nf.setMaximumFractionDigits(2);
|
|
|
if (null != listData && listData.size() > 0 && listData.get(0).size() > 0) {
|
|
|
for (Map<String, Object> map : listData) {
|
|
|
sum = nf.format(map.get("SUM(result)"));
|
|
|
sum = basesicUtil.decimalPointHandle(map.get("SUM(result)"));
|
|
|
}
|
|
|
}
|
|
|
return sum;
|
|
@ -1384,12 +1352,9 @@ public class BaseStatistsService {
|
|
|
int sum = 0;
|
|
|
String sql = "select sum(result) from medical_service_index where quotaCode='HC041000'";
|
|
|
List<Map<String, Object>> listData = singleDiseaseService.parseIntegerValue(sql);
|
|
|
NumberFormat nf = NumberFormat.getInstance();
|
|
|
nf.setGroupingUsed(false);
|
|
|
nf.setMaximumFractionDigits(2);
|
|
|
if (null != listData && listData.size() > 0 && listData.get(0).size() > 0) {
|
|
|
for (Map<String, Object> map : listData) {
|
|
|
String value = nf.format(map.get("SUM(result)"));
|
|
|
String value = basesicUtil.decimalPointHandle(map.get("SUM(result)"));
|
|
|
sum += Integer.parseInt(value);
|
|
|
}
|
|
|
}
|
|
@ -1397,16 +1362,13 @@ public class BaseStatistsService {
|
|
|
}
|
|
|
|
|
|
public String getCostOfMedicalMonitor() {
|
|
|
NumberFormat nf = NumberFormat.getInstance();
|
|
|
nf.setGroupingUsed(false);
|
|
|
nf.setMaximumFractionDigits(2);
|
|
|
// 获取门急诊费用
|
|
|
Double costOfOutPatient = Double.parseDouble(getCostOfOutPatient());
|
|
|
// 获取入院费用
|
|
|
Double costOfInPatient = Double.parseDouble(getCostOfInPatient());
|
|
|
// 医疗费用监测 = 获取门急诊费用 + 获取入院费用
|
|
|
Double costOfMedicalMonitor = costOfInPatient + costOfOutPatient;
|
|
|
return nf.format(costOfMedicalMonitor);
|
|
|
return basesicUtil.decimalPointHandle(costOfMedicalMonitor);
|
|
|
}
|
|
|
|
|
|
|
|
@ -1519,12 +1481,9 @@ public class BaseStatistsService {
|
|
|
}
|
|
|
if(denoKeyVal.equals(moleKeyVal)){
|
|
|
double point = 0;
|
|
|
NumberFormat nf = NumberFormat.getInstance();
|
|
|
nf.setGroupingUsed(false);
|
|
|
nf.setMaximumFractionDigits(2);
|
|
|
float moleResultVal = Float.valueOf(moleMap.get(resultField).toString());
|
|
|
point = ((moleResultVal - denoResultVal)/denoResultVal) * operationValue;
|
|
|
map.put(resultField, nf.format(point));
|
|
|
map.put(resultField, basesicUtil.decimalPointHandle(point));
|
|
|
divisionResultList.add(map);
|
|
|
break;
|
|
|
}
|
|
@ -1735,9 +1694,6 @@ public class BaseStatistsService {
|
|
|
}
|
|
|
dimension = dateType;
|
|
|
List<Map<String, Object>> dataList = getSimpleQuotaReport(esConfig.getMolecular(), filters,dimension ,false , null);
|
|
|
NumberFormat df = NumberFormat.getInstance();
|
|
|
df.setGroupingUsed(false);
|
|
|
df.setMaximumFractionDigits(2);
|
|
|
if(dataList != null && dataList.size() > 0){
|
|
|
if(dateType.toLowerCase().equals("year")){
|
|
|
for(int i = nowYear ; i > beforeYear ;i--){
|
|
@ -1759,7 +1715,7 @@ public class BaseStatistsService {
|
|
|
map.put(resultField,"--");
|
|
|
}else {
|
|
|
double precent = (current - last)/last*100;
|
|
|
map.put(resultField,precent-0 ==0 ? 0 : df.format(precent));
|
|
|
map.put(resultField,precent-0 ==0 ? 0 : basesicUtil.decimalPointHandle(precent));
|
|
|
}
|
|
|
resultList.add(map);
|
|
|
if(i-beforeYear <= 0){
|
|
@ -1830,7 +1786,7 @@ public class BaseStatistsService {
|
|
|
if(precent == 0){
|
|
|
map.put(resultField,0);
|
|
|
}else {
|
|
|
map.put(resultField,precent-0 ==0 ? 0 : df.format(precent));
|
|
|
map.put(resultField,precent-0 ==0 ? 0 : basesicUtil.decimalPointHandle(precent));
|
|
|
}
|
|
|
}
|
|
|
resultList.add(map);
|
|
@ -1874,7 +1830,7 @@ public class BaseStatistsService {
|
|
|
if(precent == 0){
|
|
|
map.put(resultField,0);
|
|
|
}else {
|
|
|
map.put(resultField,precent-0 ==0 ? 0 : df.format(precent));
|
|
|
map.put(resultField,precent-0 ==0 ? 0 : basesicUtil.decimalPointHandle(precent));
|
|
|
}
|
|
|
}
|
|
|
resultList.add(map);
|