fhx
2024-10-10 6623d16a2e4de709a64d4980ff8b5cc4fb6269d5
phi_platform_user/src/main/java/com/hx/phip/controller/meiji/MeiJiDataController.java
@@ -2,10 +2,7 @@
import com.alibaba.fastjson.JSONObject;
import com.hx.common.BaseController;
import com.hx.mybatisTool.SqlSentence;
import com.hx.phiappt.common.enums.MeiJiResourceFileEnum;
import com.hx.phiappt.constants.tool.comparePhoto.ComparePhotoUtil;
import com.hx.phiappt.dao.mapper.MjResourceFileMapper;
import com.hx.phiappt.constants.tool.meiji.MeiJiDataTool;
import com.hx.resultTool.Result;
import com.hx.util.StringUtils;
import com.hz.his.dto.meiji.MeiJiDataDto;
@@ -18,7 +15,6 @@
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.*;
/**
 * 美际数据
@@ -41,35 +37,8 @@
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "美际皮肤报告标识不能为空!");
        }
        SqlSentence sqlSentence = new SqlSentence();
        Map<String, Object> values = new HashMap<>();
        sqlSentence.setM(values);
        values.put("mjSkinReportId", dto.getMjSkinReportId());
        sqlSentence.setSqlSentence(" select fileName, fileUrl from mj_resource_file where isDel = 0 and mjSkinReportId = #{m.mjSkinReportId} ");
        List<Map<String, Object>> list = commonService.selectListMap(MjResourceFileMapper.class, sqlSentence);
        if(list != null && list.size() > 0){
            String flag;
            for(Map<String, Object> map : list){
                //文件验签访问
                map.put("fileUrl", ComparePhotoUtil.getDecryptImagesUrl(sFileService, map.get("fileUrl").toString()));
                //遍历根据文件名转换展示名和排序号
                flag = map.get("fileName").toString();
                flag = flag.toLowerCase(Locale.ROOT);
                for (MeiJiResourceFileEnum meiJiResourceFileEnum : MeiJiResourceFileEnum.values()) {
                    if (Objects.equals(meiJiResourceFileEnum.getFlag(), flag)){
                        map.put("sortNum", meiJiResourceFileEnum.getSortNum());
                        map.put("showName", meiJiResourceFileEnum.getShowName());
                        break;
                    }
                }
            }
            //排序
            list.sort(Comparator.comparing((Map<String, Object> h) -> ((int) h.get("sortNum"))));
        }
        JSONObject data = new JSONObject();
        data.put("list", list);
        data.put("list", MeiJiDataTool.getMjFileList(commonService, sFileService, dto.getMjSkinReportId()));
        return Result.success(data);
    }