|
@ -2,6 +2,9 @@ package com.yihu.wlyy.service.app.followup;
|
|
|
|
|
|
import com.fasterxml.jackson.databind.JavaType;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
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.dict.SystemDict;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.followup.Followup;
|
|
@ -133,22 +136,22 @@ public class FollowUpService extends BaseService {
|
|
|
re.put("followupTypeName", followupTypeName);
|
|
|
|
|
|
//随访类别转译
|
|
|
|
|
|
|
|
|
String followupClass = followup.getFollowupClass();
|
|
|
re.put("followupClass", followupClass);
|
|
|
|
|
|
|
|
|
String followupClassName = systemDictService.getDictValue("FOLLOWUP_CLASS_DICT", followup.getFollowupClass());
|
|
|
if (StringUtils.isNoneBlank(followupClass) && followupClass.contains(",")) {
|
|
|
if(StringUtils.isNoneBlank(followupClass) && followupClass.contains(",")){
|
|
|
String[] followupClassArray = followupClass.split(",");
|
|
|
followupClassName = "";
|
|
|
for (int i = 0; i < followupClassArray.length; i++) {
|
|
|
followupClassName += systemDictService.getDictValue("FOLLOWUP_CLASS_DICT", followupClassArray[i]);
|
|
|
if (i != followupClassArray.length - 1) {
|
|
|
followupClassName += ",";
|
|
|
if(i != followupClassArray.length -1){
|
|
|
followupClassName +=",";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
re.put("followupClassName", followupClassName);
|
|
|
|
|
|
//随访管理状态转译
|
|
@ -181,23 +184,23 @@ public class FollowUpService extends BaseService {
|
|
|
for (Followup followup : list) {
|
|
|
String date = DateUtil.dateToStrShort(followup.getFollowupDate());
|
|
|
Map<String, String> map = getFollowupDetail(followup);
|
|
|
if (temp.containsKey(date)) {
|
|
|
if(temp.containsKey(date)){
|
|
|
Map<String, Object> vo = temp.get(date);
|
|
|
vo.put("num", Integer.parseInt(vo.get("num").toString()) + 1);
|
|
|
((List<Map<String, String>>) vo.get("list")).add(map);
|
|
|
temp.put(date, vo);
|
|
|
} else {
|
|
|
vo.put("num",Integer.parseInt(vo.get("num").toString())+1);
|
|
|
((List<Map<String, String>>)vo.get("list")).add(map);
|
|
|
temp.put(date,vo);
|
|
|
}else{
|
|
|
Map<String, Object> vo = new HashMap<>();
|
|
|
List<Map<String, String>> list1 = new ArrayList<>();
|
|
|
vo.put("date", date);
|
|
|
vo.put("num", 1);
|
|
|
vo.put("date",date);
|
|
|
vo.put("num",1);
|
|
|
list1.add(map);
|
|
|
vo.put("list", list1);
|
|
|
temp.put(date, vo);
|
|
|
vo.put("list",list1);
|
|
|
temp.put(date,vo);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
for (Map<String, Object> map : temp.values()) {
|
|
|
for (Map<String, Object> map:temp.values()){
|
|
|
re.add(map);
|
|
|
}
|
|
|
}
|
|
@ -212,26 +215,25 @@ public class FollowUpService extends BaseService {
|
|
|
* @param teamCode
|
|
|
* @param page
|
|
|
* @param pageSize
|
|
|
* @param type 类型:0全部,1计划,2记录
|
|
|
* @param type 类型:0全部,1计划,2记录
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray getListByPatientAndTeam(String patient, Long teamCode, int page, int pageSize, String type) {
|
|
|
Sort sort = new Sort(Sort.Direction.DESC, "createTime");
|
|
|
PageRequest pageRequest = new PageRequest(page, pageSize, sort);
|
|
|
Sort sort = new Sort(Sort.Direction.DESC,"createTime");
|
|
|
PageRequest pageRequest = new PageRequest(page, pageSize,sort);
|
|
|
Page<Object> result = null;
|
|
|
|
|
|
if (StringUtils.isBlank(type)) {
|
|
|
|
|
|
if(StringUtils.isBlank(type)){
|
|
|
result = followupDao.findByPatientAndTeam(patient, teamCode, pageRequest);
|
|
|
} else if ("1".equals(type)) {
|
|
|
}else if("1".equals(type)){
|
|
|
//已经开始的就是记录
|
|
|
result = followupDao.findPlanByPatientAndTeam(patient, teamCode, pageRequest);
|
|
|
} else if ("2".equals(type)) {
|
|
|
}else if("2".equals(type)){
|
|
|
//未开始的就是计划
|
|
|
result = followupDao.findRecordByPatientAndTeam(patient, teamCode, pageRequest);
|
|
|
} else {
|
|
|
}
|
|
|
|
|
|
|
|
|
}else{}
|
|
|
|
|
|
|
|
|
JSONArray array = new JSONArray();
|
|
|
|
|
|
if (result != null && result.getContent().size() > 0) {
|
|
@ -261,10 +263,10 @@ public class FollowUpService extends BaseService {
|
|
|
Object[] objArr = (Object[]) obj;
|
|
|
// 返回值增加居民信息
|
|
|
Patient patientDetail = patientDao.findByCode(patient);
|
|
|
followup.put("patientName", patientDetail.getName() != null ? patientDetail.getName() : "");
|
|
|
followup.put("photo", patientDetail.getPhoto() != null ? patientDetail.getPhoto() : "");
|
|
|
followup.put("sex", patientDetail.getSex() != null ? patientDetail.getSex() : "");
|
|
|
followup.put("birthday", patientDetail.getBirthday() != null ? patientDetail.getBirthday() : "");
|
|
|
followup.put("patientName", patientDetail.getName()!=null?patientDetail.getName():"");
|
|
|
followup.put("photo", patientDetail.getPhoto()!=null?patientDetail.getPhoto():"");
|
|
|
followup.put("sex", patientDetail.getSex()!=null?patientDetail.getSex():"");
|
|
|
followup.put("birthday", patientDetail.getBirthday()!=null?patientDetail.getBirthday():"");
|
|
|
|
|
|
followup.put("id", objArr[15]);
|
|
|
followup.put("followupNo", objArr[16]);
|
|
@ -274,35 +276,34 @@ public class FollowUpService extends BaseService {
|
|
|
followup.put("followupType", objArr[3] == null ? "" : objArr[3]);
|
|
|
followup.put("followupTypeName", objArr[3] == null ? "" : (dictMap.get(objArr[3].toString()) != null ? dictMap.get(objArr[3].toString()) : ""));
|
|
|
followup.put("followupClass", objArr[4] == null ? "" : objArr[4]);
|
|
|
|
|
|
|
|
|
// followup.put("followupClassName", objArr[4] == null ? "" : (objArr[4].toString().equals("1") ? "高血压" : "糖尿病"));
|
|
|
|
|
|
if (objArr[4] == null) {
|
|
|
|
|
|
if( objArr[4] == null){
|
|
|
followup.put("followupClassName", "");
|
|
|
} else {
|
|
|
if (objArr[4].toString().equals("1")) {
|
|
|
}else{
|
|
|
if(objArr[4].toString().equals("1")){
|
|
|
followup.put("followupClassName", "高血压");
|
|
|
} else if (objArr[4].toString().equals("2")) {
|
|
|
}else if(objArr[4].toString().equals("2")){
|
|
|
followup.put("followupClassName", "糖尿病");
|
|
|
} else if (objArr[4].toString().equals("1,2")) {
|
|
|
}else if(objArr[4].toString().equals("3")){
|
|
|
followup.put("followupClassName", "高血压,糖尿病");
|
|
|
} else {
|
|
|
}
|
|
|
}else{}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
followup.put("status", objArr[5] == null ? "" : objArr[5]);
|
|
|
followup.put("statusName", objArr[5] == null ? "" : (statusMap.get(objArr[5].toString()) != null ? statusMap.get(objArr[5].toString()) : ""));
|
|
|
followup.put("createTime", objArr[6] != null ? DateUtil.dateToStrLong((Date) objArr[6]) : "");
|
|
|
followup.put("updateTime", objArr[7] != null ? DateUtil.dateToStrLong((Date) objArr[7]) : "");
|
|
|
followup.put("createTime", objArr[6] != null ? DateUtil.dateToStrLong((Date)objArr[6]) : "");
|
|
|
followup.put("updateTime", objArr[7] != null ? DateUtil.dateToStrLong((Date)objArr[7]) : "");
|
|
|
followup.put("followupManagerStatus", objArr[8] == null ? "" : objArr[8]);
|
|
|
followup.put("followupManagerStatusName", objArr[8] == null ? "" : (mngStatusMap.get(objArr[8].toString()) != null ? mngStatusMap.get(objArr[8].toString()) : ""));
|
|
|
followup.put("creatorCode", objArr[9]);
|
|
|
followup.put("creatorName", objArr[10]);
|
|
|
followup.put("creatorPhoto", objArr[11]);
|
|
|
followup.put("followupDate", objArr[12] != null ? DateUtil.dateToStrLong((Date) objArr[12]) : "");
|
|
|
followup.put("followupPlanDate", objArr[13] != null ? DateUtil.dateToStrLong((Date) objArr[13]) : "");
|
|
|
followup.put("followupNextDate", objArr[14] != null ? DateUtil.dateToStrLong((Date) objArr[14]) : "");
|
|
|
followup.put("followupDate", objArr[12] != null ? DateUtil.dateToStrLong((Date)objArr[12]) : "");
|
|
|
followup.put("followupPlanDate", objArr[13] != null ? DateUtil.dateToStrLong((Date)objArr[13]) : "");
|
|
|
followup.put("followupNextDate", objArr[14] != null ? DateUtil.dateToStrLong((Date)objArr[14]) : "");
|
|
|
array.put(followup);
|
|
|
}
|
|
|
}
|
|
@ -350,7 +351,7 @@ public class FollowUpService extends BaseService {
|
|
|
SignFamily signFamily = signFamilyDao.findByjiatingPatient(patientCode);
|
|
|
if (signFamily == null) {
|
|
|
signFamily = signFamilyDao.findBySanshiPatient(patientCode);
|
|
|
if (signFamily == null) {
|
|
|
if(signFamily==null){
|
|
|
throw new Exception("can not find patient's family sign info");
|
|
|
}
|
|
|
}
|
|
@ -415,12 +416,12 @@ public class FollowUpService extends BaseService {
|
|
|
/**
|
|
|
* 开始随访记录
|
|
|
*/
|
|
|
public void startFollowup(String id, String date, String followupType, String followupClass, String followupManagerStatus, String plandate) throws Exception {
|
|
|
public void startFollowup(String id, String date, String followupType, String followupClass, String followupManagerStatus,String plandate,String prescriptioncode) throws Exception {
|
|
|
Followup followup = followupDao.findOne(Long.valueOf(id));
|
|
|
if (followup != null) {
|
|
|
followup.setFollowupDate(DateUtil.strToDate(date));
|
|
|
//计划下次随访时间--huangwenjie.2017.10.19
|
|
|
if (StringUtils.isNoneBlank(plandate)) {
|
|
|
if(StringUtils.isNoneBlank(plandate)){
|
|
|
followup.setFollowupNextDate(DateUtil.strToDate(plandate));
|
|
|
Followup nextFollowup = new Followup();
|
|
|
nextFollowup.setDataFrom(followup.getDataFrom());
|
|
@ -447,12 +448,13 @@ public class FollowUpService extends BaseService {
|
|
|
nextFollowup.setIdcard(followup.getIdcard());
|
|
|
nextFollowup.setSignType(followup.getSignType());
|
|
|
followupDao.save(nextFollowup);
|
|
|
|
|
|
|
|
|
}
|
|
|
followup.setFollowupType(followupType);
|
|
|
followup.setFollowupClass(followupClass);
|
|
|
followup.setFollowupManagerStatus(followupManagerStatus);
|
|
|
followup.setStatus("3"); //状态 0取消 1已完成 2未开始 3进行中
|
|
|
followup.setPrescriptionCode(prescriptioncode);
|
|
|
|
|
|
followupDao.save(followup);
|
|
|
} else {
|
|
@ -463,7 +465,7 @@ public class FollowUpService extends BaseService {
|
|
|
/**
|
|
|
* 新增临时随访记录(返回ID)
|
|
|
*/
|
|
|
public String addFollowup(String doctorCode, String patientCode, String date, String followupType, String followupClass, String followupManagerStatus, String plandate) throws Exception {
|
|
|
public String addFollowup(String doctorCode, String patientCode, String date, String followupType, String followupClass, String followupManagerStatus,String plandate,String prescriptioncode) throws Exception {
|
|
|
String re = "";
|
|
|
|
|
|
//获取医生信息
|
|
@ -480,8 +482,8 @@ public class FollowUpService extends BaseService {
|
|
|
SignFamily signFamily = signFamilyDao.findByjiatingPatient(patientCode);
|
|
|
if (signFamily == null) {
|
|
|
signFamily = signFamilyDao.findBySanshiPatient(patientCode);
|
|
|
if (signFamily == null)
|
|
|
throw new Exception("can not find patient's family sign info");
|
|
|
if(signFamily==null)
|
|
|
throw new Exception("can not find patient's family sign info");
|
|
|
}
|
|
|
|
|
|
Followup followup = new Followup();
|
|
@ -499,16 +501,21 @@ public class FollowUpService extends BaseService {
|
|
|
followup.setFollowupClass(followupClass);
|
|
|
followup.setFollowupManagerStatus(followupManagerStatus);
|
|
|
followup.setDataFrom("2");//数据来源 1基卫 2APP
|
|
|
followup.setStatus("3"); //状态 0取消 1已完成 2未开始 3进行中
|
|
|
followup.setStatus("2"); //状态 0取消 1已完成 2未开始 3进行中
|
|
|
followup.setCreateTime(new Date());
|
|
|
followup.setCreater(doctorCode);
|
|
|
followup.setAdminTeamCode(signFamily.getAdminTeamId());
|
|
|
followup.setSignType(2);
|
|
|
//保存质询code
|
|
|
followup.setSignCode(patientService.getSignCodeByPatient(patientCode));
|
|
|
|
|
|
//如果有填入续方CODE,则添加续方关联--huangwenjie.2017.11.02
|
|
|
if(StringUtils.isNotBlank(prescriptioncode)){
|
|
|
followup.setPrescriptionCode(prescriptioncode);
|
|
|
}
|
|
|
|
|
|
//计划下次随访时间--ysj.2017.10.26
|
|
|
if (StringUtils.isNoneBlank(plandate)) {
|
|
|
if(StringUtils.isNoneBlank(plandate)){
|
|
|
followup.setFollowupNextDate(DateUtil.strToDate(plandate));
|
|
|
Followup nextFollowup = new Followup();
|
|
|
nextFollowup.setDataFrom(followup.getDataFrom());
|
|
@ -564,22 +571,22 @@ public class FollowUpService extends BaseService {
|
|
|
if (followup != null) {
|
|
|
followup.setStatus("1"); //状态 0取消 1已完成 2未开始 3进行中
|
|
|
followup = followupDao.save(followup);
|
|
|
|
|
|
|
|
|
//上传随访计划映射表记录
|
|
|
FollowupMapping followupMapping = followUpMappingDao.findByFollowupId(Integer.parseInt(String.valueOf(followup.getId())));
|
|
|
|
|
|
if (followupMapping == null) {
|
|
|
|
|
|
if(followupMapping == null){
|
|
|
followupMapping = new FollowupMapping();
|
|
|
}
|
|
|
|
|
|
|
|
|
followupMapping.setFollowupId(Integer.parseInt(String.valueOf(followup.getId())));
|
|
|
followupMapping.setCode(UUID.randomUUID().toString());
|
|
|
followupMapping.setCreateTime(DateUtil.getNowTimestamp());
|
|
|
followupMapping.setUpdateTime(DateUtil.getNowTimestamp());
|
|
|
followupMapping.setNeedUpload(1);
|
|
|
|
|
|
|
|
|
followUpMappingDao.save(followupMapping);
|
|
|
|
|
|
|
|
|
// new Thread(new FollowupUploadTask(String.valueOf(followup.getId()))).start();
|
|
|
} else {
|
|
|
throw new Exception("not exit follow:" + id + ".\r\n");
|
|
@ -607,7 +614,9 @@ public class FollowUpService extends BaseService {
|
|
|
public List<Map<String, String>> getFollowupProject(String id) throws Exception {
|
|
|
List<Map<String, String>> re = new ArrayList<>();
|
|
|
//获取已填写的面访项目
|
|
|
List<String> project = followupContentDao.findProjectByFollowupId(Long.valueOf(id));
|
|
|
// List<String> project = followupContentDao.findProjectByFollowupId(Long.valueOf(id));
|
|
|
//修改为通过ES查询---2017.11.01--huangwenjie
|
|
|
List<String> project = esfindProjectByFollowupId(id);
|
|
|
//获取所有面访项目
|
|
|
List<SystemDict> dictList = systemDictService.getDictByDictName("FOLLOWUP_PROJECT");
|
|
|
if (dictList != null && dictList.size() > 0) {
|
|
@ -666,13 +675,13 @@ public class FollowUpService extends BaseService {
|
|
|
followupContentDao.save(newList);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Followup followup = followupDao.findOne(Long.valueOf(id));
|
|
|
|
|
|
|
|
|
//如果该随访是已完成的,则添加随访信息上传映射,上传到基卫
|
|
|
if ("1".equals(followup.getStatus())) {
|
|
|
if("1".equals(followup.getStatus())){
|
|
|
FollowupMapping followupMapping = followUpMappingDao.findByFollowupId(Integer.parseInt(id));
|
|
|
if (followupMapping == null) {
|
|
|
if(followupMapping == null){
|
|
|
followupMapping = new FollowupMapping();
|
|
|
followupMapping.setCode(UUID.randomUUID().toString());
|
|
|
followupMapping.setFollowupId(Integer.parseInt(id));
|
|
@ -858,5 +867,174 @@ public class FollowUpService extends BaseService {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*ES 保存随访记录详情
|
|
|
*@author huangwenjie
|
|
|
*@date 2017/11/1 14:57
|
|
|
*/
|
|
|
@Transactional
|
|
|
public void esSaveFollowupProjectData(String id, String followupProject, String followupProjectData) throws Exception {
|
|
|
|
|
|
JestClient jestClient = elasticFactory.getJestClient();
|
|
|
//先根据条件查找出来
|
|
|
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
|
|
searchSourceBuilder.query(
|
|
|
new BoolQueryBuilder()
|
|
|
.must(QueryBuilders.matchQuery("followup_id", id))
|
|
|
.must(QueryBuilders.matchQuery("followup_project", followupProject))
|
|
|
);
|
|
|
|
|
|
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);
|
|
|
|
|
|
//保存新的随访详情信息
|
|
|
List<FollowupContentESDO> newdatalist = new ArrayList<>();
|
|
|
FollowupContentESDO followupContentESDO = new FollowupContentESDO();
|
|
|
|
|
|
followupContentESDO = JSON.parseObject(followupProjectData,FollowupContentESDO.class);
|
|
|
|
|
|
followupContentESDO.setFollowup_id(id);
|
|
|
followupContentESDO.setFollowup_project(followupProject);
|
|
|
followupContentESDO.setCreate_time(new Date());
|
|
|
newdatalist.add(followupContentESDO);
|
|
|
elastricSearchSave.save(newdatalist,esIndex,esType);
|
|
|
|
|
|
|
|
|
//如果该随访是已完成的,则添加随访信息上传映射,上传到基卫
|
|
|
Followup followup = followupDao.findOne(Long.valueOf(id));
|
|
|
if("1".equals(followup.getStatus())){
|
|
|
FollowupMapping followupMapping = followUpMappingDao.findByFollowupId(Integer.parseInt(id));
|
|
|
if(followupMapping == null){
|
|
|
followupMapping = new FollowupMapping();
|
|
|
followupMapping.setCode(UUID.randomUUID().toString());
|
|
|
followupMapping.setFollowupId(Integer.parseInt(id));
|
|
|
followupMapping.setUpdateTime(DateUtil.getNowTimestamp());
|
|
|
followupMapping.setCreateTime(DateUtil.getNowTimestamp());
|
|
|
}
|
|
|
followupMapping.setNeedUpload(1);
|
|
|
followUpMappingDao.save(followupMapping);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* ES获取面访项目数据
|
|
|
*/
|
|
|
public FollowupContentESDO esGetFollowupProjectData(String id, String followupProject) throws Exception {
|
|
|
//根据随访ID、分类ID获取随访记录详情
|
|
|
|
|
|
JestClient jestClient = elasticFactory.getJestClient();
|
|
|
//先根据条件查找出来
|
|
|
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
|
|
searchSourceBuilder.query(
|
|
|
new BoolQueryBuilder()
|
|
|
.must(QueryBuilders.matchQuery("followup_id", id))
|
|
|
.must(QueryBuilders.matchQuery("followup_project", followupProject))
|
|
|
);
|
|
|
|
|
|
Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
|
|
|
.build();
|
|
|
SearchResult result = jestClient.execute(search);
|
|
|
FollowupContentESDO followupContentESDO = result.getSourceAsObject(FollowupContentESDO.class);
|
|
|
return followupContentESDO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*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<String> esfindProjectByFollowupId(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<>();
|
|
|
|
|
|
followupContentESDOList = result.getSourceAsObjectList(FollowupContentESDO.class);
|
|
|
if(!followupContentESDOList.isEmpty()){
|
|
|
for (FollowupContentESDO followupContentESDO: followupContentESDOList) {
|
|
|
resultList.add(followupContentESDO.getFollowup_project());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return resultList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 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;
|
|
|
}
|
|
|
|
|
|
public String getFollowupByPrescriptionCode(String prescriptionCode) {
|
|
|
Followup followup = followupDao.getFollowupByPrescriptionCode(prescriptionCode);
|
|
|
|
|
|
String jsonString = JSON.toJSONString(followup);
|
|
|
|
|
|
return jsonString;
|
|
|
}
|
|
|
|
|
|
}
|