|
@ -13,6 +13,8 @@ import com.yihu.wlyy.repository.dict.SystemDictDao;
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
import com.yihu.wlyy.repository.followup.FollowupContentDao;
|
|
import com.yihu.wlyy.repository.followup.FollowupContentDao;
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
|
import com.yihu.wlyy.service.system.SystemDictService;
|
|
|
|
import com.yihu.wlyy.task.FollowupUploadTask;
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.data.domain.PageRequest;
|
|
import org.springframework.data.domain.PageRequest;
|
|
@ -47,37 +49,115 @@ public class FollowUpService extends BaseService {
|
|
private FollowupContentDao followupContentDao;
|
|
private FollowupContentDao followupContentDao;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private SystemDictDao systemDictDao;
|
|
|
|
|
|
private SystemDictService systemDictService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private ObjectMapper objectMapper;
|
|
private ObjectMapper objectMapper;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 转译随访信息
|
|
|
|
*/
|
|
|
|
private Map<String,String> getFollowupDetail(Followup followup) throws Exception
|
|
|
|
{
|
|
|
|
Map<String,String> re = new HashMap<>();
|
|
|
|
//患者信息
|
|
|
|
String patientCode = followup.getPatientCode();
|
|
|
|
Patient patient = patientDao.findByCode(patientCode);
|
|
|
|
if(patient!=null) {
|
|
|
|
re.put("patientCode",patientCode);
|
|
|
|
re.put("patientName",patient.getName());
|
|
|
|
re.put("idcard",patient.getIdcard());
|
|
|
|
re.put("sex",String.valueOf(patient.getSex()));
|
|
|
|
re.put("birthday",DateUtil.dateToStrLong(patient.getBirthday()));
|
|
|
|
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
throw new Exception("not exit patient:"+patientCode);
|
|
|
|
}
|
|
|
|
|
|
|
|
re.put("id",String.valueOf(followup.getId()));
|
|
|
|
re.put("followupNo",followup.getFollowupNo());
|
|
|
|
re.put("followupDate",DateUtil.dateToStrLong(followup.getFollowupDate()));
|
|
|
|
re.put("followupNextDate",DateUtil.dateToStrLong(followup.getFollowupNextDate()));
|
|
|
|
|
|
|
|
//随访方式转译
|
|
|
|
re.put("followupType",followup.getFollowupType());
|
|
|
|
String followupTypeName = systemDictService.getDictValue("FOLLOWUP_WAY_DICT",followup.getFollowupType());
|
|
|
|
re.put("followupTypeName",followupTypeName);
|
|
|
|
|
|
|
|
//随访类别转译
|
|
|
|
re.put("followupClass",followup.getFollowupClass());
|
|
|
|
String followupClassName = systemDictService.getDictValue("FOLLOWUP_CLASS_DICT",followup.getFollowupClass());
|
|
|
|
re.put("followupClassName",followupClassName);
|
|
|
|
|
|
|
|
//随访管理状态转译
|
|
|
|
re.put("followupManagerStatus",followup.getFollowupManagerStatus());
|
|
|
|
String followupManagerStatusName = systemDictService.getDictValue("FOLLOWUP_MANAGER_STATUS",followup.getFollowupManagerStatus());
|
|
|
|
re.put("followupManagerStatusName",followupManagerStatusName);
|
|
|
|
|
|
|
|
re.put("doctorCode",followup.getDoctorCode());
|
|
|
|
re.put("doctorName",followup.getDoctorName());
|
|
|
|
re.put("orgCode",followup.getOrgCode());
|
|
|
|
re.put("orgName",followup.getOrgName());
|
|
|
|
re.put("dataFrom",followup.getDataFrom());
|
|
|
|
re.put("status",followup.getStatus());
|
|
|
|
re.put("followupContentPhone",followup.getFollowupContentPhone());
|
|
|
|
re.put("createTime",DateUtil.dateToStrLong(followup.getCreateTime()));
|
|
|
|
re.put("creater",followup.getCreater());
|
|
|
|
|
|
|
|
return re;
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取医生随访列表
|
|
* 获取医生随访列表
|
|
*/
|
|
*/
|
|
public List<Followup> getListByDoctor(String doctorCode,String startTime,String endTime,String page,String pageSize) throws Exception
|
|
|
|
|
|
public List<Map<String,String>> getListByDoctor(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");
|
|
Sort sort = new Sort(Sort.Direction.ASC, "followupDate");
|
|
// 分页信息
|
|
// 分页信息
|
|
int pageInt = Integer.valueOf(page)-1;
|
|
int pageInt = Integer.valueOf(page)-1;
|
|
int pageSizeInt = Integer.valueOf(pageSize);
|
|
int pageSizeInt = Integer.valueOf(pageSize);
|
|
Pageable pageRequest = new PageRequest(pageInt, pageSizeInt, sort);
|
|
Pageable pageRequest = new PageRequest(pageInt, pageSizeInt, sort);
|
|
return followupDao.findByDoctor(doctorCode,DateUtil.strToDate(startTime),DateUtil.strToDate(endTime),pageRequest);
|
|
|
|
|
|
List<Followup> list = followupDao.findByDoctor(doctorCode,DateUtil.strToDate(startTime),DateUtil.strToDate(endTime),pageRequest);
|
|
|
|
|
|
|
|
if(list!=null && list.size()>0)
|
|
|
|
{
|
|
|
|
for(Followup followup : list)
|
|
|
|
{
|
|
|
|
Map<String,String> map = getFollowupDetail(followup);
|
|
|
|
re.add(map);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return re;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取医生随访列表(创建者)
|
|
* 获取医生随访列表(创建者)
|
|
*/
|
|
*/
|
|
public List<Followup> getListByCreater(String doctorCode,String startTime,String endTime,String page,String pageSize) throws Exception
|
|
|
|
|
|
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");
|
|
Sort sort = new Sort(Sort.Direction.ASC, "followupDate");
|
|
// 分页信息
|
|
// 分页信息
|
|
int pageInt = Integer.valueOf(page)-1;
|
|
int pageInt = Integer.valueOf(page)-1;
|
|
int pageSizeInt = Integer.valueOf(pageSize);
|
|
int pageSizeInt = Integer.valueOf(pageSize);
|
|
Pageable pageRequest = new PageRequest(pageInt, pageSizeInt, sort);
|
|
Pageable pageRequest = new PageRequest(pageInt, pageSizeInt, sort);
|
|
return followupDao.findByCreater(doctorCode,DateUtil.strToDate(startTime),DateUtil.strToDate(endTime),pageRequest);
|
|
|
|
|
|
List<Followup> list = followupDao.findByCreater(doctorCode,DateUtil.strToDate(startTime),DateUtil.strToDate(endTime),pageRequest);
|
|
|
|
|
|
|
|
if(list!=null && list.size()>0)
|
|
|
|
{
|
|
|
|
for(Followup followup : list)
|
|
|
|
{
|
|
|
|
Map<String,String> map = getFollowupDetail(followup);
|
|
|
|
re.add(map);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return re;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -206,8 +286,42 @@ public class FollowUpService extends BaseService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 完成随访记录,并上传随访记录
|
|
|
|
*/
|
|
|
|
public void finishFollowup(String id) throws Exception {
|
|
|
|
Followup followup = followupDao.findOne(Long.valueOf(id));
|
|
|
|
if(followup!=null)
|
|
|
|
{
|
|
|
|
followup.setStatus("1"); //状态 0取消 1已完成 2未开始 3进行中
|
|
|
|
followupDao.save(followup);
|
|
|
|
|
|
|
|
//上传随访计划
|
|
|
|
new Thread(new FollowupUploadTask(String.valueOf(followup.getId()))).start();
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
throw new Exception("not exit follow:"+id+".\r\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/*********************************** 随访详情 *******************************************************************/
|
|
/*********************************** 随访详情 *******************************************************************/
|
|
|
|
/**
|
|
|
|
* 获取面访项目列表
|
|
|
|
*/
|
|
|
|
public Map<String,String> getFollowup(String id) throws Exception
|
|
|
|
{
|
|
|
|
Map<String,String> re = new HashMap<>();
|
|
|
|
Followup followup = followupDao.findOne(Long.valueOf(id));
|
|
|
|
if(followup!=null)
|
|
|
|
{
|
|
|
|
re = getFollowupDetail(followup);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
throw new Exception("not exit follow:"+id+".\r\n");
|
|
|
|
}
|
|
|
|
return re;
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取面访项目列表
|
|
* 获取面访项目列表
|
|
*/
|
|
*/
|
|
@ -217,7 +331,7 @@ public class FollowUpService extends BaseService {
|
|
//获取已填写的面访项目
|
|
//获取已填写的面访项目
|
|
List<String> project = followupContentDao.findProjectByFollowupId(Long.valueOf(id));
|
|
List<String> project = followupContentDao.findProjectByFollowupId(Long.valueOf(id));
|
|
//获取所有面访项目
|
|
//获取所有面访项目
|
|
List<SystemDict> dictList = systemDictDao.findByDictName("FOLLOWUP_PROJECT");
|
|
|
|
|
|
List<SystemDict> dictList = systemDictService.getDictByDictName("FOLLOWUP_PROJECT");
|
|
if (dictList!=null && dictList.size()>0)
|
|
if (dictList!=null && dictList.size()>0)
|
|
{
|
|
{
|
|
for(SystemDict dict:dictList)
|
|
for(SystemDict dict:dictList)
|