|
@ -391,11 +391,25 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
|
signRecordDO.setPatient(patientId);
|
|
|
signRecordDO.setName(patientDO.getName());
|
|
|
List<ServicePackageRecordDO> recordDOList = signRecordDO.getRecordDOList();
|
|
|
List<String> packages = recordDOList.stream().map(ServicePackageRecordDO::getServicePackageId).collect(Collectors.toList());
|
|
|
if (packages.size()>0){
|
|
|
String packagesId = packages.stream().map(String::valueOf).collect(Collectors.joining("','"));
|
|
|
String sql = " SELECT DISTINCT i.org_code FROM base_service_package_sign_record sr, " +
|
|
|
" base_service_package_record r, base_service_package i WHERE sr.id = r.sign_id " +
|
|
|
" and sr.status=1 and sr.patient = '"+patientId+"' " +
|
|
|
" AND r.service_package_id = i.id AND i.del = 1 AND sr.`status` = 1 and i.id in ('"+packagesId+"') ";
|
|
|
if (jdbcTemplate.queryForList(sql).size()>0){
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg,"您已签约该机构,无法重复签约");
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
String signId = signRecordDO.getId();
|
|
|
List<String> idList = new ArrayList<>();
|
|
|
if(StringUtil.isEmpty(signId)){
|
|
|
List<ServicePackageSignRecordDO> signRecordDOs = servicePackageSignRecordDao.findByStatusAndPatient(1,signRecordDO.getPatient());
|
|
|
if(signRecordDOs.size()==0){
|
|
|
|
|
|
// List<ServicePackageSignRecordDO> signRecordDOs = servicePackageSignRecordDao.findByStatusAndPatient(1,signRecordDO.getPatient());
|
|
|
// if(signRecordDOs.size()==0){
|
|
|
BaseDoctorDO doctorDO = doctorDao.findById(doctorId);
|
|
|
//需要新增签约记录
|
|
|
signRecordDO.setStatus(1);
|
|
@ -420,24 +434,24 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
|
archiveDO.setSignStatus(1);
|
|
|
archiveDao.save(archiveDO);
|
|
|
}
|
|
|
}else{
|
|
|
//不能重复签约
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg,"请勿重复签约");
|
|
|
return result;
|
|
|
// ArchiveDO archiveDO = archiveDao.findByPatientAndDoctorCode(patientId,doctorId);
|
|
|
// if(archiveDO!=null){
|
|
|
// archiveDO.setSignStatus(1);
|
|
|
// archiveDao.save(archiveDO);
|
|
|
// }
|
|
|
// signId = signRecordDOs.get(0).getId();
|
|
|
// List<ServicePackageRecordDO> existList = servicePackageRecordDao.findBySignId(signId);
|
|
|
// idList = existList.stream().map(ServicePackageRecordDO::getServicePackageId).collect(Collectors.toList());
|
|
|
}
|
|
|
// }else{
|
|
|
// //不能重复签约
|
|
|
// result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
// result.put(ResponseContant.resultMsg,"请勿重复签约");
|
|
|
// return result;
|
|
|
//// ArchiveDO archiveDO = archiveDao.findByPatientAndDoctorCode(patientId,doctorId);
|
|
|
//// if(archiveDO!=null){
|
|
|
//// archiveDO.setSignStatus(1);
|
|
|
//// archiveDao.save(archiveDO);
|
|
|
//// }
|
|
|
//// signId = signRecordDOs.get(0).getId();
|
|
|
//// List<ServicePackageRecordDO> existList = servicePackageRecordDao.findBySignId(signId);
|
|
|
//// idList = existList.stream().map(ServicePackageRecordDO::getServicePackageId).collect(Collectors.toList());
|
|
|
// }
|
|
|
}else{
|
|
|
//不能重复签约
|
|
|
result.put(ResponseContant.resultFlag, ResponseContant.fail);
|
|
|
result.put(ResponseContant.resultMsg,"请勿重复签约");
|
|
|
result.put(ResponseContant.resultMsg,"不允许修改原有签约信息");
|
|
|
return result;
|
|
|
}
|
|
|
//生成居民标签
|