|
@ -15,6 +15,7 @@ import com.yihu.jw.entity.base.login.BaseLoginLogDO;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.care.device.DevicePatientDevice;
|
|
|
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
|
|
|
import com.yihu.jw.es.es.ElasticSearchHelperUtil;
|
|
|
import com.yihu.jw.es.util.ElasticsearchUtil;
|
|
|
import com.yihu.jw.es.util.SaveModel;
|
|
|
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
|
|
@ -27,9 +28,11 @@ import com.yihu.jw.util.common.IdCardUtil;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.nlpcn.es4sql.jdbc.ObjectResult;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
@ -79,6 +82,12 @@ public class StatisticsService {
|
|
|
private PatientDeviceDao patientDeviceDao;
|
|
|
@Autowired
|
|
|
private SystemMessageDao systemMessageDao;
|
|
|
@Autowired
|
|
|
private ElasticSearchHelperUtil elasticSearchHelper;
|
|
|
@Value("${es.index.Statistics}")
|
|
|
private String esIndex;
|
|
|
@Value("${es.type.Statistics}")
|
|
|
private String esType;
|
|
|
|
|
|
private static final String defalutArea = "330100";
|
|
|
|
|
@ -1404,4 +1413,45 @@ public class StatisticsService {
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @param esSql
|
|
|
* @param jsonStr 修改数据
|
|
|
* @return
|
|
|
*/
|
|
|
public boolean esDataModify(String esSql,String jsonStr) {
|
|
|
try {
|
|
|
if (StringUtils.containsIgnoreCase(esSql,"limit")){
|
|
|
return false;
|
|
|
}
|
|
|
Boolean flag=false;
|
|
|
List<SaveModel> objs = elasticsearchUtil.excute(esSql,SaveModel.class,"","");
|
|
|
List<Map<String,Object>> sourceMap = new ArrayList<>();
|
|
|
int i=0;
|
|
|
for (SaveModel tmp:objs){
|
|
|
String jsonStr1 = JSON.toJSONString(tmp);
|
|
|
Map<String,Object> tmpInfo = com.alibaba.fastjson.JSONObject.parseObject(jsonStr1,Map.class);
|
|
|
if (StringUtils.isNotBlank(jsonStr)){
|
|
|
Map<String,Object> modifyInfo = com.alibaba.fastjson.JSONObject.parseObject(jsonStr,Map.class);
|
|
|
for (String key:modifyInfo.keySet()){
|
|
|
tmpInfo.put(key, modifyInfo.get(key));
|
|
|
}
|
|
|
sourceMap.add(tmpInfo);
|
|
|
}
|
|
|
i++;
|
|
|
}
|
|
|
if (i>0){
|
|
|
flag = elasticSearchHelper.updateByMap(esIndex,esIndex,sourceMap);//修改
|
|
|
}
|
|
|
return flag;
|
|
|
}
|
|
|
catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|