From 7e52f375aea9e6315625d0ac0f7b69de199f433b Mon Sep 17 00:00:00 2001 From: fhx <308050795@qq.com> Date: 星期四, 01 八月 2024 16:14:50 +0800 Subject: [PATCH] 1.新增处理治疗单项目模式数据逻辑代码 --- phi_platform_user/src/main/java/com/hx/phip/service/treat/impl/TreatV3ServiceImpl.java | 67 +++++++++++++++++++++++++++++++++ 1 files changed, 66 insertions(+), 1 deletions(-) diff --git a/phi_platform_user/src/main/java/com/hx/phip/service/treat/impl/TreatV3ServiceImpl.java b/phi_platform_user/src/main/java/com/hx/phip/service/treat/impl/TreatV3ServiceImpl.java index b376cb6..0b4e5b7 100644 --- a/phi_platform_user/src/main/java/com/hx/phip/service/treat/impl/TreatV3ServiceImpl.java +++ b/phi_platform_user/src/main/java/com/hx/phip/service/treat/impl/TreatV3ServiceImpl.java @@ -1,6 +1,8 @@ package com.hx.phip.service.treat.impl; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.hx.common.dao.CommonDao; import com.hx.common.service.CommonService; import com.hx.exception.TipsException; @@ -20,6 +22,7 @@ import com.hx.phiappt.model.*; import com.hx.phiappt.model.guide.VisitOrder; import com.hx.phiappt.model.treat.*; +import com.hx.phiappt.vo.treat.TreatProjectModeDataVo; import com.hx.phip.common.wx.corp.WeiXinCorpMpUtil; import com.hx.phip.common.wx.corp.WeiXinMpUtil; import com.hx.phip.config.CustomParameter; @@ -77,7 +80,8 @@ private UserBeChangeLogMapper userBeChangeLogMapper; @Resource private TreatSingleSignMapper treatSingleSignMapper; - + @Resource + private SystemParameterMapper systemParameterMapper; @@ -558,6 +562,67 @@ } + /** 澶勭悊娌荤枟鍗曟ā寮忔暟鎹� */ + public void handleModeData(List<TreatProject> treatProjectList){ + //鍏堣繃婊ゅ嚭鎵撴硶涓嶄负绌虹殑娌荤枟鍗曢」鐩細椤圭洰鍚嶏紝鎵撴硶 + Map<String, String> dataMap = treatProjectList.stream().filter(s->StringUtils.noNull(s.getItemMode())).collect(Collectors.toMap(TreatProject::getProjectName, TreatProject::getItemMode)); + if(dataMap == null || dataMap.size() < 1){ + return; + } + + SystemParameter sp = systemParameterMapper.selectOneByName(SystemParameter.KEY_ZLD_PROJECT_MODE_DATA); + List<TreatProjectModeDataVo> modeDataVoList = null; + if(sp != null && StringUtils.isEmpty(sp.getParamValue())){ + modeDataVoList = JSONArray.parseArray(sp.getParamValue(), TreatProjectModeDataVo.class); + } + + if(modeDataVoList == null){ + modeDataVoList = new ArrayList<>(); + } + + TreatProjectModeDataVo modeDataVo; + for(Map.Entry<String, String> entry : dataMap.entrySet()){ + //娌℃湁鏃跺垯 + if(modeDataVoList.size() == 0){ + modeDataVoList.add(new TreatProjectModeDataVo(entry.getKey(), entry.getValue())); + continue; + + } + + for(int i = 0; i < modeDataVoList.size(); i++){ + modeDataVo = modeDataVoList.get(i); + //鏈夌浉鍚岀殑椤圭洰鍚嶆暟鎹� + if(modeDataVo.getProjectName().equals(entry.getKey())){ + //鐒跺悗瀵瑰簲鐨勬墦娉曚笉瀛樺湪 + if(!modeDataVo.getModeList().contains(entry.getValue())){ + modeDataVo.getModeList().add(entry.getValue()); + continue; + } + } + + //鏈�鍚庝竴涓椂琛ㄧず娌″尮閰嶅埌锛屽垯鏂板 + if(i == modeDataVoList.size() - 1){ + modeDataVoList.add(new TreatProjectModeDataVo(entry.getKey(), entry.getValue())); + } + } + } + + if(modeDataVoList.size() < 1){ + return; + } + + JSONArray arr = JSONArray.parseArray(JSONObject.toJSONString(modeDataVoList)); + if(sp == null){ + sp = new SystemParameter(); + sp.setParamName(SystemParameter.KEY_ZLD_PROJECT_MODE_DATA); + sp.setParamValue(arr.toString()); + systemParameterMapper.insert(sp); + }else{ + sp.setParamValue(arr.toString()); + systemParameterMapper.updateInfoById(sp); + } + } + /////////////////////////////////////////////////////////////////////////////// //澶勭悊缂栬緫娌荤枟閫氱煡鍗曟椂椤圭洰鍙樺姩閫昏緫 -- Gitblit v1.8.0