|
@ -33,6 +33,7 @@ import com.yihu.wlyy.service.system.SystemDictService;
|
|
import com.yihu.wlyy.task.PushMsgTask;
|
|
import com.yihu.wlyy.task.PushMsgTask;
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
|
|
import com.yihu.wlyy.util.IdCardUtil;
|
|
import io.searchbox.client.JestClient;
|
|
import io.searchbox.client.JestClient;
|
|
import io.searchbox.core.*;
|
|
import io.searchbox.core.*;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@ -51,6 +52,7 @@ import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.PageRequest;
|
|
import org.springframework.data.domain.PageRequest;
|
|
import org.springframework.data.domain.Pageable;
|
|
import org.springframework.data.domain.Pageable;
|
|
import org.springframework.data.domain.Sort;
|
|
import org.springframework.data.domain.Sort;
|
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
@ -133,8 +135,8 @@ public class FollowUpService extends BaseService {
|
|
/**
|
|
/**
|
|
* 转译随访信息
|
|
* 转译随访信息
|
|
*/
|
|
*/
|
|
private Map<String, String> getFollowupDetail(Followup followup) throws Exception {
|
|
|
|
Map<String, String> re = new HashMap<>();
|
|
|
|
|
|
private Map<String, Object> getFollowupDetail(Followup followup) throws Exception {
|
|
|
|
Map<String, Object> re = new HashMap<>();
|
|
//患者信息
|
|
//患者信息
|
|
String patientCode = followup.getPatientCode();
|
|
String patientCode = followup.getPatientCode();
|
|
Patient patient = patientDao.findByCode(patientCode);
|
|
Patient patient = patientDao.findByCode(patientCode);
|
|
@ -154,6 +156,8 @@ public class FollowUpService extends BaseService {
|
|
throw new Exception("not exit patient:" + patientCode);
|
|
throw new Exception("not exit patient:" + patientCode);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
re.put("address", patient.getAddress());//患者详细地址
|
|
|
|
re.put("isWX", org.springframework.util.StringUtils.isEmpty(followup.getOpenid()) ? false : true);//是否关注微信
|
|
re.put("id", String.valueOf(followup.getId()));
|
|
re.put("id", String.valueOf(followup.getId()));
|
|
re.put("followupNo", followup.getFollowupNo());
|
|
re.put("followupNo", followup.getFollowupNo());
|
|
re.put("followupDate", DateUtil.dateToStrLong(followup.getFollowupDate()));
|
|
re.put("followupDate", DateUtil.dateToStrLong(followup.getFollowupDate()));
|
|
@ -208,20 +212,31 @@ public class FollowUpService extends BaseService {
|
|
public List<Map<String, Object>> getListByDoctor(String doctorCode, String startTime, String endTime) throws Exception {
|
|
public List<Map<String, Object>> getListByDoctor(String doctorCode, String startTime, String endTime) throws Exception {
|
|
List<Map<String, Object>> re = new ArrayList<>();
|
|
List<Map<String, Object>> re = new ArrayList<>();
|
|
Map<String, Map<String, Object>> temp = new HashMap<>();
|
|
Map<String, Map<String, Object>> temp = new HashMap<>();
|
|
|
|
String sql="SELECT " +
|
|
|
|
" a.*,p.openid,p.address " +
|
|
|
|
"FROM " +
|
|
|
|
" wlyy_followup a, " +
|
|
|
|
" wlyy_patient p " +
|
|
|
|
"WHERE " +
|
|
|
|
"a.patient_code=p.`code` " +
|
|
|
|
"and " +
|
|
|
|
" a.doctor_code = '"+doctorCode+"'" +
|
|
|
|
"AND a.followup_date BETWEEN '"+startTime+"' AND '"+endTime+"'" +
|
|
|
|
"AND a. STATUS <> '0'";
|
|
|
|
List<Followup> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(Followup.class));
|
|
|
|
|
|
List<Followup> list = followupDao.findByDoctor(doctorCode, DateUtil.strToDate(startTime), DateUtil.strToDate(endTime));
|
|
|
|
if (list != null && list.size() > 0) {
|
|
if (list != null && list.size() > 0) {
|
|
for (Followup followup : list) {
|
|
for (Followup followup : list) {
|
|
String date = DateUtil.dateToStrShort(followup.getFollowupDate());
|
|
String date = DateUtil.dateToStrShort(followup.getFollowupDate());
|
|
Map<String, String> map = getFollowupDetail(followup);
|
|
|
|
|
|
Map<String, Object> map = getFollowupDetail(followup);
|
|
if (temp.containsKey(date)) {
|
|
if (temp.containsKey(date)) {
|
|
Map<String, Object> vo = temp.get(date);
|
|
Map<String, Object> vo = temp.get(date);
|
|
vo.put("num", Integer.parseInt(vo.get("num").toString()) + 1);
|
|
vo.put("num", Integer.parseInt(vo.get("num").toString()) + 1);
|
|
((List<Map<String, String>>) vo.get("list")).add(map);
|
|
|
|
|
|
((List<Map<String, Object>>) vo.get("list")).add(map);
|
|
temp.put(date, vo);
|
|
temp.put(date, vo);
|
|
} else {
|
|
} else {
|
|
Map<String, Object> vo = new HashMap<>();
|
|
Map<String, Object> vo = new HashMap<>();
|
|
List<Map<String, String>> list1 = new ArrayList<>();
|
|
|
|
|
|
List<Map<String, Object>> list1 = new ArrayList<>();
|
|
vo.put("date", date);
|
|
vo.put("date", date);
|
|
vo.put("num", 1);
|
|
vo.put("num", 1);
|
|
list1.add(map);
|
|
list1.add(map);
|
|
@ -348,8 +363,8 @@ public class FollowUpService extends BaseService {
|
|
/**
|
|
/**
|
|
* 获取医生随访列表(创建者)
|
|
* 获取医生随访列表(创建者)
|
|
*/
|
|
*/
|
|
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<>();
|
|
|
|
|
|
public List<Map<String, Object>> getListByCreater(String doctorCode, String startTime, String endTime, String page, String pageSize) throws Exception {
|
|
|
|
List<Map<String, Object>> re = new ArrayList<>();
|
|
// 排序
|
|
// 排序
|
|
Sort sort = new Sort(Sort.Direction.ASC, "followupDate");
|
|
Sort sort = new Sort(Sort.Direction.ASC, "followupDate");
|
|
// 分页信息
|
|
// 分页信息
|
|
@ -360,7 +375,7 @@ public class FollowUpService extends BaseService {
|
|
|
|
|
|
if (list != null && list.size() > 0) {
|
|
if (list != null && list.size() > 0) {
|
|
for (Followup followup : list) {
|
|
for (Followup followup : list) {
|
|
Map<String, String> map = getFollowupDetail(followup);
|
|
|
|
|
|
Map<String, Object> map = getFollowupDetail(followup);
|
|
re.add(map);
|
|
re.add(map);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@ -380,7 +395,7 @@ public class FollowUpService extends BaseService {
|
|
//获取患者信息
|
|
//获取患者信息
|
|
Patient patient = patientDao.findByCode(patientCode);
|
|
Patient patient = patientDao.findByCode(patientCode);
|
|
if (patient == null) {
|
|
if (patient == null) {
|
|
throw new Exception("not exit patient:" + patientCode + ".\r\n");
|
|
|
|
|
|
throw new Exception("not exit patient:" + patientCode + ".\r ");
|
|
}
|
|
}
|
|
ConcernDO concern = concernService.getByDoctorAndPatient(doctorCode,patientCode);
|
|
ConcernDO concern = concernService.getByDoctorAndPatient(doctorCode,patientCode);
|
|
|
|
|
|
@ -389,7 +404,7 @@ public class FollowUpService extends BaseService {
|
|
//获取医生信息
|
|
//获取医生信息
|
|
Doctor doctor = doctorDao.findByCode(map.get("doctor").toString());
|
|
Doctor doctor = doctorDao.findByCode(map.get("doctor").toString());
|
|
if (doctor == null) {
|
|
if (doctor == null) {
|
|
throw new Exception("not exit doctor:" + doctorCode + ".\r\n");
|
|
|
|
|
|
throw new Exception("not exit doctor:" + doctorCode + ".\r ");
|
|
}
|
|
}
|
|
|
|
|
|
Followup followup = new Followup();
|
|
Followup followup = new Followup();
|
|
@ -426,6 +441,7 @@ public class FollowUpService extends BaseService {
|
|
/**
|
|
/**
|
|
* 编辑随访计划
|
|
* 编辑随访计划
|
|
*/
|
|
*/
|
|
|
|
@Transactional
|
|
public void editFollowupPlan(String doctorCode, String id, String date, String followupType) throws Exception {
|
|
public void editFollowupPlan(String doctorCode, String id, String date, String followupType) throws Exception {
|
|
Followup followup = followupDao.findOne(Long.valueOf(id));
|
|
Followup followup = followupDao.findOne(Long.valueOf(id));
|
|
if (followup != null) {
|
|
if (followup != null) {
|
|
@ -437,7 +453,7 @@ public class FollowUpService extends BaseService {
|
|
|
|
|
|
followupDao.save(followup);
|
|
followupDao.save(followup);
|
|
} else {
|
|
} else {
|
|
throw new Exception("not exit follow:" + id + ".\r\n");
|
|
|
|
|
|
throw new Exception("not exit follow:" + id + ".\r ");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@ -486,7 +502,7 @@ public class FollowUpService extends BaseService {
|
|
|
|
|
|
followupDao.save(followup);
|
|
followupDao.save(followup);
|
|
} else {
|
|
} else {
|
|
throw new Exception("not exit follow:" + id + ".\r\n");
|
|
|
|
|
|
throw new Exception("not exit follow:" + id + ".\r ");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@ -499,13 +515,13 @@ public class FollowUpService extends BaseService {
|
|
//获取医生信息
|
|
//获取医生信息
|
|
Doctor doctor = doctorDao.findByCode(doctorCode);
|
|
Doctor doctor = doctorDao.findByCode(doctorCode);
|
|
if (doctor == null) {
|
|
if (doctor == null) {
|
|
throw new Exception("not exit doctor:" + doctorCode + ".\r\n");
|
|
|
|
|
|
throw new Exception("not exit doctor:" + doctorCode + ".\r ");
|
|
}
|
|
}
|
|
|
|
|
|
//获取患者信息
|
|
//获取患者信息
|
|
Patient patient = patientDao.findByCode(patientCode);
|
|
Patient patient = patientDao.findByCode(patientCode);
|
|
if (patient == null) {
|
|
if (patient == null) {
|
|
throw new Exception("not exit patient:" + patientCode + ".\r\n");
|
|
|
|
|
|
throw new Exception("not exit patient:" + patientCode + ".\r ");
|
|
}
|
|
}
|
|
ConcernDO concern = concernService.getByDoctorAndPatient(doctorCode,patientCode);
|
|
ConcernDO concern = concernService.getByDoctorAndPatient(doctorCode,patientCode);
|
|
|
|
|
|
@ -583,7 +599,7 @@ public class FollowUpService extends BaseService {
|
|
followup.setStatus("0"); //状态 0取消 1已完成 2未开始 3进行中
|
|
followup.setStatus("0"); //状态 0取消 1已完成 2未开始 3进行中
|
|
followupDao.save(followup);
|
|
followupDao.save(followup);
|
|
} else {
|
|
} else {
|
|
throw new Exception("not exit follow:" + id + ".\r\n");
|
|
|
|
|
|
throw new Exception("not exit follow:" + id + ".\r ");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@ -613,7 +629,7 @@ public class FollowUpService extends BaseService {
|
|
|
|
|
|
// new Thread(new FollowupUploadTask(String.valueOf(followup.getId()))).start();
|
|
// new Thread(new FollowupUploadTask(String.valueOf(followup.getId()))).start();
|
|
} else {
|
|
} else {
|
|
throw new Exception("not exit follow:" + id + ".\r\n");
|
|
|
|
|
|
throw new Exception("not exit follow:" + id + ".\r ");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@ -621,13 +637,13 @@ public class FollowUpService extends BaseService {
|
|
/**
|
|
/**
|
|
* 获取面访项目列表
|
|
* 获取面访项目列表
|
|
*/
|
|
*/
|
|
public Map<String, String> getFollowup(String id) throws Exception {
|
|
|
|
Map<String, String> re = new HashMap<>();
|
|
|
|
|
|
public Map<String, Object> getFollowup(String id) throws Exception {
|
|
|
|
Map<String, Object> re = new HashMap<>();
|
|
Followup followup = followupDao.findOne(Long.valueOf(id));
|
|
Followup followup = followupDao.findOne(Long.valueOf(id));
|
|
if (followup != null) {
|
|
if (followup != null) {
|
|
re = getFollowupDetail(followup);
|
|
re = getFollowupDetail(followup);
|
|
} else {
|
|
} else {
|
|
throw new Exception("not exit follow:" + id + ".\r\n");
|
|
|
|
|
|
throw new Exception("not exit follow:" + id + ".\r ");
|
|
}
|
|
}
|
|
return re;
|
|
return re;
|
|
}
|
|
}
|
|
@ -728,7 +744,7 @@ public class FollowUpService extends BaseService {
|
|
if (followup != null) {
|
|
if (followup != null) {
|
|
re = followup.getFollowupContentPhone();
|
|
re = followup.getFollowupContentPhone();
|
|
} else {
|
|
} else {
|
|
throw new Exception("not exit followup:" + id + ".\r\n");
|
|
|
|
|
|
throw new Exception("not exit followup:" + id + ".\r ");
|
|
}
|
|
}
|
|
return re;
|
|
return re;
|
|
}
|
|
}
|
|
@ -742,7 +758,7 @@ public class FollowUpService extends BaseService {
|
|
followup.setFollowupContentPhone(content);
|
|
followup.setFollowupContentPhone(content);
|
|
followupDao.save(followup);
|
|
followupDao.save(followup);
|
|
} else {
|
|
} else {
|
|
throw new Exception("not exit followup:" + id + ".\r\n");
|
|
|
|
|
|
throw new Exception("not exit followup:" + id + ".\r ");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|