|
@@ -10,12 +10,15 @@ import com.diagbot.dto.KlDiagnoseTypeDTO;
|
|
|
import com.diagbot.entity.KlDiagnose;
|
|
|
import com.diagbot.entity.KlDiagnoseBase;
|
|
|
import com.diagbot.entity.KlDiagnoseCondition;
|
|
|
+import com.diagbot.entity.KlRuleBase;
|
|
|
+import com.diagbot.entity.KlRuleCondition;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.service.impl.KlDiagnoseServiceImpl;
|
|
|
import com.diagbot.util.DateUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
import com.diagbot.vo.KlDiagnoseByIdVO;
|
|
|
import com.diagbot.vo.KlDiagnoseClearVO;
|
|
|
import com.diagbot.vo.KlDiagnoseInfoVO;
|
|
@@ -24,6 +27,7 @@ import com.diagbot.vo.KlDiagnoseSaveVO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import javax.swing.plaf.SplitPaneUI;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
@@ -133,7 +137,84 @@ public class KlDiagnoseFacade extends KlDiagnoseServiceImpl {
|
|
|
}
|
|
|
|
|
|
public Boolean saveDiagnoseAll(KlDiagnoseSaveVO klDiagnoseSaveVO) {
|
|
|
-
|
|
|
+ Date now = DateUtil.now();
|
|
|
+ boolean res = false;
|
|
|
+ // 校验名称是否相同
|
|
|
+ int count = this.count(new QueryWrapper<KlDiagnose>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("concept_id", klDiagnoseSaveVO.getConceptId())
|
|
|
+ .ne("id", klDiagnoseSaveVO.getId() == null ? -1 : klDiagnoseSaveVO.getId()));
|
|
|
+ if (count > 0) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该诊断依据已存在!");
|
|
|
+ }
|
|
|
+ //校验数据是否还在
|
|
|
+ if (null != klDiagnoseSaveVO.getId()) {
|
|
|
+ int sum = this.count(new QueryWrapper<KlDiagnose>().eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("id", klDiagnoseSaveVO.getId()));
|
|
|
+ if (sum == 0) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该数据已不存在!");
|
|
|
+ }
|
|
|
+ UpdateWrapper<KlDiagnose> klDiagnoseUpdate = new UpdateWrapper<>();
|
|
|
+ klDiagnoseUpdate.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("id", klDiagnoseSaveVO.getId())
|
|
|
+ .set(StringUtil.isNotBlank(klDiagnoseSaveVO.getDescription()), "description", klDiagnoseSaveVO.getDescription())
|
|
|
+ .set(StringUtil.isNotBlank(klDiagnoseSaveVO.getConceptId().toString()), "concept_id", klDiagnoseSaveVO.getConceptId())
|
|
|
+ .set("gmt_modified", now);
|
|
|
+ res = this.update(klDiagnoseUpdate);
|
|
|
+
|
|
|
+ //先删除原有的详情;
|
|
|
+ res = clearDetail(klDiagnoseSaveVO.getId());
|
|
|
+ // if (ListUtil.isNotEmpty(klRuleInfoSaveVO.getKlRuleInfoSaveSub())) {
|
|
|
+ // //再重新传入的详情保存
|
|
|
+ // res = saveCommon(klRuleInfoSaveVO);
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // //先保存主表rule
|
|
|
+ // KlRule klRule = new KlRule();
|
|
|
+ // klRule.setConceptId(klRuleInfoSaveVO.getParConceptId());
|
|
|
+ // klRule.setDescription(klRuleInfoSaveVO.getParDescription());
|
|
|
+ // klRule.setHasSubCond(klRuleInfoSaveVO.getParHasSub());
|
|
|
+ // klRule.setRuleType(klRuleInfoSaveVO.getParRuleType());
|
|
|
+ // klRule.setMsg(klRuleInfoSaveVO.getParMsg());
|
|
|
+ // klRule.setStatus(klRuleInfoSaveVO.getParStatus());
|
|
|
+ // klRule.setGmtCreate(now);
|
|
|
+ // klRule.setGmtModified(now);
|
|
|
+ // res = this.save(klRule);
|
|
|
+ // if (res) {
|
|
|
+ // //再保存附表
|
|
|
+ // klRuleInfoSaveVO.setId(klRule.getId());
|
|
|
+ // res = saveCommon(klRuleInfoSaveVO);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // return res;
|
|
|
+ }
|
|
|
return null;
|
|
|
+
|
|
|
+ }
|
|
|
+ public boolean clearDetail(Long id){
|
|
|
+ boolean res = false;
|
|
|
+ QueryWrapper<KlDiagnoseCondition> klDiagnoseQuery = new QueryWrapper<>();
|
|
|
+ klDiagnoseQuery.eq("is_deleted", IsDeleteEnum.N.getKey()).eq("diagnose_id", id);
|
|
|
+ List<KlDiagnoseCondition> diaConditionList = klDiagnoseConditionFacade.list(klDiagnoseQuery);
|
|
|
+ List<Long> baseId = new ArrayList<>();
|
|
|
+ if (ListUtil.isNotEmpty(diaConditionList)) {
|
|
|
+ for (KlDiagnoseCondition data : diaConditionList) {
|
|
|
+ if(null!=data.getDiagnoseBaseId()&&0!=data.getDiagnoseBaseId()){
|
|
|
+ baseId.add(data.getDiagnoseBaseId());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (ListUtil.isNotEmpty(baseId)) {
|
|
|
+ QueryWrapper<KlDiagnoseBase> klDiagnoseBaseQuery = new QueryWrapper<>();
|
|
|
+ klDiagnoseBaseQuery.eq("is_deleted", IsDeleteEnum.N.getKey()).in("id", baseId);
|
|
|
+ //删除kl_rule_base表数据
|
|
|
+ res = klDiagnoseBaseFacade.remove(klDiagnoseBaseQuery);
|
|
|
+
|
|
|
+ }
|
|
|
+ //删除kl_rule_condition表的数据
|
|
|
+ res = klDiagnoseConditionFacade.remove(klDiagnoseQuery);
|
|
|
+ return res;
|
|
|
}
|
|
|
}
|