|
@@ -58,6 +58,8 @@ public class QcTypeFacade extends QcTypeServiceImpl {
|
|
|
public RespDTO<List<QcType>> indexData(QcTypeVO qcTypeVO) {
|
|
|
List<QcType> list = this.list(new QueryWrapper<QcType>()
|
|
|
.eq("hospital_id", qcTypeVO.getHospitalId())
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .ne("id",qcTypeVO.getId())
|
|
|
.isNull("parent_type_id")
|
|
|
.orderByAsc("name")
|
|
|
);
|
|
@@ -74,13 +76,18 @@ public class QcTypeFacade extends QcTypeServiceImpl {
|
|
|
//判断关联关系
|
|
|
QcType qcType = this.getOne(new QueryWrapper<QcType>()
|
|
|
.eq("hospital_id", cancelTypeVO.getHospitalId())
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
.eq("id", cancelTypeVO.getId()));
|
|
|
//存在关联 给出提示
|
|
|
if (null != qcType.getParentTypeId()) {
|
|
|
QcType qcTypeMain= this.getOne(new QueryWrapper<QcType>()
|
|
|
.eq("hospital_id", cancelTypeVO.getHospitalId())
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
.eq("id", qcType.getParentTypeId()));
|
|
|
- return RespDTO.onSucBoth(CommonErrorCode.CHECK_CONNECTION.getCode(),"该类型已被" + "\"" + qcTypeMain.getName() + "\"" + "类型绑定,确定需要解绑?",null);
|
|
|
+ RespDTO respDTO = new RespDTO();
|
|
|
+ respDTO.code = "00000005";
|
|
|
+ respDTO.msg = "该类型已被" + "\"" + qcTypeMain.getName() + "\"" + "类型绑定,确定需要解绑?";
|
|
|
+ return respDTO;
|
|
|
}
|
|
|
}
|
|
|
//删除关联状态
|
|
@@ -88,10 +95,13 @@ public class QcTypeFacade extends QcTypeServiceImpl {
|
|
|
this.update(new UpdateWrapper<QcType>()
|
|
|
.eq("hospital_id", cancelTypeVO.getHospitalId())
|
|
|
.eq("id", cancelTypeVO.getId())
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
.set("parent_type_id", null)
|
|
|
);
|
|
|
- return RespDTO.onSucBoth(CommonErrorCode.CANCEL_SUCCESSFUL.getCode(),CommonErrorCode.CANCEL_SUCCESSFUL.getMsg(),null);
|
|
|
-
|
|
|
+ RespDTO respDTO = new RespDTO();
|
|
|
+ respDTO.code = "00000005";
|
|
|
+ respDTO.msg = "解绑成功";
|
|
|
+ return respDTO;
|
|
|
}else{
|
|
|
return new RespDTO();
|
|
|
}
|
|
@@ -104,14 +114,19 @@ public class QcTypeFacade extends QcTypeServiceImpl {
|
|
|
* @param qcTypeSaveVO
|
|
|
*/
|
|
|
public RespDTO saveOrUpdate(QcTypeSaveVO qcTypeSaveVO) {
|
|
|
- //初始化参数
|
|
|
- CommonParam param = initCommonParam();
|
|
|
- // 保存主表
|
|
|
- saveQcType(qcTypeSaveVO, param);
|
|
|
- // 保存质控类型和质控条目映射关系
|
|
|
- saveQcTypeCasesEntry(qcTypeSaveVO, param);
|
|
|
- //质控类型进行关联
|
|
|
- getTypeConnections(qcTypeSaveVO, param);
|
|
|
+
|
|
|
+ try {
|
|
|
+ //初始化参数
|
|
|
+ CommonParam param = initCommonParam();
|
|
|
+ // 保存主表
|
|
|
+ saveQcType(qcTypeSaveVO, param);
|
|
|
+ // 保存质控类型和质控条目映射关系
|
|
|
+ saveQcTypeCasesEntry(qcTypeSaveVO, param);
|
|
|
+ //质控类型进行关联
|
|
|
+ getTypeConnections(qcTypeSaveVO, param);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return RespDTO.onError("保存失败");
|
|
|
+ }
|
|
|
return RespDTO.onSuc("保存成功");
|
|
|
|
|
|
}
|
|
@@ -240,21 +255,16 @@ public class QcTypeFacade extends QcTypeServiceImpl {
|
|
|
this.update(new UpdateWrapper<QcType>()
|
|
|
.eq("hospital_id", qcTypeVO.getHospitalId())
|
|
|
.eq("parent_type_id",qcTypeVO.getId())
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
.set("parent_type_id",null)
|
|
|
);
|
|
|
}
|
|
|
if(ListUtil.isNotEmpty(connectionIds)){
|
|
|
for (Long id : connectionIds) {
|
|
|
- QcType qcType = this.getOne(new QueryWrapper<QcType>()
|
|
|
- .eq("hospital_id", qcTypeSaveVO.getHospitalId())
|
|
|
- .eq("id", id));
|
|
|
- if(null != qcType.getParentTypeId()){
|
|
|
- //同一个质控id只能被绑定一次
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "当前质控类型已被"+qcType.getParentTypeId()+"质控id绑定");
|
|
|
- }
|
|
|
//删除绑定质控id所有case_entry_id
|
|
|
qcTypeCasesEntryFacade.remove(new QueryWrapper<QcTypeCasesEntry>()
|
|
|
.eq("type_id", id)
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
);
|
|
|
//该医院质控id下的质控条目case_entry_id与主关联的保持一致
|
|
|
list.forEach(qcTypeCasesEntryVO->{
|
|
@@ -272,9 +282,9 @@ public class QcTypeFacade extends QcTypeServiceImpl {
|
|
|
this.update(new UpdateWrapper<QcType>()
|
|
|
.eq("hospital_id", qcTypeSaveVO.getHospitalId())
|
|
|
.eq("id", id)
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
.set("parent_type_id",qcTypeVO.getId())
|
|
|
);
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
}
|