|
|
@ -7,7 +7,6 @@ import com.ccsens.recovery.bean.dto.HospitalDto; |
|
|
|
import com.ccsens.recovery.bean.dto.PatientDto; |
|
|
|
import com.ccsens.recovery.bean.message.RecoveryWithActionFeedBack; |
|
|
|
import com.ccsens.recovery.bean.message.RecoveryWithStartDrill; |
|
|
|
import com.ccsens.recovery.bean.message.RecoveryWithStartRecipe; |
|
|
|
import com.ccsens.recovery.bean.po.*; |
|
|
|
import com.ccsens.recovery.bean.vo.PatientVo; |
|
|
|
import com.ccsens.recovery.bean.vo.RecipeVo; |
|
|
@ -20,7 +19,6 @@ import com.ccsens.util.bean.message.common.MessageConstant; |
|
|
|
import com.ccsens.util.bean.message.common.MessageRule; |
|
|
|
import com.ccsens.util.config.RabbitMQConfig; |
|
|
|
import com.ccsens.util.message.SwitchoverProjectUtil; |
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.amqp.core.AmqpTemplate; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -59,6 +57,10 @@ public class PatientService implements IPatientService{ |
|
|
|
private PatientRobotMapper patientRobotMapper; |
|
|
|
@Resource |
|
|
|
private RecoveryCentreMapper recoveryCentreMapper; |
|
|
|
@Resource |
|
|
|
private RecipeProjectDecomposeMapper projectDecomposeMapper; |
|
|
|
@Resource |
|
|
|
private IHospitalService hospitalService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<PatientVo.Patient> queryPatientByDoctorId(HospitalDto.DoctorId param, Long userId) { |
|
|
@ -70,13 +72,7 @@ public class PatientService implements IPatientService{ |
|
|
|
public List<PatientVo.Patient> queryPatientByRecovery(HospitalDto.RecoveryCentreId param, Long userId) { |
|
|
|
Long centreId = param.getId(); |
|
|
|
if(ObjectUtil.isNull(centreId)){ |
|
|
|
//如果康复中心id为空,通过userId查找康复师,然后查找康复中心的id
|
|
|
|
RecoveryDoctorExample recoveryDoctorExample = new RecoveryDoctorExample(); |
|
|
|
recoveryDoctorExample.createCriteria().andUserIdEqualTo(userId); |
|
|
|
List<RecoveryDoctor> doctorList = recoveryDoctorMapper.selectByExample(recoveryDoctorExample); |
|
|
|
if(CollectionUtil.isNotEmpty(doctorList)){ |
|
|
|
centreId = doctorList.get(0).getCentreId(); |
|
|
|
} |
|
|
|
centreId = hospitalService.getCentreByUserId(userId); |
|
|
|
} |
|
|
|
return patientDao.queryPatientByHospitalId(centreId); |
|
|
|
} |
|
|
@ -243,9 +239,13 @@ public class PatientService implements IPatientService{ |
|
|
|
|
|
|
|
@Override |
|
|
|
public void completeRecovery(PatientDto.EndRecovery param, Long userId) throws Exception { |
|
|
|
//TODO 给患者和机器人关联的记录添加结束时间
|
|
|
|
|
|
|
|
//给患者和机器人关联的记录添加结束时间
|
|
|
|
patientDao.updateRobotEndTime(param.getPatientId(),System.currentTimeMillis()); |
|
|
|
//TODO 将处方项目关联的任务设为完成
|
|
|
|
// RecipeProjectDecompose projectDecompose = projectDecomposeMapper.selectByPrimaryKey(param.getRecipeProjectId());
|
|
|
|
// if(ObjectUtil.isNotNull(projectDecompose)){
|
|
|
|
// projectDecompose.getTaskId();
|
|
|
|
// }
|
|
|
|
//发送消息,让机器人切回康复中心的项目
|
|
|
|
Set<String> userIdSet = new HashSet<>(); |
|
|
|
Long projectId = null; |
|
|
@ -266,14 +266,32 @@ public class PatientService implements IPatientService{ |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<PatientVo.Patient> vaguePatientByIdCard(PatientDto.VaguePatient param, Long userId) { |
|
|
|
Long centreId = null; |
|
|
|
//如果康复中心id为空,通过userId查找康复师,然后查找康复中心的id
|
|
|
|
RecoveryDoctorExample recoveryDoctorExample = new RecoveryDoctorExample(); |
|
|
|
recoveryDoctorExample.createCriteria().andUserIdEqualTo(userId); |
|
|
|
List<RecoveryDoctor> doctorList = recoveryDoctorMapper.selectByExample(recoveryDoctorExample); |
|
|
|
if(CollectionUtil.isNotEmpty(doctorList)){ |
|
|
|
centreId = doctorList.get(0).getCentreId(); |
|
|
|
} |
|
|
|
Long centreId = hospitalService.getCentreByUserId(userId); |
|
|
|
return patientDao.vaguePatientByIdCard(param.getIdCard(),centreId); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public PatientVo.RecordStatus getDrillStatus(PatientDto.SubTimeTaskId param, Long userId) { |
|
|
|
PatientVo.RecordStatus recordStatus = new PatientVo.RecordStatus(); |
|
|
|
|
|
|
|
RecipeRecordExample recipeRecordExample = new RecipeRecordExample(); |
|
|
|
recipeRecordExample.createCriteria().andSubTaskIdEqualTo(param.getSubTaskId()); |
|
|
|
List<RecipeRecord> recipeRecordList = recipeRecordMapper.selectByExample(recipeRecordExample); |
|
|
|
if(CollectionUtil.isNotEmpty(recipeRecordList)){ |
|
|
|
RecipeRecord recipeRecord = recipeRecordList.get(0); |
|
|
|
recordStatus.setId(recipeRecord.getId()); |
|
|
|
if(ObjectUtil.isNotNull(recipeRecord.getStartTime()) && ObjectUtil.isNotNull(recipeRecord.getEndTime())){ |
|
|
|
if(recipeRecord.getStartTime() != 0 && recipeRecord.getEndTime() == 0){ |
|
|
|
recordStatus.setStatus(1); |
|
|
|
return recordStatus; |
|
|
|
} |
|
|
|
if(recipeRecord.getEndTime() != 0){ |
|
|
|
recordStatus.setStatus(2); |
|
|
|
return recordStatus; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
recordStatus.setStatus(0); |
|
|
|
return recordStatus; |
|
|
|
} |
|
|
|
} |
|
|
|