|
|
@ -3,12 +3,16 @@ package com.ccsens.recovery.service; |
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.ccsens.recovery.bean.dto.HospitalDto; |
|
|
|
import com.ccsens.recovery.bean.po.RecoveryCentre; |
|
|
|
import com.ccsens.recovery.bean.po.RecoveryCentreExample; |
|
|
|
import com.ccsens.recovery.bean.po.RecoveryDoctor; |
|
|
|
import com.ccsens.recovery.bean.po.RecoveryDoctorExample; |
|
|
|
import com.ccsens.recovery.bean.vo.HospitalVo; |
|
|
|
import com.ccsens.recovery.persist.dao.DoctorDao; |
|
|
|
import com.ccsens.recovery.persist.mapper.RecoveryCentreMapper; |
|
|
|
import com.ccsens.recovery.persist.mapper.RecoveryDoctorMapper; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.hibernate.validator.constraints.pl.REGON; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
@ -27,14 +31,14 @@ public class HospitalService implements IHospitalService{ |
|
|
|
private RecoveryDoctorMapper recoveryDoctorMapper; |
|
|
|
@Resource |
|
|
|
private DoctorDao doctorDao; |
|
|
|
@Resource |
|
|
|
private RecoveryCentreMapper recoveryCentreMapper; |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<HospitalVo.RobotInfo> queryRobotByHospital(HospitalDto.RecoveryCentreId param, Long userId) { |
|
|
|
//康复室id非必填,如果没有则用当前登录的userId来查找所属的康复室
|
|
|
|
Long centreId = param.getId(); |
|
|
|
if(ObjectUtil.isNull(centreId)){ |
|
|
|
centreId = getCentreByUserId(userId); |
|
|
|
} |
|
|
|
|
|
|
|
Long centreId = getCentreByUserId(param.getProjectId()); |
|
|
|
|
|
|
|
return doctorDao.queryRobotByCentre(centreId); |
|
|
|
} |
|
|
|
|
|
|
@ -49,4 +53,16 @@ public class HospitalService implements IHospitalService{ |
|
|
|
} |
|
|
|
return centreId; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Long getCentreByProjectId(Long projectId) { |
|
|
|
Long centreId = null; |
|
|
|
RecoveryCentreExample recoveryCentreExample = new RecoveryCentreExample(); |
|
|
|
recoveryCentreExample.createCriteria().andProjectIdEqualTo(projectId); |
|
|
|
List<RecoveryCentre> recoveryCentres = recoveryCentreMapper.selectByExample(recoveryCentreExample); |
|
|
|
if(CollectionUtil.isNotEmpty(recoveryCentres)){ |
|
|
|
centreId = recoveryCentres.get(0).getId(); |
|
|
|
} |
|
|
|
return centreId; |
|
|
|
} |
|
|
|
} |
|
|
|