|
@ -2,6 +2,7 @@ package com.yihu.wlyy.service.app.followup;
|
|
|
|
|
|
import javax.transaction.Transactional;
|
|
|
|
|
|
import com.fasterxml.jackson.databind.JavaType;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.wlyy.entity.dict.SystemDict;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
@ -66,38 +67,66 @@ public class FollowUpService extends BaseService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*新增随访计划(简单)
|
|
|
* 获取医生随访列表(创建者)
|
|
|
*/
|
|
|
public void addFollowupPlan(String doctorCode,String patientCode,String date) throws Exception {
|
|
|
public List<Followup> getListByCreater(String doctorCode,String startTime,String endTime,String page,String pageSize) throws Exception
|
|
|
{
|
|
|
// 排序
|
|
|
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);
|
|
|
return followupDao.findByCreater(doctorCode,DateUtil.strToDate(startTime),DateUtil.strToDate(endTime),pageRequest);
|
|
|
}
|
|
|
|
|
|
//获取医生信息
|
|
|
Doctor doctor = doctorDao.findByCode(doctorCode);
|
|
|
if(doctor==null)
|
|
|
/**
|
|
|
*新增随访计划(批量)
|
|
|
*/
|
|
|
@Transactional
|
|
|
public void addFollowupPlan(String doctorCode,String patientCode,String data) throws Exception {
|
|
|
//批量随访计划
|
|
|
JavaType javaType = objectMapper.getTypeFactory().constructParametricType(List.class, Map.class);
|
|
|
List<Map<String,String>> list = objectMapper.readValue(data,javaType);
|
|
|
if(list!=null && list.size()>0)
|
|
|
{
|
|
|
throw new Exception("not exit doctor:"+doctorCode+".\r\n");
|
|
|
}
|
|
|
//获取患者信息
|
|
|
Patient patient = patientDao.findByCode(patientCode);
|
|
|
if(patient==null)
|
|
|
{
|
|
|
throw new Exception("not exit patient:"+patientCode+".\r\n");
|
|
|
}
|
|
|
|
|
|
//获取患者信息
|
|
|
Patient patient = patientDao.findByCode(patientCode);
|
|
|
if(patient==null)
|
|
|
{
|
|
|
throw new Exception("not exit patient:"+patientCode+".\r\n");
|
|
|
}
|
|
|
List<Followup> followupPlan = new ArrayList<>();
|
|
|
for(Map<String,String> map : list)
|
|
|
{
|
|
|
//获取医生信息
|
|
|
Doctor doctor = doctorDao.findByCode(map.get("doctor"));
|
|
|
if(doctor==null)
|
|
|
{
|
|
|
throw new Exception("not exit doctor:"+doctorCode+".\r\n");
|
|
|
}
|
|
|
|
|
|
Followup followup = new Followup();
|
|
|
followup.setFollowupDate(DateUtil.strToDate(date));
|
|
|
followup.setDoctorCode(doctorCode);
|
|
|
followup.setDoctorName(doctor.getName());
|
|
|
followup.setOrgCode(doctor.getHospital());
|
|
|
followup.setOrgName(doctor.getHospitalName());
|
|
|
followup.setPatientCode(patientCode);
|
|
|
followup.setPatientName(patient.getName());
|
|
|
followup.setIdcard(patient.getIdcard());
|
|
|
followup.setDataFrom("2");//数据来源 1基卫 2APP
|
|
|
followup.setStatus("2"); //状态 0取消 1已完成 2未开始 3进行中
|
|
|
followup.setCreateTime(new Date());
|
|
|
Followup followup = new Followup();
|
|
|
followup.setFollowupType(map.get("type"));
|
|
|
followup.setFollowupDate(DateUtil.strToDate(map.get("date")));
|
|
|
followup.setDoctorCode(doctor.getCode());
|
|
|
followup.setDoctorName(doctor.getName());
|
|
|
followup.setOrgCode(doctor.getHospital());
|
|
|
followup.setOrgName(doctor.getHospitalName());
|
|
|
followup.setPatientCode(patientCode);
|
|
|
followup.setPatientName(patient.getName());
|
|
|
followup.setIdcard(patient.getIdcard());
|
|
|
followup.setDataFrom("2");//数据来源 1基卫 2APP
|
|
|
followup.setStatus("2"); //状态 0取消 1已完成 2未开始 3进行中
|
|
|
followup.setCreateTime(new Date());
|
|
|
followup.setCreater(doctorCode);
|
|
|
|
|
|
followupPlan.add(followup);
|
|
|
}
|
|
|
|
|
|
followupDao.save(followup);
|
|
|
followupDao.save(followupPlan);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -155,6 +184,7 @@ public class FollowUpService extends BaseService {
|
|
|
followup.setDataFrom("2");//数据来源 1基卫 2APP
|
|
|
followup.setStatus("3"); //状态 0取消 1已完成 2未开始 3进行中
|
|
|
followup.setCreateTime(new Date());
|
|
|
followup.setCreater(doctorCode);
|
|
|
|
|
|
followupDao.save(followup);
|
|
|
re = String.valueOf(followup.getId());
|