|
@@ -59,6 +59,7 @@ public class QcTypeFacade extends QcTypeServiceImpl {
|
|
|
List<QcType> list = this.list(new QueryWrapper<QcType>()
|
|
|
.eq("hospital_id", qcTypeVO.getHospitalId())
|
|
|
.isNull("parent_type_id")
|
|
|
+ .orderByAsc("name")
|
|
|
);
|
|
|
return RespDTO.onSuc(list);
|
|
|
}
|
|
@@ -68,28 +69,32 @@ public class QcTypeFacade extends QcTypeServiceImpl {
|
|
|
* @param cancelTypeVO
|
|
|
*/
|
|
|
public RespDTO getOrCancel(CancelTypeVO cancelTypeVO) {
|
|
|
- //修改操作
|
|
|
- if (cancelTypeVO.getId() != null&& 0 == cancelTypeVO.getCancel()) {
|
|
|
+ //修改和删除都会触发操作
|
|
|
+ if (cancelTypeVO.getId() != null&& null == cancelTypeVO.getCancel()) {
|
|
|
//判断关联关系
|
|
|
QcType qcType = this.getOne(new QueryWrapper<QcType>()
|
|
|
.eq("hospital_id", cancelTypeVO.getHospitalId())
|
|
|
.eq("id", cancelTypeVO.getId()));
|
|
|
- if (null != qcType.getParentTypeId() && 0 == cancelTypeVO.getCancel()) {
|
|
|
+ //存在关联 给出提示
|
|
|
+ if (null != qcType.getParentTypeId()) {
|
|
|
QcType qcTypeMain= this.getOne(new QueryWrapper<QcType>()
|
|
|
.eq("hospital_id", cancelTypeVO.getHospitalId())
|
|
|
.eq("id", qcType.getParentTypeId()));
|
|
|
return RespDTO.onSucBoth(CommonErrorCode.CHECK_CONNECTION.getCode(),"该类型已被" + "\"" + qcTypeMain.getName() + "\"" + "类型绑定,确定需要解绑?",null);
|
|
|
}
|
|
|
- //删除关联状态
|
|
|
- if (1 == cancelTypeVO.getCancel()) {
|
|
|
- this.update(new UpdateWrapper<QcType>()
|
|
|
- .eq("hospital_id", cancelTypeVO.getHospitalId())
|
|
|
- .eq("id", cancelTypeVO.getId())
|
|
|
- .set("parent_type_id", null)
|
|
|
- );
|
|
|
- }
|
|
|
}
|
|
|
- return RespDTO.onSucBoth(CommonErrorCode.CANCEL_SUCCESSFUL.getCode(),CommonErrorCode.CANCEL_SUCCESSFUL.getMsg(),null);
|
|
|
+ //删除关联状态
|
|
|
+ if (cancelTypeVO.getId() != null && 1 == cancelTypeVO.getCancel()) {
|
|
|
+ this.update(new UpdateWrapper<QcType>()
|
|
|
+ .eq("hospital_id", cancelTypeVO.getHospitalId())
|
|
|
+ .eq("id", cancelTypeVO.getId())
|
|
|
+ .set("parent_type_id", null)
|
|
|
+ );
|
|
|
+ return RespDTO.onSucBoth(CommonErrorCode.CANCEL_SUCCESSFUL.getCode(),CommonErrorCode.CANCEL_SUCCESSFUL.getMsg(),null);
|
|
|
+
|
|
|
+ }else{
|
|
|
+ return new RespDTO();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -229,6 +234,15 @@ public class QcTypeFacade extends QcTypeServiceImpl {
|
|
|
BeanUtil.copyProperties(qcTypeSaveVO, qcTypeVO);
|
|
|
List<Long> connectionIds = qcTypeSaveVO.getTypeIdList();
|
|
|
List<QcTypeCasesEntryVO> list = qcTypeSaveVO.getQcTypeCasesEntryVOList();
|
|
|
+ //修改操作
|
|
|
+ if(null !=qcTypeSaveVO.getId()){
|
|
|
+ //删除父类id
|
|
|
+ this.update(new UpdateWrapper<QcType>()
|
|
|
+ .eq("hospital_id", qcTypeVO.getHospitalId())
|
|
|
+ .eq("parent_type_id",qcTypeVO.getId())
|
|
|
+ .set("parent_type_id",null)
|
|
|
+ );
|
|
|
+ }
|
|
|
if(ListUtil.isNotEmpty(connectionIds)){
|
|
|
for (Long id : connectionIds) {
|
|
|
QcType qcType = this.getOne(new QueryWrapper<QcType>()
|