|
@@ -121,8 +121,6 @@ public class HospitalInfoFacade extends HospitalInfoServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 校验子医院
|
|
|
- List<TranHospitalRelation> saveRelationList = Lists.newArrayList();
|
|
|
// 获取子医院
|
|
|
List<HospitalRelationVO> hospitalRelationVOList = hospitalInfoSaveVO.getHospitalRelationVOList();
|
|
|
if (ListUtil.isNotEmpty(hospitalRelationVOList)) {
|
|
@@ -150,15 +148,6 @@ public class HospitalInfoFacade extends HospitalInfoServiceImpl {
|
|
|
if (hospitalId != null && !hospitalId.equals(hospitalInfo.getId()) && !keyExist.contains(unionKey)) {
|
|
|
errorOther.add(hospitalRelationVO);
|
|
|
keyExist.add(unionKey);
|
|
|
- } else {
|
|
|
- TranHospitalRelation tranHospitalRelation = new TranHospitalRelation();
|
|
|
- BeanUtil.copyProperties(hospitalRelationVO, tranHospitalRelation);
|
|
|
- tranHospitalRelation.setHospitalId(hospitalInfo.getId());
|
|
|
- tranHospitalRelation.setCreator(userId);
|
|
|
- tranHospitalRelation.setModifier(userId);
|
|
|
- tranHospitalRelation.setGmtCreate(now);
|
|
|
- tranHospitalRelation.setGmtModified(now);
|
|
|
- saveRelationList.add(tranHospitalRelation);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -170,7 +159,7 @@ public class HospitalInfoFacade extends HospitalInfoServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //新增数据
|
|
|
+ // 新增数据
|
|
|
if (hospitalInfo.getId() == null) {
|
|
|
hospitalInfo.setCreator(userId);
|
|
|
hospitalInfo.setGmtCreate(now);
|
|
@@ -184,7 +173,20 @@ public class HospitalInfoFacade extends HospitalInfoServiceImpl {
|
|
|
// 先删除子医院关联表
|
|
|
tranHospitalRelationService.remove(new QueryWrapper<TranHospitalRelation>().eq("hospital_id", hospitalInfo.getId()));
|
|
|
// 插入子医院关联表
|
|
|
- tranHospitalRelationService.saveBatch(saveRelationList);
|
|
|
+ List<TranHospitalRelation> saveRelationList = Lists.newArrayList();
|
|
|
+ for (HospitalRelationVO hospitalRelationVO : hospitalRelationVOList) {
|
|
|
+ TranHospitalRelation tranHospitalRelation = new TranHospitalRelation();
|
|
|
+ BeanUtil.copyProperties(hospitalRelationVO, tranHospitalRelation);
|
|
|
+ tranHospitalRelation.setHospitalId(hospitalInfo.getId());
|
|
|
+ tranHospitalRelation.setCreator(userId);
|
|
|
+ tranHospitalRelation.setModifier(userId);
|
|
|
+ tranHospitalRelation.setGmtCreate(now);
|
|
|
+ tranHospitalRelation.setGmtModified(now);
|
|
|
+ saveRelationList.add(tranHospitalRelation);
|
|
|
+ }
|
|
|
+ if (ListUtil.isNotEmpty(saveRelationList)) {
|
|
|
+ tranHospitalRelationService.saveBatch(saveRelationList);
|
|
|
+ }
|
|
|
return null;
|
|
|
}
|
|
|
|
|
@@ -250,7 +252,7 @@ public class HospitalInfoFacade extends HospitalInfoServiceImpl {
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
.eq("hospital_id", id));
|
|
|
if (count > 0) {
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医院存在关联医院,无法删除");
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医院存在关联子医院,无法删除");
|
|
|
}
|
|
|
// 主表逻辑删除
|
|
|
hospitalInfo.setIsDeleted(IsDeleteEnum.Y.getKey());
|