|
@@ -10,24 +10,26 @@ 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.entity.wrapper.KlDiagnoseBaseWrapper;
|
|
|
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.BeanUtil;
|
|
|
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.KlDiagnoseDetailVO;
|
|
|
+import com.diagbot.vo.KlDiagnoseGroupVO;
|
|
|
import com.diagbot.vo.KlDiagnoseInfoVO;
|
|
|
import com.diagbot.vo.KlDiagnoseSatarDisVO;
|
|
|
import com.diagbot.vo.KlDiagnoseSaveVO;
|
|
|
+import com.diagbot.vo.KlDiagnoseTypeVO;
|
|
|
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;
|
|
@@ -163,36 +165,19 @@ public class KlDiagnoseFacade extends KlDiagnoseServiceImpl {
|
|
|
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;
|
|
|
+ res = clearDetail(klDiagnoseSaveVO.getId());
|
|
|
+
|
|
|
+ if (ListUtil.isNotEmpty(klDiagnoseSaveVO.getKlDiagnoseTypeVO())) {
|
|
|
+ //再重新传入的详情保存
|
|
|
+ res = saveCommon(klDiagnoseSaveVO);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
- public boolean clearDetail(Long id){
|
|
|
+
|
|
|
+ public boolean clearDetail(Long id) {
|
|
|
boolean res = false;
|
|
|
QueryWrapper<KlDiagnoseCondition> klDiagnoseQuery = new QueryWrapper<>();
|
|
|
klDiagnoseQuery.eq("is_deleted", IsDeleteEnum.N.getKey()).eq("diagnose_id", id);
|
|
@@ -200,7 +185,7 @@ public class KlDiagnoseFacade extends KlDiagnoseServiceImpl {
|
|
|
List<Long> baseId = new ArrayList<>();
|
|
|
if (ListUtil.isNotEmpty(diaConditionList)) {
|
|
|
for (KlDiagnoseCondition data : diaConditionList) {
|
|
|
- if(null!=data.getDiagnoseBaseId()&&0!=data.getDiagnoseBaseId()){
|
|
|
+ if (null != data.getDiagnoseBaseId() && 0 != data.getDiagnoseBaseId()) {
|
|
|
baseId.add(data.getDiagnoseBaseId());
|
|
|
}
|
|
|
|
|
@@ -217,4 +202,71 @@ public class KlDiagnoseFacade extends KlDiagnoseServiceImpl {
|
|
|
res = klDiagnoseConditionFacade.remove(klDiagnoseQuery);
|
|
|
return res;
|
|
|
}
|
|
|
+
|
|
|
+ public Boolean saveCommon(KlDiagnoseSaveVO klDiagnoseSaveVO) {
|
|
|
+ Date now = DateUtil.now();
|
|
|
+ boolean res = false;
|
|
|
+ List<KlDiagnoseTypeVO> klDiagnoseTypeVO = klDiagnoseSaveVO.getKlDiagnoseTypeVO();
|
|
|
+ List<KlDiagnoseCondition> klDiagnoseConditionList = new ArrayList<>();
|
|
|
+ List<KlDiagnoseBaseWrapper> klDiagnoseBaseListWrapper = new ArrayList<>();
|
|
|
+ List<KlDiagnoseBase> klDiagnoseBaseList = new ArrayList<>();
|
|
|
+ for (KlDiagnoseTypeVO data : klDiagnoseTypeVO) {
|
|
|
+ KlDiagnoseCondition klDiagnoseCondition = new KlDiagnoseCondition();
|
|
|
+ klDiagnoseCondition.setConditionType(data.getConditionType());//取出诊断的类型,2拟诊,3 确诊
|
|
|
+ List<KlDiagnoseGroupVO> groupVO = data.getGroupVO();
|
|
|
+ for (KlDiagnoseGroupVO data2 : groupVO) {
|
|
|
+ klDiagnoseCondition.setBaseGroup(data2.getBaseGroup());//
|
|
|
+ klDiagnoseCondition.setConditionGroup(data2.getConditionGroup());
|
|
|
+ klDiagnoseCondition.setFitNo(data2.getFitNo());
|
|
|
+ klDiagnoseConditionList.add(klDiagnoseCondition);
|
|
|
+ //明细
|
|
|
+ List<KlDiagnoseDetailVO> klDiagnoseDetail = data2.getKlDiagnoseDetail();
|
|
|
+ for (KlDiagnoseDetailVO detailVO : klDiagnoseDetail) {
|
|
|
+ KlDiagnoseBaseWrapper klDiagnoseBaseWrapper = new KlDiagnoseBaseWrapper();
|
|
|
+ KlDiagnoseBase klDiagnoseBase = new KlDiagnoseBase();
|
|
|
+ klDiagnoseBaseWrapper.setBaseGroup(data2.getBaseGroup());
|
|
|
+ klDiagnoseBase.setGmtModified(now);
|
|
|
+ klDiagnoseBase.setConceptId(detailVO.getConceptId());
|
|
|
+ klDiagnoseBase.setType(detailVO.getBasType());
|
|
|
+ klDiagnoseBase.setDescription(detailVO.getDescription());
|
|
|
+ klDiagnoseBase.setMaxOperator(detailVO.getMaxOperator());
|
|
|
+ klDiagnoseBase.setMaxValue(detailVO.getMaxVal());
|
|
|
+ klDiagnoseBase.setMaxUnit(detailVO.getMaxUnit());
|
|
|
+ klDiagnoseBase.setMinOperator(detailVO.getMinOperator());
|
|
|
+ klDiagnoseBase.setMinValue(detailVO.getMinVal());
|
|
|
+ klDiagnoseBase.setMinUnit(detailVO.getMinUnit());
|
|
|
+ klDiagnoseBase.setStatus(1);
|
|
|
+ klDiagnoseBase.setEqValue(detailVO.getEqValue());
|
|
|
+ klDiagnoseBase.setEqOperator(detailVO.getEqOperator());
|
|
|
+ klDiagnoseBase.setEqUnit(detailVO.getEqUnit());
|
|
|
+ BeanUtil.copyProperties(klDiagnoseBase, klDiagnoseBaseWrapper);
|
|
|
+ klDiagnoseBaseList.add(klDiagnoseBase);
|
|
|
+ klDiagnoseBaseListWrapper.add(klDiagnoseBaseWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ res = klDiagnoseBaseFacade.saveBatch(klDiagnoseBaseList);
|
|
|
+ if (res) {
|
|
|
+ for (KlDiagnoseBase base : klDiagnoseBaseList) {
|
|
|
+ for (KlDiagnoseBaseWrapper baseWrapper : klDiagnoseBaseListWrapper) {
|
|
|
+ if (baseWrapper.getDescription().equals(base.getDescription())) {
|
|
|
+ KlDiagnoseCondition klDiagnoseCondition = new KlDiagnoseCondition();
|
|
|
+ //TODO
|
|
|
+ klDiagnoseCondition.setDiagnoseBaseId(base.getId());
|
|
|
+ klDiagnoseCondition.setBaseGroup(baseWrapper.getBaseGroup());
|
|
|
+ klDiagnoseCondition.setConditionType(1);
|
|
|
+ klDiagnoseCondition.setDiagnoseId(klDiagnoseSaveVO.getId());
|
|
|
+ klDiagnoseConditionList.add(klDiagnoseCondition);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ res = klDiagnoseConditionFacade.saveBatch(klDiagnoseConditionList);
|
|
|
+
|
|
|
+ return res;
|
|
|
+ }
|
|
|
}
|