|  | @ -3,6 +3,9 @@ package com.yihu.wlyy.service.third.jw;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSON;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import com.yihu.es.entity.FollowupContentESDO;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.config.es.ElasticFactory;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.config.es.ElastricSearchSave;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.doctor.profile.Doctor;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.followup.*;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.entity.oldpeople.OldPeoplePhysicalExaminationEntity;
 | 
	
	
		
			
				|  | @ -21,9 +24,14 @@ import com.yihu.wlyy.repository.prescription.PrescriptionDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.common.account.PatientService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.util.DateUtil;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.util.HttpClientUtil;
 | 
	
		
			
				|  |  | import io.searchbox.client.JestClient;
 | 
	
		
			
				|  |  | import io.searchbox.core.*;
 | 
	
		
			
				|  |  | import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | import org.apache.http.NameValuePair;
 | 
	
		
			
				|  |  | import org.apache.http.message.BasicNameValuePair;
 | 
	
		
			
				|  |  | import org.elasticsearch.index.query.BoolQueryBuilder;
 | 
	
		
			
				|  |  | import org.elasticsearch.index.query.QueryBuilders;
 | 
	
		
			
				|  |  | import org.elasticsearch.search.builder.SearchSourceBuilder;
 | 
	
		
			
				|  |  | import org.slf4j.Logger;
 | 
	
		
			
				|  |  | import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
	
		
			
				|  | @ -85,6 +93,15 @@ public class JwPrescriptionService {
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private FollowUpMappingDao followUpMappingDao;
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     @Value("${es.type.FollowUpContent}")
 | 
	
		
			
				|  |  |     private String esType;
 | 
	
		
			
				|  |  |     @Value("${es.index.FollowUp}")
 | 
	
		
			
				|  |  |     private String esIndex;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private ElasticFactory elasticFactory;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private ElastricSearchSave elastricSearchSave;
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取字典列表
 | 
	
		
			
				|  |  |      *
 | 
	
	
		
			
				|  | @ -694,112 +711,82 @@ public class JwPrescriptionService {
 | 
	
		
			
				|  |  |                             try {
 | 
	
		
			
				|  |  |                                 followup = followUpDao.save(followup);
 | 
	
		
			
				|  |  |                                 Long followupId = followup.getId();
 | 
	
		
			
				|  |  |                                 //删除原有记录
 | 
	
		
			
				|  |  |                                 followupContentDao.deleteByFollowupId(followup.getId());
 | 
	
		
			
				|  |  |                                 
 | 
	
		
			
				|  |  |                                 //组装数据
 | 
	
		
			
				|  |  |                                 List<FollowupContent> newList = new ArrayList<>();
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                                 followupContent1.forEach((k, v) -> {
 | 
	
		
			
				|  |  |                                     FollowupContent item = new FollowupContent();
 | 
	
		
			
				|  |  |                                     item.setFollowupId(followupId);
 | 
	
		
			
				|  |  |                                     item.setFollowupProject("1");
 | 
	
		
			
				|  |  |                                     item.setFollowupKey(k);
 | 
	
		
			
				|  |  |                                     item.setFollowupValue(v);
 | 
	
		
			
				|  |  |                                     item.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                                     newList.add(item);
 | 
	
		
			
				|  |  |                                 });
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                                 followupContent2.forEach((k, v) -> {
 | 
	
		
			
				|  |  |                                     FollowupContent item = new FollowupContent();
 | 
	
		
			
				|  |  |                                     item.setFollowupId(followupId);
 | 
	
		
			
				|  |  |                                     item.setFollowupProject("2");
 | 
	
		
			
				|  |  |                                     item.setFollowupKey(k);
 | 
	
		
			
				|  |  |                                     item.setFollowupValue(v);
 | 
	
		
			
				|  |  |                                     item.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                                     newList.add(item);
 | 
	
		
			
				|  |  |                                 });
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                                 followupContent3.forEach((k, v) -> {
 | 
	
		
			
				|  |  |                                     FollowupContent item = new FollowupContent();
 | 
	
		
			
				|  |  |                                     item.setFollowupId(followupId);
 | 
	
		
			
				|  |  |                                     item.setFollowupProject("3");
 | 
	
		
			
				|  |  |                                     item.setFollowupKey(k);
 | 
	
		
			
				|  |  |                                     item.setFollowupValue(v);
 | 
	
		
			
				|  |  |                                     item.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                                     newList.add(item);
 | 
	
		
			
				|  |  |                                 });
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                                 followupContent4.forEach((k, v) -> {
 | 
	
		
			
				|  |  |                                     FollowupContent item = new FollowupContent();
 | 
	
		
			
				|  |  |                                     item.setFollowupId(followupId);
 | 
	
		
			
				|  |  |                                     item.setFollowupProject("4");
 | 
	
		
			
				|  |  |                                     item.setFollowupKey(k);
 | 
	
		
			
				|  |  |                                     item.setFollowupValue(v);
 | 
	
		
			
				|  |  |                                     item.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                                     newList.add(item);
 | 
	
		
			
				|  |  |                                 });
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                                 followupContent5.forEach((k, v) -> {
 | 
	
		
			
				|  |  |                                     FollowupContent item = new FollowupContent();
 | 
	
		
			
				|  |  |                                     item.setFollowupId(followupId);
 | 
	
		
			
				|  |  |                                     item.setFollowupProject("5");
 | 
	
		
			
				|  |  |                                     item.setFollowupKey(k);
 | 
	
		
			
				|  |  |                                     item.setFollowupValue(v);
 | 
	
		
			
				|  |  |                                     item.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                                     newList.add(item);
 | 
	
		
			
				|  |  |                                 });
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                                 followupContent6.forEach((k, v) -> {
 | 
	
		
			
				|  |  |                                     FollowupContent item = new FollowupContent();
 | 
	
		
			
				|  |  |                                     item.setFollowupId(followupId);
 | 
	
		
			
				|  |  |                                     item.setFollowupProject("6");
 | 
	
		
			
				|  |  |                                     item.setFollowupKey(k);
 | 
	
		
			
				|  |  |                                     item.setFollowupValue(v);
 | 
	
		
			
				|  |  |                                     item.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                                     newList.add(item);
 | 
	
		
			
				|  |  |                                 });
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                                 followupContent7.forEach((k, v) -> {
 | 
	
		
			
				|  |  |                                     FollowupContent item = new FollowupContent();
 | 
	
		
			
				|  |  |                                     item.setFollowupId(followupId);
 | 
	
		
			
				|  |  |                                     item.setFollowupProject("7");
 | 
	
		
			
				|  |  |                                     item.setFollowupKey(k);
 | 
	
		
			
				|  |  |                                     item.setFollowupValue(v);
 | 
	
		
			
				|  |  |                                     item.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                                     newList.add(item);
 | 
	
		
			
				|  |  |                                 });
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                                 followupContent8.forEach((k, v) -> {
 | 
	
		
			
				|  |  |                                     FollowupContent item = new FollowupContent();
 | 
	
		
			
				|  |  |                                     item.setFollowupId(followupId);
 | 
	
		
			
				|  |  |                                     item.setFollowupProject("8");
 | 
	
		
			
				|  |  |                                     item.setFollowupKey(k);
 | 
	
		
			
				|  |  |                                     item.setFollowupValue(v);
 | 
	
		
			
				|  |  |                                     item.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                                     newList.add(item);
 | 
	
		
			
				|  |  |                                 });
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                                 followupContent9.forEach((k, v) -> {
 | 
	
		
			
				|  |  |                                     FollowupContent item = new FollowupContent();
 | 
	
		
			
				|  |  |                                     item.setFollowupId(followupId);
 | 
	
		
			
				|  |  |                                     item.setFollowupProject("9");
 | 
	
		
			
				|  |  |                                     item.setFollowupKey(k);
 | 
	
		
			
				|  |  |                                     item.setFollowupValue(v);
 | 
	
		
			
				|  |  |                                     item.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                                     newList.add(item);
 | 
	
		
			
				|  |  |                                 });
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                                 followupContent10.forEach((k, v) -> {
 | 
	
		
			
				|  |  |                                     FollowupContent item = new FollowupContent();
 | 
	
		
			
				|  |  |                                     item.setFollowupId(followupId);
 | 
	
		
			
				|  |  |                                     item.setFollowupProject("10");
 | 
	
		
			
				|  |  |                                     item.setFollowupKey(k);
 | 
	
		
			
				|  |  |                                     item.setFollowupValue(v);
 | 
	
		
			
				|  |  |                                     item.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                                     newList.add(item);
 | 
	
		
			
				|  |  |                                 });
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                                 followupContentDao.save(newList);
 | 
	
		
			
				|  |  |                                 List<FollowupContentESDO> newList = new ArrayList<>();
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                                 FollowupContentESDO followupContentESDO1 = new FollowupContentESDO();
 | 
	
		
			
				|  |  |                                 String jsonString1 = JSON.toJSONString(followupContent1);
 | 
	
		
			
				|  |  |                                 followupContentESDO1 = JSON.parseObject(jsonString1, FollowupContentESDO.class);
 | 
	
		
			
				|  |  |                                 followupContentESDO1.setFollowup_id(String.valueOf(followupId));
 | 
	
		
			
				|  |  |                                 followupContentESDO1.setFollowup_project("1");
 | 
	
		
			
				|  |  |                                 newList.add(followupContentESDO1);
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                                 FollowupContentESDO followupContentESDO2 = new FollowupContentESDO();
 | 
	
		
			
				|  |  |                                 String jsonString2 = JSON.toJSONString(followupContent2);
 | 
	
		
			
				|  |  |                                 followupContentESDO2 = JSON.parseObject(jsonString2, FollowupContentESDO.class);
 | 
	
		
			
				|  |  |                                 followupContentESDO2.setFollowup_id(String.valueOf(followupId));
 | 
	
		
			
				|  |  |                                 followupContentESDO2.setFollowup_project("2");
 | 
	
		
			
				|  |  |                                 newList.add(followupContentESDO2);
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                                 FollowupContentESDO followupContentESDO3 = new FollowupContentESDO();
 | 
	
		
			
				|  |  |                                 String jsonString3 = JSON.toJSONString(followupContent3);
 | 
	
		
			
				|  |  |                                 followupContentESDO3 = JSON.parseObject(jsonString3, FollowupContentESDO.class);
 | 
	
		
			
				|  |  |                                 followupContentESDO3.setFollowup_id(String.valueOf(followupId));
 | 
	
		
			
				|  |  |                                 followupContentESDO3.setFollowup_project("3");
 | 
	
		
			
				|  |  |                                 newList.add(followupContentESDO3);
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                                 FollowupContentESDO followupContentESDO4 = new FollowupContentESDO();
 | 
	
		
			
				|  |  |                                 String jsonString4 = JSON.toJSONString(followupContent4);
 | 
	
		
			
				|  |  |                                 followupContentESDO4 = JSON.parseObject(jsonString4, FollowupContentESDO.class);
 | 
	
		
			
				|  |  |                                 followupContentESDO4.setFollowup_id(String.valueOf(followupId));
 | 
	
		
			
				|  |  |                                 followupContentESDO4.setFollowup_project("4");
 | 
	
		
			
				|  |  |                                 newList.add(followupContentESDO4);
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                                 FollowupContentESDO followupContentESDO5 = new FollowupContentESDO();
 | 
	
		
			
				|  |  |                                 String jsonString5 = JSON.toJSONString(followupContent5);
 | 
	
		
			
				|  |  |                                 followupContentESDO5 = JSON.parseObject(jsonString5, FollowupContentESDO.class);
 | 
	
		
			
				|  |  |                                 followupContentESDO5.setFollowup_id(String.valueOf(followupId));
 | 
	
		
			
				|  |  |                                 followupContentESDO5.setFollowup_project("5");
 | 
	
		
			
				|  |  |                                 newList.add(followupContentESDO5);
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                                 FollowupContentESDO followupContentESDO6 = new FollowupContentESDO();
 | 
	
		
			
				|  |  |                                 String jsonString6 = JSON.toJSONString(followupContent6);
 | 
	
		
			
				|  |  |                                 followupContentESDO6 = JSON.parseObject(jsonString6, FollowupContentESDO.class);
 | 
	
		
			
				|  |  |                                 followupContentESDO6.setFollowup_id(String.valueOf(followupId));
 | 
	
		
			
				|  |  |                                 followupContentESDO6.setFollowup_project("6");
 | 
	
		
			
				|  |  |                                 newList.add(followupContentESDO6);
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                                 FollowupContentESDO followupContentESDO7 = new FollowupContentESDO();
 | 
	
		
			
				|  |  |                                 String jsonString7 = JSON.toJSONString(followupContent7);
 | 
	
		
			
				|  |  |                                 followupContentESDO7 = JSON.parseObject(jsonString7, FollowupContentESDO.class);
 | 
	
		
			
				|  |  |                                 followupContentESDO7.setFollowup_id(String.valueOf(followupId));
 | 
	
		
			
				|  |  |                                 followupContentESDO7.setFollowup_project("7");
 | 
	
		
			
				|  |  |                                 newList.add(followupContentESDO7);
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                                 FollowupContentESDO followupContentESDO8= new FollowupContentESDO();
 | 
	
		
			
				|  |  |                                 String jsonString8 = JSON.toJSONString(followupContent8);
 | 
	
		
			
				|  |  |                                 followupContentESDO8 = JSON.parseObject(jsonString8, FollowupContentESDO.class);
 | 
	
		
			
				|  |  |                                 followupContentESDO8.setFollowup_id(String.valueOf(followupId));
 | 
	
		
			
				|  |  |                                 followupContentESDO8.setFollowup_project("8");
 | 
	
		
			
				|  |  |                                 newList.add(followupContentESDO8);
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                                 FollowupContentESDO followupContentESDO9= new FollowupContentESDO();
 | 
	
		
			
				|  |  |                                 String jsonString9 = JSON.toJSONString(followupContent9);
 | 
	
		
			
				|  |  |                                 followupContentESDO9 = JSON.parseObject(jsonString9, FollowupContentESDO.class);
 | 
	
		
			
				|  |  |                                 followupContentESDO9.setFollowup_id(String.valueOf(followupId));
 | 
	
		
			
				|  |  |                                 followupContentESDO9.setFollowup_project("9");
 | 
	
		
			
				|  |  |                                 newList.add(followupContentESDO9);
 | 
	
		
			
				|  |  |                                 
 | 
	
		
			
				|  |  |                                 FollowupContentESDO followupContentESDO10= new FollowupContentESDO();
 | 
	
		
			
				|  |  |                                 String jsonString10 = JSON.toJSONString(followupContent10);
 | 
	
		
			
				|  |  |                                 followupContentESDO10 = JSON.parseObject(jsonString10, FollowupContentESDO.class);
 | 
	
		
			
				|  |  |                                 followupContentESDO10.setFollowup_id(String.valueOf(followupId));
 | 
	
		
			
				|  |  |                                 followupContentESDO10.setFollowup_project("10");
 | 
	
		
			
				|  |  |                                 newList.add(followupContentESDO10);
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                                 //ES保存新数据
 | 
	
		
			
				|  |  |                                 this.esSaveFollowupContentData(String.valueOf(followupId),newList);
 | 
	
		
			
				|  |  |                         
 | 
	
		
			
				|  |  |                                 List<FollowupDrugs> DRUG_LIST = new ArrayList<>();//用药记录
 | 
	
		
			
				|  |  |                         
 | 
	
	
		
			
				|  | @ -880,11 +867,10 @@ public class JwPrescriptionService {
 | 
	
		
			
				|  |  |                     //组装请求结果MAP
 | 
	
		
			
				|  |  |                     HashMap<String,String> followupResultMap = new HashMap<>();
 | 
	
		
			
				|  |  |                     
 | 
	
		
			
				|  |  |                     List<FollowupContent> followupContents = followupContentDao.findByFollowupId(followup.getId());
 | 
	
		
			
				|  |  |                     
 | 
	
		
			
				|  |  |                     for (FollowupContent followupContent : followupContents) {
 | 
	
		
			
				|  |  |                         followupResultMap.put(followupContent.getFollowupKey(), followupContent.getFollowupValue());
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     List<FollowupContentESDO> followupContentESDOList = this.esfindFollowUpContestsByFollowupId(String.valueOf(followup.getId()));
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                     //转MAP
 | 
	
		
			
				|  |  |                     followupResultMap =  this.operaESFollowUpContentData(followupContentESDOList);
 | 
	
		
			
				|  |  |                     
 | 
	
		
			
				|  |  |                     String OPERATOR = followup.getJwdoctorCode();//操作员&录入医生
 | 
	
		
			
				|  |  |                     if (StringUtils.isBlank(OPERATOR)) {
 | 
	
	
		
			
				|  | @ -920,6 +906,8 @@ public class JwPrescriptionService {
 | 
	
		
			
				|  |  |                         FAMILY_FOLLOWUP_CLASS_NAMES = "高血压,糖尿病";
 | 
	
		
			
				|  |  |                     } else {}
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                     
 | 
	
		
			
				|  |  |                     
 | 
	
		
			
				|  |  |                     followupResultMap.put("FAMILY_FOLLOWUP_TYPE",FAMILY_FOLLOWUP_TYPE);
 | 
	
		
			
				|  |  |                     followupResultMap.put("ORG_CODE",JW_ORG_CODE);
 | 
	
		
			
				|  |  |                     followupResultMap.put("FOLLOWUP_SOURCE",FOLLOWUP_SOURCE);
 | 
	
	
		
			
				|  | @ -1125,4 +1113,201 @@ public class JwPrescriptionService {
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         return re;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      *ES 删除随访详情信息
 | 
	
		
			
				|  |  |      *@author huangwenjie
 | 
	
		
			
				|  |  |      *@date 2017/11/1 15:17
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void esDeleteFollowUpContent(List<FollowupContentESDO> datalist) throws Exception{
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             JestClient jestClient = elasticFactory.getJestClient();
 | 
	
		
			
				|  |  |             //根据id批量删除
 | 
	
		
			
				|  |  |             Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
 | 
	
		
			
				|  |  |             for (FollowupContentESDO obj : datalist) {
 | 
	
		
			
				|  |  |                 Delete index = new Delete.Builder(obj.getId()).build();
 | 
	
		
			
				|  |  |                 bulk.addAction(index);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             BulkResult br = jestClient.execute(bulk.build());
 | 
	
		
			
				|  |  |             
 | 
	
		
			
				|  |  |             logger.info("delete data count:" + datalist.size());
 | 
	
		
			
				|  |  |             logger.info("delete flag:" + br.isSucceeded());
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * ES获取面访项目数据详情
 | 
	
		
			
				|  |  |      *@author huangwenjie
 | 
	
		
			
				|  |  |      *@date 2017/11/1 19:41
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<FollowupContentESDO>  esfindFollowUpContestsByFollowupId(String id) throws Exception {
 | 
	
		
			
				|  |  |         //根据随访ID、分类ID获取随访记录详情
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         List<String> resultList = new ArrayList<>();
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         JestClient jestClient = elasticFactory.getJestClient();
 | 
	
		
			
				|  |  |         //先根据条件查找出来
 | 
	
		
			
				|  |  |         SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
 | 
	
		
			
				|  |  |         searchSourceBuilder.query(
 | 
	
		
			
				|  |  |                 new BoolQueryBuilder()
 | 
	
		
			
				|  |  |                         .must(QueryBuilders.matchQuery("followup_id", id))
 | 
	
		
			
				|  |  |         );
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
 | 
	
		
			
				|  |  |                 .build();
 | 
	
		
			
				|  |  |         SearchResult result = jestClient.execute(search);
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         List<FollowupContentESDO> followupContentESDOList = new ArrayList<>();
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         return followupContentESDOList;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      *ES 保存随访记录详情
 | 
	
		
			
				|  |  |      *@author huangwenjie
 | 
	
		
			
				|  |  |      *@date 2017/11/1 14:57
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void esSaveFollowupContentData(String followupid, List<FollowupContentESDO> newdatalist) throws Exception {
 | 
	
		
			
				|  |  |         JestClient jestClient = elasticFactory.getJestClient();
 | 
	
		
			
				|  |  |         //先根据条件查找出来
 | 
	
		
			
				|  |  |         SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
 | 
	
		
			
				|  |  |         searchSourceBuilder.query(
 | 
	
		
			
				|  |  |                 new BoolQueryBuilder()
 | 
	
		
			
				|  |  |                         .must(QueryBuilders.matchQuery("followup_id", id))
 | 
	
		
			
				|  |  |         );
 | 
	
		
			
				|  |  |         Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType).build();
 | 
	
		
			
				|  |  |         SearchResult result = jestClient.execute(search);
 | 
	
		
			
				|  |  |         List<FollowupContentESDO> dataList = result.getSourceAsObjectList(FollowupContentESDO.class);
 | 
	
		
			
				|  |  |         //删除原有记录
 | 
	
		
			
				|  |  |         this.esDeleteFollowUpContent(dataList);
 | 
	
		
			
				|  |  |         //保存新的随访详情记录
 | 
	
		
			
				|  |  |         elastricSearchSave.save(newdatalist,esIndex,esType);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     public HashMap<String,String> operaESFollowUpContentData(List<FollowupContentESDO> esdataList){
 | 
	
		
			
				|  |  |         HashMap<String,String> result = new HashMap<>();
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         for (FollowupContentESDO followupContentESDO: esdataList) {
 | 
	
		
			
				|  |  |             
 | 
	
		
			
				|  |  |             switch (followupContentESDO.getFollowup_project()){
 | 
	
		
			
				|  |  |                 case "1":
 | 
	
		
			
				|  |  |                     result.put("NO_SYMPTOM", followupContentESDO.getNO_SYMPTOM());//无症状【0.无 1.有】
 | 
	
		
			
				|  |  |                     result.put("HEADACHE", followupContentESDO.getHEADACHE());//头痛头晕【0.无 1.有】
 | 
	
		
			
				|  |  |                     result.put("NAUSEA", followupContentESDO.getNAUSEA());//恶心呕吐【0.无 1.有】
 | 
	
		
			
				|  |  |                     result.put("VERTIGO_TINNITUS", followupContentESDO.getVERTIGO_TINNITUS());//眼花耳鸣【0.无 1.有】
 | 
	
		
			
				|  |  |                     result.put("DIFFICULTY_BREATHING", followupContentESDO.getDIFFICULTY_BREATHING());//呼吸困难【0.无 1.有】
 | 
	
		
			
				|  |  |                     result.put("PALPITATIONS",followupContentESDO.getPALPITATIONS());//心悸胸闷【0.无 1.有】
 | 
	
		
			
				|  |  |                     result.put("EPISTAXIS_BLEEDING", followupContentESDO.getEPISTAXIS_BLEEDING());//鼻衄出血不止【0.无 1.有】
 | 
	
		
			
				|  |  |                     result.put("LIMBS_NUMB", followupContentESDO.getLIMBS_NUMB());//四肢发麻【0.无 1.有】
 | 
	
		
			
				|  |  |                     result.put("EXTREMITY_EDEMA", followupContentESDO.getEXTREMITY_EDEMA());//下肢水肿【0.无 1.有】
 | 
	
		
			
				|  |  |                     result.put("SYMPTOM_OTHER", followupContentESDO.getSYMPTOM_OTHER());//"其他症状"
 | 
	
		
			
				|  |  |                     result.put("POLYDIPSIA", followupContentESDO.getPOLYDIPSIA());//多饮【0.无 1.有】
 | 
	
		
			
				|  |  |                     result.put("MORE_FOOD", followupContentESDO.getMORE_FOOD());//多食【0.无 1.有】
 | 
	
		
			
				|  |  |                     result.put("MORE_URINE", followupContentESDO.getMORE_URINE());//多尿【0.无 1.有】
 | 
	
		
			
				|  |  |                     result.put("BLURRED_VISION", followupContentESDO.getBLURRED_VISION());//视力模糊【0.无 1.有】
 | 
	
		
			
				|  |  |                     result.put("INFECTION", followupContentESDO.getINFECTION());//感染【0.无 1.有】
 | 
	
		
			
				|  |  |                     result.put("NUMB_HANDS", followupContentESDO.getNUMB_HANDS());//手脚麻木【0.无 1.有】
 | 
	
		
			
				|  |  |                     result.put("WEIGHT_LOSS", followupContentESDO.getWEIGHT());//体重明显下降【0.无 1.有】
 | 
	
		
			
				|  |  |                     result.put("HYPOG_REACT_CODE", followupContentESDO.getHYPOG_REACT_CODE());//低血糖反应【0.无;1.偶尔;2.频繁;】
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 case "2":
 | 
	
		
			
				|  |  |                     result.put("HEIGHT", followupContentESDO.getHEIGHT());//身高
 | 
	
		
			
				|  |  |                     result.put("HEIGHT_EXP", followupContentESDO.getHEIGHT_EXP());//期望身高
 | 
	
		
			
				|  |  |                     result.put("WEIGHT", followupContentESDO.getWEIGHT());//体重
 | 
	
		
			
				|  |  |                     result.put("WEIGHT_EXP", followupContentESDO.getWEIGHT_EXP());//期望体重
 | 
	
		
			
				|  |  |                     result.put("BP_D",followupContentESDO.getBP_D());//舒张压
 | 
	
		
			
				|  |  |                     result.put("BP_U", followupContentESDO.getBP_U());//收缩压
 | 
	
		
			
				|  |  |                     result.put("BS_FPG",followupContentESDO.getBS_FPG());//空腹血糖
 | 
	
		
			
				|  |  |                     result.put("NO_BS_FPG", followupContentESDO.getNO_BS_FPG());//餐后血糖
 | 
	
		
			
				|  |  |                     result.put("RANDOM_BLOOD_SUGAR",followupContentESDO.getRANDOM_BLOOD_SUGAR());//随机血糖
 | 
	
		
			
				|  |  |                     result.put("BMI", followupContentESDO.getBMI());//体质指数
 | 
	
		
			
				|  |  |                     result.put("BMI_EXP", followupContentESDO.getBMI_EXP());//期望体质
 | 
	
		
			
				|  |  |                     result.put("OTHER_POSITIVE_SIGNS", followupContentESDO.getOTHER_POSITIVE_SIGNS());//体征其他
 | 
	
		
			
				|  |  |                     result.put("POFDA_MARK", followupContentESDO.getPOFDA_MARK());//足背动脉搏动【TOUCH_DICT】
 | 
	
		
			
				|  |  |                     result.put("HEART_RATE", followupContentESDO.getHEART_RATE());//心率
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 case "3":
 | 
	
		
			
				|  |  |                     result.put("GHB", followupContentESDO.getGHB());//糖化血红蛋白
 | 
	
		
			
				|  |  |                     result.put("RENAL_FUNCTION_CREATININE", followupContentESDO.getRENAL_FUNCTION_CREATININE());//血清肌酐
 | 
	
		
			
				|  |  |                     result.put("RENAL_FUNCTION_BUN", followupContentESDO.getRENAL_FUNCTION_BUN());//血尿素氮
 | 
	
		
			
				|  |  |                     result.put("MICROALBUMINURIA",followupContentESDO.getMICROALBUMINURIA());//尿微量白蛋白
 | 
	
		
			
				|  |  |                     result.put("EXAM_DATE", followupContentESDO.getEXAM_DATE());//检查日期
 | 
	
		
			
				|  |  |                     result.put("BLOOD_FAT_TRIGLYCERIDE", followupContentESDO.getBLOOD_FAT_TRIGLYCERIDE());//甘油三酯 V01
 | 
	
		
			
				|  |  |                     result.put("BLOOD_FAT_TC", followupContentESDO.getBLOOD_FAT_TC());//总胆固醇 V02
 | 
	
		
			
				|  |  |                     result.put("BLOOD_FAT_LDLC", followupContentESDO.getBLOOD_FAT_LDLC());//血清低密度脂蛋白胆固醇 V03
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 case "4":
 | 
	
		
			
				|  |  |                     result.put("DAILY_SMOKING", followupContentESDO.getDAILY_SMOKING());//日吸烟量
 | 
	
		
			
				|  |  |                     result.put("SOMKING_EXP", followupContentESDO.getSOMKING_EXP());//日吸烟期望
 | 
	
		
			
				|  |  |                     result.put("DAILY_DRINKING",followupContentESDO.getDAILY_DRINKING());//日饮酒量
 | 
	
		
			
				|  |  |                     result.put("DRINK_EXP", followupContentESDO.getDRINK_EXP());//日饮酒期望
 | 
	
		
			
				|  |  |                     result.put("EXERCISE_FREQ_CODE", followupContentESDO.getEXERCISE_FREQ_CODE());//运动频率【HYGIENE_SPORT_FREQ_DICT】
 | 
	
		
			
				|  |  |                     result.put("EXERCISE_FREQ_CODE_EXP", followupContentESDO.getEXERCISE_FREQ_CODE_EXP());//运动频率期望【HYGIENE_SPORT_FREQ_DICT】
 | 
	
		
			
				|  |  |                     result.put("EXERCISE_DURATION_MINS", followupContentESDO.getEXERCISE_DURATION_MINS());//运动时长(min) 分钟/次
 | 
	
		
			
				|  |  |                     result.put("EXERCISE_DURATION_MINS_EXP", followupContentESDO.getEXERCISE_DURATION_MINS_EXP());//运动时长期望(min) 分钟/次期望
 | 
	
		
			
				|  |  |                     result.put("SALT_TAKEN_LEVEL_CODE", followupContentESDO.getSALT_TAKEN_LEVEL_CODE());//摄盐情况【LIGHT_WEIGHT_DICT】
 | 
	
		
			
				|  |  |                     result.put("SALT_TAKEN_LEVEL_EXP", followupContentESDO.getSALT_TAKEN_LEVEL_EXP());//摄盐情况期望【LIGHT_WEIGHT_DICT】
 | 
	
		
			
				|  |  |                     result.put("PSY_ADJUST_RESULT_CODE", followupContentESDO.getPSY_ADJUST_RESULT_CODE());//心里调整【GOOD_FAIR_POOR_DICT】
 | 
	
		
			
				|  |  |                     result.put("COMPLIANCE_RESULT_CODE", followupContentESDO.getCOMPLIANCE_RESULT_CODE());//遵医行为【GOOD_FAIR_POOR_DICT】
 | 
	
		
			
				|  |  |                     result.put("DAILY_STAPLE", followupContentESDO.getDAILY_STAPLE());//主食(克/天)
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 case "5":
 | 
	
		
			
				|  |  |                     result.put("HYP_FOLLOWUP_TYPE_CODE", followupContentESDO.getHYP_FOLLOWUP_TYPE_CODE());//高血压随访分类【FOLLOW_TYPE_DICT】
 | 
	
		
			
				|  |  |                     result.put("HYP_COMPLICATION_DETAIL", followupContentESDO.getHYP_COMPLICATION_DETAIL());//高血压随访分类--详情
 | 
	
		
			
				|  |  |                     result.put("DIA_FOLLOWUP_TYPE_CODE", followupContentESDO.getDIA_FOLLOWUP_TYPE_CODE());//糖尿病随访分类【FOLLOW_TYPE_DICT】
 | 
	
		
			
				|  |  |                     result.put("DIA_COMPLICATION_DETAIL", followupContentESDO.getDIA_COMPLICATION_DETAIL());//糖尿病随访分类--详情
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 case "6":
 | 
	
		
			
				|  |  |                     result.put("DRUG_COMPLIANCE_CODE", followupContentESDO.getDRUG_COMPLIANCE_CODE());//服药依从性【DRUG_STATE_DICT】
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 
 | 
	
		
			
				|  |  |                 case "7":
 | 
	
		
			
				|  |  |                     result.put("CONTROL_DATE", followupContentESDO.getCONTROL_DATE());//控制日期 V04
 | 
	
		
			
				|  |  |                     result.put("CONTROL_CONSTITUTOR", followupContentESDO.getCONTROL_CONSTITUTOR());//制定者姓名 V05
 | 
	
		
			
				|  |  |                     result.put("CONTROL_CONSTITUTOR_DOCTORCODE", followupContentESDO.getCONTROL_CONSTITUTOR_DOCTORCODE());//制定者本地CODE V05
 | 
	
		
			
				|  |  |                     result.put("CONTROL_CONSTITUTOR_JWDOCTORCODE", followupContentESDO.getCONTROL_CONSTITUTOR_JWDOCTORCODE());//制定者本地CODE V05
 | 
	
		
			
				|  |  |                     result.put("CONTROL_BP_U", followupContentESDO.getCONTROL_BP_U());//血压收缩压 V06
 | 
	
		
			
				|  |  |                     result.put("CONTROL_BP_D", followupContentESDO.getCONTROL_BP_D());//血压舒张压 V07
 | 
	
		
			
				|  |  |                     result.put("CONTROL_BS_FPG", followupContentESDO.getCONTROL_NO_BS_FPG());//空腹血糖 V08
 | 
	
		
			
				|  |  |                     result.put("CONTROL_NO_BS_FPG", followupContentESDO.getCONTROL_NO_BS_FPG());//餐后血糖 V09
 | 
	
		
			
				|  |  |                     result.put("CONTROL_GHB", followupContentESDO.getCONTROL_GHB());//糖化血红蛋白 V10
 | 
	
		
			
				|  |  |                     result.put("CONTROL_TRIGLYCERIDE", followupContentESDO.getCONTROL_TRIGLYCERIDE());//甘油三酯 V11
 | 
	
		
			
				|  |  |                     result.put("CONTROL_TOTAL_CHOLESTEROL", followupContentESDO.getCONTROL_TOTAL_CHOLESTEROL());//总胆固醇 V12
 | 
	
		
			
				|  |  |                     result.put("CONTROL_LDL",followupContentESDO.getCONTROL_LDL());//低密度脂蛋白 V13
 | 
	
		
			
				|  |  |                     result.put("CONTROL_WEIGHT", followupContentESDO.getCONTROL_WEIGHT());//体重 V14
 | 
	
		
			
				|  |  |                     result.put("CONTROL_EXERCISE_FREQ_CODE",followupContentESDO.getCONTROL_EXERCISE_FREQ_CODE());//运动频率 V15
 | 
	
		
			
				|  |  |                     result.put("CONTROL_EXERCISE_DURATION_MINS",followupContentESDO.getCONTROL_EXERCISE_DURATION_MINS());//运动时长 V16
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                     
 | 
	
		
			
				|  |  |                 case "8":
 | 
	
		
			
				|  |  |                     result.put("ARCHIVE_TIME", followupContentESDO.getARCHIVE_TIME());//健康教育日期 V17
 | 
	
		
			
				|  |  |                     result.put("ARCHIVE_OPERATOR_NAME", followupContentESDO.getARCHIVE_OPERATOR_NAME());//健康教育记录者 基卫系统医生【传中文名称】 V18
 | 
	
		
			
				|  |  |                     result.put("HEALTH_EDUCATE", followupContentESDO.getHEADACHE());//健康教育【CHRO_HEALTH_EDUCATE_DICT】 V19
 | 
	
		
			
				|  |  |                     result.put("EDUCATE_CONTENT", followupContentESDO.getEDUCATE_CONTENT());//健康教育内容 V20
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                     
 | 
	
		
			
				|  |  |                 case "9":
 | 
	
		
			
				|  |  |                     result.put("DRUG_ADVERSE_MARK", followupContentESDO.getDRUG_ADVERSE_MARK());//药物不良反应【0.无;1.有;】
 | 
	
		
			
				|  |  |                     result.put("ADR_REMARK", followupContentESDO.getADR_REMARK());//药物不良反应【内容】
 | 
	
		
			
				|  |  |                     result.put("TRANSFER_RESON", followupContentESDO.getTRANSFER_RESON());//转诊原因
 | 
	
		
			
				|  |  |                     result.put("TRANSFER_ORG_DEPT", followupContentESDO.getTRANSFER_ORG_DEPT());//转诊机构科室
 | 
	
		
			
				|  |  |                     result.put("REFUSE_REFERRAL", followupContentESDO.getREFUSE_REFERRAL());//患者拒绝转诊【0 否 1 是】
 | 
	
		
			
				|  |  |                     result.put("REFUSE_REFERRAL_WHY", followupContentESDO.getREFUSE_REFERRAL_WHY());//患者拒绝转诊内容
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 case "10":
 | 
	
		
			
				|  |  |                     result.put("ARCHIVE_ID", followupContentESDO.getARCHIVE_ID());//档案ID
 | 
	
		
			
				|  |  |                     result.put("CHECK_FEE_TYPE", followupContentESDO.getCHECK_FEE_TYPE());//检测费用类型
 | 
	
		
			
				|  |  |                     result.put("FAMILY_FOLLOWUP_ID", followupContentESDO.getFAMILY_FOLLOWUP_ID());//随访细表外键随访ID
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |                 default:
 | 
	
		
			
				|  |  |                     break;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |