|
@ -11,28 +11,20 @@ import com.yihu.jw.entity.followup.Followup;
|
|
|
import com.yihu.jw.entity.followup.FollowupContent;
|
|
|
import com.yihu.jw.entity.followup.FollowupSign;
|
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
|
import com.yihu.jw.entity.hospital.message.MessageNoticeSetting;
|
|
|
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
|
|
|
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
|
|
|
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
|
|
|
import com.yihu.jw.hospital.message.service.SystemMessageService;
|
|
|
import com.yihu.jw.hospital.module.followup.dao.FollowUpDao;
|
|
|
import com.yihu.jw.hospital.module.followup.dao.FollowupContentDao;
|
|
|
import com.yihu.jw.hospital.module.followup.dao.FollowupDrugsDao;
|
|
|
import com.yihu.jw.hospital.module.followup.dao.FollowupSignDao;
|
|
|
import com.yihu.jw.hospital.module.rehabilitation.service.RehabilitationManageService;
|
|
|
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
|
|
|
import com.yihu.jw.hospital.task.PushMsgTask;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.patient.service.BasePatientService;
|
|
|
import com.yihu.jw.rehabilitation.ServiceItemPlanDao;
|
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.util.http.HttpClientUtil;
|
|
|
import com.yihu.jw.util.idcard.IdCardUtil;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.http.NameValuePair;
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
import org.jsoup.Jsoup;
|
|
@ -40,7 +32,6 @@ import org.jsoup.nodes.Document;
|
|
|
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.data.domain.Sort;
|
|
@ -81,7 +72,6 @@ public class FollowUpService {
|
|
|
|
|
|
@Autowired
|
|
|
private FollowupContentDao followupContentDao;
|
|
|
|
|
|
@Autowired
|
|
|
private WlyyHospitalSysDictDao hospitalSysDictDao;
|
|
|
@Autowired
|
|
@ -89,34 +79,144 @@ public class FollowUpService {
|
|
|
@Autowired
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
@Autowired
|
|
|
private PushMsgTask pushMsgTask;
|
|
|
@Autowired
|
|
|
private RehabilitationManageService rehabilitationManageService;
|
|
|
@Autowired
|
|
|
private ServiceItemPlanDao serviceItemPlanDao;
|
|
|
|
|
|
@Autowired
|
|
|
private HttpClientUtil httpClientUtil;
|
|
|
|
|
|
@Value("${doctorAssistant.api}")
|
|
|
private String doctorAssistant;
|
|
|
|
|
|
@Value("${doctorAssistant.target_url}")
|
|
|
private String targetUrl;
|
|
|
//
|
|
|
// @Value("${es.type.FollowUpContent}")
|
|
|
// private String esType;
|
|
|
// @Value("${es.index.FollowUp}")
|
|
|
// private String esIndex;
|
|
|
|
|
|
@Autowired
|
|
|
private SystemMessageService messageService;
|
|
|
@Autowired
|
|
|
private ObjectMapper objectMapper;
|
|
|
@Autowired
|
|
|
private FollowupSignDao followupSignDao;
|
|
|
@Autowired
|
|
|
private PrescriptionDao prescriptionDao;
|
|
|
|
|
|
//随访记录列表
|
|
|
public PageEnvelop followupPage(String businessType, String businessSource, String startDate, String endDate, String patientName,
|
|
|
String followupStatus,String doctorName, Integer page, Integer size){
|
|
|
String sql = "SELECT DISTINCT f.id,f.patient_name patientName,f.patient_code patientCode,p.idcard,p.birthday,p.sex,p.mobile, " +
|
|
|
"f.doctor_code doctorCode,f.doctor_name doctorName,pl.disease_name businessTypeName,pl.disease businessType, " +
|
|
|
"h.dept_code deptCode,h.dept_name deptName,f.`status`,date_format(f.followup_date, '%Y-%m-%d %H:%i:%s') followupDate,'诊后康复' businessSource," +
|
|
|
"date_format(f.followup_plan_date, '%Y-%m-%d %H:%i:%s') followupPlanDate,date_format(pl.create_time, '%Y-%m-%d %H:%i:%s') turnDownDate," +
|
|
|
"pl.plan_doctor_name planDoctorName,h2.dept_name turnDownDeptName ";
|
|
|
String countSql = "select count(DISTINCT f.id) ";
|
|
|
String filter = " from wlyy_followup f " +
|
|
|
"INNER JOIN base_service_item_plan ip on f.id = ip.relation_code and ip.relation_type='6' " +
|
|
|
"LEFT JOIN wlyy_patient_rehabilitation_plan pl on pl.id = ip.plan_id " +
|
|
|
"INNER JOIN base_patient p on p.id = f.patient_code " +
|
|
|
"LEFT JOIN base_doctor_hospital h on f.doctor_code=h.doctor_code and h.del=1 " +
|
|
|
"LEFT JOIN base_doctor_hospital h2 on pl.plan_doctor=h2.doctor_code and h2.del=1 " +
|
|
|
"WHERE 1=1 ";
|
|
|
if(StringUtils.isNotBlank(businessType)){
|
|
|
filter += " and pl.disease='"+businessType+"' ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(businessSource)){
|
|
|
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(patientName)){
|
|
|
filter += " and f.patient_name like '%" + patientName + "%' ";
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(followupStatus)){
|
|
|
filter += " and f.status='"+followupStatus+"' ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(doctorName)){
|
|
|
sql += " and f.doctor_name like '%"+doctorName+"%' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
|
filter += " and f.followup_date>='"+startDate+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(endDate)){
|
|
|
filter += " and f.followup_date<='"+endDate+" 23:59:59' ";
|
|
|
}
|
|
|
String orderBy = " order by f.followup_date desc limit "+(page-1)*size+","+size;
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql+filter+orderBy);
|
|
|
for (Map<String, Object> vo : list) {
|
|
|
String idcard = vo.get("idcard")+"";
|
|
|
String birthday = vo.get("birthday")+"";
|
|
|
Integer age = com.yihu.jw.util.common.IdCardUtil.getAgeByBirthdayOrIdcard(idcard,DateUtil.strToDate(birthday));
|
|
|
String status = vo.get("status")+"";
|
|
|
if("1".equals(status)){
|
|
|
vo.put("statusName", "已完成");
|
|
|
}else {
|
|
|
vo.put("statusName", "未完成");
|
|
|
}
|
|
|
vo.put("age", age);
|
|
|
String sex = vo.get("sex")+"";
|
|
|
if("1".equals(sex)){
|
|
|
vo.put("sexName", "男");
|
|
|
}else if("2".equals(sex)){
|
|
|
vo.put("sexName", "女");
|
|
|
}else {
|
|
|
vo.put("sexName", "未知");
|
|
|
}
|
|
|
}
|
|
|
long count = jdbcTemplate.queryForObject(countSql+filter,Long.class);
|
|
|
return PageEnvelop.getSuccessListWithPage("查询成功",list,page,size,count);
|
|
|
}
|
|
|
|
|
|
//业务类型
|
|
|
public List<Map<String, Object>> businessTypeList(){
|
|
|
String sql = "select distinct disease code,disease_name name from wlyy_patient_rehabilitation_plan order by disease_name";
|
|
|
return jdbcTemplate.queryForList(sql);
|
|
|
}
|
|
|
|
|
|
public List<Map<String, Object>> followupList(String businessType, String businessSource, String startDate, String endDate, String patientName,
|
|
|
String followupStatus,String doctorName){
|
|
|
String sql = "SELECT DISTINCT f.id,f.patient_name patientName,f.patient_code patientCode,p.idcard,p.birthday,p.sex,p.mobile,p.address, " +
|
|
|
"f.doctor_code doctorCode,f.doctor_name doctorName,pl.disease_name businessTypeName,pl.disease businessType, " +
|
|
|
"h.dept_code deptCode,h.dept_name deptName,f.`status`,date_format(f.followup_date, '%Y-%m-%d %H:%i:%s') followupDate,'诊后康复' businessSource," +
|
|
|
"date_format(f.followup_plan_date, '%Y-%m-%d %H:%i:%s') followupPlanDate,date_format(pl.create_time, '%Y-%m-%d %H:%i:%s') turnDownDate,pl.plan_doctor_name planDoctorName,h2.dept_name turnDownDeptName ";
|
|
|
String filter = " from wlyy_followup f " +
|
|
|
"INNER JOIN base_service_item_plan ip on f.id = ip.relation_code and ip.relation_type='6' " +
|
|
|
"LEFT JOIN wlyy_patient_rehabilitation_plan pl on pl.id = ip.plan_id " +
|
|
|
"INNER JOIN base_patient p on p.id = f.patient_code " +
|
|
|
"LEFT JOIN base_doctor_hospital h on f.doctor_code=h.doctor_code and h.del=1 " +
|
|
|
"LEFT JOIN base_doctor_hospital h2 on pl.plan_doctor=h2.doctor_code and h2.del=1 " +
|
|
|
"WHERE 1=1 ";
|
|
|
if(StringUtils.isNotBlank(businessType)){
|
|
|
filter += " and pl.disease='"+businessType+"' ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(businessSource)){
|
|
|
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(patientName)){
|
|
|
filter += " and f.patient_name like '%" + patientName + "%' ";
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(followupStatus)){
|
|
|
filter += " and f.status='"+followupStatus+"' ";
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(doctorName)){
|
|
|
sql += " and f.doctor_name like '%"+doctorName+"%' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(startDate)){
|
|
|
filter += " and f.followup_date>='"+startDate+"' ";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(endDate)){
|
|
|
filter += " and f.followup_date<='"+endDate+" 23:59:59' ";
|
|
|
}
|
|
|
String orderBy = " order by f.followup_date desc ";
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql+filter+orderBy);
|
|
|
for (Map<String, Object> vo : list) {
|
|
|
String idcard = vo.get("idcard")+"";
|
|
|
String status = vo.get("status")+"";
|
|
|
if("1".equals(status)){
|
|
|
vo.put("statusName", "已完成");
|
|
|
}else {
|
|
|
vo.put("statusName", "未完成");
|
|
|
}
|
|
|
String sex = vo.get("sex")+"";
|
|
|
if("1".equals(sex)){
|
|
|
vo.put("sexName", "男");
|
|
|
}else if("2".equals(sex)){
|
|
|
vo.put("sexName", "女");
|
|
|
}else {
|
|
|
vo.put("sexName", "未知");
|
|
|
}
|
|
|
String birthday = vo.get("birthday")+"";
|
|
|
Integer age = com.yihu.jw.util.common.IdCardUtil.getAgeByBirthdayOrIdcard(idcard,DateUtil.strToDate(birthday));
|
|
|
vo.put("age", age);
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
//字典
|
|
|
public String getDictValue(String dictName,String code){
|
|
@ -355,9 +455,7 @@ public class FollowUpService {
|
|
|
*/
|
|
|
public JSONArray getListByPatient(
|
|
|
String patient, int page, int pageSize, String type,String doctorCode) {
|
|
|
// Sort sort = new Sort(Sort.Direction.DESC, "createTime");
|
|
|
PageRequest pageRequest = PageRequest.of(page, pageSize);
|
|
|
|
|
|
Page<Object> result = null;
|
|
|
|
|
|
if (StringUtils.isBlank(type)) {
|
|
@ -473,11 +571,9 @@ public class FollowUpService {
|
|
|
public List<Map<String, String>> getListByCreater(String doctorCode, String startTime, String endTime, String page, String pageSize) throws Exception {
|
|
|
List<Map<String, String>> re = new ArrayList<>();
|
|
|
// 排序
|
|
|
// Sort sort = new Sort(Sort.Direction.ASC, "followupDate");
|
|
|
// 分页信息
|
|
|
int pageInt = Integer.valueOf(page) - 1;
|
|
|
int pageSizeInt = Integer.valueOf(pageSize);
|
|
|
// Pageable pageRequest = new PageRequest(pageInt, pageSizeInt, sort);
|
|
|
PageRequest pageRequest = PageRequest.of(pageInt, pageSizeInt);
|
|
|
List<Followup> list = followupDao.findByCreater(doctorCode, DateUtil.strToDate(startTime), DateUtil.strToDate(endTime), pageRequest);
|
|
|
|
|
@ -1076,37 +1172,6 @@ public class FollowUpService {
|
|
|
message.setType("4");//随访计划提醒
|
|
|
message.setReadonly(1);//是否只读消息
|
|
|
list.add(message);
|
|
|
|
|
|
if (messageService.getMessageNoticeSettingByMessageType(doctor, "1", MessageNoticeSetting.MessageTypeEnum.systemSwitch.getValue())) {
|
|
|
// 推送消息给医生
|
|
|
pushMsgTask.put(doctor, "4", title, content, "");
|
|
|
try {
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
List<Followup> followups = followupDao.getByDoctorPlan(doctor, format.parse(start), format.parse(end));
|
|
|
for (Followup followup : followups) {
|
|
|
// 新增发送医生助手模板消息 v1.4.0 by wujunjie
|
|
|
BaseDoctorDO doctor1 = doctorDao.findById(doctor).orElse(null);
|
|
|
String doctorOpenID = doctor1.getOpenid();
|
|
|
if (StringUtils.isNotEmpty(doctorOpenID)) {
|
|
|
String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("type", "6"));
|
|
|
params.add(new BasicNameValuePair("openId", doctorOpenID));
|
|
|
params.add(new BasicNameValuePair("url", targetUrl));
|
|
|
params.add(new BasicNameValuePair("first", "您今日有" + count + "个随访计划待处理"));
|
|
|
params.add(new BasicNameValuePair("remark", ""));
|
|
|
SimpleDateFormat formatDate = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
|
|
|
String newDate = formatDate.format(new Date());
|
|
|
String keywords = followup.getPatientName() + newDate + "," + "请进入手机APP查看";
|
|
|
params.add(new BasicNameValuePair("keywords", keywords));
|
|
|
|
|
|
httpClientUtil.post(url, params, "UTF-8");
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
messageDao.saveAll(list);
|
|
|
}
|
|
@ -1117,236 +1182,6 @@ public class FollowUpService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* ES 保存随访记录详情
|
|
|
*
|
|
|
* @author huangwenjie
|
|
|
* @date 2017/11/1 14:57
|
|
|
*/
|
|
|
// @Transactional
|
|
|
// public void esSaveFollowupProjectData(String id, String followupProject, String followupProjectData) throws Exception {
|
|
|
// JestClient jestClient = null;
|
|
|
// try {
|
|
|
//
|
|
|
//
|
|
|
// 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);
|
|
|
//
|
|
|
// List<FollowupContentESDO> dataList = new ArrayList<>();
|
|
|
// if(followupContentESDO != null){
|
|
|
// dataList.add(followupContentESDO);
|
|
|
// //删除原有记录
|
|
|
// this.esDeleteFollowUpContent(dataList);
|
|
|
// }
|
|
|
//
|
|
|
// //保存新的随访详情信息
|
|
|
// List<FollowupContentESDO> newdatalist = new ArrayList<>();
|
|
|
// 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);
|
|
|
// //随访完成,增加随访状态完成的标记
|
|
|
// Prescription prescription = prescriptionDao.findByCode(followup.getPrescriptionCode());
|
|
|
// if(prescription != null){
|
|
|
// prescription.setViewSuifang(1);
|
|
|
// prescriptionDao.save(prescription);
|
|
|
// }
|
|
|
// }
|
|
|
//
|
|
|
// } finally {
|
|
|
// if (jestClient != null) {
|
|
|
// jestClient.shutdownClient();
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
/**
|
|
|
* ES获取面访项目数据
|
|
|
*/
|
|
|
// public FollowupContentESDO esGetFollowupProjectData(String id, String followupProject) throws Exception {
|
|
|
// JestClient jestClient = null;
|
|
|
// FollowupContentESDO followupContentESDO = null;
|
|
|
// try {
|
|
|
// //根据随访ID、分类ID获取随访记录详情
|
|
|
// 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 = result.getSourceAsObject(FollowupContentESDO.class);
|
|
|
// } finally {
|
|
|
// if (jestClient != null) {
|
|
|
// jestClient.shutdownClient();
|
|
|
// }
|
|
|
// }
|
|
|
// return followupContentESDO;
|
|
|
// }
|
|
|
|
|
|
/**
|
|
|
* ES 删除随访详情信息
|
|
|
*
|
|
|
* @author huangwenjie
|
|
|
* @date 2017/11/1 15:17
|
|
|
*/
|
|
|
// public void esDeleteFollowUpContent(List<FollowupContentESDO> datalist) throws Exception {
|
|
|
// JestClient jestClient = null;
|
|
|
// try {
|
|
|
// 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());
|
|
|
// jestClient.shutdownClient();
|
|
|
// } finally {
|
|
|
// if (jestClient != null) {
|
|
|
// jestClient.shutdownClient();
|
|
|
// }
|
|
|
// }
|
|
|
//
|
|
|
// }
|
|
|
|
|
|
/**
|
|
|
* ES获取面访项目数据列表
|
|
|
*
|
|
|
* @author huangwenjie
|
|
|
* @date 2017/11/1 19:41
|
|
|
*/
|
|
|
// public List<String> esfindProjectByFollowupId(String id) throws Exception {
|
|
|
// JestClient jestClient = null;
|
|
|
// List<String> resultList = new ArrayList<>();
|
|
|
// try {
|
|
|
// //根据随访ID、分类ID获取随访记录详情
|
|
|
// jestClient = elasticFactory.getJestClient();
|
|
|
// //先根据条件查找出来
|
|
|
// SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
|
|
|
// searchSourceBuilder.from(0).size(100);
|
|
|
// 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) {
|
|
|
//
|
|
|
// if("2".equals(followupContentESDO.getFollowup_project())){
|
|
|
//// //判断血压必填
|
|
|
//// if(StringUtils.isNotBlank(followupContentESDO.getBP_D()) && StringUtils.isNotBlank(followupContentESDO.getBP_U())
|
|
|
//// &&StringUtils.isNotBlank(followupContentESDO.getBLOOD_SUGAR()) && StringUtils.isNotBlank(followupContentESDO.getBLOOD_SUGAR_TYPE())){
|
|
|
//// resultList.add(followupContentESDO.getFollowup_project());
|
|
|
//// } else if(StringUtils.isNotBlank(followupContentESDO.getBP_D()) && StringUtils.isNotBlank(followupContentESDO.getBP_U())){
|
|
|
//// resultList.add(followupContentESDO.getFollowup_project());
|
|
|
//// }
|
|
|
// if(StringUtils.isNotBlank(followupContentESDO.getBP_D()) && StringUtils.isNotBlank(followupContentESDO.getBP_U())){
|
|
|
// resultList.add(followupContentESDO.getFollowup_project());
|
|
|
// }
|
|
|
// if(StringUtils.isNotBlank(followupContentESDO.getBLOOD_SUGAR()) && StringUtils.isNotBlank(followupContentESDO.getBLOOD_SUGAR_TYPE())){
|
|
|
// resultList.add(followupContentESDO.getFollowup_project());
|
|
|
// }
|
|
|
// }else if("3".equals(followupContentESDO.getFollowup_project())){
|
|
|
// //判断血糖必填
|
|
|
// if(StringUtils.isNotBlank(followupContentESDO.getBS_FPG()) ||
|
|
|
// StringUtils.isNotBlank(followupContentESDO.getNO_BS_FPG())||
|
|
|
// StringUtils.isNotBlank(followupContentESDO.getRANDOM_BLOOD_SUGAR())){
|
|
|
// resultList.add(followupContentESDO.getFollowup_project());
|
|
|
// }
|
|
|
// }else{
|
|
|
// resultList.add(followupContentESDO.getFollowup_project());
|
|
|
// }
|
|
|
//
|
|
|
// }
|
|
|
// }
|
|
|
//
|
|
|
// jestClient.shutdownClient();
|
|
|
// } finally {
|
|
|
// if (jestClient != null) {
|
|
|
// jestClient.shutdownClient();
|
|
|
// }
|
|
|
// }
|
|
|
// return resultList;
|
|
|
// }
|
|
|
|
|
|
/**
|
|
|
* ES获取面访项目数据详情
|
|
|
*
|
|
|
* @author huangwenjie
|
|
|
* @date 2017/11/1 19:41
|
|
|
*/
|
|
|
// public List<FollowupContentESDO> esfindFollowUpContestsByFollowupId(String id) throws Exception {
|
|
|
// JestClient jestClient = null;
|
|
|
// List<FollowupContentESDO> followupContentESDOList = new ArrayList<>();
|
|
|
// try {
|
|
|
// //根据随访ID、分类ID获取随访记录详情
|
|
|
//
|
|
|
// List<String> resultList = new ArrayList<>();
|
|
|
//
|
|
|
// 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);
|
|
|
//
|
|
|
// } finally {
|
|
|
// if (jestClient != null) {
|
|
|
// jestClient.shutdownClient();
|
|
|
// }
|
|
|
// }
|
|
|
// return followupContentESDOList;
|
|
|
// }
|
|
|
|
|
|
/**
|
|
|
* 根据续方CODE获取随访记录信息
|
|
@ -1363,109 +1198,6 @@ public class FollowUpService {
|
|
|
return jsonString;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取随访详情记录分类记录数
|
|
|
*
|
|
|
* @param followupid
|
|
|
* @param type
|
|
|
* @return
|
|
|
*/
|
|
|
// public int getfollowupcontent(String followupid, String type) throws Exception {
|
|
|
//
|
|
|
// int count = 0;
|
|
|
// String[] typelist = null;
|
|
|
// if (type.contains(",")) {
|
|
|
// typelist = type.split(",");
|
|
|
// } else {
|
|
|
// typelist = new String[]{type};
|
|
|
// }
|
|
|
//
|
|
|
// for (String typekey : typelist) {
|
|
|
// if (!"drug".equals(type)) {
|
|
|
//
|
|
|
// FollowupContentESDO followupContentESDO = this.esGetFollowupProjectData(followupid, typekey);
|
|
|
// if (followupContentESDO != null) {
|
|
|
// count++;
|
|
|
// }
|
|
|
//
|
|
|
// } else {
|
|
|
// //获取用药记录
|
|
|
// List<FollowupDrugs> drugsList = followupDrugsDao.findByFollowupId(Long.valueOf(followupid));
|
|
|
// if (!drugsList.isEmpty()) {
|
|
|
// count = count + drugsList.size();
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
//
|
|
|
// return count;
|
|
|
//
|
|
|
// }
|
|
|
|
|
|
/**
|
|
|
* 检查随访记录是否可完成
|
|
|
* @param followupid
|
|
|
* @return
|
|
|
*/
|
|
|
// public boolean checkfollowupcompleted(String followupid) throws Exception {
|
|
|
// boolean result = true;
|
|
|
//
|
|
|
// List<FollowupContentESDO> eslist = this.esfindFollowUpContestsByFollowupId(followupid);
|
|
|
//
|
|
|
// if (!eslist.isEmpty()) {
|
|
|
// for (FollowupContentESDO followupContentESDO : eslist) {
|
|
|
//
|
|
|
// if("2".equals(followupContentESDO.getFollowup_project())){
|
|
|
// //判断血压必填
|
|
|
// if(StringUtils.isBlank(followupContentESDO.getBP_D()) || StringUtils.isBlank(followupContentESDO.getBP_U())){
|
|
|
// return false;
|
|
|
// }
|
|
|
// }else if("3".equals(followupContentESDO.getFollowup_project())){
|
|
|
// //判断血糖必填
|
|
|
// if(StringUtils.isBlank(followupContentESDO.getBS_FPG()) &&
|
|
|
// StringUtils.isBlank(followupContentESDO.getNO_BS_FPG()) &&
|
|
|
// StringUtils.isBlank(followupContentESDO.getRANDOM_BLOOD_SUGAR())){
|
|
|
// return false;
|
|
|
// }
|
|
|
// }else if("5".equals(followupContentESDO.getFollowup_project())){
|
|
|
// //判断评价
|
|
|
// if(StringUtils.isBlank(followupContentESDO.getDIA_FOLLOWUP_TYPE_CODE()) &&
|
|
|
// StringUtils.isBlank(followupContentESDO.getHYP_FOLLOWUP_TYPE_CODE())){
|
|
|
// return false;
|
|
|
// }
|
|
|
// }else{}
|
|
|
//
|
|
|
// }
|
|
|
// }
|
|
|
//
|
|
|
// return result;
|
|
|
// }
|
|
|
//
|
|
|
|
|
|
/**
|
|
|
* 保存随访详情
|
|
|
* followupContentESDO
|
|
|
*/
|
|
|
// public void esSaveFollowupContentESDAO(FollowupContentESDO followupContentESDO)throws Exception{
|
|
|
// JestClient jestClient = null;
|
|
|
// try {
|
|
|
//
|
|
|
//
|
|
|
// jestClient = elasticFactory.getJestClient();
|
|
|
//
|
|
|
// List<FollowupContentESDO> dataList = new ArrayList<>();
|
|
|
// if(followupContentESDO != null){
|
|
|
// dataList.add(followupContentESDO);
|
|
|
// //删除原有记录
|
|
|
// this.esDeleteFollowUpContent(dataList);
|
|
|
// }
|
|
|
// elastricSearchSave.save(dataList, esIndex, esType);
|
|
|
//
|
|
|
// } finally {
|
|
|
// if (jestClient != null) {
|
|
|
// jestClient.shutdownClient();
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
public void updateFollowup(Long id) {
|
|
|
Followup followup = followupDao.findById(id).orElse(null);
|
|
|
followup.setStatus("1");
|