|
@ -22,6 +22,7 @@ import com.yihu.jw.restmodel.web.ObjEnvelop;
|
|
|
import com.yihu.jw.rm.specialist.SpecialistMapping;
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.util.entity.ServiceException;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.json.JSONArray;
|
|
@ -36,6 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import java.sql.Timestamp;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* Created by 刘文彬 on 2018/8/16.
|
|
@ -64,19 +66,66 @@ public class RehabilitationManageService {
|
|
|
@Autowired
|
|
|
private RehabilitationDetailAppointmentDao rehabilitationDetailAppointmentDao;
|
|
|
@Autowired
|
|
|
ImUtil imUtil;
|
|
|
private ImUtil imUtil;
|
|
|
@Autowired
|
|
|
BaseDoctorDao doctorDao;
|
|
|
private BaseDoctorDao doctorDao;
|
|
|
@Autowired
|
|
|
BasePatientDao patientDao;
|
|
|
private BasePatientDao patientDao;
|
|
|
@Autowired
|
|
|
private PatientMedicalRecordsRehabilitationDao medicalRecordsRehabilitationDao;
|
|
|
|
|
|
@Autowired
|
|
|
PatientDiseaseServerDao patientDiseaseServerDao;
|
|
|
private PatientDiseaseServerDao patientDiseaseServerDao;
|
|
|
@Autowired
|
|
|
private SystemDictService systemDictService;
|
|
|
@Autowired
|
|
|
private PatientRehabilitationPlanLogDao patientRehabilitationPlanLogDao;
|
|
|
|
|
|
//添加康复计划日志
|
|
|
public void addPlanLog(String planId,String doctorCode,String doctorName){
|
|
|
if(StringUtils.isBlank(doctorCode)){
|
|
|
return;
|
|
|
}
|
|
|
if(StringUtils.isBlank(doctorName)){
|
|
|
BaseDoctorDO doctorDO = doctorDao.findByIdAndDel(doctorCode);
|
|
|
doctorName = doctorDO.getName();
|
|
|
}
|
|
|
PatientRehabilitationPlanLogDO planLogDO = new PatientRehabilitationPlanLogDO();
|
|
|
planLogDO.setId(UUID.randomUUID().toString().replace("-",""));
|
|
|
planLogDO.setPlanId(planId);
|
|
|
planLogDO.setCreateTime(new Date());
|
|
|
planLogDO.setCreateUser(doctorCode);
|
|
|
planLogDO.setCreateUserName(doctorName);
|
|
|
patientRehabilitationPlanLogDao.save(planLogDO);
|
|
|
}
|
|
|
|
|
|
//计划负责人分配执行人
|
|
|
public void assignExecutor(PatientRehabilitationPlanDO planDO,String uid){
|
|
|
if(StringUtils.isNotBlank(uid)){
|
|
|
PatientRehabilitationPlanDO planDO1 = patientRehabilitationPlanDao.findById(planDO.getId()).orElse(null);
|
|
|
if(planDO1==null){
|
|
|
throw new ServiceException("康复计划不存在");
|
|
|
}
|
|
|
if(!uid.equals(planDO1.getPlanDoctor())){
|
|
|
throw new ServiceException("您不是该康复计划负责人,不允许操作");
|
|
|
}
|
|
|
}
|
|
|
List<RehabilitationDetailDO> detailDOS = rehabilitationDetailDao.findByPlanIdAndStatus(planDO.getId(),0);
|
|
|
List<RehabilitationDetailDO> detailDOList = planDO.getDetailDOList();
|
|
|
Map<String,RehabilitationDetailDO> map = detailDOList.stream().collect(Collectors.toMap
|
|
|
(RehabilitationDetailDO::getHospitalServiceItemId, log->log,(oldLog, newLog)->oldLog));
|
|
|
for (RehabilitationDetailDO detailDO : detailDOS){
|
|
|
String serviceItemId = detailDO.getHospitalServiceItemId();
|
|
|
if(map.containsKey(serviceItemId)){
|
|
|
RehabilitationDetailDO newDetail = map.get(serviceItemId);
|
|
|
detailDO.setDoctor(newDetail.getDoctor());
|
|
|
detailDO.setDoctorName(newDetail.getDoctorName());
|
|
|
}
|
|
|
}
|
|
|
rehabilitationDetailDao.saveAll(detailDOS);
|
|
|
|
|
|
addPlanLog(planDO.getId(),uid,null);
|
|
|
}
|
|
|
|
|
|
public List<Map<String, Object>> selectPlanByPatient(String patient, Integer status, String planId, String doctor) {
|
|
|
if (StringUtils.isNoneBlank(planId)) {
|