如果存在,不再查询

master
wyb 2 years ago
parent 0cc82101c9
commit 0c4c2d94b9

@ -1,6 +1,8 @@
package com.docus.server;
import com.docus.infrastructure.core.utils.SpringUtil;
import com.docus.server.message.dao.TrInpatientOutpatientDao;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;

@ -120,6 +120,9 @@ public class SdBusinessServiceImpl implements SdBusinessService {
@Override
@Transactional(rollbackFor = Exception.class)
public void trInpatientOutPatient(String patientId) {
if (trInpatientOutpatientDao.exists(patientId)){
return;
}
String sdRyIndex = tBasicMapper.getSdRyIndex(patientId);
if (Func.isBlank(sdRyIndex)) {
log.warn("patientId{} 没有患者索引!", patientId);

@ -20,4 +20,10 @@ public interface TrInpatientOutpatientDao extends IBaseDao<TrInpatientOutpatient
* @param inpatientId
*/
void deleteTrInpatientOutpatientByInpatientId(String inpatientId);
/**
*
* @param inpatientId
* @return true false
*/
boolean exists(String inpatientId);
}

@ -36,4 +36,12 @@ public class TrInpatientOutpatientDaoImpl extends BaseDaoImpl<TrInpatientOutpati
wrapper.eq(TrInpatientOutpatient::getPatientId, inpatientId);
baseMapper.delete(wrapper);
}
@Override
public boolean exists(String inpatientId) {
LambdaQueryWrapper<TrInpatientOutpatient> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TrInpatientOutpatient::getPatientId, inpatientId);
wrapper.last(" LIMIT 1");
return baseMapper.selectCount(wrapper)>1;
}
}

Loading…
Cancel
Save