【丽水】满意度模块化:新增 ruoyi-satisfaction 独立模块
- 新增 ruoyi-satisfaction 模块并在根 pom 注册、ruoyi-admin 增加依赖:
满意度 domain / mapper / service / controller / api 门面与 satisfaction 开关
- 满意度按站点口径策略化(common / 省立同德 sltd),接口地址保持不变
- 从 smartor、ruoyi-admin、ruoyi-system、ruoyi-common 中摘除满意度实现
- 新增门诊用药错误记录 PatMedOuthospError(domain / mapper / XML)
- 调整 IVR 模板脚本、随访子任务相关 Mapper 与 XML
已删除2个文件
已重命名20个文件
已修改19个文件
已添加44个文件
| | |
| | | <version>${ruoyi.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 满æåº¦æ¨¡å --> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-satisfaction</artifactId> |
| | | <version>${ruoyi.version}</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | </dependencyManagement> |
| | | |
| | |
| | | <module>ruoyi-generator</module> |
| | | <module>ruoyi-common</module> |
| | | <module>ruoyi-message</module> |
| | | <module>ruoyi-satisfaction</module> |
| | | <module>smartor</module> |
| | | </modules> |
| | | <packaging>pom</packaging> |
| | |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-message</artifactId> |
| | | </dependency> |
| | | <!-- 满æåº¦æ¨¡åï¼Controller / Service / Mapper / SQL / domain å
¨é¨å¨æ¬æ¨¡åå
ï¼ --> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-satisfaction</artifactId> |
| | | </dependency> |
| | | <!-- https://mvnrepository.com/artifact/net.glxn.qrgen/javase --> |
| | | <dependency> |
| | | <groupId>net.glxn.qrgen</groupId> |
| | |
| | | import com.ruoyi.quartz.task.RyTask; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysUserDeptService; |
| | | import com.smartor.common.MydOptionRatioChartBuilder; |
| | | import com.ruoyi.satisfaction.api.SatisfactionExportBundle; |
| | | import com.ruoyi.satisfaction.api.SatisfactionFacade; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.domain.DTO.QuestionResultDTO; |
| | | import com.smartor.domain.VO.*; |
| | | import com.smartor.domain.entity.ServiceSubtaskEntity; |
| | | import com.smartor.service.IServiceSubtaskRecordService; |
| | |
| | | |
| | | @Autowired |
| | | private IServiceSubtaskService serviceSubtaskService; |
| | | |
| | | /** |
| | | * 满æåº¦æ¨¡å对å¤é¨é¢ï¼å¸¸é©» Beanï¼ã |
| | | * <p> |
| | | * 满æåº¦ç¸å
³æ°æ®ï¼é®é¢è¯¦æ
å æ¯ï¼åªè½éè¿å®è·åï¼æ»¡æåº¦æ¨¡åå
³éæ¶ |
| | | * é¨é¢è¿åç©ºç»æå¹¶æ WARNï¼<b>ä¸ä¼</b>å½±åé访导åºçå
¶å®å
容ã |
| | | */ |
| | | @Autowired |
| | | private SatisfactionFacade satisfactionFacade; |
| | | |
| | | @Autowired |
| | | private IServiceTaskService serviceTaskService; |
| | |
| | | serviceSubtaskList = serviceSubtaskService.patItem(serviceSubtaskEntity); |
| | | } |
| | | List<ServiceSubtaskExport> serviceSubtaskExports = null; |
| | | List<ServiceSubtaskDetailRatioExport> serviceSubtaskDetailRatioExports = null; |
| | | //满æåº¦å æ¯å¯¼åºå
ï¼é»è®¤ç©ºå
ï¼æ²¡æå¯å¯¼åºçæ£è
æ¶ä¿æä¸ºç©ºï¼ï¼ææ°æ®æ¶ç±æ»¡æåº¦é¨é¢å¡«å
|
| | | SatisfactionExportBundle ratioBundle = SatisfactionExportBundle.empty(); |
| | | if (!CollectionUtils.isEmpty(serviceSubtaskList)) { |
| | | serviceSubtaskExports = DtoConversionUtils.sourceToTarget(serviceSubtaskList, ServiceSubtaskExport.class); |
| | | for (ServiceSubtaskExport serviceSubtaskExport : serviceSubtaskExports) { |
| | |
| | | } |
| | | } |
| | | //é®é¢è¯¦æ
å æ¯ï¼åªç»è®¡æ¬æ¬¡å¯¼åºçè¿æ¹æ£è
ï¼æ°é=é该éé¡¹çæ£è
æ°ï¼æ¯ä¾=å 该é¢ä½çäººæ° |
| | | //满æåº¦æ¨¡åååï¼åªéè¿æ»¡æåº¦æ¨¡åæ´é²ç api å
åæ°ï¼å¯¼åºå
= è¡ + è¡ç±»å + å¾è¡¨æå»ºå¨ï¼ï¼ |
| | | //模åå
³éï¼satisfaction.enabled=falseï¼æ¶é¨é¢è¿å空导åºå
ï¼å¯¼åºç
§å¸¸å®æï¼åªæ¯æ²¡æå æ¯ Sheetï¼ã |
| | | List<Long> subtaskIds = new ArrayList<>(); |
| | | for (ServiceSubtaskRes serviceSubtaskRes : serviceSubtaskList) { |
| | | if (serviceSubtaskRes.getId() != null) { |
| | | subtaskIds.add(serviceSubtaskRes.getId()); |
| | | } |
| | | } |
| | | serviceSubtaskDetailRatioExports = serviceSubtaskService.statMydQuestionOptionForExport(subtaskIds, null); |
| | | ratioBundle = satisfactionFacade.getQuestionOptionRatioExport(subtaskIds, null); |
| | | } |
| | | |
| | | |
| | | ExcelUtil<ServiceSubtaskExport> util = new ExcelUtil<ServiceSubtaskExport>(ServiceSubtaskExport.class); |
| | | //第ä¸ä¸ªSheetï¼é®é¢è¯¦æ
å æ¯å¾è¡¨ï¼æä»»å¡åç§°åç»ï¼ä¸ä¸ªä»»å¡ä¸å¼ æ±ç¶å¾ï¼ |
| | | util.exportExcelTwoSheetWithChart(response, serviceSubtaskExports, "æ£è
é访信æ¯è¡¨å", |
| | | serviceSubtaskDetailRatioExports, "é®é¢è¯¦æ
å æ¯", ServiceSubtaskDetailRatioExport.class, |
| | | new MydOptionRatioChartBuilder(serviceSubtaskDetailRatioExports)); |
| | | ratioBundle.getRows(), "é®é¢è¯¦æ
å æ¯", ratioBundle.getRowClass(), |
| | | ratioBundle.getChartBuilder()); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.smartor.domain.DTO.QuestionResultDTO; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.domain.VO.MydTrendReqVO; |
| | | import com.smartor.domain.VO.MzMydScoreRankVO; |
| | | import com.smartor.domain.VO.QuestionCountKsOrBqVO; |
| | | import com.smartor.domain.VO.SltdMydTotalVO; |
| | | import com.smartor.domain.entity.ServiceSubtaskEntity; |
| | | import com.smartor.service.IServiceSubtaskDetailService; |
| | | import com.smartor.service.IServiceSubtaskService; |
| | |
| | | map = ServiceSubtaskDetailService.getServiceSubtaskDetails(serviceSubtaskDetailVO); |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * çç«å德满æåº¦æ°æ®ç»è®¡ï¼æé¢ç®ç»è®¡é项æ°é/å æ¯ï¼å¹¶ç»åºè¯¥é¢ç综åå¾åï¼ |
| | | * <p> |
| | | * ç»¼åæ»¡æåº¦ = (徿»¡æé¡¹æ°Ã1 + 满æé¡¹æ°Ã0.8 + ä¸è¬é¡¹æ°Ã0.6 + 䏿»¡æé¡¹æ°Ã0.4 + å¾ä¸æ»¡æé¡¹æ°Ã0.2) |
| | | * / (徿»¡æé¡¹æ° + 满æé¡¹æ° + ä¸è¬é¡¹æ° + 䏿»¡æé¡¹æ° + å¾ä¸æ»¡æé¡¹æ°) à 100%ï¼ |
| | | * ãæªç»åããä¸éç¨ãçä¸å¨äºæ¡£éçé项æ¢ä¸è¿ååä¹ä¸è¿åæ¯ã |
| | | */ |
| | | @ApiOperation("çç«å德满æåº¦æ°æ®ç»è®¡") |
| | | @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid") |
| | | @PostMapping("/sltdMydTotalByScore") |
| | | public Map<String, Object> sltdMydTotalByScore(@RequestBody SltdMydTotalVO sltdMydTotalVO) { |
| | | List<ServiceSubtaskRes> serviceSubtaskResList = null; |
| | | if (CollectionUtils.isNotEmpty(sltdMydTotalVO.getServiceTypeList())) { |
| | | //serviceTypeå¯è½ä¼åºç°å¤ä¸ªï¼ä¸æ³å¤åæ¹æ³äºï¼ä¸ä¸ªä¸ä¸ªæ¥è¯¢å§ |
| | | for (String st : sltdMydTotalVO.getServiceTypeList()) { |
| | | ServiceSubtaskEntity serviceSubtaskEntity = new ServiceSubtaskEntity(); |
| | | serviceSubtaskEntity.setServiceType(st); |
| | | serviceSubtaskEntity.setEndOutHospTime(sltdMydTotalVO.getEndOutHospTime()); |
| | | serviceSubtaskEntity.setStartOutHospTime(sltdMydTotalVO.getStartOutHospTime()); |
| | | serviceSubtaskEntity.setDeptOrDistrict(sltdMydTotalVO.getDeptOrDistrict()); |
| | | serviceSubtaskEntity.setLeavehospitaldistrictcodes(sltdMydTotalVO.getLeavehospitaldistrictcodes()); |
| | | serviceSubtaskEntity.setLeaveldeptcodes(sltdMydTotalVO.getLeaveldeptcodes()); |
| | | //æºæ/é¢åºç± @AddOrgId 注å
¥ï¼è½å°æ¥è¯¢æ¡ä»¶ä¸ï¼é¿å
è·¨æºæåæ° |
| | | serviceSubtaskEntity.setOrgid(sltdMydTotalVO.getOrgid()); |
| | | serviceSubtaskEntity.setCampusid(sltdMydTotalVO.getCampusid()); |
| | | if (serviceSubtaskEntity != null) { |
| | | List<ServiceSubtask> serviceSubtasks = serviceSubtaskService.getServiceSubtasks(serviceSubtaskEntity); |
| | | List<ServiceSubtaskRes> serviceSubtaskRes = DtoConversionUtils.sourceToTarget(serviceSubtasks, ServiceSubtaskRes.class); |
| | | if (CollectionUtils.isNotEmpty(serviceSubtaskResList)) { |
| | | serviceSubtaskResList.addAll(serviceSubtaskRes); |
| | | } else { |
| | | if (CollectionUtils.isEmpty(serviceSubtaskResList)) serviceSubtaskResList = serviceSubtaskRes; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // æ questiontext åç»å转æ¢ä¸º QuestionResultVO |
| | | List<QuestionResultDTO> result = new ArrayList<>(); |
| | | if (CollectionUtils.isNotEmpty(serviceSubtaskResList)) { |
| | | List<ServiceSubtaskDetailRatioExport> detailList = serviceSubtaskService.getDetailRatio(sltdMydTotalVO, serviceSubtaskResList); |
| | | |
| | | if (detailList == null) { |
| | | //serviceType ç»åä¸å¨æ¯æèå´å
ï¼å¦åæ¶å«é访 2 åæ»¡æåº¦ 6/14ï¼ï¼ç»æç¡®æç¤ºè䏿¯ææè¿å空æ°ç» |
| | | return error("å½å serviceType ç»åæä¸æ¯æç»è®¡é®é¢å æ¯ï¼è¯·å弿¥è¯¢ï¼ä»
æ¯æé访 2 ææ»¡æåº¦ 6/14ï¼"); |
| | | } |
| | | if (CollectionUtils.isNotEmpty(detailList)) { |
| | | Map<String, List<ServiceSubtaskDetailRatioExport>> groupedMap = detailList.stream().collect(Collectors.groupingBy(ServiceSubtaskDetailRatioExport::getQuestiontext)); |
| | | |
| | | groupedMap.forEach((questionText, exportList) -> { |
| | | QuestionResultDTO questionResultDTO = new QuestionResultDTO(); |
| | | questionResultDTO.setQeustionText(questionText); |
| | | questionResultDTO.setSubtaskDetailRatioExportList(exportList); |
| | | //综åå¾åï¼(徿»¡æÃ1 + 满æÃ0.8 + ä¸è¬Ã0.6 + 䏿»¡æÃ0.4 + å¾ä¸æ»¡æÃ0.2) / äºæ¡£é¡¹æ°ä¹å à 100% |
| | | questionResultDTO.setAvgScore(calcMydScore(exportList)); |
| | | result.add(questionResultDTO); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | return success(result); |
| | | } |
| | | |
| | | @ApiOperation("çç«å德满æåº¦æ°æ®ç»è®¡éè¿ç§å®¤æç
åº") |
| | | @PostMapping("/statQuestionOptionByKsOrBq") |
| | | public Map<String, Object> statQuestionOptionByKsOrBq(@RequestBody QuestionCountKsOrBqVO questionResultVO) { |
| | | return success(serviceSubtaskService.statQuestionOptionByKsOrBq(questionResultVO)); |
| | | } |
| | | |
| | | @ApiOperation("çç«åå¾·æ£è
满æåº¦è¶å¿") |
| | | @PostMapping("/mydTrend") |
| | | public Map<String, Object> mydTrend(@RequestBody MydTrendReqVO mydTrendReqVO) { |
| | | return success(serviceSubtaskService.mydTrend(mydTrendReqVO)); |
| | | } |
| | | |
| | | @ApiOperation("çç«åå¾·æ£è
满æåº¦ç»´æ¤") |
| | | @PostMapping("/sltdMydTotalByDimension") |
| | | public Map<String, Object> sltdMydTotalByDimension(@RequestBody MydTrendReqVO mydTrendReqVO) { |
| | | return success(serviceSubtaskService.sltdMydTotalByDimension(mydTrendReqVO)); |
| | | } |
| | | |
| | | @ApiOperation("é¨è¯æ»¡æåº¦ç»¼åå¾åæåï¼æç§å®¤æç
åºï¼") |
| | | @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid") |
| | | @PostMapping("/mzMydScoreRank") |
| | | public Map<String, Object> mzMydScoreRank(@RequestBody MzMydScoreRankVO mzMydScoreRankVO) { |
| | | return success(serviceSubtaskService.mzMydScoreRank(mzMydScoreRankVO)); |
| | | } |
| | | |
| | | /** |
| | | * å¤éé¢çé®é¢ç±»å |
| | | */ |
| | | private static final String VALUE_TYPE_MULTIPLE = "2"; |
| | | |
| | | /** |
| | | * 满æåº¦äºæ¡£é项ï¼é¡ºåºä¸æé顺åºä¸è´ï¼ |
| | | */ |
| | | private static final String[] MYD_SCORE_OPTIONS = {"徿»¡æ", "满æ", "ä¸è¬", "䏿»¡æ", "å¾ä¸æ»¡æ"}; |
| | | |
| | | /** |
| | | * 满æåº¦äºæ¡£æéï¼å¾æ»¡æ 1ãæ»¡æ 0.8ãä¸è¬ 0.6ã䏿»¡æ 0.4ãå¾ä¸æ»¡æ 0.2 |
| | | */ |
| | | private static final BigDecimal[] MYD_SCORE_WEIGHTS = { |
| | | new BigDecimal("1"), new BigDecimal("0.8"), new BigDecimal("0.6"), new BigDecimal("0.4"), new BigDecimal("0.2")}; |
| | | |
| | | /** |
| | | * 计ç®ä¸éé¢ç满æåº¦ç»¼åå¾åï¼ç¾åå¶ï¼ä¿ç两ä½å°æ°ï¼ |
| | | * <p> |
| | | * ç»¼åæ»¡æåº¦ = (徿»¡æé¡¹æ°Ã1 + 满æé¡¹æ°Ã0.8 + ä¸è¬é¡¹æ°Ã0.6 + 䏿»¡æé¡¹æ°Ã0.4 + å¾ä¸æ»¡æé¡¹æ°Ã0.2) |
| | | * / (徿»¡æé¡¹æ° + 满æé¡¹æ° + ä¸è¬é¡¹æ° + 䏿»¡æé¡¹æ° + å¾ä¸æ»¡æé¡¹æ°) à 100% |
| | | * <p> |
| | | * æéæéé¡¹ææ¡å¤å®ï¼è§ {@link #mydScoreOptionIndex(String)}ï¼ï¼ä¸åä¾èµæç»ç score åæ®µï¼ |
| | | * å岿°æ®é score æ 0ãã0000000001ãè¿ç±»èå¼ï¼æ score ç®ä¼æå¾ååºå®æ 0 æ 100ã |
| | | * ãæªç»åããä¸éç¨ãçä¸å¨äºæ¡£éçé项æ¢ä¸è¿ååä¹ä¸è¿åæ¯ã |
| | | * |
| | | * @param exportList åä¸éé¢ç®çé项ç»è®¡æç» |
| | | * @return ç¾åå¶ç»¼åå¾åï¼æ ææé¡¹æ°æ¶è¿å "0.00" |
| | | */ |
| | | private String calcMydScore(List<ServiceSubtaskDetailRatioExport> exportList) { |
| | | if (CollectionUtils.isEmpty(exportList)) return "0.00"; |
| | | |
| | | BigDecimal scoreSum = BigDecimal.ZERO; //ååï¼Î£(æ¡£ä½æé à 项æ°) |
| | | BigDecimal countSum = BigDecimal.ZERO; //忝ï¼äºæ¡£é¡¹æ°ä¹å |
| | | |
| | | for (ServiceSubtaskDetailRatioExport detail : exportList) { |
| | | //å¤éé¢ä¸è¡æ¯å¤ä¸ªé项çåå¼ä¹åï¼åæ¯åªç® 1 项ï¼ä¼æå¾åç®é«ï¼ä¸è®¡å
¥ç»¼åå¾å |
| | | if (VALUE_TYPE_MULTIPLE.equals(detail.getValueType())) continue; |
| | | //ãä¸éç¨ãä¸å¨å
¬å¼çäºæ¡£éï¼ä¸è®¡å
¥ç»¼åå¾å |
| | | if (isNotApplicable(detail)) continue; |
| | | |
| | | int optionIndex = mydScoreOptionIndex(detail.getOptionresult()); |
| | | BigDecimal count = parseDecimal(detail.getCount()); |
| | | if (optionIndex < 0 || count == null || count.signum() <= 0) continue; |
| | | |
| | | scoreSum = scoreSum.add(MYD_SCORE_WEIGHTS[optionIndex].multiply(count)); |
| | | countSum = countSum.add(count); |
| | | } |
| | | |
| | | if (countSum.signum() <= 0) return "0.00"; |
| | | |
| | | return scoreSum.divide(countSum, 6, RoundingMode.HALF_UP) |
| | | .multiply(BigDecimal.valueOf(100)) |
| | | .setScale(2, RoundingMode.HALF_UP) |
| | | .toPlainString(); |
| | | } |
| | | |
| | | /** |
| | | * éé¡¹ææ¡ â æ»¡æåº¦äºæ¡£ä¸æ ï¼å¾æ»¡æ 0ãæ»¡æ 1ãä¸è¬ 2ã䏿»¡æ 3ãå¾ä¸æ»¡æ 4ï¼ï¼ä¸å¨äºæ¡£éè¿å -1 |
| | | */ |
| | | private int mydScoreOptionIndex(String optionresult) { |
| | | if (StringUtils.isEmpty(optionresult)) return -1; |
| | | String text = optionresult.trim(); |
| | | for (int i = 0; i < MYD_SCORE_OPTIONS.length; i++) { |
| | | if (MYD_SCORE_OPTIONS[i].equals(text)) return i; |
| | | } |
| | | //å
¼å®¹ãA 徿»¡æããB.满æãè¿ç±»å¸¦é项åºå·åç¼çå岿°æ® |
| | | if (text.length() > 2 && (text.charAt(1) == ' ' || text.charAt(1) == '.' || text.charAt(1) == 'ã')) { |
| | | String stripped = text.substring(2).trim(); |
| | | for (int i = 0; i < MYD_SCORE_OPTIONS.length; i++) { |
| | | if (MYD_SCORE_OPTIONS[i].equals(stripped)) return i; |
| | | } |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦ãä¸éç¨ãé项 |
| | | */ |
| | | private boolean isNotApplicable(ServiceSubtaskDetailRatioExport detail) { |
| | | return containsNotApplicable(detail.getOptionresult()) || containsNotApplicable(detail.getTargetvalue()); |
| | | } |
| | | |
| | | private boolean containsNotApplicable(String optionText) { |
| | | if (StringUtils.isEmpty(optionText)) return false; |
| | | String text = optionText.trim(); |
| | | return text.contains("ä¸éç¨") || text.contains("æªç") || text.contains("æç"); |
| | | } |
| | | |
| | | /** |
| | | * å符串转 BigDecimalï¼ç©ºå¼/éæ³å¼è¿å null |
| | | */ |
| | | private BigDecimal parseDecimal(String value) { |
| | | if (StringUtils.isEmpty(value)) return null; |
| | | try { |
| | | return new BigDecimal(value.trim()); |
| | | } catch (NumberFormatException e) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.smartor.domain.ServiceSubtaskDetailTrace; |
| | | import com.smartor.domain.VO.DetailTraceDealVO; |
| | | import com.smartor.domain.VO.SatisfactionExceptConfigQuestionReqVO; |
| | | import com.smartor.domain.VO.ServiceSubtaskDetailTraceVO; |
| | | import com.smartor.service.IServiceSubtaskDetailTraceService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | Object questionTotal = result.get("questionTotal"); |
| | | long total = questionTotal == null ? 0L : Long.parseLong(String.valueOf(questionTotal)); |
| | | return getDataTable3(total, result); |
| | | } |
| | | |
| | | /** |
| | | * è·å满æåº¦å¼å¸¸é
ç½®é¢ç® |
| | | */ |
| | | @ApiOperation("è·å满æåº¦å¼å¸¸é
ç½®é¢ç®") |
| | | @PostMapping("/getSatisfactionExceptConfigQuestion") |
| | | public Map<String, Object> getSatisfactionExceptConfigQuestion(@RequestBody SatisfactionExceptConfigQuestionReqVO questionReqVO) { |
| | | log.info("è·å满æåº¦å¼å¸¸é
ç½®é¢ç®çå
¥å: {}", questionReqVO); |
| | | Map<String, Object> satisfactionExceptConfigQuestion = serviceSubtaskDetailTraceService.getSatisfactionExceptConfigQuestion(questionReqVO); |
| | | return satisfactionExceptConfigQuestion; |
| | | } |
| | | |
| | | /** |
| | |
| | | #ä¸éè¦è¿è¡é¿æä»»å¡çæºæ |
| | | noLongTask: |
| | | |
| | | |
| | | |
| | | #çç«åå¾·åæ°æ®å
Œ
±æ¥å£ |
| | | sltd_pub_path: "http://open-tdyy.cfuture.shop/kapi/gw-api/" |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.core.service; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 满æåº¦åç±»æ¥è¯¢æ¥å£ï¼ä¾ ruoyi-system çæ¨¡åéè¿ Spring 容å¨è°ç¨æ»¡æåº¦æ¨¡åçå®ç°ï¼ã |
| | | * <p> |
| | | * <b>为ä»ä¹åç¬æåºè¿ä¸ªæ¥å£</b>ï¼æ»¡æåº¦åç±»åæ¬æå¨ {@link IUserExtInfoService} ä¸ï¼ |
| | | * ç± smartor 模åç {@code UserExtInfoServiceImpl} å®ç°ã满æåº¦æ¨¡åååï¼ |
| | | * 该æ¥è¯¢å·²æ´æ®µæ¬å
¥ ruoyi-satisfactionï¼ä¸ºäºä¸è®©è°ç¨æ¹ï¼ç»å½é¾è·¯ï¼ä¸æ»¡æåº¦æ¨¡åç´æ¥è¦åï¼ |
| | | * è¿éæ"满æåº¦åç±»"è¿ä¸è½ååç¬æ½ææ¥å£æ¾å¨ ruoyi-commonï¼ |
| | | * <ul> |
| | | * <li>æ¥å£å¨ ruoyi-common ââ è°ç¨æ¹åªä¾èµæ¥å£ï¼ä¸ä¾èµæ»¡æåº¦æ¨¡åï¼</li> |
| | | * <li>å®ç°ç±æ»¡æåº¦æ¨¡åç常驻é¨é¢ {@code SatisfactionFacade} æä¾ï¼ |
| | | * 该 Bean <b>æ°¸è¿åå¨</b>ï¼å æ¤è°ç¨æ¹ä¸ä¼å 为满æåº¦æ¨¡å被å
³éèå¯å¨å¤±è´¥ï¼</li> |
| | | * <li>满æåº¦æ¨¡åå
³éï¼{@code satisfaction.enabled=false}ï¼æè¯¥æ¨¡åæ´ä½ä¸å¨ä¾èµéæ¶ï¼ |
| | | * è°ç¨æ¹æ¿ä¸å°å®ç°ï¼åºéçº§ä¸ºç©ºç»æï¼è§ {@code SysUserServiceImpl#loadSatisfactionCategories}ï¼ã</li> |
| | | * </ul> |
| | | */ |
| | | public interface ISatisfactionCategoryService { |
| | | |
| | | /** |
| | | * è·å满æåº¦é®é¢åç±»ï¼è¯é³ + é®å·ï¼ï¼å¸¦ç¼åã |
| | | * |
| | | * @param orgid æºæID |
| | | * @return å
å« {@code voiceCategories} ä¸ {@code questionnaireCategorys} ç Mapï¼ |
| | | * 满æåº¦æ¨¡åå
³éæä¸å¯ç¨æ¶è¿å空 Map |
| | | */ |
| | | Map<String, Object> getSatisfactionCategories(String orgid); |
| | | } |
| | |
| | | |
| | | /** |
| | | * ç¨æ·æ©å±ä¿¡æ¯æå¡æ¥å£ï¼ä¾ ruoyi-system éè¿ SpringUtils è°ç¨ smartor å®ç°ï¼ |
| | | * <p> |
| | | * 注æï¼å {@code getSatisfactionCategories} 已鿻¡æåº¦æ¨¡ååè¿åºï¼ |
| | | * æ¹ç± {@link ISatisfactionCategoryService} æä¾ï¼å®ç°å¨ ruoyi-satisfaction 模åï¼ï¼ |
| | | * è¿æ ·ç»å½å满æåº¦åç±»çé¾è·¯ä¸åä¾èµ smartor çæ¨¡æ¿/åç±» Mapperã |
| | | */ |
| | | public interface IUserExtInfoService { |
| | | |
| | |
| | | * @return å
å« orgid å campusid ç Mapï¼æ¾ä¸å°æ¶è¿å空 Map |
| | | */ |
| | | Map<String, String> getUserOrgInfo(String userId, String orgid, String campusid); |
| | | |
| | | /** |
| | | * è·å满æåº¦é®é¢åç±»ï¼è¯é³ + é®å·ï¼ |
| | | * |
| | | * @param orgid æºæID |
| | | * @return å
å« voiceCategories å questionnaireCategorys ç Map |
| | | */ |
| | | Map<String, Object> getSatisfactionCategories(String orgid); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.quartz.constant; |
| | | |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | /** |
| | | * çç«å德鍿¥è¯ééåºå®å¸¸éï¼ä¸éè¦å¨ sys_config éé
çé£äºï¼ |
| | | * |
| | | * @author smartor |
| | | */ |
| | | public class MzGatherConstant { |
| | | |
| | | private MzGatherConstant() { |
| | | } |
| | | |
| | | /** çç«åå¾·æºæID */ |
| | | public static final String ORG_ID = "20001001"; |
| | | |
| | | /** æç¹çç¼åä¿çæ¶é¿ï¼å°æ¶ï¼ï¼é»è®¤ 30 天 */ |
| | | public static final long CACHE_TTL_HOURS = 24L * 30L; |
| | | |
| | | /** å页卿¬è½®å
çéè¯æ¬¡æ° */ |
| | | public static final int PAGE_RETRY_TIMES = 3; |
| | | |
| | | /** å页éè¯é´éï¼æ¯«ç§ï¼ */ |
| | | public static final long PAGE_RETRY_SLEEP_MS = 2000L; |
| | | |
| | | /** è¿ç»å¤å°é¡µæ¥å£å¤±è´¥å°±å¤å®"æ¥å£æ´ä½ä¸å¯ç¨"ï¼æ¬è½®æåç»æï¼ä¸å空转åé¢å å页 */ |
| | | public static final int MAX_CONSECUTIVE_PAGE_FAIL = 3; |
| | | |
| | | /** æ¥æªæ¥æ¥å£åªæ¯ææå¤©æ¥ï¼æ¶é´åæ°ä¼ yyyy-MM-dd */ |
| | | public static final DateTimeFormatter DAY_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | |
| | | /** æ¥å¿ä¸æç¹éç¨çæ¶é´æ ¼å¼ */ |
| | | public static final DateTimeFormatter MINUTE_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>ruoyi</artifactId> |
| | | <groupId>com.ruoyi</groupId> |
| | | <version>3.8.5</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>ruoyi-satisfaction</artifactId> |
| | | |
| | | <description> |
| | | 满æåº¦æ¨¡åï¼æ»¡æåº¦ç»è®¡/æ¥è¯¢/任塿°å¢çå¯ä¸å®ç°å¤ã |
| | | æ¬æ¨¡åèªå¸¦ Mapper ä¸ SQLï¼å¯ç´æ¥æ¥è¯¢ service_subtaskãservice_subtask_detail 忍¡æ¿åç±»è¡¨ï¼ |
| | | å
¶å®æ¨¡åéè¦æ»¡æåº¦æ°æ®åªè½éè¿ com.ruoyi.satisfaction.api è°ç¨ã |
| | | æ¯æéè¿ sys_config åæ°è¡¨éç satisfaction.enabled æ´ä½å
³éï¼è¿è¡æ¶è¯»åï¼æ¹å®æå¤ 10 ç§çæï¼ã |
| | | </description> |
| | | |
| | | <dependencies> |
| | | <!-- éç¨å·¥å
·ï¼BaseController / ExcelUtil / PageUtils / Arith / SecurityUtils / DtoConversionUtils |
| | | åæ¶ä¼ é带å
¥ pagehelper(å« mybatis)ãswagger-annotationsãcommons-lang3ãjackson ç --> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-common</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- lombokï¼ruoyi-common éæ¯ç´æ¥ä¾èµï¼æ¤å¤æ¾å¼å£°æçæ¬ï¼é¿å
注解å¤çå¨ç¼ºå¤± --> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <version>1.18.34</version> |
| | | </dependency> |
| | | |
| | | <!-- MyBatisï¼Mapper æ¥å£ä¸ XMLï¼pagehelper å·²ä¼ é带å
¥ï¼è¿éåªæ¯æ¾å¼åæå¾ï¼ --> |
| | | <dependency> |
| | | <groupId>org.mybatis.spring.boot</groupId> |
| | | <artifactId>mybatis-spring-boot-starter</artifactId> |
| | | <version>2.2.2</version> |
| | | </dependency> |
| | | |
| | | <!-- Servlet APIï¼HttpServletResponseï¼Controller 导åºç¨ï¼ --> |
| | | <dependency> |
| | | <groupId>javax.servlet</groupId> |
| | | <artifactId>javax.servlet-api</artifactId> |
| | | <version>4.0.1</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction; |
| | | |
| | | /** |
| | | * 满æåº¦æ¨¡åå
æ ¹ã |
| | | * <p> |
| | | * ç®å½çº¦å®ï¼ |
| | | * <ul> |
| | | * <li>{@code com.ruoyi.satisfaction.api} ââ <b>å¯ä¸å¯¹å¤å
</b>ï¼å
¶å®æ¨¡ååªè½ä¾èµè¿ä¸ªå
ï¼</li> |
| | | * <li>{@code controller} / {@code service} / {@code mapper} / {@code domain} ââ æ¨¡åå
é¨å®ç°ï¼ |
| | | * å
¶å®æ¨¡åä¸åºç´æ¥å¼ç¨ã</li> |
| | | * </ul> |
| | | * 模åå¯éè¿ {@code sys_config} åæ°è¡¨ç {@code satisfaction.enabled=false} æ´ä½å
³é |
| | | * ï¼è¿è¡æ¶è¯»åï¼æ¹å®æå¤ 10 ç§çæï¼ï¼å
³éå |
| | | * {@code com.ruoyi.satisfaction.api.SatisfactionFacade} ä»åå¨ï¼ä½ææè°ç¨é级为空å¼/å
¨é¶ï¼ |
| | | * ç´æ¥è®¿é®æ»¡æåº¦ç«¯ç¹ç请æ±ä¼è¢«æ¦æªå¨æ¦ä¸å¹¶è¿åæç¡®ç"æªå¯ç¨"ä¸å¡é误ã |
| | | */ |
| | | public final class SatisfactionModule { |
| | | |
| | | /** |
| | | * 模åé
ç½®åç¼ï¼ä»
ä½ä¸º yml å
åºé
ç½®çé®åç¼ï¼ä¸»å¼å
³å¨ sys_config åæ°è¡¨éï¼ |
| | | */ |
| | | public static final String PROPERTIES_PREFIX = "satisfaction"; |
| | | |
| | | private SatisfactionModule() { |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.api; |
| | | |
| | | import com.ruoyi.satisfaction.domain.ServiceSubtaskDetailRatioExport; |
| | | import com.ruoyi.satisfaction.service.SatisfactionSubtaskService; |
| | | import com.ruoyi.satisfaction.support.MydOptionRatioChartBuilder; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * {@link SatisfactionApi} çå
é¨å®ç°ï¼<b>常驻 Bean</b>ï¼ã |
| | | * <p> |
| | | * å¼å
³å·²æ¹ä¸ºåæ¾å¨ {@code sys_config} åæ°è¡¨ç {@code satisfaction.enabled}ï¼ |
| | | * <b>è¿è¡æ¶ç读</b>ï¼å æ¤æ¬ Bean æ æ¡ä»¶åå»ºï¼ |
| | | * <ul> |
| | | * <li>åæ°ä¸º {@code true}ï¼é»è®¤ï¼â {@link SatisfactionFacade} æ£å¸¸è½¬åå°æ¬å®ç°ï¼</li> |
| | | * <li>åæ°ä¸º {@code false} â æ¬ Bean ä»ç¶åå¨ï¼ä½é¨é¢å¨ |
| | | * {@link com.ruoyi.satisfaction.config.SatisfactionSwitch} å¤æä¸ºå
³éå |
| | | * ä¸å转åï¼èæ¯è¿åå®å
¨ç©ºå¼/å
¨é¶ã</li> |
| | | * </ul> |
| | | * 乿以ä¸åç¨ {@code @ConditionalOnProperty}ï¼é£ä¸ªæ³¨è§£åªå¨<b>å¯å¨æ¶</b>æ±å¼ä¸æ¬¡ï¼ |
| | | * ä¸"æ¹å®åæ°é
ç½®å³æ¶çæ"çè¯æ±å²çªã |
| | | * <p> |
| | | * è°ç¨æ¹<b>ä¸è¦</b>ç´æ¥æ³¨å
¥æ¬ç±»ï¼åºæ³¨å
¥ {@link SatisfactionFacade}ã |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class DefaultSatisfactionApi implements SatisfactionApi { |
| | | |
| | | private final SatisfactionSubtaskService satisfactionSubtaskService; |
| | | |
| | | public DefaultSatisfactionApi(SatisfactionSubtaskService satisfactionSubtaskService) { |
| | | this.satisfactionSubtaskService = satisfactionSubtaskService; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isEnabled() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getSatisfactionCategories(String orgid) { |
| | | return satisfactionSubtaskService.getSatisfactionCategories(orgid); |
| | | } |
| | | |
| | | @Override |
| | | public SatisfactionExportBundle getQuestionOptionRatioExport(List<Long> subtaskIds, String questiontext) { |
| | | List<ServiceSubtaskDetailRatioExport> rows = |
| | | satisfactionSubtaskService.statMydQuestionOptionForExport(subtaskIds, questiontext); |
| | | if (rows == null || rows.isEmpty()) { |
| | | // 没æè¡æ¶ä¸ç»å¾è¡¨æå»ºå¨ï¼ExcelUtil ä¼è·³è¿è¯¥ Sheetï¼ä¸åå®ç°"ç©ºæ°æ®ä¸ç»å¾"ä¸è´ï¼ |
| | | return new SatisfactionExportBundle(rows, ServiceSubtaskDetailRatioExport.class, null); |
| | | } |
| | | return new SatisfactionExportBundle(rows, ServiceSubtaskDetailRatioExport.class, |
| | | new MydOptionRatioChartBuilder(rows)); |
| | | } |
| | | |
| | | @Override |
| | | public boolean hasSatisfactionCategory(String orgid) { |
| | | Map<String, Object> categories = satisfactionSubtaskService.getSatisfactionCategories(orgid); |
| | | if (categories == null || categories.isEmpty()) { |
| | | return false; |
| | | } |
| | | Object voice = categories.get("voiceCategories"); |
| | | Object questionnaire = categories.get("questionnaireCategorys"); |
| | | return isNotEmpty(voice) || isNotEmpty(questionnaire); |
| | | } |
| | | |
| | | private boolean isNotEmpty(Object value) { |
| | | return value instanceof java.util.Collection && !((java.util.Collection<?>) value).isEmpty(); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getSatisfactionIndex(String type, String code, String orgid, |
| | | Long ivrCategoryid, Long svyCategoryid) { |
| | | return satisfactionSubtaskService.getSatisfactionIndex(type, code, orgid, ivrCategoryid, svyCategoryid); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.api; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 满æåº¦æ¨¡å<b>坹夿¥å£</b>ï¼å¯ä¸å
许å
¶å®æ¨¡åä¾èµçå
¥å£ï¼ã |
| | | * <p> |
| | | * 设计约å®ï¼ |
| | | * <ul> |
| | | * <li>åªæ´é² DTO / åºæ¬ç±»åï¼<b>䏿´é²</b>满æåº¦æ¨¡åå
é¨çå®ä½ä¸ Mapperï¼</li> |
| | | * <li>æ¬æ¥å£ç± {@link SatisfactionFacade} ç»ä¸è½¬åºï¼é¨é¢<b>æ°¸è¿åå¨</b>ï¼ |
| | | * å³ä½¿æ»¡æåº¦æ¨¡å被å
³éï¼{@code sys_config} åæ° {@code satisfaction.enabled=false}ï¼ |
| | | * ä¹ä¸ä¼å¯¼è´è°ç¨æ¹å¯å¨å¤±è´¥ï¼</li> |
| | | * <li>å
³éæ¶åæ¹æ³è¿å {@code false} / 空éå / {@code null}ï¼å¹¶æ WARN æ¥å¿ï¼ |
| | | * <b>䏿å¼å¸¸</b>ï¼ä»¥å
å½±åè°ç¨æ¹ä¸»æµç¨ï¼å¦é访导åºãç»å½ï¼ã</li> |
| | | * </ul> |
| | | */ |
| | | public interface SatisfactionApi { |
| | | |
| | | /** |
| | | * 满æåº¦æ¨¡åæ¯å¦å·²å¯ç¨ |
| | | */ |
| | | boolean isEnabled(); |
| | | |
| | | /** |
| | | * è·å满æåº¦é®é¢åç±»ï¼è¯é³ + é®å·ï¼ï¼å¸¦ç¼åã |
| | | * <p> |
| | | * ä¾ç»å½é¾è·¯ä½¿ç¨ï¼å {@code IUserExtInfoService.getSatisfactionCategories}ï¼ã |
| | | * <p> |
| | | * è¿åç»æï¼ä¸è¿ç§»åå®å
¨ä¸è´ï¼ï¼ |
| | | * <pre> |
| | | * { |
| | | * "voiceCategories": [ {categoryid, categoryName}, ... ], |
| | | * "questionnaireCategorys": [ {categoryid, categoryName}, ... ] |
| | | * } |
| | | * </pre> |
| | | * |
| | | * @param orgid æºæ id |
| | | * @return åç±»ç»æï¼æ¨¡åå
³éæ¶è¿å空 Map |
| | | */ |
| | | Map<String, Object> getSatisfactionCategories(String orgid); |
| | | |
| | | /** |
| | | * é®é¢è¯¦æ
å æ¯å¯¼åºå
ï¼ä¾é访导åºä½¿ç¨ï¼ã |
| | | * <p> |
| | | * 对åºå {@code IServiceSubtaskService.statMydQuestionOptionForExport}ã |
| | | * <p> |
| | | * è¿å {@link SatisfactionExportBundle}ï¼è¡å表 + è¡ç±»å + å¾è¡¨æå»ºå¨ä¸æ¬¡ç»é½ï¼ |
| | | * è°ç¨æ¹ï¼é访导åºï¼å æ¤<b>åªé import api å
</b>å³å¯æç»æäº¤ç» |
| | | * {@code ExcelUtil.exportExcelTwoSheetWithChart}ï¼ |
| | | * ä¸éè¦æ¥è§¦æ¬æ¨¡åç {@code domain} / {@code support} å
ã |
| | | * |
| | | * @param subtaskIds æ¬æ¬¡å¯¼åºçåä»»å¡ id |
| | | * @param questiontext é¢ç®å
容ï¼å¯éï¼æ¨¡ç³å¹é
ï¼ |
| | | * @return 导åºå
ï¼æ¨¡åå
³éæ¶è¿å {@link SatisfactionExportBundle#empty()}ï¼å¯¼åºç
§å¸¸å®æï¼åªæ¯æ²¡æå æ¯ Sheetï¼ |
| | | */ |
| | | SatisfactionExportBundle getQuestionOptionRatioExport(List<Long> subtaskIds, String questiontext); |
| | | |
| | | /** |
| | | * å¤æè¯¥æºææ¯å¦å卿»¡æåº¦é
ç½®ï¼å¯éè½åï¼ä¾è°ç¨æ¹ååç½®æ ¡éªï¼ |
| | | * |
| | | * @param orgid æºæ id |
| | | * @return æè¯é³æé®å·æ»¡æåº¦åç±»æ¶è¿å true |
| | | */ |
| | | boolean hasSatisfactionCategory(String orgid); |
| | | |
| | | /** |
| | | * é访ç»è®¡é¡µçãæ»¡æåº¦ææ°ãï¼æ»¡æåº¦é¢ç®æ»é / å¡«æ¥é / 宿æ¯ä¾ã |
| | | * <p> |
| | | * 对åºå {@code IServiceSubtaskService#getSfStatisticsJoy} å
é¨ç§æç |
| | | * {@code getSatisfactionIndex}ï¼ç°å·²æ¬å
¥æ¬æ¨¡åï¼ã |
| | | * <p> |
| | | * â ï¸ åºäº"䏿¹è¡ä¸º"çè¦æ±ï¼è¢«è¿ç§»å®ç°éçå缺é·<b>åæ ·ä¿ç</b>ï¼ |
| | | * æ¬æ¹æ³æå®è¿å {@code {mydtmzl: 0, mydtbl: 0, wcbl: 0.0}}ã |
| | | * å æ¤æ¨¡åå
³éæ¶è¿ååæ ·çå
¨é¶ Mapï¼è°ç¨æ¹å¾å°çæ¾ç¤ºç»æä¸å¼å¯æ¶ä¸è´ã |
| | | * |
| | | * @param type "1"=æç§å®¤ï¼"2"=æç
åº |
| | | * @param code ç§å®¤/ç
åºç¼ç |
| | | * @param orgid æºæ id |
| | | * @param ivrCategoryid è¯é³æ»¡æåº¦åç±» idï¼å¯ä¸º nullï¼ |
| | | * @param svyCategoryid é®å·æ»¡æåº¦åç±» idï¼å¯ä¸º nullï¼ |
| | | * @return {@code mydtmzl}(Integer) / {@code mydtbl}(Integer) / {@code wcbl}(Double) |
| | | */ |
| | | Map<String, Object> getSatisfactionIndex(String type, String code, String orgid, |
| | | Long ivrCategoryid, Long svyCategoryid); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.api; |
| | | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ãé®é¢è¯¦æ
å æ¯ã导åºå
ï¼æ»¡æåº¦æ¨¡å坹夿´é²ç导åºè½½ä½ï¼ã |
| | | * <p> |
| | | * <b>为ä»ä¹éè¦å®</b>ï¼é访导åºï¼{@code ServiceSubtaskController#patItemExport}ï¼éè¦ææ»¡æåº¦å æ¯è¡ |
| | | * äº¤ç» {@code ExcelUtil.exportExcelTwoSheetWithChart(...)}ï¼èè¿ä¸ªæ¹æ³è¦æ±åæ¶ç»åº |
| | | * ãè¡å表 + è¡ç±»å {@code Class} + å¾è¡¨æå»ºå¨ããå¦æè®©è°ç¨æ¹èªå·±æ¿è¿ä¸æ ·ï¼ |
| | | * å®å°±å¿
é¡» import 满æåº¦æ¨¡åå
é¨ç {@code domain} ä¸ {@code support} å
ï¼ |
| | | * è¿åãå
¶å®æ¨¡ååªè½ç¨æ¬æ¨¡åæ´é²ç apiãç约æã |
| | | * <p> |
| | | * å æ¤è¿éæä¸æ ·ä¸è¥¿æå
æä¸ä¸ª <b>api å±çå¼å¯¹è±¡</b>ï¼ |
| | | * <ul> |
| | | * <li>{@link #getRows()} ââ å æ¯è¡ï¼è°ç¨æ¹åªå½ä½ {@code List<?>} éä¼ ï¼ä¸éè¦ç¥éå
·ä½ç±»åï¼ï¼</li> |
| | | * <li>{@link #getRowClass()} ââ è¡ç±»åï¼åæ ·åªæ¯éä¼ ç» {@code ExcelUtil}ï¼ï¼</li> |
| | | * <li>{@link #getChartBuilder()} ââ æ±ç¶å¾æå»ºå¨ï¼ä»¥ ruoyi-common ç |
| | | * {@link ExcelUtil.ChartSheetBuilder} æ¥å£ç±»åæ´é²ï¼å®ç°å¨æ¨¡åå
é¨ï¼ |
| | | * 模åå
³éæ¶ä¸º {@code null}ï¼ã</li> |
| | | * </ul> |
| | | * è°ç¨æ¹åªé import æ¬ç±»ä¸ {@link SatisfactionFacade} å³å¯å®ææ´ä¸ªå¯¼åºã |
| | | */ |
| | | public class SatisfactionExportBundle { |
| | | |
| | | /** |
| | | * 模åå
³éæ¶ä½¿ç¨ç空导åºå
ï¼æ è¡ãæ å¾è¡¨æå»ºå¨ï¼ |
| | | */ |
| | | private static final SatisfactionExportBundle EMPTY = |
| | | new SatisfactionExportBundle(Collections.emptyList(), null, null); |
| | | |
| | | private final List<?> rows; |
| | | |
| | | private final Class<?> rowClass; |
| | | |
| | | private final ExcelUtil.ChartSheetBuilder chartBuilder; |
| | | |
| | | public SatisfactionExportBundle(List<?> rows, Class<?> rowClass, ExcelUtil.ChartSheetBuilder chartBuilder) { |
| | | this.rows = rows == null ? Collections.emptyList() : rows; |
| | | this.rowClass = rowClass; |
| | | this.chartBuilder = chartBuilder; |
| | | } |
| | | |
| | | /** |
| | | * 模åå
³éæ¶ç空å
ï¼è¡å表为空ãè¡ç±»åä¸å¾è¡¨æå»ºå¨ä¸º nullï¼ã |
| | | * <p>é
å {@code ExcelUtil} ç"è¡å表为空åè·³è¿è¯¥ Sheet"è¡ä¸ºï¼å¯¼åºå¯ä»¥ç
§å¸¸å®æã |
| | | */ |
| | | public static SatisfactionExportBundle empty() { |
| | | return EMPTY; |
| | | } |
| | | |
| | | /** |
| | | * å æ¯è¡ï¼è°ç¨æ¹åªä½éä¼ ï¼ä¸å»ºè®®èªè¡è§£æå
¶å段è¯ä¹ï¼ |
| | | */ |
| | | public List<?> getRows() { |
| | | return rows; |
| | | } |
| | | |
| | | /** |
| | | * å æ¯è¡çç±»åï¼éä¼ ç» {@code ExcelUtil} ç¨ï¼æ¨¡åå
³éæ¶ä¸º nullï¼ |
| | | */ |
| | | public Class<?> getRowClass() { |
| | | return rowClass; |
| | | } |
| | | |
| | | /** |
| | | * æ±ç¶å¾ Sheet æå»ºå¨ï¼éä¼ ç» {@code ExcelUtil} ç¨ï¼æ æ°æ®ææ¨¡åå
³éæ¶ä¸º nullï¼ |
| | | */ |
| | | public ExcelUtil.ChartSheetBuilder getChartBuilder() { |
| | | return chartBuilder; |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦æ²¡æå¯å¯¼åºçè¡ |
| | | */ |
| | | public boolean isEmpty() { |
| | | return rows.isEmpty(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.api; |
| | | |
| | | import com.ruoyi.common.core.service.ISatisfactionCategoryService; |
| | | import com.ruoyi.satisfaction.config.SatisfactionProperties; |
| | | import com.ruoyi.satisfaction.config.SatisfactionSwitch; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.ObjectProvider; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 满æåº¦æ¨¡å对å¤é¨é¢ï¼<b>常驻 Bean</b>ï¼ã |
| | | * <p> |
| | | * è¿æ¯å
¶å®æ¨¡åè®¿é®æ»¡æåº¦è½åç<b>å¯ä¸å
¥å£</b>ã |
| | | * <p> |
| | | * ä¸ {@link SatisfactionApi} å®ç°ç±»çå
³ç³»ï¼ |
| | | * <ul> |
| | | * <li>å®ç°ç±» {@link DefaultSatisfactionApi} <b>常驻</b>ï¼ä¸ååå¯å¨ææ¡ä»¶è£
é
æ§å¶ï¼ï¼</li> |
| | | * <li>å¼å
³åæ¾å¨ {@code sys_config} åæ°è¡¨ç {@code satisfaction.enabled}ï¼ |
| | | * ç± {@link SatisfactionSwitch} <b>è¿è¡æ¶</b>读åï¼10 ç§è¿ç¨å
ç¼åï¼ï¼ |
| | | * æ¹å®åæ°è®¾ç½®æ ééå¯ï¼</li> |
| | | * <li>æ¬é¨é¢<b>æ°¸è¿</b>æ¯ Spring Beanï¼å æ¤è°ç¨æ¹ï¼é访导åºãç»å½é¾è·¯ï¼ |
| | | * ç {@code @Autowired} å¨ä»»ä½å¼å
³ç¶æä¸é½<b>ä¸ä¼å¯å¨å¤±è´¥</b>ï¼</li> |
| | | * <li>å
³éæ¶åæ¹æ³è¿å失败/空å¼å¹¶æ WARNï¼<b>䏿å¼å¸¸</b>ï¼ |
| | | * ä¿è¯è°ç¨æ¹ä¸»æµç¨ï¼å¦å¯¼åºãç»å½ï¼ç
§å¸¸å®æã</li> |
| | | * </ul> |
| | | * |
| | | * <h3>使ç¨ç¤ºä¾</h3> |
| | | * <pre> |
| | | * @Autowired |
| | | * private SatisfactionFacade satisfactionFacade; |
| | | * |
| | | * if (satisfactionFacade.isEnabled()) { |
| | | * Map<String, Object> categories = satisfactionFacade.getSatisfactionCategories(orgid); |
| | | * } |
| | | * </pre> |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class SatisfactionFacade implements SatisfactionApi, ISatisfactionCategoryService { |
| | | |
| | | private final SatisfactionProperties properties; |
| | | |
| | | /** |
| | | * è¿è¡æ¶å¼å
³ï¼{@code sys_config} ä¼å
ï¼{@link SatisfactionProperties} å
åºï¼ |
| | | */ |
| | | private final SatisfactionSwitch satisfactionSwitch; |
| | | |
| | | /** |
| | | * å
é¨å®ç°ï¼æ¨¡åå
³éæ¶ä¸º {@code null}ã |
| | | * <p> |
| | | * ç¨ {@code ObjectProvider} æ°æ§è·åï¼å³ä½¿å®ç° Bean ä¸åå¨ä¹ä¸ä¼å¯¼è´æ³¨å
¥å¤±è´¥ã |
| | | */ |
| | | private final ObjectProvider<SatisfactionApi> apiProvider; |
| | | |
| | | /** |
| | | * Spring 使ç¨çæé å¨ã |
| | | * <p> |
| | | * â ï¸ <b>å¿
é¡»æ¾å¼æ 注 {@code @Autowired}</b>ï¼æ¬ç±»æä¸¤ä¸ªå
¬å¼æé å¨ |
| | | * ï¼å¦ä¸ä¸ªæ¯ç»æµè¯/é Spring ç¯å¢ç¨çï¼ï¼è¥ä¸æ 注ï¼Spring ä¼å 为"æé å¨ä¸å¯ä¸" |
| | | * èéåæ¥æ¾æ åæé å¨ï¼ä»èå¨å¯å¨æ¶æ¥ |
| | | * {@code No default constructor found}ãå·²ç± |
| | | * {@code sql/_probe/verify_spring_beans.py} éææå
³ã |
| | | */ |
| | | @Autowired |
| | | public SatisfactionFacade(SatisfactionProperties properties, |
| | | SatisfactionSwitch satisfactionSwitch, |
| | | ObjectProvider<SatisfactionApi> apiProvider) { |
| | | this.properties = properties; |
| | | this.satisfactionSwitch = satisfactionSwitch; |
| | | this.apiProvider = apiProvider; |
| | | } |
| | | |
| | | /** |
| | | * ä¾<b>æµè¯/é Spring ç¯å¢</b>ç´æ¥æé ï¼ç´æ¥ç»åºå
é¨å®ç°ï¼å¯ä¸º nullï¼ã |
| | | * <p> |
| | | * å¼å
³åèª {@code sys_config} çæ¨¡æé®å¼ï¼è§ {@link SatisfactionSwitch#SatisfactionSwitch}ï¼ï¼ |
| | | * ä»èä¿è¯"å¼å
³æ ¡éª"èæ¬æ é Spring/æ°æ®åºå³å¯è¿è¡ã |
| | | */ |
| | | public SatisfactionFacade(SatisfactionProperties properties, SatisfactionApi delegate, String sysConfigValue) { |
| | | this(properties, new SatisfactionSwitch(properties, sysConfigValue), new FixedProvider(delegate)); |
| | | } |
| | | |
| | | /** |
| | | * åè¿è¡æ¶å¼å
³ï¼ä¾æ¦æªå¨å¤ç¨åä¸ä¸ªå®ä¾ãä¹ä¾æµè¯æè¨ï¼ |
| | | */ |
| | | public SatisfactionSwitch getSatisfactionSwitch() { |
| | | return satisfactionSwitch; |
| | | } |
| | | |
| | | /** |
| | | * åå
é¨å®ç°ï¼æ¨¡åå
³éãå®ç°ç¼ºå¤±ãæåªæ¾å°èªå·±æ¶è¿å {@code null}ã |
| | | * <p> |
| | | * â ï¸ <b>å¿
é¡»æé¤"èªå·±"</b>ï¼æ¬ç±»èªèº«ä¹å®ç°äº {@link SatisfactionApi}ï¼è Spring å¨ |
| | | * æç±»åæ¥æ¾åé Bean æ¶ï¼è¥ç¬¬ä¸è½®æ²¡æ¾å°å«çå®ç°ï¼ä¾å¦ ruoyi-satisfaction |
| | | * 没æè¢«æè¿åºç¨ï¼æå°æ¥åæäººç¨æ¡ä»¶è£
é
æå®ææï¼ï¼ä¼<b>æèªå¼ç¨å½ä½å
åºåé</b>è¿åã |
| | | * 飿 · {@code delegateOrNull()} 伿¿å° {@code this}ï¼éå |
| | | * {@code getSatisfactionCategories()} é {@code delegate.getXxx()} 就忿 ééå½ |
| | | * ï¼StackOverflowErrorï¼ãè¿éæ¾å¼è¿æ»¤æèªå·±ï¼æ"没æå®ç°"å¦å®è§ä¸ºä¸å¯ç¨ã |
| | | * <p> |
| | | * â ï¸ <b>æ¬æ¹æ³ä¸è½æ¿ä»£å¼å
³å¤æ</b>ï¼å¼å
³ï¼{@code sys_config: satisfaction.enabled}ï¼ |
| | | * å
³éæ¶ {@link DefaultSatisfactionApi} ä¾ç¶åå¨ï¼æä»¥è°ç¨ç¹ä¸å¾å
å¤ {@link #isEnabled()}ã |
| | | * <p> |
| | | * ç¨ {@code stream()} è䏿¯ {@code getIfAvailable()}ï¼åè
å¨åéå¤äºä¸ä¸ªæ¶æ |
| | | * {@code NoUniqueBeanDefinitionException}ï¼å®ç»§æ¿èª {@code NoSuchBeanDefinitionException}ï¼ï¼ |
| | | * æç»ä¼è¢«åæ nullï¼æ©ç"æäººåå äºä¸ä¸ªå®ç°"è¿ç§é
ç½®é®é¢ã |
| | | */ |
| | | private SatisfactionApi delegateOrNull() { |
| | | if (apiProvider == null) { |
| | | return null; |
| | | } |
| | | try { |
| | | return apiProvider.stream() |
| | | .filter(api -> api != this) |
| | | .findFirst() |
| | | .orElse(null); |
| | | } catch (Exception e) { |
| | | // 容å¨ç¶æå¼å¸¸æ¶æ"æªå¯ç¨"å¤çï¼ç»ä¸è®©è°ç¨æ¹ï¼ç»å½ãé访导åºï¼å 为满æåº¦è失败 |
| | | log.warn("ãæ»¡æåº¦ãè·åå
é¨å®ç°å¤±è´¥ï¼ææªå¯ç¨å¤çï¼{}", e.toString()); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public boolean isEnabled() { |
| | | return satisfactionSwitch.isEnabled() && delegateOrNull() != null; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getSatisfactionCategories(String orgid) { |
| | | if (!isEnabled()) { |
| | | log.warn("ãæ»¡æåº¦ãæ¨¡åæªå¯ç¨ï¼åæ°é
ç½® satisfaction.enabled=falseï¼ï¼getSatisfactionCategories è¿åç©ºç»æãorgid={}", orgid); |
| | | return Collections.emptyMap(); |
| | | } |
| | | return delegateOrNull().getSatisfactionCategories(orgid); |
| | | } |
| | | |
| | | @Override |
| | | public SatisfactionExportBundle getQuestionOptionRatioExport(List<Long> subtaskIds, String questiontext) { |
| | | if (!isEnabled()) { |
| | | log.warn("ãæ»¡æåº¦ãæ¨¡åæªå¯ç¨ï¼åæ°é
ç½® satisfaction.enabled=falseï¼ï¼getQuestionOptionRatioExport è¿å空导åºå
ãsubtaskIds æ°é={}", |
| | | subtaskIds == null ? 0 : subtaskIds.size()); |
| | | return SatisfactionExportBundle.empty(); |
| | | } |
| | | return delegateOrNull().getQuestionOptionRatioExport(subtaskIds, questiontext); |
| | | } |
| | | |
| | | @Override |
| | | public boolean hasSatisfactionCategory(String orgid) { |
| | | if (!isEnabled()) { |
| | | return false; |
| | | } |
| | | return delegateOrNull().hasSatisfactionCategory(orgid); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getSatisfactionIndex(String type, String code, String orgid, |
| | | Long ivrCategoryid, Long svyCategoryid) { |
| | | if (!isEnabled()) { |
| | | log.warn("ãæ»¡æåº¦ãæ¨¡åæªå¯ç¨ï¼åæ°é
ç½® satisfaction.enabled=falseï¼ï¼getSatisfactionIndex è¿åå
¨é¶ç»æãtype={}, code={}", |
| | | type, code); |
| | | // è¿åä¸"å¯ç¨æ¶"å®å
¨ç¸åçå
¨é¶ Mapï¼è¢«è¿ç§»å®ç°å å缺é·ä¹æå®è¿åå
¨é¶ï¼ï¼ |
| | | // è¿æ ·é访ç»è®¡é¡µå¨æ¨¡åå
³éååçæ¾ç¤ºç»æä¸è´ã |
| | | return emptySatisfactionIndex(); |
| | | } |
| | | return delegateOrNull().getSatisfactionIndex(type, code, orgid, ivrCategoryid, svyCategoryid); |
| | | } |
| | | |
| | | /** |
| | | * å
¨é¶ç满æåº¦ææ°ï¼é®åä¸ç±»åä¸è¢«è¿ç§»å®ç°ä¸è´ï¼{@code mydtmzl}(Integer)ã |
| | | * {@code mydtbl}(Integer)ã{@code wcbl}(Double)ï¼ |
| | | */ |
| | | public static Map<String, Object> emptySatisfactionIndex() { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("mydtmzl", 0); |
| | | map.put("mydtbl", 0); |
| | | map.put("wcbl", 0.0); |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * åºå®ç ObjectProvider å®ç°ï¼ä»
ç¨äºé Spring ç¯å¢/æµè¯ã |
| | | */ |
| | | private static final class FixedProvider implements ObjectProvider<SatisfactionApi> { |
| | | |
| | | private final SatisfactionApi api; |
| | | |
| | | private FixedProvider(SatisfactionApi api) { |
| | | this.api = api; |
| | | } |
| | | |
| | | @Override |
| | | public SatisfactionApi getObject(Object... args) { |
| | | return api; |
| | | } |
| | | |
| | | @Override |
| | | public SatisfactionApi getIfAvailable() { |
| | | return api; |
| | | } |
| | | |
| | | @Override |
| | | public SatisfactionApi getIfUnique() { |
| | | return api; |
| | | } |
| | | |
| | | @Override |
| | | public SatisfactionApi getObject() { |
| | | return api; |
| | | } |
| | | |
| | | @Override |
| | | public java.util.stream.Stream<SatisfactionApi> stream() { |
| | | return api == null ? java.util.stream.Stream.empty() : java.util.stream.Stream.of(api); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.config; |
| | | |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.servlet.HandlerInterceptor; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * 满æåº¦æ¨¡åå¼å
³æ¦æªå¨ã |
| | | * <p> |
| | | * <b>ä½ç¨</b>ï¼å½å¼å
³å
³éï¼{@code sys_config} ä¸ {@code satisfaction.enabled=false}ï¼æ¶ï¼ |
| | | * å½ä¸æ»¡æåº¦ç«¯ç¹ç请æ±ä¼è¢«ç«å³æ¦ä¸å¹¶æåº {@link ServiceException}ï¼ |
| | | * ç± RuoYi çå
¨å±å¼å¸¸å¤çå¨è¿å<b>æç¡®çä¸å¡é误æç¤º</b>ï¼è䏿¯ 404 æéé»è¿åç©ºæ°æ®ï¼ã |
| | | * <p> |
| | | * å¼å
³å¼ç± {@link SatisfactionSwitch} å¨è¿è¡æ¶è¯»åï¼{@code sys_config}ï¼10 ç§è¿ç¨å
ç¼åï¼ï¼ |
| | | * å æ¤æ¹å®åæ°è®¾ç½®<b>ä¸éè¦éå¯</b>ï¼æå¤ 10 ç§å³çæã |
| | | * <p> |
| | | * <b>为ä»ä¹ä¸ç¨ {@code @ConditionalOnProperty} 让 Controller ç´æ¥ä¸æ³¨å</b>ï¼ |
| | | * <ul> |
| | | * <li>飿 ·è°ç¨æ¹åªä¼æ¿å° HTTP 404 ââ è½ç¶ä¹æ¯å¤±è´¥ï¼ä½ä¸æ¯"æç¡®é误"ï¼ |
| | | * å端/å¤é¾æ æ³åºå"模å被å
³é"å"å°ååéäº"ï¼</li> |
| | | * <li>èä¸ {@code @ConditionalOnProperty} åªå¨<b>å¯å¨æ¶</b>æ±å¼ä¸æ¬¡ï¼ |
| | | * åä¸å°"æ¹å®åæ°é
置就çæ"ï¼ä¸åæ°è¡¨å¼å
³çè¯æ±å²çªã</li> |
| | | * </ul> |
| | | * <p> |
| | | * <b>为ä»ä¹ä¸ä¼å½±åå
¶å®ä¸å¡ä¸å¯å¨</b>ï¼ |
| | | * <ul> |
| | | * <li>æ¬æ¦æªå¨åªç»è®°å¨ <b>17 个满æåº¦ç«¯ç¹</b>ç精确路å¾ä¸ |
| | | * ï¼è§ {@link SatisfactionWebConfig}ï¼ï¼ä¸ä¼ç¢°å°é访/é®å·/å
¶å®æ¥å£ï¼</li> |
| | | * <li>模åå
³éæ¶ï¼Controller ä¸ Service 便§æ¯æ®é Beanï¼å¯å¨ä¸åå½±åï¼ï¼ |
| | | * å
¶å®æ¨¡åéè¿ {@code SatisfactionFacade} åæ°æ¶æ¿å°çæ¯å®å
¨ç©ºå¼/å
¨é¶ï¼ |
| | | * åªæ"ä¸é¨è°æ»¡æåº¦ç«¯ç¹"çè¯·æ±æä¼æ¶å°é误ã</li> |
| | | * </ul> |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class SatisfactionAvailabilityInterceptor implements HandlerInterceptor { |
| | | |
| | | /** |
| | | * 模å被å
³éæ¶è¿åç»è°ç¨æ¹çé误æç¤ºï¼å端å¯ç´æ¥å±ç¤ºï¼ |
| | | */ |
| | | public static final String DISABLED_MESSAGE = |
| | | "满æåº¦åè½æªå¯ç¨ï¼åæ°é
ç½® satisfaction.enabled=falseï¼ï¼è¯¥æ¥å£ä¸å¯ç¨"; |
| | | |
| | | private final SatisfactionSwitch satisfactionSwitch; |
| | | |
| | | public SatisfactionAvailabilityInterceptor(SatisfactionSwitch satisfactionSwitch) { |
| | | this.satisfactionSwitch = satisfactionSwitch; |
| | | } |
| | | |
| | | @Override |
| | | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { |
| | | if (!satisfactionSwitch.isEnabled()) { |
| | | // request å
许为 nullï¼åå
æµè¯ç´æ¥è° preHandle æ¶ä¸æé 请æ±å¯¹è±¡ï¼ |
| | | String method = request == null ? "-" : request.getMethod(); |
| | | String uri = request == null ? "-" : request.getRequestURI(); |
| | | log.warn("ãæ»¡æåº¦ã模åå·²å
³éï¼åæ°é
ç½® satisfaction.enabled=falseï¼ï¼æç»è®¿é® {} {}", method, uri); |
| | | throw new ServiceException(DISABLED_MESSAGE); |
| | | } |
| | | return true; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.config; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 满æåº¦æ¨¡åé
ç½®ï¼åç¼ {@code satisfaction}ï¼ã |
| | | * <p> |
| | | * â ï¸ <b>è¿ä¸æ¯ä¸»å¼å
³</b>ãæ»¡æåº¦æ¨¡åçå¼å
³<b>åå¨ {@code sys_config} åæ°é
置表é</b>ï¼ |
| | | * <pre> |
| | | * åæ°é®åï¼satisfaction.enabled |
| | | * åæ°é®å¼ï¼trueï¼å¯ç¨ï¼é»è®¤ï¼/ falseï¼å
³éï¼ |
| | | * </pre> |
| | | * è§ {@link SatisfactionSwitch}ãæ¬ç±»ç {@link #isEnabled()} åªä½ä¸º<b>å
åº</b>ï¼ |
| | | * å½ {@code sys_config} éæ²¡æè¿ä¸è¡ãæé Spring ç¯å¢åä¸å°é
ç½®æå¡æ¶æä¼ç¨å°ã |
| | | * <p> |
| | | * å¦éå¨ yml ä¸å
åºï¼ä¸è¬ä¸å¿
è¦ï¼æ£å¸¸åºå¨åæ°è®¾ç½®é¡µç»´æ¤ï¼ï¼ |
| | | * <pre> |
| | | * satisfaction: |
| | | * enabled: false |
| | | * </pre> |
| | | * <p> |
| | | * <b>å
³éåçè¡ä¸º</b>ï¼ |
| | | * <ul> |
| | | * <li>æ¬æ¨¡åç <b>17 个满æåº¦ç«¯ç¹</b>ï¼{@code /smartor/satisfaction/**}ã |
| | | * {@code /smartor/serviceSubtaskDetail} ä¸ç 5 个ã{@code /smartor/trace/getSatisfactionExceptConfigQuestion}ï¼ |
| | | * ä»ä¼æ³¨åï¼ä½è¯·æ±ä¼å¨è¿å
¥æ¹æ³å被 |
| | | * {@link SatisfactionAvailabilityInterceptor} æ¦ä¸å¹¶æåº |
| | | * {@code ServiceException("满æåº¦åè½æªå¯ç¨â¦")} ââ è°ç¨æ¹æ¿å°çæ¯ |
| | | * <b>æç¡®çä¸å¡é误æç¤º</b>ï¼è䏿¯ 404ï¼ä¾¿äºåºå"模å被å
³é"ä¸"å°ååé"ï¼</li> |
| | | * <li>{@code com.ruoyi.satisfaction.api.SatisfactionFacade} ä»ç¶åå¨ï¼ |
| | | * å
¶å®æ¨¡åï¼é访导åºãé访ç»è®¡ãç»å½é¾è·¯ï¼éè¿å®åæ°æ¶ä¼æ¿å°å®å
¨ç©ºå¼/å
¨é¶ï¼ |
| | | * <b>ä¸å½±åè°ç¨æ¹å¯å¨ä¸ä¸»æµç¨</b>ï¼</li> |
| | | * <li>é访ãé®å·ãçµè¯çå
¶å®ä¸å¡å®å
¨ä¸åå½±åï¼æ¦æªå¨åªæå¨ä¸è¿° 17 个路å¾ä¸ï¼ã</li> |
| | | * </ul> |
| | | */ |
| | | @Data |
| | | @Component |
| | | @ConfigurationProperties(prefix = "satisfaction") |
| | | public class SatisfactionProperties { |
| | | |
| | | /** |
| | | * æ¯å¦å¯ç¨æ»¡æåº¦æ¨¡åï¼é»è®¤å¯ç¨ï¼ã |
| | | * <p> |
| | | * ä»
å½ {@code sys_config} 䏿²¡æ {@code satisfaction.enabled} æ¶çæï¼è§ {@link SatisfactionSwitch}ã |
| | | */ |
| | | private boolean enabled = true; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.config; |
| | | |
| | | import com.ruoyi.common.core.service.IConfigService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.ObjectProvider; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 满æåº¦æ¨¡å<b>æ»å¼å
³</b>ï¼å¼åæ¾å¨ {@code sys_config} åæ°é
置表ä¸ï¼<b>è¿è¡æ¶è¯»åãå¯ç忢</b>ã |
| | | * |
| | | * <h3>åæ°é
ç½®</h3> |
| | | * <pre> |
| | | * åæ°é®åï¼satisfaction.enabled |
| | | * åæ°é®å¼ï¼true = å¯ç¨ï¼é»è®¤ï¼ |
| | | * false = å
³é |
| | | * </pre> |
| | | * ä½ç½®ï¼ç³»ç»ç®¡ç â åæ°è®¾ç½® â æ°å¢/ä¿®æ¹ã |
| | | * <pre> |
| | | * insert into sys_config (config_name, config_key, config_value, config_type, create_by, create_time, remark) |
| | | * values ('满æåº¦æ¨¡åå¼å
³', 'satisfaction.enabled', 'true', 'Y', 'admin', sysdate(), 'trueå¯ç¨ï¼falseå
³éï¼é»è®¤trueï¼'); |
| | | * </pre> |
| | | * |
| | | * <h3>åå¼ä¼å
级</h3> |
| | | * <ol> |
| | | * <li>{@code sys_config} é {@code satisfaction.enabled} çå¼ï¼<b>主ç¨</b>ï¼ |
| | | * æ¥èªæ¬é¡¹ç® {@code IConfigService} æ¥å£ï¼å®ç°å¨ ruoyi-system ç {@code SysConfigServiceImpl}ï¼ï¼</li> |
| | | * <li>{@link SatisfactionProperties#isEnabled()}ï¼<b>å
åº</b>ï¼ä»
å½ sys_config éæ²¡æè¿ä¸è¡ã |
| | | * æé Spring ç¯å¢åä¸å°é
ç½®æå¡æ¶ä½¿ç¨ï¼é»è®¤ trueï¼ã</li> |
| | | * </ol> |
| | | * |
| | | * <h3>为ä»ä¹é»è®¤ true</h3> |
| | | * åå²è¡ä¸ºå°±æ¯"é»è®¤å¼å¯"ãåæ°è¡ç¼ºå¤±æ¶æ true å¤çï¼ä¿è¯åçº§å°æ¬çæ¬å |
| | | * 满æåº¦åè½ä¸ä¼å 为å°äºä¸è¡é
ç½®èçªç¶ä¸å¯ç¨ï¼è¦å
³éå¿
é¡»æ¾å¼é
ç½® falseï¼ã |
| | | * |
| | | * <h3>为ä»ä¹è¯»ä¸å°é
ç½®æ¶ä¹æ trueï¼fail-openï¼</h3> |
| | | * 读 {@code sys_config} éè¦èµ°æ°æ®åºï¼æ°æ®åºæå¨æ¶å¦æ fail-closed 伿æ´ä¸ªæ»¡æåº¦ä¸å¡ææ»ã |
| | | * è¿ééæ©ä¸"åæ°è¡ç¼ºå¤±"ä¸è´çå¤çï¼åªæ WARN å¹¶æ¾è¡ï¼å®å¯å¤å¼ä¸ä¼å¿ï¼ä¹ä¸åæ°æ®åºæå¨æ¾å¤§å¨ã |
| | | * |
| | | * <h3>为ä»ä¹æ 10 ç§ç¼å</h3> |
| | | * {@code SysConfigServiceImpl#selectConfigByKey} å½å<b>æ¯æ¬¡é½æ¥åº</b>ï¼Redis ç¼å飿®µè¢«æ³¨éæäºï¼ï¼ |
| | | * èæ¬å¼å
³å¨æ¯æ¬¡æ»¡æåº¦è¯·æ±ãæ¯æ¬¡ç»å½ååç±»æ¶é½ä¼è¢«è¯»å°ãè¿éå ä¸ä¸ªè¿ç¨å
TTL ç¼åï¼ |
| | | * ææ¥åºéå°"æ¯ä¸ªå®ä¾æ¯ 10 ç§æå¤ä¸æ¬¡"ã代价æ¯åæ°æ¹å¨æå¤ 10 ç§çæï¼å¤å®ä¾é¨ç½²æ¶åèªè®¡æ¶ï¼ã |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class SatisfactionSwitch { |
| | | |
| | | /** |
| | | * sys_config éçåæ°é®å |
| | | */ |
| | | public static final String CONFIG_KEY = "satisfaction.enabled"; |
| | | |
| | | /** |
| | | * è¿ç¨å
ç¼åæææï¼æ¯«ç§ï¼ |
| | | */ |
| | | private static final long CACHE_TTL_MILLIS = 10_000L; |
| | | |
| | | private final SatisfactionProperties satisfactionProperties; |
| | | |
| | | /** |
| | | * åæ°é
ç½®æå¡ï¼ruoyi-common çæ¥å£ï¼å®ç°å¨ ruoyi-systemï¼ã |
| | | * <p> |
| | | * ç¨ {@code ObjectProvider} æ°æ§åï¼æ¬æ¨¡ååªä¾èµ ruoyi-commonï¼ |
| | | * å¨åå
æµè¯/ç¬ç«é¨ç½²ç"容å¨é没æå®ç°"çåºæ¯ä¸ä¸è½å æ¤å¯å¨å¤±è´¥ã |
| | | */ |
| | | private final ObjectProvider<IConfigService> configServiceProvider; |
| | | |
| | | /** |
| | | * æè¿ä¸æ¬¡è§£æç»æï¼å«æ¯å¦æ¥èª sys_configï¼ |
| | | */ |
| | | private volatile Boolean cachedEnabled; |
| | | |
| | | /** |
| | | * æè¿ä¸æ¬¡è§£æçæ¶é´æ³ |
| | | */ |
| | | private volatile long cachedAt; |
| | | |
| | | /** |
| | | * Spring 使ç¨çæé å¨ã |
| | | * <p> |
| | | * â ï¸ <b>å¿
é¡»æ¾å¼æ 注 {@code @Autowired}</b>ï¼æ¬ç±»æä¸¤ä¸ªå
¬å¼æé å¨ |
| | | * ï¼å¦ä¸ä¸ªç»æµè¯/é Spring ç¯å¢ç¨ï¼ï¼ä¸æ 注çè¯ Spring ä¼å "æé å¨ä¸å¯ä¸" |
| | | * éåæ¥æ¾æ åæé å¨ï¼å¯å¨å³æ¥ {@code No default constructor found}ã |
| | | */ |
| | | @Autowired |
| | | public SatisfactionSwitch(SatisfactionProperties satisfactionProperties, |
| | | ObjectProvider<IConfigService> configServiceProvider) { |
| | | this.satisfactionProperties = satisfactionProperties; |
| | | this.configServiceProvider = configServiceProvider; |
| | | } |
| | | |
| | | /** |
| | | * ä¾<b>æµè¯/é Spring ç¯å¢</b>ç´æ¥æé ï¼{@code configValue} å°±æ¯ sys_config éçé®å¼ï¼ |
| | | * ä¼ {@code null} 表示"åæ°è¡ä¸åå¨"ï¼æ¤æ¶åè½å° {@link SatisfactionProperties}ï¼ã |
| | | */ |
| | | public SatisfactionSwitch(SatisfactionProperties satisfactionProperties, final String configValue) { |
| | | this(satisfactionProperties, new FixedProvider(configValue)); |
| | | // é Spring ç¯å¢ä¸æ²¡æ"æ¹é
ç½®åç 10 ç§"çæ¦å¿µï¼ç´æ¥ç¦ç¨ç¼åï¼ä¿è¯æè¨å³æ¶å¯è§ |
| | | this.cachedEnabled = resolve(); |
| | | this.cachedAt = System.currentTimeMillis() + CACHE_TTL_MILLIS * 1000L; |
| | | } |
| | | |
| | | /** |
| | | * 满æåº¦åè½æ¯å¦å¯ç¨ï¼è¿è¡æ¶çè¯»ï¼æå¤ 10 ç§å»¶è¿ï¼ |
| | | */ |
| | | public boolean isEnabled() { |
| | | long now = System.currentTimeMillis(); |
| | | Boolean cached = this.cachedEnabled; |
| | | if (cached != null && now - this.cachedAt < CACHE_TTL_MILLIS) { |
| | | return cached; |
| | | } |
| | | boolean resolved = resolve(); |
| | | this.cachedEnabled = resolved; |
| | | this.cachedAt = now; |
| | | return resolved; |
| | | } |
| | | |
| | | /** |
| | | * æ¸
æè¿ç¨å
ç¼åï¼ä¸æ¬¡è°ç¨ç«å³éæ°è¯» sys_configï¼ä¾æµè¯/éè¦ç«å³çæçåºæ¯ï¼ |
| | | */ |
| | | public void invalidateCache() { |
| | | this.cachedEnabled = null; |
| | | } |
| | | |
| | | /** |
| | | * è§£æå½åå¼å
³å¼ï¼sys_config ä¼å
ï¼å
¶æ¬¡ yml å
åº |
| | | */ |
| | | private boolean resolve() { |
| | | String value = readFromSysConfig(); |
| | | if (value != null) { |
| | | if (!"true".equalsIgnoreCase(value) && !"false".equalsIgnoreCase(value)) { |
| | | log.warn("ãæ»¡æåº¦ãsys_config ä¸ {} çå¼ä¸æ¯ true/falseï¼å®é
=ã{}ãï¼ï¼å°æã䏿¯ false å³å¯ç¨ãå¤ç", |
| | | CONFIG_KEY, value); |
| | | } |
| | | boolean enabled = !"false".equalsIgnoreCase(value); |
| | | log.debug("ãæ»¡æåº¦ãå¼å
³åèª sys_configï¼{}={} -> enabled={}", CONFIG_KEY, value, enabled); |
| | | return enabled; |
| | | } |
| | | boolean enabled = satisfactionProperties.isEnabled(); |
| | | log.debug("ãæ»¡æåº¦ãsys_config 䏿ªé
ç½® {}ï¼åè½ satisfaction.enabled={}", CONFIG_KEY, enabled); |
| | | return enabled; |
| | | } |
| | | |
| | | /** |
| | | * 读 sys_config çåå§é®å¼ï¼æ²¡æå®ç°ã没æè¿ä¸è¡ãæè¯»åºå¤±è´¥é½è¿å {@code null} |
| | | */ |
| | | private String readFromSysConfig() { |
| | | if (configServiceProvider == null) { |
| | | return null; |
| | | } |
| | | try { |
| | | IConfigService configService = configServiceProvider.stream().findFirst().orElse(null); |
| | | if (configService == null) { |
| | | return null; |
| | | } |
| | | String value = configService.selectConfigByKey(CONFIG_KEY); |
| | | if (value == null || value.trim().isEmpty()) { |
| | | return null; |
| | | } |
| | | return value.trim(); |
| | | } catch (Exception e) { |
| | | // 容卿²¡æå®ç°ãæ°æ®æºå¼å¸¸ãSQL æ¥éâ¦â¦ä¸å¾æ"åæ°ç¼ºå¤±"å¤çï¼fail-openï¼ï¼ç»ä¸å½±å主æµç¨ |
| | | log.warn("ãæ»¡æåº¦ã读å sys_config ç {} å¤±è´¥ï¼æ¬æ¬¡ææªé
ç½®å¤çï¼fail-openï¼ï¼{}", |
| | | CONFIG_KEY, e.toString()); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * åºå®å¼ç {@code ObjectProvider}ï¼åªç¨äºé Spring ç¯å¢/æµè¯ |
| | | */ |
| | | private static final class FixedProvider implements ObjectProvider<IConfigService> { |
| | | |
| | | private final IConfigService configService; |
| | | |
| | | private FixedProvider(final String configValue) { |
| | | this.configService = configValue == null ? null : configKey -> configValue; |
| | | } |
| | | |
| | | @Override |
| | | public IConfigService getObject(Object... args) { |
| | | return configService; |
| | | } |
| | | |
| | | @Override |
| | | public IConfigService getIfAvailable() { |
| | | return configService; |
| | | } |
| | | |
| | | @Override |
| | | public IConfigService getIfUnique() { |
| | | return configService; |
| | | } |
| | | |
| | | @Override |
| | | public IConfigService getObject() { |
| | | return configService; |
| | | } |
| | | |
| | | @Override |
| | | public java.util.stream.Stream<IConfigService> stream() { |
| | | return configService == null ? java.util.stream.Stream.empty() : java.util.stream.Stream.of(configService); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.config; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
| | | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 满æåº¦æ¨¡åç MVC é
ç½®ï¼æ {@link SatisfactionAvailabilityInterceptor} åªæå° |
| | | * <b>21 个满æåº¦æ¥å£ä¸å±äºæ¬æ¨¡åç 17 个端ç¹</b>ä¸ã |
| | | * <p> |
| | | * <b>为ä»ä¹é个åè·¯å¾è䏿¯ç¨ {@code /smartor/**} ä¹ç±»çåç¼</b>ï¼ |
| | | * <ul> |
| | | * <li>{@code /smartor/serviceSubtaskDetail/**} 䏿¢ææ»¡æåº¦ç«¯ç¹ï¼5 个ï¼ï¼ |
| | | * 乿é访æç»ç«¯ç¹ï¼å
¶å®ï¼ï¼ç¨åç¼ä¼è¯¯ä¼¤ï¼</li> |
| | | * <li>{@code /smartor/trace/**} ä¸åªæ 1 个满æåº¦ç«¯ç¹ï¼å
¶ä½æ¯å¼å¸¸è·è¸ªä¸å¡ï¼</li> |
| | | * <li>å æ¤è¿éæ¾å¼æä¸¾ï¼ä¿è¯"åªæ¦æ»¡æåº¦"ï¼ç»ä¸å½±åå
¶å®ä¸å¡ã</li> |
| | | * </ul> |
| | | * å¦å¤ 4 ä¸ªä½¿ç¨æ»¡æåº¦æ°æ®çé访æ¥å£ï¼{@code patItemExport} / {@code getSfStatisticsJoy} / |
| | | * {@code getSfStatisticsJoydetails} / {@code saveMYDQuestionAnswer}ï¼<b>ä¸å¨è¿é</b>ï¼ |
| | | * å®ä»¬å±äºé访ä¸å¡ï¼æ¨¡åå
³éæ¶å¿
须继ç»å¯ç¨ï¼æ»¡æåº¦é¨åé级为空/å
¨é¶ï¼ã |
| | | */ |
| | | @Configuration |
| | | public class SatisfactionWebConfig implements WebMvcConfigurer { |
| | | |
| | | /** |
| | | * æ£è
满æåº¦ï¼11 个ï¼å {@code PatSatisfactionController}ï¼ |
| | | */ |
| | | private static final String PAT_SATISFACTION_PATTERN = "/smartor/satisfaction/**"; |
| | | |
| | | /** |
| | | * çç«åå¾· / é¨è¯æ»¡æåº¦ç¬å ç 5 个端ç¹ï¼åæå¨é访æç» Controller ä¸ï¼ |
| | | */ |
| | | private static final List<String> SLTD_ENDPOINTS = Arrays.asList( |
| | | "/smartor/serviceSubtaskDetail/sltdMydTotalByScore", |
| | | "/smartor/serviceSubtaskDetail/statQuestionOptionByKsOrBq", |
| | | "/smartor/serviceSubtaskDetail/mydTrend", |
| | | "/smartor/serviceSubtaskDetail/sltdMydTotalByDimension", |
| | | "/smartor/serviceSubtaskDetail/mzMydScoreRank"); |
| | | |
| | | /** |
| | | * 满æåº¦å¼å¸¸é
ç½®é¢ç®ï¼1 个ï¼åæå¨é访å¼å¸¸è·è¸ª Controller ä¸ï¼ |
| | | */ |
| | | private static final String EXCEPT_CONFIG_ENDPOINT = "/smartor/trace/getSatisfactionExceptConfigQuestion"; |
| | | |
| | | @Autowired |
| | | private SatisfactionAvailabilityInterceptor satisfactionAvailabilityInterceptor; |
| | | |
| | | /** |
| | | * 便µè¯/é Spring ç¯å¢ç´æ¥æé |
| | | */ |
| | | public SatisfactionWebConfig() { |
| | | } |
| | | |
| | | public SatisfactionWebConfig(SatisfactionAvailabilityInterceptor interceptor) { |
| | | this.satisfactionAvailabilityInterceptor = interceptor; |
| | | } |
| | | |
| | | /** |
| | | * æ¬æ¨¡åéè¦"å
³éå³æç¡®æ¥é"ç 17 个端ç¹ï¼ä¾æ ¡éªèæ¬/åå
æµè¯æè¨ï¼ |
| | | */ |
| | | public static List<String> guardedPathPatterns() { |
| | | List<String> patterns = new ArrayList<>(); |
| | | patterns.add(PAT_SATISFACTION_PATTERN); |
| | | patterns.addAll(SLTD_ENDPOINTS); |
| | | patterns.add(EXCEPT_CONFIG_ENDPOINT); |
| | | return patterns; |
| | | } |
| | | |
| | | @Override |
| | | public void addInterceptors(InterceptorRegistry registry) { |
| | | registry.addInterceptor(satisfactionAvailabilityInterceptor) |
| | | .addPathPatterns(guardedPathPatterns()) |
| | | // æ¦æªå¨æ¬èº«å¾è½»ï¼åªè¯»ä¸ä¸ª booleanï¼ï¼order ç»ä¸ªå°å¼è®©å®å¨ä¸å¡æ¦æªå¨ä¹åæ§è¡ |
| | | .order(-100); |
| | | } |
| | | } |
| ÎļþÃû´Ó ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatSatisfactionController.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.web.controller.smartor; |
| | | package com.ruoyi.satisfaction.controller; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.utils.PageUtils; |
| | | import com.smartor.domain.VO.PatSatisfactionReqVO; |
| | | import com.smartor.domain.VO.PatSatisfactionResVO; |
| | | import com.ruoyi.satisfaction.domain.vo.PatSatisfactionReqVO; |
| | | import com.ruoyi.satisfaction.domain.vo.PatSatisfactionResVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.smartor.domain.PatSatisfaction; |
| | | import com.smartor.service.IPatSatisfactionService; |
| | | import com.ruoyi.satisfaction.domain.PatSatisfaction; |
| | | import com.ruoyi.satisfaction.service.IPatSatisfactionService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | |
| | | /** |
| | | * æ£è
满æåº¦Controller |
| | | * æ£è
满æåº¦ Controllerï¼å·²è¿å
¥ ruoyi-satisfaction 模åï¼ã |
| | | * <p> |
| | | * â ï¸ <b>URL ä¸åºå
¥åä¸åæªæ¹</b>ï¼{@code @RequestMapping("/smartor/satisfaction")} ä¸å
¨é¨ |
| | | * {@code @PostMapping}/{@code @GetMapping} è·¯å¾ä¿æåæ ·ï¼å端æ é任使¹å¨ã |
| | | * è¿ç§»åªæ¹äºç±»æå¨ç Maven 模åä¸å
åã |
| | | * <p> |
| | | * <b>å¼å
³</b>ï¼æ¬ Controller å§ç»æ³¨åï¼ä¸é {@code satisfaction.enabled} æ¶å¤±ï¼ã |
| | | * 模å被å
³éæ¶ç± {@code SatisfactionAvailabilityInterceptor} |
| | | * ï¼è§ {@code config/SatisfactionWebConfig}ï¼å¨è¿å
¥æ¹æ³åæåº {@code ServiceException}ï¼ |
| | | * è°ç¨æ¹ä¼æ¿å°<b>æç¡®çé误æç¤º</b>ï¼è䏿¯ 404ï¼è½åºå"模å被å
³é"ä¸"å°ååé"ï¼ã |
| | | * æ¦æªå¨åªæå¨æ¬æ¨¡åç 17 个满æåº¦ç«¯ç¹ä¸ï¼é访/é®å·çå
¶å®ä¸å¡å®å
¨ä¸åå½±åã |
| | | * |
| | | * @author lihu |
| | | * @date 2025-06-30 |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.controller; |
| | | |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.satisfaction.domain.vo.SatisfactionExceptConfigQuestionReqVO; |
| | | import com.ruoyi.satisfaction.service.SatisfactionSubtaskService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 满æåº¦å¼å¸¸é
ç½®é¢ç® Controllerï¼å·²è¿å
¥ ruoyi-satisfaction 模åï¼ã |
| | | * <p> |
| | | * â ï¸ <b>URL ä¸åºå
¥åä¸åæªæ¹</b>ï¼è¯¥ç«¯ç¹åæ¬æå¨ |
| | | * {@code com.ruoyi.web.controller.smartor.ServiceSubtaskDetailTraceController} |
| | | * ï¼ç±»çº§ {@code @RequestMapping("/smartor/trace")}ï¼ä¸ï¼è¿ç§»å |
| | | * <b>类级路å¾ä¸åæ¹æ³è·¯å¾é½ä¿æåæ ·</b>ï¼æç»å¯¹å¤å°å仿¯ |
| | | * {@code POST /smartor/trace/getSatisfactionExceptConfigQuestion}ï¼å端æ é任使¹å¨ã |
| | | * <p> |
| | | * <b>为ä»ä¹ç±»çº§è·¯å¾è¦æ²¿ç¨ {@code /smartor/trace}ï¼</b> |
| | | * 该端ç¹çä¸å¡æ¯"é访任å¡å¼å¸¸è·è¸ªé¡µé¢ééæ©æ»¡æåº¦å¼å¸¸é¢ç®"ï¼ |
| | | * ä½å®çæ°æ®æ¥æºä¸çéé»è¾ï¼æ»¡æåº¦åç±» + 模æ¿é¢ç®ï¼å®å
¨å±äºæ»¡æåº¦åï¼ |
| | | * ææ¨¡ååè¦æ±å¿
é¡»æ¬å
¥æ¬æ¨¡åã为äºåå°"URL ä¸å"ï¼è¿éå»ææ²¿ç¨å类级åç¼ï¼ |
| | | * è䏿¯æ¹å° {@code /smartor/satisfaction} ä¸ã |
| | | * <p> |
| | | * <b>å¼å
³</b>ï¼æ¬ Controller å§ç»æ³¨åï¼ä¸é {@code satisfaction.enabled} æ¶å¤±ï¼ã |
| | | * 模å被å
³éæ¶ç± {@code SatisfactionAvailabilityInterceptor} |
| | | * ï¼è§ {@code config/SatisfactionWebConfig}ï¼å¨è¿å
¥æ¹æ³åæåº {@code ServiceException}ï¼ |
| | | * è°ç¨æ¹ä¼æ¿å°<b>æç¡®çé误æç¤º</b>ï¼è䏿¯ 404ï¼ã |
| | | * 注æï¼åä¸åç¼ {@code /smartor/trace} ä¸ç<b>å¼å¸¸è·è¸ª</b>端ç¹ä¸åå½±å |
| | | * ââ æ¦æªå¨åªæå¨æ¬ç±»çè¿ 1 个路å¾ä¸ã |
| | | */ |
| | | @Slf4j |
| | | @Api(description = "满æåº¦å¼å¸¸é
ç½®é¢ç®") |
| | | @RestController |
| | | @RequestMapping("/smartor/trace") |
| | | public class SatisfactionExceptConfigController extends BaseController { |
| | | |
| | | @Autowired |
| | | private SatisfactionSubtaskService satisfactionSubtaskService; |
| | | |
| | | /** |
| | | * è·å满æåº¦å¼å¸¸é
ç½®é¢ç® |
| | | * <p> |
| | | * è¿ç§»è¯´æï¼å
¥åãè¿åç»æãæ¥å¿æ ¼å¼ä¸è¢«è¿ç§»çå®ç°å®å
¨ä¸è´ï¼ |
| | | * åå®ç°éçæ¥è¯¢é»è¾æ´æ®µæ¬å°äº |
| | | * {@link SatisfactionSubtaskService#getSatisfactionExceptConfigQuestion}ã |
| | | */ |
| | | @ApiOperation("è·å满æåº¦å¼å¸¸é
ç½®é¢ç®") |
| | | @PostMapping("/getSatisfactionExceptConfigQuestion") |
| | | public Map<String, Object> getSatisfactionExceptConfigQuestion( |
| | | @RequestBody SatisfactionExceptConfigQuestionReqVO questionReqVO) { |
| | | log.info("è·å满æåº¦å¼å¸¸é
ç½®é¢ç®çå
¥å: {}", questionReqVO); |
| | | Map<String, Object> satisfactionExceptConfigQuestion = |
| | | satisfactionSubtaskService.getSatisfactionExceptConfigQuestion(questionReqVO); |
| | | return satisfactionExceptConfigQuestion; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.controller; |
| | | |
| | | import com.ruoyi.common.annotation.AddOrgId; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.satisfaction.domain.ServiceSubtaskDetailRatioExport; |
| | | import com.ruoyi.satisfaction.domain.dto.QuestionResultDTO; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionSubtaskQuery; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionSubtaskRef; |
| | | import com.ruoyi.satisfaction.domain.vo.MydTrendReqVO; |
| | | import com.ruoyi.satisfaction.domain.vo.MzMydScoreRankVO; |
| | | import com.ruoyi.satisfaction.domain.vo.QuestionCountKsOrBqVO; |
| | | import com.ruoyi.satisfaction.domain.vo.SltdMydTotalVO; |
| | | import com.ruoyi.satisfaction.service.SatisfactionSubtaskService; |
| | | import com.ruoyi.satisfaction.service.strategy.SatisfactionScoreStrategyResolver; |
| | | import com.ruoyi.satisfaction.service.strategy.SatisfactionSites; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * çç«åå¾· / é¨è¯æ»¡æåº¦ç»è®¡ Controllerï¼å·²è¿å
¥ ruoyi-satisfaction 模åï¼ã |
| | | * <p> |
| | | * â ï¸ <b>URL ä¸åºå
¥åä¸åæªæ¹</b>ï¼è¿äºç«¯ç¹åæ¬æå¨ |
| | | * {@code ServiceSubtaskDetailController}ï¼{@code /smartor/serviceSubtaskDetail}ï¼ä¸ï¼ |
| | | * è¿ç§»å {@code @RequestMapping} ä¸å
¨é¨ {@code @PostMapping} è·¯å¾ä¿æåæ ·ï¼å端æ é任使¹å¨ã |
| | | * <p> |
| | | * è¿ç§»æ¶å¯ä¸è°æ´çä¸å¤ï¼{@code sltdMydTotalByScore} 忬è°ç¨ |
| | | * {@code serviceSubtaskService.getServiceSubtasks(...)}ï¼é访主干 Serviceï¼ä¸è½æ¬ï¼ï¼ |
| | | * ç°æ¹ä¸ºè°ç¨æ»¡æåº¦æ¨¡åèªå¸¦ç {@link SatisfactionSubtaskService#getMydSubtaskRefs}ï¼ |
| | | * æ¥è¯¢æ¡ä»¶ä¸åç»ç»è®¡å£å¾éåä¿æä¸è´ï¼è§åæ¹æ³å
注éï¼ã |
| | | * <p> |
| | | * <b>å¼å
³</b>ï¼æ¬ Controller å§ç»æ³¨åï¼ä¸é {@code satisfaction.enabled} æ¶å¤±ï¼ã |
| | | * 模å被å
³éæ¶ç± {@code SatisfactionAvailabilityInterceptor} |
| | | * ï¼è§ {@code config/SatisfactionWebConfig}ï¼å¨è¿å
¥æ¹æ³åæåº {@code ServiceException}ï¼ |
| | | * è°ç¨æ¹ä¼æ¿å°<b>æç¡®çé误æç¤º</b>ï¼è䏿¯ 404ï¼ã |
| | | * 注æï¼åä¸åç¼ {@code /smartor/serviceSubtaskDetail} ä¸ç<b>é访æç»</b>端ç¹ä¸åå½±å |
| | | * ââ æ¦æªå¨åªæå¨æ¬ç±»ç 5 个满æåº¦è·¯å¾ä¸ã |
| | | */ |
| | | @Api(description = "çç«å德满æåº¦ç»è®¡") |
| | | @RestController |
| | | @RequestMapping("/smartor/serviceSubtaskDetail") |
| | | public class SltdSatisfactionController extends BaseController { |
| | | |
| | | /** |
| | | * ç«ç¹å£å¾çç¥è§£æå¨ï¼ç»¼å满æåº¦å¾åæç«ç¹ï¼çç«åå¾·ï¼åçç¥è®¡ç®ï¼ |
| | | * ä¸åæç®æ³ä¸å¸¸éåå¨ Controller éã |
| | | */ |
| | | @Autowired |
| | | private SatisfactionScoreStrategyResolver satisfactionScoreStrategyResolver; |
| | | |
| | | @Autowired |
| | | private SatisfactionSubtaskService satisfactionSubtaskService; |
| | | |
| | | // ================================================================ 端ç¹ï¼URL åæ ·ï¼ |
| | | |
| | | /** |
| | | * çç«å德满æåº¦æ°æ®ç»è®¡ï¼æé¢ç®ç»è®¡é项æ°é/å æ¯ï¼å¹¶ç»åºè¯¥é¢ç综åå¾åï¼ |
| | | * <p> |
| | | * ç»¼åæ»¡æåº¦ = (徿»¡æé¡¹æ°Ã1 + 满æé¡¹æ°Ã0.8 + ä¸è¬é¡¹æ°Ã0.6 + 䏿»¡æé¡¹æ°Ã0.4 + å¾ä¸æ»¡æé¡¹æ°Ã0.2) |
| | | * / (徿»¡æé¡¹æ° + 满æé¡¹æ° + ä¸è¬é¡¹æ° + 䏿»¡æé¡¹æ° + å¾ä¸æ»¡æé¡¹æ°) à 100%ï¼ |
| | | * ãæªç»åããä¸éç¨ãçä¸å¨äºæ¡£éçé项æ¢ä¸è¿ååä¹ä¸è¿åæ¯ã |
| | | */ |
| | | @ApiOperation("çç«å德满æåº¦æ°æ®ç»è®¡") |
| | | @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid") |
| | | @PostMapping("/sltdMydTotalByScore") |
| | | public Map<String, Object> sltdMydTotalByScore(@RequestBody SltdMydTotalVO sltdMydTotalVO) { |
| | | List<SatisfactionSubtaskRef> subtaskRefs = null; |
| | | if (CollectionUtils.isNotEmpty(sltdMydTotalVO.getServiceTypeList())) { |
| | | //serviceTypeå¯è½ä¼åºç°å¤ä¸ªï¼ä¸æ³å¤åæ¹æ³äºï¼ä¸ä¸ªä¸ä¸ªæ¥è¯¢å§ |
| | | for (String st : sltdMydTotalVO.getServiceTypeList()) { |
| | | SatisfactionSubtaskQuery query = new SatisfactionSubtaskQuery(); |
| | | query.setServiceType(st); |
| | | query.setEndOutHospTime(sltdMydTotalVO.getEndOutHospTime()); |
| | | query.setStartOutHospTime(sltdMydTotalVO.getStartOutHospTime()); |
| | | query.setDeptOrDistrict(sltdMydTotalVO.getDeptOrDistrict()); |
| | | query.setLeavehospitaldistrictcodes(sltdMydTotalVO.getLeavehospitaldistrictcodes()); |
| | | query.setLeaveldeptcodes(sltdMydTotalVO.getLeaveldeptcodes()); |
| | | //æºæ/é¢åºç± @AddOrgId 注å
¥ï¼è½å°æ¥è¯¢æ¡ä»¶ä¸ï¼é¿å
è·¨æºæåæ° |
| | | query.setOrgid(sltdMydTotalVO.getOrgid()); |
| | | query.setCampusid(sltdMydTotalVO.getCampusid()); |
| | | List<SatisfactionSubtaskRef> refs = satisfactionSubtaskService.getMydSubtaskRefs(query); |
| | | if (CollectionUtils.isNotEmpty(subtaskRefs)) { |
| | | subtaskRefs.addAll(refs); |
| | | } else { |
| | | if (CollectionUtils.isEmpty(subtaskRefs)) subtaskRefs = refs; |
| | | } |
| | | } |
| | | } |
| | | // æ questiontext åç»å转æ¢ä¸º QuestionResultVO |
| | | List<QuestionResultDTO> result = new ArrayList<>(); |
| | | if (CollectionUtils.isNotEmpty(subtaskRefs)) { |
| | | List<ServiceSubtaskDetailRatioExport> detailList = |
| | | satisfactionSubtaskService.getDetailRatio(sltdMydTotalVO, subtaskRefs); |
| | | |
| | | if (detailList == null) { |
| | | //serviceType ç»åä¸å¨æ¯æèå´å
ï¼å¦åæ¶å«é访 2 åæ»¡æåº¦ 6/14ï¼ï¼ç»æç¡®æç¤ºè䏿¯ææè¿å空æ°ç» |
| | | return error("å½å serviceType ç»åæä¸æ¯æç»è®¡é®é¢å æ¯ï¼è¯·å弿¥è¯¢ï¼ä»
æ¯æé访 2 ææ»¡æåº¦ 6/14ï¼"); |
| | | } |
| | | if (CollectionUtils.isNotEmpty(detailList)) { |
| | | Map<String, List<ServiceSubtaskDetailRatioExport>> groupedMap = |
| | | detailList.stream().collect(Collectors.groupingBy(ServiceSubtaskDetailRatioExport::getQuestiontext)); |
| | | |
| | | groupedMap.forEach((questionText, exportList) -> { |
| | | QuestionResultDTO questionResultDTO = new QuestionResultDTO(); |
| | | questionResultDTO.setQeustionText(questionText); |
| | | questionResultDTO.setSubtaskDetailRatioExportList(exportList); |
| | | //综åå¾åï¼(徿»¡æÃ1 + 满æÃ0.8 + ä¸è¬Ã0.6 + 䏿»¡æÃ0.4 + å¾ä¸æ»¡æÃ0.2) / äºæ¡£é¡¹æ°ä¹å à 100% |
| | | questionResultDTO.setAvgScore(calcMydScore(exportList)); |
| | | result.add(questionResultDTO); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | return success(result); |
| | | } |
| | | |
| | | @ApiOperation("çç«å德满æåº¦æ°æ®ç»è®¡éè¿ç§å®¤æç
åº") |
| | | @PostMapping("/statQuestionOptionByKsOrBq") |
| | | public Map<String, Object> statQuestionOptionByKsOrBq(@RequestBody QuestionCountKsOrBqVO questionResultVO) { |
| | | return success(satisfactionSubtaskService.statQuestionOptionByKsOrBq(questionResultVO)); |
| | | } |
| | | |
| | | @ApiOperation("çç«åå¾·æ£è
满æåº¦è¶å¿") |
| | | @PostMapping("/mydTrend") |
| | | public Map<String, Object> mydTrend(@RequestBody MydTrendReqVO mydTrendReqVO) { |
| | | return success(satisfactionSubtaskService.mydTrend(mydTrendReqVO)); |
| | | } |
| | | |
| | | @ApiOperation("çç«åå¾·æ£è
满æåº¦ç»´æ¤") |
| | | @PostMapping("/sltdMydTotalByDimension") |
| | | public Map<String, Object> sltdMydTotalByDimension(@RequestBody MydTrendReqVO mydTrendReqVO) { |
| | | return success(satisfactionSubtaskService.sltdMydTotalByDimension(mydTrendReqVO)); |
| | | } |
| | | |
| | | @ApiOperation("é¨è¯æ»¡æåº¦ç»¼åå¾åæåï¼æç§å®¤æç
åºï¼") |
| | | @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid") |
| | | @PostMapping("/mzMydScoreRank") |
| | | public Map<String, Object> mzMydScoreRank(@RequestBody MzMydScoreRankVO mzMydScoreRankVO) { |
| | | return success(satisfactionSubtaskService.mzMydScoreRank(mzMydScoreRankVO)); |
| | | } |
| | | |
| | | // ================================================================ 综è¯è®¡ç®ï¼æ¹èµ°ç«ç¹çç¥ï¼ |
| | | |
| | | /** |
| | | * 计ç®ä¸éé¢ç满æåº¦ç»¼åå¾åï¼ç¾åå¶ï¼ä¿ç两ä½å°æ°ï¼ã |
| | | * <p> |
| | | * <b>çç¥åæ¹é </b>ï¼ç®æ³æ¬èº«å·²åæ ·æ¬å° |
| | | * {@link com.ruoyi.satisfaction.service.strategy.SltdSatisfactionScoreStrategy} |
| | | * ï¼çç«åå¾·å£å¾ï¼ï¼æ¬æ¹æ³åªè´è´£"æç«ç¹åçç¥ + æ null åç°ä¸º 0.00"ã |
| | | * 计ç®è¿ç¨ä¸è¿åå¼ä¸è¿ç§»å<b>å®å
¨ä¸è´</b>ã |
| | | * |
| | | * @param exportList åä¸éé¢ç®çé项ç»è®¡æç» |
| | | * @return ç¾åå¶ç»¼åå¾åï¼æ ææé¡¹æ°æ¶è¿å "0.00" |
| | | */ |
| | | private String calcMydScore(List<ServiceSubtaskDetailRatioExport> exportList) { |
| | | BigDecimal score = satisfactionScoreStrategyResolver |
| | | .resolve(SatisfactionSites.SLTD) |
| | | .comprehensiveScore(exportList); |
| | | return score == null ? "0.00" : score.toPlainString(); |
| | | } |
| | | } |
| ÎļþÃû´Ó smartor/src/main/java/com/smartor/domain/PatSatisfaction.java ÐÞ¸Ä |
| | |
| | | package com.smartor.domain; |
| | | package com.ruoyi.satisfaction.domain; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.annotation.Excel; |
| ÎļþÃû´Ó smartor/src/main/java/com/smartor/domain/ServiceSubtaskDetailRatioExport.java ÐÞ¸Ä |
| | |
| | | package com.smartor.domain; |
| | | package com.ruoyi.satisfaction.domain; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.annotation.Excel; |
| ÎļþÃû´Ó smartor/src/main/java/com/smartor/domain/DTO/MydTrendReqDTO.java ÐÞ¸Ä |
| | |
| | | package com.smartor.domain.DTO; |
| | | package com.ruoyi.satisfaction.domain.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| ÎļþÃû´Ó smartor/src/main/java/com/smartor/domain/DTO/MzMydScoreRankDTO.java ÐÞ¸Ä |
| | |
| | | package com.smartor.domain.DTO; |
| | | package com.ruoyi.satisfaction.domain.dto; |
| | | |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import io.swagger.annotations.ApiModel; |
| ÎļþÃû´Ó smartor/src/main/java/com/smartor/domain/DTO/QuestionCountKsOrBqDTO.java ÐÞ¸Ä |
| | |
| | | package com.smartor.domain.DTO; |
| | | package com.ruoyi.satisfaction.domain.dto; |
| | | |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import com.smartor.domain.ServiceSubtaskDetailRatioExport; |
| | | import com.ruoyi.satisfaction.domain.ServiceSubtaskDetailRatioExport; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| ÎļþÃû´Ó smartor/src/main/java/com/smartor/domain/DTO/QuestionResultDTO.java ÐÞ¸Ä |
| | |
| | | package com.smartor.domain.DTO; |
| | | package com.ruoyi.satisfaction.domain.dto; |
| | | |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import com.smartor.domain.ServiceSubtaskDetailRatioExport; |
| | | import com.ruoyi.satisfaction.domain.ServiceSubtaskDetailRatioExport; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| ÎļþÃû´Ó smartor/src/main/java/com/smartor/domain/DTO/ServiceSubtaskOptionStatDTO.java ÐÞ¸Ä |
| | |
| | | package com.smartor.domain.DTO; |
| | | package com.ruoyi.satisfaction.domain.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| ÎļþÃû´Ó smartor/src/main/java/com/smartor/domain/entity/PatSatisfactionDetailEntity.java ÐÞ¸Ä |
| | |
| | | package com.smartor.domain.entity; |
| | | package com.ruoyi.satisfaction.domain.entity; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.domain.entity; |
| | | |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 满æåº¦ç»è®¡èåæ¥è¯¢å
¥å |
| | | * <p> |
| | | * ç¨äº satisfactionGraph 䏿¬¡æ§æ¥åºãæ¬æ¬¡è¯·æ±æ¶åçæææ¨¡æ¿ãçåééä¸å¡«æ¥éï¼ |
| | | * æ¿ä»£åæ¥ãæ¯ä¸ªæ¨¡æ¿é®é¢åæ¥ä¸¤æ¬¡ãçåæ³ã |
| | | * orgid / campusid å¤ç¨ BaseEntity åæ®µï¼ä¸å ServiceSubtaskSatisfactionEntity å弿¥æºä¸è´ï¼ã |
| | | * |
| | | * @author smartor |
| | | */ |
| | | @ApiModel(value = "SatisfactionStatQuery", description = "满æåº¦ç»è®¡èåæ¥è¯¢å
¥å") |
| | | @Data |
| | | public class SatisfactionStatQuery extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä»»å¡ç±»åï¼service_subtask.typeï¼ï¼å符串æ¯è¾ï¼é¿å
varchar 䏿°åéå¼è½¬æ¢ |
| | | */ |
| | | @ApiModelProperty(value = "ä»»å¡ç±»å(1ãè¯é³ï¼2ãé®å·è¡¨ï¼)") |
| | | private String type; |
| | | |
| | | /** |
| | | * æ¥è¯¢å¼å§æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "æ¥è¯¢å¼å§æ¶é´") |
| | | private Date startTime; |
| | | |
| | | /** |
| | | * æ¥è¯¢ç»ææ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "æ¥è¯¢ç»ææ¶é´") |
| | | private Date endTime; |
| | | |
| | | /** |
| | | * é¨é¨éå |
| | | */ |
| | | @ApiModelProperty(value = "é¨é¨éå") |
| | | private List<String> deptcodes; |
| | | |
| | | /** |
| | | * ç
åºç¼å· |
| | | */ |
| | | @ApiModelProperty(value = "ç
åºéå") |
| | | private List<String> hospitaldistrictcodes; |
| | | |
| | | /** |
| | | * åºç¡æ¨¡æ¿Idsï¼ivr ç¨ templateidï¼é®å·ç¨ svyidï¼ |
| | | */ |
| | | @ApiModelProperty(value = "åºç¡æ¨¡æ¿Ids") |
| | | private List<Long> libTemplateIds; |
| | | } |
| ÎļþÃû´Ó smartor/src/main/java/com/smartor/domain/entity/ServiceSubtaskSatisfactionEntity.java ÐÞ¸Ä |
| | |
| | | package com.smartor.domain.entity; |
| | | package com.ruoyi.satisfaction.domain.entity; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.annotation.Excel; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import com.smartor.domain.TaskSendTimeVO; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.domain.row; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 满æåº¦åç±»åªè¯»è§å¾ï¼è¯é³ä¾§ä¸é®å·ä¾§å
±ç¨ï¼ã |
| | | * <p> |
| | | * 为ä»ä¹å
±ç¨ä¸ä¸ªç±»ï¼è¯é³ç {@code ivr_liba_script_assort} ä¸é®å·ç |
| | | * {@code svy_lib_script_category} 卿»¡æåº¦ç»è®¡éè¯ä¹å®å
¨ä¸è´ââ |
| | | * 齿¯ãä¸ä¸ªæ»¡æåº¦åç±»ï¼id + åç§° + typeãï¼è°ç¨æ¹åªç¨æ¥ |
| | | * ãæ {@code type.contains("myd")} è¿æ»¤åºåç±» idãå¹¶æåç§°åç»ãã |
| | | * <p> |
| | | * 两表çåå§ååä¸åï¼SQL éå·²åå«åå½ä¸ï¼ |
| | | * <ul> |
| | | * <li>è¯é³ï¼{@code index_assort_name as name}</li> |
| | | * <li>é®å·ï¼{@code name}ï¼å忬æ¥å°±æ¯ nameï¼</li> |
| | | * </ul> |
| | | * <p> |
| | | * â ï¸ è¿æ¯<b>åªè¯»</b>è§å¾ã |
| | | */ |
| | | @Data |
| | | public class SatisfactionCategoryRow { |
| | | |
| | | /** |
| | | * åç±» id |
| | | */ |
| | | private Long id; |
| | | |
| | | /** |
| | | * åç±»åç§° |
| | | * <p>注æï¼åç±»å£å¾ç»è®¡æ¯æã模æ¿ä¸çåç±»åãï¼{@code script_assortname} / |
| | | * {@code categoryName}ï¼åç»ï¼è䏿¯ç¨æ¬åæ®µï¼æ¬å段主è¦ç¨äºå»ºåç±» id â åç§°çæ å°ã |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * å类类åï¼æ»¡æåº¦åºå®ä¸º myd ç¸å
³ï¼è°ç¨æ¹æ contains("myd") è¿æ»¤ï¼ |
| | | */ |
| | | private String type; |
| | | |
| | | /** |
| | | * 对åºå {@code pid}ï¼ç¶åç±» idï¼é¡¶å±ä¸º {@code null} æ {@code -1}ï¼ã |
| | | * <p> |
| | | * ç¨éï¼{@code /smartor/trace/getSatisfactionExceptConfigQuestion} èµ°çæ¯ |
| | | * è¯é³åç±»ç<b>æå¡æ¹æ³</b> {@code IvrLibaScriptAssortServiceImpl.selectIvrLibaScriptAssortList}ï¼ |
| | | * è¯¥æ¹æ³ä¼æåç±»æ¼ææ ã<b>åªè¿åé¡¶å±èç¹</b>ï¼{@code pid == null || pid == -1}ï¼ï¼ |
| | | * æä»¥è°ç¨æ¹å¿
é¡»ç¨æ¬å段ååæ ·çé¡¶å±çéæè½ä¸åæä¸è´ã |
| | | * <p> |
| | | * è¯é³ä¾§ä¸é®å·ä¾§é½åäºæ¬åï¼ä½<b>åªæè¯é³ä¾§</b>éè¦æå®çé¡¶å±ââ |
| | | * é®å·ä¾§åæç´æ¥ç¨ {@code svyLibScriptCategoryMapper} åå
¨é¨åç±»ï¼ä¸æ¼æ ï¼ï¼ |
| | | * 两侧ä¸ä¸è´æ¯åæè¡ä¸ºï¼å¿
é¡»ä¿çã |
| | | */ |
| | | private Long pid; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.domain.row; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 满æåº¦ç»è®¡ç¨çãè¯é³æ¨¡æ¿é®é¢ãåªè¯»è§å¾ã |
| | | * <p> |
| | | * 为ä»ä¹éè¦è¿ä¸ªç±»ï¼è䏿¯ç´æ¥ç¨ {@code com.smartor.domain.IvrLibaTemplateScript}ï¼ï¼ |
| | | * <ul> |
| | | * <li>é£ä¸ªå®ä½å±äº smartor ç**è¯é³æ¨¡æ¿ç®¡ç**ä¸å¡ï¼è¢« 9 个æä»¶ä½¿ç¨ï¼å«æ¨¡æ¿å¢å æ¹æ¥ï¼ï¼ä¸è½æ¬è¿æ¬æ¨¡åï¼</li> |
| | | * <li>满æåº¦ç»è®¡å
¶å®åªç¨å°å®ç 5 ä¸ªåæ®µï¼è§ä¸ï¼ï¼æéå忝æ´å¥å®ä½æ´æ¸
æ°ï¼</li> |
| | | * <li>æ¬æ¨¡åè¦æ±ãä¸ä¾èµ smartorãï¼æä»¥ä¸è½ import å®ã</li> |
| | | * </ul> |
| | | * åæ®µä¸æºè¡¨ {@code ivr_liba_template_script} çåä¸ä¸å¯¹åºï¼å£å¾ä¸åå®ç°å®å
¨ä¸è´ã |
| | | * <p> |
| | | * â ï¸ è¿æ¯<b>åªè¯»</b>è§å¾ï¼æ¬æ¨¡åä¸ä¼å¯¹å®åä»»ä½åæä½ã |
| | | */ |
| | | @Data |
| | | public class SatisfactionIvrScriptRow { |
| | | |
| | | /** |
| | | * 对åºå {@code templateid}ï¼è¯é³æ¨¡æ¿ idã |
| | | * <p>èåç»è®¡ï¼åéé/åæ¶äººæ°/å¡«æ¥éï¼æå®åç»ã |
| | | */ |
| | | private Long templateid; |
| | | |
| | | /** |
| | | * 对åºå {@code scriptid}ï¼é项表 {@code ivr_liba_template_targetoption} å
³èçé®é¢ idã |
| | | * <p>ç¨äºå该é®é¢çé项åå¼ï¼ç®æé«/æä½åï¼ã<b>å¯è½ä¸º null</b>ï¼ |
| | | * æ¤æ¶åå®ç°ç SQL 䏿¼ scriptid æ¡ä»¶ï¼çäºå该表å
¨é¨åå¼ï¼ã |
| | | */ |
| | | private Long scriptid; |
| | | |
| | | /** |
| | | * 对åºå {@code script_content}ï¼é®é¢å
容ã |
| | | * <p>ç¨äºä¸å¡«æ¥æç»ç {@code questiontext} åå¹é
ï¼MySQL ç {@code =} 忽ç¥å¤§å°åä¸å°¾é¨ç©ºæ ¼ï¼ã |
| | | */ |
| | | private String scriptContent; |
| | | |
| | | /** |
| | | * 对åºå {@code script_assortname}ï¼è¯é³æ»¡æåº¦åç±»åç§°ã |
| | | * <p>åç±»å£å¾ç»è®¡ï¼{@code satisfactionGraph}ï¼æå®åç»ã |
| | | */ |
| | | private String scriptAssortname; |
| | | |
| | | /** |
| | | * 对åºå {@code dimension}ï¼ç»´åº¦ã |
| | | * <p>维度å£å¾ç»è®¡ï¼{@code satisfactionGraphDimension}ï¼æå®åç»ã |
| | | */ |
| | | private String dimension; |
| | | |
| | | // ==================== ä»
ãæ»¡æåº¦å¼å¸¸é
ç½®é¢ç®ãæ¥å£ä½¿ç¨ ==================== |
| | | // ä¸é¢ 3 ä¸ªåæ®µåªæ /smartor/trace/getSatisfactionExceptConfigQuestion éè¦ï¼ |
| | | // ç»è®¡å£å¾ï¼satisfactionGraph / satisfactionGraphDimensionï¼çæ¥è¯¢ä¸åè¿äºåï¼ä¿æä¸º nullã |
| | | |
| | | /** |
| | | * 对åºå {@code id}ï¼{@code ivr_liba_template_script} 主é®ã |
| | | * <p>ãæ»¡æåº¦å¼å¸¸é
ç½®é¢ç®ãæ¥å£æå®ä½ä¸ºè¿åéç {@code questionId}ã |
| | | */ |
| | | private Long id; |
| | | /** |
| | | * 对åºå {@code script_topic}ï¼é¢ç®ä¸»é¢ã |
| | | * <p>ãæ»¡æåº¦å¼å¸¸é
ç½®é¢ç®ãæ¥å£æå®ä½ä¸ºè¿åéç {@code questionTopic}ã |
| | | */ |
| | | private String scriptTopic; |
| | | |
| | | /** |
| | | * 对åºå {@code script_type}ï¼é¢ç®ç±»åã |
| | | * <p>ãæ»¡æåº¦å¼å¸¸é
ç½®é¢ç®ãæ¥å£æå®ä½ä¸ºè¿åéç {@code questionType}ã |
| | | */ |
| | | private String scriptType; |
| | | |
| | | /** |
| | | * 对åºå {@code script_assortid}ï¼æå±è¯é³åç±» idã |
| | | * <p>ãæ»¡æåº¦å¼å¸¸é
ç½®é¢ç®ãæ¥å£æå®ä½ä¸ºè¿åéç {@code categoryId}ã |
| | | */ |
| | | private Long scriptAssortid; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.domain.row; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * é项åå¼åªè¯»è§å¾ï¼åªå scriptid ä¸ score 两åï¼ã |
| | | * <p> |
| | | * ç¨éï¼æ»¡æåº¦æç»ç»è®¡éç®æ¯ä¸ªé®é¢ç**æé«å / æä½å**ã |
| | | * åå®ç°å¯¹åº |
| | | * {@code IvrLibaTemplateTargetoptionMapper.selectIvrLibaTargetoptionScores} ä¸ |
| | | * {@code SvyLibTemplateTargetoptionMapper.selectSvyLibTargetoptionScores}ï¼ |
| | | * 两è
åä¸è¯ä¹å®å
¨ä¸è´ï¼å嫿¥èª {@code ivr_liba_template_targetoption} ä¸ |
| | | * {@code svy_lib_template_targetoption}ï¼ï¼æä»¥å
±ç¨ä¸ä¸ªç±»ã |
| | | * <p> |
| | | * â ï¸ {@code score} ç¨ {@code String} æ¿è½½ï¼å岿°æ®éåå¨ |
| | | * {@code 0}ã{@code 0000000001} è¿ç±»èå¼ï¼åå®ç°ä¹æ¯æå符串解æï¼ |
| | | * <b>ä¸è½</b>æ¹ææ°åç±»åï¼å¦åè§£æè¡ä¸ºä¼åã |
| | | * <p> |
| | | * â ï¸ è¿æ¯<b>åªè¯»</b>è§å¾ã |
| | | */ |
| | | @Data |
| | | public class SatisfactionOptionScoreRow { |
| | | |
| | | /** |
| | | * 对åºå {@code scriptid}ï¼é®é¢ idï¼å
³è {@code *_lib_template_script}ï¼ |
| | | */ |
| | | private Long scriptid; |
| | | |
| | | /** |
| | | * 对åºå {@code score}ï¼é项åå¼ï¼å符串ï¼ä¿çèå¼åæ ·ï¼ |
| | | */ |
| | | private String score; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.domain.row; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 满æåº¦ç»è®¡åãæ»¡æåº¦åç±» / 模æ¿é®é¢ãæ¶çæ¥è¯¢æ¡ä»¶ã |
| | | * <p> |
| | | * 为ä»ä¹åç¬å®ä¹ï¼åå®ç°çå
¥åå¤ç¨äº smartor çå®ä½ï¼{@code IvrLibaScriptAssort} / |
| | | * {@code SvyLibScriptCategory} / {@code IvrLibaTemplateScript} / {@code SvyLibTemplateScriptVO}ï¼ï¼ |
| | | * è¿äºå®ä½ä¸è½æ¬è¿æ¬æ¨¡åãæ»¡æåº¦å®é
åªç¨å°ä¸é¢è¿å 个æ¡ä»¶ï¼æ
æ¶æä¸ºä¸ä¸ªæ¥è¯¢å¯¹è±¡ã |
| | | * <p> |
| | | * 忡件ä¸åæ¥éå对åºï¼ |
| | | * <ul> |
| | | * <li>{@code orgid} ââ ææºæè¿æ»¤åç±»ï¼{@code and orgid = #{orgid}}ï¼ï¼</li> |
| | | * <li>{@code type} ââ æå类类åè¿æ»¤ï¼åå®ç°æ¯ {@code like concat('%', type, '%')}ï¼ |
| | | * 满æåº¦ä¼ {@code "myd"}ï¼</li> |
| | | * <li>{@code scriptAssortids} ââ æè¯é³åç±» id åé®é¢ï¼{@code script_assortid in (...)}ï¼ï¼</li> |
| | | * <li>{@code scriptCategoryids} ââ æé®å·åç±» id åé®é¢ï¼{@code categoryid in (...)}ï¼ï¼</li> |
| | | * <li>{@code dimensionList} ââ æç»´åº¦åé®é¢ãåå®ç°ï¼éç©ºæ¶ {@code dimension in (...)}ï¼ |
| | | * <b>为空æ¶</b>è¯é³ä¾§æ¼ {@code dimension IS NOT NULL}ãé®å·ä¾§ä¸æ¼è¯¥æ¡ä»¶ï¼å£å¾ä¸åï¼å¿
é¡»ä¿çï¼ã</li> |
| | | * </ul> |
| | | */ |
| | | @Data |
| | | public class SatisfactionScriptQuery { |
| | | |
| | | /** |
| | | * æºæ id |
| | | */ |
| | | private String orgid; |
| | | |
| | | /** |
| | | * å类类åï¼æ»¡æåº¦åºå®ä¼ "myd"ï¼ |
| | | */ |
| | | private String type; |
| | | |
| | | /** |
| | | * è¯é³åç±» id å表ï¼{@code ivr_liba_script_assort.id}ï¼ |
| | | */ |
| | | private List<Long> scriptAssortids; |
| | | |
| | | /** |
| | | * é®å·åç±» id å表ï¼{@code svy_lib_script_category.id}ï¼ |
| | | */ |
| | | private List<Long> scriptCategoryids; |
| | | |
| | | /** |
| | | * 维度å表 |
| | | */ |
| | | private List<String> dimensionList; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.domain.row; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 满æåº¦ç»è®¡åãåä»»å¡ãæ¶çæ¥è¯¢æ¡ä»¶ã |
| | | * <p> |
| | | * 对åºåå®ç° {@code ServiceSubtaskServiceImpl.getServiceSubtasks(ServiceSubtaskEntity)} |
| | | * é {@code sltdMydTotalByScore} å®é
ç¨å°çæ¡ä»¶ãåæ¹æ³è¿æ¯æè¿ç¾ä¸ªå
¶å®åæ®µï¼ |
| | | * 使»¡æåº¦åªç¨å°ä¸é¢è¿äºï¼æ
æ¶æä¸ºæ¬æ¥è¯¢å¯¹è±¡ã |
| | | * <p> |
| | | * æ¯ä¸ªå段ä¸åæ¥ç SQL æ¡ä»¶<b>éå对åº</b>ï¼è§ {@code SatisfactionMapper.xml}ï¼ï¼ |
| | | * <ul> |
| | | * <li>{@code orgid}ï¼{@code and orgid = #{orgid}}ï¼éç©ºææ¼ï¼</li> |
| | | * <li>{@code campusid}ï¼{@code and campusid = #{campusid}}ï¼éç©ºææ¼ï¼</li> |
| | | * <li>{@code serviceType}ï¼{@code and service_type = #{serviceType}}ï¼éç©ºææ¼ï¼è°ç¨æ¹é个 serviceType æ¥è¯¢ååå¹¶ï¼</li> |
| | | * <li>{@code startOutHospTime} / {@code endOutHospTime}ï¼æ {@code endtime} ç yymmdd æ¯è¾</li> |
| | | * <li>{@code deptOrDistrict} 为 {@code 1} æ¶ï¼æ {@code leavehospitaldistrictcodes} è¿æ»¤ç
åº</li> |
| | | * <li>{@code leaveldeptcodes}ï¼æ {@code deptcode} è¿æ»¤ç§å®¤</li> |
| | | * </ul> |
| | | */ |
| | | @Data |
| | | public class SatisfactionSubtaskQuery { |
| | | |
| | | /** |
| | | * æºæ id |
| | | */ |
| | | private String orgid; |
| | | |
| | | /** |
| | | * é¢åº id |
| | | */ |
| | | private String campusid; |
| | | |
| | | /** |
| | | * æå¡ç±»åï¼æ»¡æåº¦ä¸º 6 ä½é¢ / 14 é¨è¯ï¼ |
| | | */ |
| | | private String serviceType; |
| | | |
| | | /** |
| | | * åºé¢å¼å§æ¶é´ï¼æ endtime è¿æ»¤ï¼ |
| | | */ |
| | | private Date startOutHospTime; |
| | | |
| | | /** |
| | | * åºé¢ç»ææ¶é´ï¼æ endtime è¿æ»¤ï¼ |
| | | */ |
| | | private Date endOutHospTime; |
| | | |
| | | /** |
| | | * 维度æ è¯ï¼{@code 1} 表示æç
åºè¿æ»¤ |
| | | * <p> |
| | | * â ï¸ å SQL ç¨çæ¯ {@code <if test="deptOrDistrict==1">}ï¼ä¸æ°åæ¯è¾ï¼ï¼ |
| | | * å æ¤è¿éæ¯ {@code Integer}ï¼åå¼è¯ä¹ä¸åæ¥ä¸è´ã |
| | | */ |
| | | private String deptOrDistrict = "1"; |
| | | |
| | | /** |
| | | * ç
åºä»£ç å表ï¼ä»
å¨ {@code deptOrDistrict == 1} æ¶çæï¼ |
| | | */ |
| | | private List<String> leavehospitaldistrictcodes; |
| | | |
| | | /** |
| | | * ç§å®¤ä»£ç å表 |
| | | */ |
| | | private List<String> leaveldeptcodes; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.domain.row; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 满æåº¦ç»è®¡ç¨çãåä»»å¡å¼ç¨ãåªè¯»è§å¾ï¼åªå id ä¸ taskidã |
| | | * <p> |
| | | * 为ä»ä¹éè¦å®ï¼ |
| | | * <ul> |
| | | * <li>{@code sltdMydTotalByScore} åæ¬ææ¥è¯¢ç»æè½¬æ smartor ç {@code ServiceSubtaskRes}ï¼ |
| | | * ä½åç»åªç¨å° {@code getId()} ä¸ {@code getTaskid()} ä¸¤ä¸ªåæ®µ |
| | | * ï¼ä¾ {@code getDetailRatio} æ½åº subtaskIds / taskIdsï¼ï¼</li> |
| | | * <li>æ¬æ¨¡åè¦æ±ä¸ä¾èµ smartor çå®ä½ï¼æ
ç¨è¿ä¸ªæç®åªè¯»è§å¾æ¿è½½ï¼</li> |
| | | * <li>åª select 两åï¼é¿å
ååå®ç°é£æ ·ææ¥è¿å
¨è¡¨çåæ®µæ¥å Javaã</li> |
| | | * </ul> |
| | | * â ï¸ è¿æ¯<b>åªè¯»</b>è§å¾ã |
| | | */ |
| | | @Data |
| | | public class SatisfactionSubtaskRef { |
| | | |
| | | /** |
| | | * 对åºå {@code id}ï¼åä»»å¡ idï¼æ»¡æåº¦ 6/14 忝ç¨å®ç»è®¡éé¡¹å æ¯ï¼ |
| | | */ |
| | | private Long id; |
| | | |
| | | /** |
| | | * 对åºå {@code taskid}ï¼ä»»å¡ idï¼é访 2 忝ç¨å®ç»è®¡éé¡¹å æ¯ï¼ |
| | | */ |
| | | private Long taskid; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.domain.row; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 满æåº¦ç»è®¡ç¨çãé®å·æ¨¡æ¿é®é¢ãåªè¯»è§å¾ã |
| | | * <p> |
| | | * 为ä»ä¹éè¦è¿ä¸ªç±»ï¼è䏿¯ç´æ¥ç¨ {@code com.smartor.domain.SvyLibTemplateScript}ï¼ï¼ |
| | | * <ul> |
| | | * <li>é£ä¸ªå®ä½å±äº smartor ç**é®å·æ¨¡æ¿ç®¡ç**ä¸å¡ï¼è¢« 13 个æä»¶ä½¿ç¨ï¼å«æ¨¡æ¿å¢å æ¹æ¥ï¼ï¼ä¸è½æ¬è¿æ¬æ¨¡åï¼</li> |
| | | * <li>满æåº¦ç»è®¡åªç¨å°å®ç 5 ä¸ªåæ®µï¼è§ä¸ï¼ï¼</li> |
| | | * <li>æ¬æ¨¡åè¦æ±ãä¸ä¾èµ smartorãï¼æä»¥ä¸è½ import å®ã</li> |
| | | * </ul> |
| | | * <p> |
| | | * â ï¸ éè¦å£å¾å·®å¼ï¼åå®ç°å°±æï¼å¿
é¡»ä¿çï¼ï¼ |
| | | * <ul> |
| | | * <li>{@code querySvyLibTemplateIds}ï¼æåç±»åé®é¢ï¼ï¼èåç»è®¡ç¨çæ¨¡æ¿ id æ¯ {@code svyid} åï¼ |
| | | * èåé项åå¼ç¨çå
³è id æ¯ {@code id} åï¼{@code svy_lib_template_script} 主é®ï¼ï¼</li> |
| | | * <li>{@code selectSLTScriptListBydimension}ï¼æç»´åº¦åé®é¢ï¼ï¼ä¸¤è
é½ç¨ {@code svyid}ã</li> |
| | | * </ul> |
| | | * ä¸ºä¿æä¸è¢«è¿ç§»å®ç°å®å
¨ä¸è´ï¼æ¬ç±»<b>åæ¶</b>ä¿ç {@code svyid} ä¸ {@code id}ï¼ |
| | | * ç±åæ¥è¯¢èªè¡å³å®ååªä¸åï¼ä¸åæ¥éå对åºï¼ã |
| | | * <p> |
| | | * â ï¸ è¿æ¯<b>åªè¯»</b>è§å¾ï¼æ¬æ¨¡åä¸ä¼å¯¹å®åä»»ä½åæä½ã |
| | | */ |
| | | @Data |
| | | public class SatisfactionSvyScriptRow { |
| | | |
| | | /** |
| | | * 对åºå {@code svyid}ï¼é®å·æ¨¡æ¿ idã |
| | | */ |
| | | private Long svyid; |
| | | |
| | | /** |
| | | * 对åºå {@code id}ï¼{@code svy_lib_template_script} 主é®ã |
| | | * <p>æåç±»æ¥è¯¢æ¶ï¼é项表 {@code svy_lib_template_targetoption} æå®å
³èã |
| | | */ |
| | | private Long id; |
| | | |
| | | /** |
| | | * 对åºå {@code script_content}ï¼é®é¢å
容ã |
| | | */ |
| | | private String scriptContent; |
| | | |
| | | /** |
| | | * 对åºå {@code categoryName}ï¼é®å·æ»¡æåº¦åç±»åç§°ã |
| | | * <p>åç±»å£å¾ç»è®¡ï¼{@code satisfactionGraph}ï¼æå®åç»ã |
| | | */ |
| | | private String categoryName; |
| | | |
| | | /** |
| | | * 对åºå {@code dimension}ï¼ç»´åº¦ã |
| | | */ |
| | | private String dimension; |
| | | |
| | | // ==================== ä»
ãæ»¡æåº¦å¼å¸¸é
ç½®é¢ç®ãæ¥å£ä½¿ç¨ ==================== |
| | | // ä¸é¢ 3 ä¸ªåæ®µåªæ /smartor/trace/getSatisfactionExceptConfigQuestion éè¦ï¼ |
| | | // ç»è®¡å£å¾ï¼satisfactionGraph / satisfactionGraphDimensionï¼çæ¥è¯¢ä¸åè¿äºåï¼ä¿æä¸º nullã |
| | | |
| | | /** |
| | | * 对åºå {@code script_topic}ï¼é¢ç®ä¸»é¢ã |
| | | * <p>ãæ»¡æåº¦å¼å¸¸é
ç½®é¢ç®ãæ¥å£æå®ä½ä¸ºè¿åéç {@code questionTopic}ã |
| | | */ |
| | | private String scriptTopic; |
| | | |
| | | /** |
| | | * 对åºå {@code script_type}ï¼é¢ç®ç±»åã |
| | | * <p>ãæ»¡æåº¦å¼å¸¸é
ç½®é¢ç®ãæ¥å£æå®ä½ä¸ºè¿åéç {@code questionType}ã |
| | | */ |
| | | private String scriptType; |
| | | |
| | | /** |
| | | * 对åºå {@code categoryid}ï¼æå±é®å·åç±» idã |
| | | * <p>ãæ»¡æåº¦å¼å¸¸é
ç½®é¢ç®ãæ¥å£æå®ä½ä¸ºè¿åéç {@code categoryId}ã |
| | | */ |
| | | private Long categoryid; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.domain.row; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * ãé访满æåº¦ææ°ãç»è®¡ç¨ç {@code service_task} åªè¯»è§å¾ã |
| | | * <p> |
| | | * 为ä»ä¹éè¦è¿ä¸ªç±»ï¼è䏿¯ç´æ¥ç¨ {@code com.smartor.domain.ServiceTask}ï¼ï¼ |
| | | * <ul> |
| | | * <li>é£ä¸ªå®ä½å±äº smartor ç**é访任å¡ç®¡ç**ä¸å¡ï¼è¢«å¤§éæä»¶ä½¿ç¨ï¼å«å¢å æ¹æ¥ï¼ï¼ä¸è½æ¬è¿æ¬æ¨¡åï¼</li> |
| | | * <li>满æåº¦ææ°ç»è®¡åªç¨å°å®ç 4 ä¸ªåæ®µï¼è§ä¸ï¼ï¼</li> |
| | | * <li>æ¬æ¨¡åè¦æ±ãä¸ä¾èµ smartorãï¼æä»¥ä¸è½ import å®ã</li> |
| | | * </ul> |
| | | * <p> |
| | | * 对åºåå®ç°ï¼{@code ServiceTaskMapper.selectServiceTaskList}ï¼ç» |
| | | * {@code ServiceTaskServiceImpl.selectServiceTaskList} è°ç¨ï¼ï¼ |
| | | * è°ç¨æ¹åªå {@code getType()} / {@code getTemplateid()} / {@code getTaskid()} / {@code getOrgid()}ã |
| | | * <p> |
| | | * â ï¸ è¿æ¯<b>åªè¯»</b>è§å¾ï¼æ¬æ¨¡åä¸ä¼å¯¹å®åä»»ä½åæä½ã |
| | | */ |
| | | @Data |
| | | public class SatisfactionTaskRow { |
| | | |
| | | /** |
| | | * 对åºå {@code taskid}ï¼éè®¿ä»»å¡ idã |
| | | * <p>ç¨äºæ {@code taskid} ç»è®¡åééï¼{@code service_subtask}ï¼ä¸å¡«æ¥éï¼{@code service_subtask_detail}ï¼ã |
| | | */ |
| | | private Long taskid; |
| | | |
| | | /** |
| | | * 对åºå {@code templateid}ï¼ä»»å¡æç¨æ¨¡æ¿ idã |
| | | * <p>ç¨äºæ¥è¯¥ä»»å¡æ¨¡æ¿ä¸ç满æåº¦é¢ç®æ°éï¼è¯é³ {@code ivr_task_template_script} / |
| | | * é®å· {@code svy_task_template_script}ï¼ã |
| | | */ |
| | | private Long templateid; |
| | | |
| | | /** |
| | | * 对åºå {@code type}ï¼ä»»å¡ç±»åï¼{@code "1"}=è¯é³ï¼{@code "2"}=é®å·ï¼ã |
| | | */ |
| | | private String type; |
| | | |
| | | /** |
| | | * 对åºå {@code orgid}ï¼æºæ idã |
| | | * <p>åå®ç°æå®éä¼ ç»åç» 3 æ¡æ¥è¯¢ç {@code orgid} æ¡ä»¶ã |
| | | */ |
| | | private String orgid; |
| | | } |
| ÎļþÃû´Ó smartor/src/main/java/com/smartor/domain/VO/MydTrendReqVO.java ÐÞ¸Ä |
| | |
| | | package com.smartor.domain.VO; |
| | | package com.ruoyi.satisfaction.domain.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.annotation.Excel; |
| ÎļþÃû´Ó smartor/src/main/java/com/smartor/domain/VO/MzMydScoreRankVO.java ÐÞ¸Ä |
| | |
| | | package com.smartor.domain.VO; |
| | | package com.ruoyi.satisfaction.domain.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| ÎļþÃû´Ó smartor/src/main/java/com/smartor/domain/VO/PatSatisfactionReqVO.java ÐÞ¸Ä |
| | |
| | | package com.smartor.domain.VO; |
| | | package com.ruoyi.satisfaction.domain.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import com.smartor.domain.entity.PatSatisfactionDetailEntity; |
| | | import com.ruoyi.satisfaction.domain.entity.PatSatisfactionDetailEntity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| ÎļþÃû´Ó smartor/src/main/java/com/smartor/domain/VO/PatSatisfactionResVO.java ÐÞ¸Ä |
| | |
| | | package com.smartor.domain.VO; |
| | | package com.ruoyi.satisfaction.domain.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import com.smartor.domain.entity.PatSatisfactionDetailEntity; |
| | | import com.ruoyi.satisfaction.domain.entity.PatSatisfactionDetailEntity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| ÎļþÃû´Ó smartor/src/main/java/com/smartor/domain/VO/QuestionCountKsOrBqVO.java ÐÞ¸Ä |
| | |
| | | package com.smartor.domain.VO; |
| | | package com.ruoyi.satisfaction.domain.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.annotation.Excel; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import com.smartor.domain.ServiceSubtaskDetailRatioExport; |
| | | import com.ruoyi.satisfaction.domain.ServiceSubtaskDetailRatioExport; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| ÎļþÃû´Ó smartor/src/main/java/com/smartor/domain/VO/SatisfactionExceptConfigQuestionReqVO.java ÐÞ¸Ä |
| | |
| | | package com.smartor.domain.VO; |
| | | package com.ruoyi.satisfaction.domain.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.annotation.Excel; |
| ÎļþÃû´Ó smartor/src/main/java/com/smartor/domain/VO/SltdMydTotalVO.java ÐÞ¸Ä |
| | |
| | | package com.smartor.domain.VO; |
| | | package com.ruoyi.satisfaction.domain.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.annotation.Excel; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.mapper; |
| | | |
| | | import com.ruoyi.satisfaction.domain.PatSatisfaction; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ£è
满æåº¦ Mapper æ¥å£ã |
| | | * <p> |
| | | * è¿ç§»è¯´æï¼å为 {@code com.smartor.mapper.PatSatisfactionMapper}ï¼æ´ä½æ¬å
¥æ»¡æåº¦æ¨¡åã |
| | | * å¯¹åº XMLï¼{@code ruoyi-satisfaction/src/main/resources/mapper/satisfaction/PatSatisfactionMapper.xml} |
| | | * |
| | | * @author lihu |
| | | * @date 2025-06-30 |
| | | */ |
| | | @Mapper |
| | | public interface PatSatisfactionMapper { |
| | | |
| | | /** |
| | | * æ¥è¯¢æ£è
满æåº¦ |
| | | * |
| | | * @param id æ£è
满æåº¦ä¸»é® |
| | | * @return æ£è
满æåº¦ |
| | | */ |
| | | PatSatisfaction selectPatSatisfactionById(Long id); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ£è
满æåº¦å表 |
| | | * |
| | | * @param patSatisfaction æ£è
满æåº¦ |
| | | * @return æ£è
满æåº¦éå |
| | | */ |
| | | List<PatSatisfaction> selectPatSatisfactionList(PatSatisfaction patSatisfaction); |
| | | |
| | | /** |
| | | * æ°å¢æ£è
满æåº¦ |
| | | * |
| | | * @param patSatisfaction æ£è
满æåº¦ |
| | | * @return ç»æ |
| | | */ |
| | | int insertPatSatisfaction(PatSatisfaction patSatisfaction); |
| | | |
| | | /** |
| | | * ä¿®æ¹æ£è
满æåº¦ |
| | | * |
| | | * @param patSatisfaction æ£è
满æåº¦ |
| | | * @return ç»æ |
| | | */ |
| | | int updatePatSatisfaction(PatSatisfaction patSatisfaction); |
| | | |
| | | /** |
| | | * å 餿£è
满æåº¦ |
| | | * |
| | | * @param id æ£è
满æåº¦ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | int deletePatSatisfactionById(Long id); |
| | | |
| | | /** |
| | | * æ¹éå 餿£è
满æåº¦ |
| | | * |
| | | * @param ids éè¦å é¤çæ°æ®ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | int deletePatSatisfactionByIds(Long[] ids); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.mapper; |
| | | |
| | | import com.ruoyi.satisfaction.domain.ServiceSubtaskDetailRatioExport; |
| | | import com.ruoyi.satisfaction.domain.dto.MydTrendReqDTO; |
| | | import com.ruoyi.satisfaction.domain.dto.MzMydScoreRankDTO; |
| | | import com.ruoyi.satisfaction.domain.dto.QuestionCountKsOrBqDTO; |
| | | import com.ruoyi.satisfaction.domain.dto.ServiceSubtaskOptionStatDTO; |
| | | import com.ruoyi.satisfaction.domain.entity.SatisfactionStatQuery; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionSubtaskQuery; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionSubtaskRef; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionTaskRow; |
| | | import com.ruoyi.satisfaction.domain.vo.MzMydScoreRankVO; |
| | | import com.ruoyi.satisfaction.domain.vo.PatSatisfactionReqVO; |
| | | import com.ruoyi.satisfaction.domain.vo.QuestionCountKsOrBqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 满æåº¦ç»è®¡ Mapper æ¥å£ã |
| | | * <p> |
| | | * è¿ç§»è¯´æï¼æ¹æ³åæ¬æ£è½å¨ {@code com.smartor.mapper.ServiceSubtaskMapper} ä¸ |
| | | * {@code com.smartor.mapper.ServiceSubtaskDetailMapper} ä¸ï¼æ»¡æåº¦æ¨¡åååéä¸å°æ¤å¤ã |
| | | * <p> |
| | | * æ¬æ¨¡åèªå¸¦ SQLï¼<b>ç´æ¥æ¥è¯¢</b> {@code service_subtask} / {@code service_subtask_detail}ï¼ |
| | | * 以忍¡æ¿å类表ï¼ä¸ä¾èµä»»ä½å
¶å®æ¨¡åç Mapperã |
| | | * <p> |
| | | * å¯¹åº XMLï¼{@code ruoyi-satisfaction/src/main/resources/mapper/satisfaction/SatisfactionMapper.xml} |
| | | * <p> |
| | | * å·²å é¤çæ»ä»£ç ï¼æ¬è¿æ¶ç¡®è®¤é¶è°ç¨ç¹ï¼ï¼ |
| | | * <ul> |
| | | * <li>{@code selectSatisfactionSubtaskList} ââ 被 {@code selectSatisfactionSubtaskTypes} æ¿ä»£ï¼</li> |
| | | * <li>{@code querySendCount} ââ 被 {@code selectSatisfactionSendCount} æ¿ä»£ã</li> |
| | | * </ul> |
| | | */ |
| | | @Mapper |
| | | public interface SatisfactionMapper { |
| | | |
| | | // ================================================================ åééç»è®¡ |
| | | |
| | | /** |
| | | * 满æåº¦æ±ç¶å¾ï¼ä¸æ¬¡æ§ç»è®¡æ¬æ¬¡è¯·æ±å
¨é¨æ¨¡æ¿çåééï¼æ libtemplateid åç»ï¼ã |
| | | * |
| | | * @param query èåæ¥è¯¢æ¡ä»¶ |
| | | * @return æ¯è¡å« libtemplateidãcnt |
| | | */ |
| | | List<Map<String, Object>> selectSatisfactionSendCount(SatisfactionStatQuery query); |
| | | |
| | | /** |
| | | * 满æåº¦ç»è®¡ï¼åªæ¥æ¬æ¬¡æ¡ä»¶ä¸å®é
åå¨åªäº typeï¼1 è¯é³ / 2 é®å·ï¼ã |
| | | * |
| | | * @param patSatisfactionReqVO æ¥è¯¢æ¡ä»¶ |
| | | * @return å»éåç type å表ï¼å¯è½ä¸º nullï¼ |
| | | */ |
| | | List<String> selectSatisfactionSubtaskTypes(PatSatisfactionReqVO patSatisfactionReqVO); |
| | | |
| | | // ================================================================ å¡«æ¥éç»è®¡ |
| | | |
| | | /** |
| | | * 满æåº¦æ±ç¶å¾ï¼ä¸æ¬¡æ§ç»è®¡æ¬æ¬¡è¯·æ±å
¨é¨æ¨¡æ¿çå¡«æ¥éï¼æ 模æ¿+é®é¢+score åç»ï¼ã |
| | | * |
| | | * @param query èåæ¥è¯¢æ¡ä»¶ |
| | | * @return æ¯è¡å« libtemplateidãquestiontextãscoreãcnt |
| | | */ |
| | | List<Map<String, Object>> selectSatisfactionFillStat(SatisfactionStatQuery query); |
| | | |
| | | /** |
| | | * 满æåº¦ç»è®¡ï¼ä¸æ¬¡æ§ç»è®¡æ¬æ¬¡è¯·æ±å
¨é¨é®é¢çå¡«æ¥éï¼æ 模æ¿+é®é¢+matchedtext+score åç»ï¼ã |
| | | * |
| | | * @param query èåæ¥è¯¢æ¡ä»¶ |
| | | * @return æ¯è¡å« libtemplateidãquestiontextãmatchedtextãscoreãcntãtargetvalue |
| | | */ |
| | | List<Map<String, Object>> selectSatisfactionFillStatByMatchedtext(SatisfactionStatQuery query); |
| | | |
| | | /** |
| | | * 满æåº¦æ±ç¶å¾ï¼ä¸æ¬¡æ§ç»è®¡æ¬æ¬¡è¯·æ±å
¨é¨æ¨¡æ¿çãåæ¶äººæ°ãã |
| | | * <p> |
| | | * åæ¶äººæ°å¿
é¡»æ¯äººæ°å£å¾ï¼count distinct sub_idï¼ï¼ä¸è½æé¢ç®æ±æ»çæ¡è¡æ°ï¼é¢éå£å¾ï¼ã |
| | | * |
| | | * @param query èåæ¥è¯¢æ¡ä»¶ |
| | | * @return æ¯è¡å« libtemplateidãcnt |
| | | */ |
| | | List<Map<String, Object>> selectSatisfactionFillPersonCount(SatisfactionStatQuery query); |
| | | |
| | | // ================================================================ çç«åå¾·ï¼è¶å¿ä¸ç»´åº¦ |
| | | |
| | | /** |
| | | * çç«åå¾·æ£è
满æåº¦è¶å¿ã |
| | | * |
| | | * @param startFinishTime å¼å§æ¶é´ |
| | | * @param endFinishTime ç»ææ¶é´ |
| | | * @param type ç²åº¦ï¼week / month / year / day |
| | | * @return è¶å¿æ°æ® |
| | | */ |
| | | List<MydTrendReqDTO> mydTrend(@Param("startFinishTime") Date startFinishTime, |
| | | @Param("endFinishTime") Date endFinishTime, |
| | | @Param("type") String type); |
| | | |
| | | /** |
| | | * çç«åå¾·æ£è
满æåº¦ââæç§å®¤ç»´åº¦ç»è®¡ã |
| | | */ |
| | | List<MydTrendReqDTO> sltdMydTotalByDimension(@Param("startFinishTime") Date startFinishTime, |
| | | @Param("endFinishTime") Date endFinishTime, |
| | | @Param("type") String type); |
| | | |
| | | /** |
| | | * çç«åå¾·æ£è
满æåº¦ââæé¢åºç»´åº¦ç»è®¡ã |
| | | */ |
| | | List<MydTrendReqDTO> sltdMydTotalByYQ(@Param("startFinishTime") Date startFinishTime, |
| | | @Param("endFinishTime") Date endFinishTime, |
| | | @Param("type") String type); |
| | | |
| | | // ================================================================ éé¡¹å æ¯ |
| | | |
| | | /** |
| | | * ç»è®¡æ»¡æåº¦é项çç¾åæ¯ã |
| | | * |
| | | * @param taskIds ä»»å¡ ID å表 |
| | | * @param subtaskIds åä»»å¡ ID å表ï¼é空æ¶åªç»è®¡è¿äºåä»»å¡ï¼ä¸ºç©ºåç»è®¡è¿äºä»»å¡ä¸çå
¨é¨åä»»å¡ï¼ |
| | | * @param startOutHospTime åºé¢å¼å§æ¶é´ |
| | | * @param endOutHospTime åºé¢ç»ææ¶é´ |
| | | * @param startFinishTime 宿å¼å§æ¶é´ |
| | | * @param endFinishTime å®æç»ææ¶é´ |
| | | * @param scoreStart åå¼ä¸é |
| | | * @param scoreEnd åå¼ä¸é |
| | | * @param questiontext é¢ç®å
å®¹ï¼æ¨¡ç³å¹é
ï¼ |
| | | * @param valueType é¢åï¼2=å¤éï¼ |
| | | */ |
| | | List<ServiceSubtaskDetailRatioExport> statQuestionOption( |
| | | @Param("taskIds") List<Long> taskIds, |
| | | @Param("startOutHospTime") Date startOutHospTime, |
| | | @Param("endOutHospTime") Date endOutHospTime, |
| | | @Param("startFinishTime") Date startFinishTime, |
| | | @Param("endFinishTime") Date endFinishTime, |
| | | @Param("scoreStart") Double scoreStart, |
| | | @Param("scoreEnd") Double scoreEnd, |
| | | @Param("questiontext") String questiontext, |
| | | @Param("valueType") String valueType, |
| | | @Param("subtaskIds") List<Long> subtaskIds); |
| | | |
| | | /** |
| | | * 满æåº¦å¯¼åºï¼éé¡¹å æ¯ã |
| | | * <p> |
| | | * é¡¹æ° = éäºè¯¥éé¡¹çæ£è
æ°ï¼åä¸äººåä¸é¢åªåææ°ä¸æ¡æç»ï¼ï¼åæ° = 该éé¡¹æææç» score ä¹åã |
| | | * |
| | | * @param subtaskIds æ¬æ¬¡å¯¼åºçåä»»å¡ ID |
| | | * @param questiontext é¢ç®å
容ï¼å¯éï¼æ¨¡ç³å¹é
ï¼ |
| | | */ |
| | | List<ServiceSubtaskOptionStatDTO> statMydQuestionOptionForExport( |
| | | @Param("subtaskIds") List<Long> subtaskIds, |
| | | @Param("questiontext") String questiontext); |
| | | |
| | | /** |
| | | * æ ¹æ®åä»»å¡ ID ç»è®¡æ»¡æåº¦é项çç¾åæ¯ï¼ç¨äºæ»¡æåº¦ç»è®¡ serviceType=6/14ï¼ã |
| | | */ |
| | | List<ServiceSubtaskDetailRatioExport> statQuestionOptionBySubtaskIds( |
| | | @Param("subtaskIds") List<Long> subtaskIds, |
| | | @Param("startOutHospTime") Date startOutHospTime, |
| | | @Param("endOutHospTime") Date endOutHospTime, |
| | | @Param("startFinishTime") Date startFinishTime, |
| | | @Param("endFinishTime") Date endFinishTime, |
| | | @Param("scoreStart") Double scoreStart, |
| | | @Param("scoreEnd") Double scoreEnd, |
| | | @Param("questiontext") String questiontext, |
| | | @Param("valueType") String valueType); |
| | | |
| | | /** |
| | | * æç§å®¤/ç
åºå¯¹æ»¡æåº¦é¢ç®åå½ç±»ç»è®¡ã |
| | | */ |
| | | List<QuestionCountKsOrBqDTO> statQuestionOptionByKsOrBq(QuestionCountKsOrBqVO questionCountKsOrBqVO); |
| | | |
| | | // ================================================================ 综åå¾åæå |
| | | |
| | | /** |
| | | * é¨è¯æ»¡æåº¦ç»¼åå¾åæåï¼æç§å®¤æç
åºï¼ã |
| | | * <p> |
| | | * ç»¼åæ»¡æåº¦ = Σ(è¯åæç»æé) / è¯åæç»æ¡æ° à 100%ï¼æéåªå 1ã0.8ã0.6ã0.4ã0.2 äºæ¡£ã |
| | | * |
| | | * @param mzMydScoreRankVO æ¥è¯¢æ¡ä»¶ï¼dimensionTypeãserviceTypeãæ¶é´åºé´ãç§å®¤/ç
åºç¼å·ãorgid/campusidï¼ |
| | | * @return æ¯è¡ç§å®¤/ç
åºç综åå¾åï¼å·²æç»¼åå¾åéåº |
| | | */ |
| | | List<MzMydScoreRankDTO> selectMzMydScoreRank(MzMydScoreRankVO mzMydScoreRankVO); |
| | | // ================================================================ éå¤æç»æ¸
çï¼æ»¡æåº¦ç»è®¡åç½®ï¼ |
| | | |
| | | /** |
| | | * æ¾åºãåä¸ sub_id + questiontextãä¸é¤ææ°ä¸æ¡ä¹å¤çéå¤æç» idã |
| | | * <p> |
| | | * åå± {@code ServiceSubtaskDetailMapper}ï¼åªææ»¡æåº¦ç»è®¡è°ç¨ï¼å·²æ ¸å®ï¼ï¼æ
ä¸å¹¶æ¬å
¥ã |
| | | * <p> |
| | | * â ï¸ æ³¨æï¼è°ç¨å®ç {@code statQuestionOption} / {@code statQuestionOptionBySubtaskIds} |
| | | * ä¼å
æ§è¡æ¬æ¥è¯¢åæ§è¡ {@link #deleteRepeatDetailByIds}ï¼<b>è¿æ¯ä¼ååºçè¡ä¸º</b>ï¼åå®ç°å³å¦æ¤ï¼ã |
| | | * |
| | | * @return éè¦æ¸
ççæç» id |
| | | */ |
| | | List<Long> selectRepeatDetailIds(); |
| | | |
| | | /** |
| | | * æ id é»è¾å é¤é夿ç»ï¼{@code del_flag = 1}ï¼ã |
| | | */ |
| | | Integer deleteRepeatDetailByIds(@Param("ids") List<Long> ids); |
| | | // ================================================================ åä»»å¡ï¼æ»¡æåº¦ç»è®¡åæ°ï¼ |
| | | |
| | | /** |
| | | * ææºæ/é¢åº/æå¡ç±»å/åºé¢æ¶é´/ç§å®¤ç
åºååä»»å¡ï¼<b>åªè¿å id ä¸ taskid</b>ã |
| | | * <p> |
| | | * 对åºåå®ç° {@code ServiceSubtaskServiceImpl.getServiceSubtasks(ServiceSubtaskEntity)} |
| | | * ä¸ {@code sltdMydTotalByScore} å®é
ç¨å°çå£å¾ãåæ¹æ³åºäº |
| | | * {@code selectServiceSubtaskList}ï¼è¿ç¾ä¸ªå¯éæ¡ä»¶ + è¿åå
¨è¡¨å段ï¼ï¼ |
| | | * 满æåº¦åªéè¦ä¸è¿°æ¡ä»¶ä¸ä¸¤ä¸ª id åï¼å æ¤è¿éä¸å䏿¡ç²¾ç®æ¥è¯¢ã |
| | | * <p> |
| | | * <b>æ¡ä»¶ä¸åæéåä¸è´</b>ï¼åãéç©ºææ¼ãï¼ï¼ |
| | | * {@code del_flag = 0}ã{@code orgid}ã{@code campusid}ã{@code service_type}ã |
| | | * {@code endtime} çæ¥æåºé´ã{@code deptOrDistrict==1} æ¶çç
åº INã |
| | | * {@code leaveldeptcodes} çç§å®¤ INã |
| | | * <p> |
| | | * â ï¸ åææ é»è®¤æåºãæ é»è®¤å页ï¼{@code sort}/{@code pageSize} æªè®¾ç½®å³ä¸çæï¼ï¼ |
| | | * æ¬æ¥è¯¢åæ ·ä¸å æåºï¼ä¿è¯ç»æé¡ºåºè¡ä¸ºä¸è´ã |
| | | */ |
| | | List<SatisfactionSubtaskRef> selectMydSubtaskRefs(@Param("q") SatisfactionSubtaskQuery query); |
| | | |
| | | // ================================================================ éè®¿ãæ»¡æåº¦ææ°ãåæ° |
| | | // ä»¥ä¸ 5 ä¸ªæ¹æ³æå¡äº getSatisfactionIndexï¼é访ç»è®¡é¡µçãæ»¡æåº¦é¢ç®æ»é/å¡«æ¥é/宿æ¯ä¾ãï¼ï¼ |
| | | // 忬æ£è½å¨ smartor ç ServiceTaskMapper / IvrTaskTemplateScriptMapper / |
| | | // SvyTaskTemplateScriptMapper / ServiceSubtaskMapper / ServiceSubtaskDetailMapper ä¸ï¼ |
| | | // ç± ServiceSubtaskServiceImpl#getSatisfactionIndex é个è°ç¨ã |
| | | |
| | | /** |
| | | * æç§å®¤ <b>æ</b> ç
åºåé访任å¡ï¼åªåç»è®¡ç¨å°ç 4 åï¼ã |
| | | * <p> |
| | | * 对åºåå®ç° {@code ServiceTaskMapper.selectServiceTaskList}ï¼è°ç¨æ¹æ type äºéä¸ä¼ åï¼ |
| | | * <ul> |
| | | * <li>{@code deptcode} é空 â æ¼ {@code deptcode REGEXP CONCAT('(^|,)', #{deptcode}, '(,|$)')}ï¼</li> |
| | | * <li>{@code leavehospitaldistrictcode} é空 â æ¼åå½¢æç REGEXPï¼</li> |
| | | * </ul> |
| | | * 两è
åªä¼æä¸ä¸ªé空ï¼å æ¤æ¬æ¹æ³ä¸æ¡ SQL å³å¯è¦çåå®ç°çä¸¤ä¸ªåæ¯ã |
| | | * <p> |
| | | * <b>å£å¾éåä¸è´</b>ï¼{@code del_flag = 0}ã{@code orgid}ã{@code order by update_time desc, taskid desc}ã |
| | | */ |
| | | List<SatisfactionTaskRow> selectSatisfactionServiceTasks( |
| | | @Param("orgid") String orgid, |
| | | @Param("deptcode") String deptcode, |
| | | @Param("leavehospitaldistrictcode") String leavehospitaldistrictcode); |
| | | |
| | | /** |
| | | * ç»è®¡ææ¨¡æ¿ä¸çè¯é³æ»¡æåº¦é¢ç®æ°éã |
| | | * <p> |
| | | * 对åºåå®ç° {@code IvrTaskTemplateScriptMapper.selectIvrTaskTemplateScriptList} |
| | | * å¨ {@code templateID + orgid + scriptAssortid} ä¸ä¸ªæ¡ä»¶ä¸ç {@code size()}ã |
| | | * <p> |
| | | * <b>å£å¾æ³¨æ</b>ï¼{@code scriptAssortid} 为 {@code null} æ¶<b>䏿¼</b>该æ¡ä»¶ |
| | | * ï¼çäºç»è®¡è¯¥æ¨¡æ¿å
¨é¨é¢ç®ï¼ââä¸åæ {@code <if test="scriptAssortid != null">} ä¸è´ã |
| | | */ |
| | | int countIvrTaskTemplateScripts(@Param("templateID") Long templateID, |
| | | @Param("orgid") String orgid, |
| | | @Param("scriptAssortid") Long scriptAssortid); |
| | | |
| | | /** |
| | | * ç»è®¡ææ¨¡æ¿ä¸çé®å·æ»¡æåº¦é¢ç®æ°éã |
| | | * <p> |
| | | * 对åºåå®ç° {@code SvyTaskTemplateScriptMapper.selectSvyTaskTemplateScriptList} |
| | | * å¨ {@code templateID + orgid + categoryid} ä¸ä¸ªæ¡ä»¶ä¸ç {@code size()}ã |
| | | * <p> |
| | | * <b>å£å¾æ³¨æ</b>ï¼{@code categoryid} 为 {@code null} æ¶<b>䏿¼</b>该æ¡ä»¶ï¼ä¸åæä¸è´ï¼ã |
| | | */ |
| | | int countSvyTaskTemplateScripts(@Param("templateID") Long templateID, |
| | | @Param("orgid") String orgid, |
| | | @Param("categoryid") Long categoryid); |
| | | |
| | | /** |
| | | * ç»è®¡æä»»å¡ä¸æå®åéç¶æçå任塿°éã |
| | | * <p> |
| | | * 对åºåå®ç° {@code ServiceSubtaskMapper.selectServiceSubtaskBySendstate} |
| | | * å¨ {@code taskid + sendstates(3,5,6)} 两个æ¡ä»¶ä¸ç {@code size()}ã |
| | | * åè°ç¨æ²¡æè®¾ç½® {@code orgid}ï¼æ
æ¬æ¹æ³ä¹ä¸å«è¯¥æ¡ä»¶ã |
| | | * <p> |
| | | * <b>å£å¾æ³¨æ</b>ï¼å« {@code del_flag = 0}ï¼{@code sendstates} 为 {@code null} æ¶ä¸æ¼ IN æ¡ä»¶ã |
| | | */ |
| | | int countSubtaskBySendstates(@Param("taskid") Long taskid, |
| | | @Param("sendstates") List<Long> sendstates); |
| | | |
| | | /** |
| | | * ç»è®¡æä»»å¡ä¸ç满æåº¦æç»æ°éã |
| | | * <p> |
| | | * 对åºåå®ç° {@code ServiceSubtaskDetailMapper.selectServiceSubtaskDetailList} |
| | | * å¨ {@code taskid + categoryid + orgid} ä¸ä¸ªæ¡ä»¶ä¸ç {@code size()}ã |
| | | * <p> |
| | | * <b>å£å¾æ³¨æ</b>ï¼åæ<b>没æ</b> {@code del_flag} æ¡ä»¶ï¼æ¬æ¥è¯¢åæ ·ä¸å ï¼ |
| | | * {@code categoryid} 为 {@code null} æ¶ä¸æ¼è¯¥æ¡ä»¶ï¼ä¿çåæç"æä»»å¡ç±»åå³å®æ¯å¦è®¾ categoryid"è¡ä¸ºï¼ã |
| | | */ |
| | | int countSubtaskDetail(@Param("taskid") Long taskid, |
| | | @Param("categoryid") Long categoryid, |
| | | @Param("orgid") String orgid); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.mapper; |
| | | |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionCategoryRow; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionIvrScriptRow; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionOptionScoreRow; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionScriptQuery; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionSvyScriptRow; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 满æåº¦ç»è®¡åãæ»¡æåº¦åç±» / 模æ¿é®é¢ / é项åå¼ãçåªè¯» Mapperã |
| | | * <p> |
| | | * <b>为ä»ä¹ä¸å¤ç¨ smartor çæ¨¡æ¿/åç±» Mapperï¼</b> |
| | | * <ul> |
| | | * <li>{@code com.smartor.domain.IvrLibaScriptAssort} / {@code IvrLibaTemplateScript} / |
| | | * {@code SvyLibScriptCategory} / {@code SvyLibTemplateScript} è¿ 4 个å®ä½å±äº |
| | | * smartor ç**模æ¿ä¸å类管ç**ä¸å¡ï¼åå«è¢« 11/9/12/13 个æä»¶ä½¿ç¨ï¼å«å¢å æ¹æ¥ï¼ï¼ |
| | | * ä¸è½æ¬è¿æ¬æ¨¡åï¼</li> |
| | | * <li>æ¬æ¨¡åè¦æ±ãä¸ä¾èµ smartorï¼å
¶å®æ¨¡åè¦ç¨åªè½è°æ¬æ¨¡å apiãï¼æä»¥ä¸è½ import å®ä»¬ï¼</li> |
| | | * <li>åæè¿äºæ¥è¯¢ä¾èµ `resultMap` + å
±äº« `<sql>` çæ®µï¼èçæ®µè¢«åæä»¶éå
¶å® |
| | | * <b>éæ»¡æåº¦</b>æ¥è¯¢å
±ç¨ãç´æ¥å¤å¶ç段ä¼é æãåä¸ä»½ SQL 两å¤ç»´æ¤ãçéæ£ï¼ |
| | | * å æ¤è¿é<b>æ¹å为æ¾å¼åæ¸
å</b>ï¼åªå满æåº¦çæ£ç¨å°çåæ®µã</li> |
| | | * </ul> |
| | | * <p> |
| | | * â ï¸ æ¬ Mapper å
¨é¨æ¯<b>åªè¯»æ¥è¯¢</b>ï¼ä¸ä¼å¯¹ {@code ivr_liba_*} / {@code svy_lib_*} åä»»ä½åæä½ã |
| | | * <p> |
| | | * å¯¹åº XMLï¼{@code mapper/satisfaction/SatisfactionScriptMapper.xml} |
| | | */ |
| | | @Mapper |
| | | public interface SatisfactionScriptMapper { |
| | | |
| | | // ================================================================ 满æåº¦åç±» |
| | | |
| | | /** |
| | | * æ¥è¯¢æå®æºæä¸ç满æåº¦åç±»ï¼è¯é³ä¾§ï¼ã |
| | | * <p> |
| | | * åå®ç°ï¼{@code IvrLibaScriptAssortMapper.selectIvrLibaScriptAssortList} |
| | | * <pre> |
| | | * select id, index_assort_name, type from ivr_liba_script_assort |
| | | * where del_flag = 0 and orgid = ? and type like '%myd%' order by seqno asc |
| | | * </pre> |
| | | * è°ç¨æ¹åæ {@code type.contains("myd")} è¿æ»¤åºæ»¡æåº¦åç±» idã |
| | | * |
| | | * @param query orgid ä¸ typeï¼type ä¼ "myd"ï¼ |
| | | * @return æ¯è¡å« idãindex_assort_nameãtype |
| | | */ |
| | | List<SatisfactionCategoryRow> selectIvrCategoryList(@Param("q") SatisfactionScriptQuery query); |
| | | |
| | | /** |
| | | * æ¥è¯¢æå®æºæä¸ç满æåº¦åç±»ï¼é®å·ä¾§ï¼ã |
| | | * <p> |
| | | * åå®ç°ï¼{@code SvyLibScriptCategoryMapper.selectSvyLibScriptCategoryList} |
| | | * ï¼æ³¨æï¼è¯¥ statement å®ä¹å¨ {@code SvyLibTopicCategoryMapper.xml} éï¼namespace 䏿件åä¸ä¸è´ï¼ |
| | | * <pre> |
| | | * select id, name, type from svy_lib_script_category |
| | | * where del_flag = 0 and orgid = ? and type like '%myd%' order by seqno asc |
| | | * </pre> |
| | | * |
| | | * @param query orgid ä¸ typeï¼type ä¼ "myd"ï¼ |
| | | * @return æ¯è¡å« idãnameãtype |
| | | */ |
| | | List<SatisfactionCategoryRow> selectSvyCategoryList(@Param("q") SatisfactionScriptQuery query); |
| | | |
| | | // ================================================================ 模æ¿é®é¢ï¼æåç±»ï¼ |
| | | |
| | | /** |
| | | * æè¯é³åç±» id åé®é¢ã |
| | | * <p> |
| | | * åå®ç°ï¼{@code IvrLibaTemplateScriptMapper.queryLibTemplateIds} |
| | | * <pre> |
| | | * select templateid, scriptid, script_content, script_assortname, dimension |
| | | * from ivr_liba_template_script |
| | | * where del_flag = 0 [and script_assortid in (...)] |
| | | * </pre> |
| | | * <b>å£å¾æ³¨æ</b>ï¼{@code scriptAssortids} 为空æ¶ä¸åæ¼è¯¥æ¡ä»¶ï¼åå®ç°æ¯ |
| | | * {@code if test="scriptAssortids != null and scriptAssortids.size > 0"}ï¼ã |
| | | */ |
| | | List<SatisfactionIvrScriptRow> queryIvrScriptByAssort(@Param("q") SatisfactionScriptQuery query); |
| | | |
| | | /** |
| | | * æé®å·åç±» id åé®é¢ã |
| | | * <p> |
| | | * åå®ç°ï¼{@code SvyLibTemplateScriptMapper.querySvyLibTemplateIds} |
| | | * <pre> |
| | | * select id, svyid, script_content, categoryName, dimension |
| | | * from svy_lib_template_script |
| | | * where del_flag = 0 [and categoryid in (...)] |
| | | * </pre> |
| | | * <b>å£å¾æ³¨æ</b>ï¼åå®ç°åé项å弿¶ç¨çæ¯ {@code id}ï¼ä¸»é®ï¼ï¼ |
| | | * èèåç»è®¡çæ¨¡æ¿ id ç¨çæ¯ {@code svyid}ââ两è
é½ä¿çå¨ç»æè¡éã |
| | | */ |
| | | List<SatisfactionSvyScriptRow> querySvyScriptByCategory(@Param("q") SatisfactionScriptQuery query); |
| | | |
| | | // ================================================================ 模æ¿é®é¢ï¼æç»´åº¦ï¼ |
| | | |
| | | /** |
| | | * æç»´åº¦åé®é¢ï¼è¯é³ä¾§ï¼ã |
| | | * <p> |
| | | * åå®ç°ï¼{@code IvrLibaTemplateScriptMapper.selectILTSBydimension} |
| | | * <pre> |
| | | * ... where del_flag = 0 |
| | | * [and dimension in (...)] |
| | | * [dimension IS NOT NULL] â dimensionList ä¸ºç©ºæ¶æ¼è¿ä¸ª |
| | | * </pre> |
| | | * <b>å£å¾æ³¨æ</b>ï¼{@code dimensionList} 为空æ¶ï¼è¯é³ä¾§ä¼æ¼ |
| | | * {@code dimension IS NOT NULL}ï¼é®å·ä¾§ä¸ä¼ï¼ââè¿æ¯åå®ç°çè¡ä¸ºï¼å¿
é¡»ä¿çã |
| | | * åæ¶åå®ç°è¿æ¯æ duty/report ç¸å
³è¿æ»¤ï¼æ»¡æåº¦è°ç¨æ¶ä¸ä¼ ï¼æ
ä¸åæ´é²ã |
| | | */ |
| | | List<SatisfactionIvrScriptRow> selectIvrScriptByDimension(@Param("q") SatisfactionScriptQuery query); |
| | | |
| | | /** |
| | | * æç»´åº¦åé®é¢ï¼é®å·ä¾§ï¼ã |
| | | * <p> |
| | | * åå®ç°ï¼{@code SvyLibTemplateScriptMapper.selectSLTScriptListBydimension} |
| | | * <pre> |
| | | * ... where del_flag = 0 [and dimension in (...)] |
| | | * </pre> |
| | | * <b>å£å¾æ³¨æ</b>ï¼ä¸è¯é³ä¾§ä¸åï¼{@code dimensionList} 为空æ¶<b>䏿¼</b> |
| | | * {@code dimension IS NOT NULL}ï¼çäºå该表å
¨é¨ del_flag=0 çé®é¢ï¼ã |
| | | * å¦å¤æ¤å¤èåç»è®¡ç¨çæ¨¡æ¿ id ä¸åé项åå¼ç¨çå
³è id <b>齿¯ {@code svyid}</b>ã |
| | | */ |
| | | List<SatisfactionSvyScriptRow> selectSvyScriptByDimension(@Param("q") SatisfactionScriptQuery query); |
| | | |
| | | // ================================================================ é项åå¼ |
| | | |
| | | /** |
| | | * æé®é¢ id æ¹éåè¯é³é项åå¼ï¼åªå scriptidãscore 两åï¼ã |
| | | * <p> |
| | | * åå®ç°ï¼{@code IvrLibaTemplateTargetoptionMapper.selectIvrLibaTargetoptionScores} |
| | | * <p> |
| | | * <b>å£å¾æ³¨æ</b>ï¼{@code scriptIds} 为 null æ¶åå®ç°ä¸æ¼ scriptid æ¡ä»¶ |
| | | * ï¼çäºå该表å
¨é¨åå¼ï¼ï¼è°ç¨æ¹ç¨ null ä½ key åè¿ä¸ä»½ã |
| | | */ |
| | | List<SatisfactionOptionScoreRow> selectIvrTargetOptionScores(@Param("scriptIds") List<Long> scriptIds); |
| | | |
| | | /** |
| | | * æé®é¢ id æ¹éåé®å·é项åå¼ï¼åªå scriptidãscore 两åï¼ã |
| | | * <p> |
| | | * åå®ç°ï¼{@code SvyLibTemplateTargetoptionMapper.selectSvyLibTargetoptionScores} |
| | | */ |
| | | List<SatisfactionOptionScoreRow> selectSvyTargetOptionScores(@Param("scriptIds") List<Long> scriptIds); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.service; |
| | | |
| | | import com.ruoyi.satisfaction.domain.PatSatisfaction; |
| | | import com.ruoyi.satisfaction.domain.vo.PatSatisfactionReqVO; |
| | | import com.ruoyi.satisfaction.domain.vo.PatSatisfactionResVO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æ£è
满æåº¦ Service æ¥å£ã |
| | | * <p> |
| | | * è¿ç§»è¯´æï¼å为 {@code com.smartor.service.IPatSatisfactionService}ï¼æ´ä½æ¬å
¥æ»¡æåº¦æ¨¡åã |
| | | * æ¹æ³ç¾åä¸è¯ä¹<b>ä¸åæªæ¹</b>ï¼Controller ç URL ä¸åºå
¥åä¹å æ¤ä¿æä¸åã |
| | | * <p> |
| | | * â ï¸ æ¬æ¥å£åªåºå¨æ»¡æåº¦æ¨¡åå
é¨ä½¿ç¨ï¼å
¶å®æ¨¡åéè¦æ»¡æåº¦æ°æ®è¯·ä½¿ç¨ |
| | | * {@code com.ruoyi.satisfaction.api} ä¸çé¨é¢æ¥å£ã |
| | | * |
| | | * @author lihu |
| | | * @date 2025-06-30 |
| | | */ |
| | | public interface IPatSatisfactionService { |
| | | |
| | | // ================================================================ pat_satisfaction 表 CRUD |
| | | |
| | | /** |
| | | * æ¥è¯¢æ£è
满æåº¦ |
| | | * |
| | | * @param id æ£è
满æåº¦ä¸»é® |
| | | * @return æ£è
满æåº¦ |
| | | */ |
| | | PatSatisfaction selectPatSatisfactionById(Long id); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ£è
满æåº¦å表 |
| | | * |
| | | * @param patSatisfaction æ£è
满æåº¦ |
| | | * @return æ£è
满æåº¦éå |
| | | */ |
| | | List<PatSatisfaction> selectPatSatisfactionList(PatSatisfaction patSatisfaction); |
| | | |
| | | /** |
| | | * æ°å¢æ£è
满æåº¦ |
| | | */ |
| | | int insertPatSatisfaction(PatSatisfaction patSatisfaction); |
| | | |
| | | /** |
| | | * æ¹éæ°å¢æ£è
满æåº¦ |
| | | */ |
| | | int batchInsert(List<PatSatisfaction> patSatisfactions); |
| | | |
| | | /** |
| | | * ä¿®æ¹æ£è
满æåº¦ |
| | | */ |
| | | int updatePatSatisfaction(PatSatisfaction patSatisfaction); |
| | | |
| | | /** |
| | | * æ¹éå 餿£è
满æåº¦ |
| | | */ |
| | | int deletePatSatisfactionByIds(Long[] ids); |
| | | |
| | | /** |
| | | * å 餿£è
满æåº¦ä¿¡æ¯ |
| | | */ |
| | | int deletePatSatisfactionById(Long id); |
| | | |
| | | // ================================================================ ç»è®¡ |
| | | |
| | | /** |
| | | * æ£è
满æåº¦ç»è®¡ï¼æç»å£å¾ï¼éé®é¢è¿åçé¢äººæ°ãå¹³ååãæé«/æä½åãçé¢çãéé¡¹å æ¯ï¼ |
| | | * |
| | | * @param patSatisfactionReqVO ç»è®¡æ¡ä»¶ |
| | | * @return ç»è®¡ç»æ |
| | | */ |
| | | PatSatisfactionResVO statistics(PatSatisfactionReqVO patSatisfactionReqVO); |
| | | |
| | | /** |
| | | * æ£è
满æåº¦ç»è®¡ï¼ç»´åº¦å£å¾ï¼ä¸ {@link #statistics} çå·®å¼ä»
å¨ãé®é¢æ¥æºãï¼ |
| | | * åè
ææ»¡æåº¦åç±»åï¼æ¬æ¹æ³æå
¥å dimensionList åï¼ |
| | | */ |
| | | PatSatisfactionResVO statisticsByDimension(PatSatisfactionReqVO patSatisfactionReqVO); |
| | | |
| | | /** |
| | | * æ£è
满æåº¦æ±ç¶å¾ä¿¡æ¯ï¼åç±»å£å¾ï¼æåç±»æ±æ»åééãåæ¶äººæ°ãåæ¶çãå¹³ååï¼ |
| | | */ |
| | | Map<String, Object> satisfactionGraph(PatSatisfactionReqVO patSatisfactionReqVO); |
| | | |
| | | /** |
| | | * æ£è
满æåº¦æ±ç¶å¾ä¿¡æ¯ï¼ç»´åº¦å£å¾ï¼ |
| | | */ |
| | | Map<String, Object> satisfactionGraphDimension(PatSatisfactionReqVO patSatisfactionReqVO); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.service; |
| | | |
| | | import com.ruoyi.satisfaction.domain.ServiceSubtaskDetailRatioExport; |
| | | import com.ruoyi.satisfaction.domain.dto.MydTrendReqDTO; |
| | | import com.ruoyi.satisfaction.domain.dto.MzMydScoreRankDTO; |
| | | import com.ruoyi.satisfaction.domain.dto.QuestionCountKsOrBqDTO; |
| | | import com.ruoyi.satisfaction.domain.vo.MydTrendReqVO; |
| | | import com.ruoyi.satisfaction.domain.vo.MzMydScoreRankVO; |
| | | import com.ruoyi.satisfaction.domain.vo.QuestionCountKsOrBqVO; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionCategoryRow; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionIvrScriptRow; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionScriptQuery; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionSubtaskQuery; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionSubtaskRef; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionSvyScriptRow; |
| | | import com.ruoyi.satisfaction.domain.vo.SatisfactionExceptConfigQuestionReqVO; |
| | | import com.ruoyi.satisfaction.domain.vo.SltdMydTotalVO; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 满æåº¦ãåä»»å¡ç»´åº¦ãç»è®¡æå¡ã |
| | | * <p> |
| | | * è¿ç§»è¯´æï¼è¿äºæ¹æ³åå± {@code com.smartor.service.IServiceSubtaskService}ï¼ |
| | | * ä½åªææ»¡æåº¦ç¸å
³å
¥å£å¨ç¨ï¼å·²éä¸ªæ ¸å®æ å
¶å®è°ç¨æ¹ï¼ï¼æ
æ´æ¹æ¬å
¥æ»¡æåº¦æ¨¡åã |
| | | * æ¹æ³ç¾åé¤ {@link #getDetailRatio} å¤å<b>ä¸åæªæ¹</b>ã |
| | | * <p> |
| | | * â ï¸ æ¬æ¥å£åªåºå¨æ»¡æåº¦æ¨¡åå
é¨ä½¿ç¨ï¼å
¶å®æ¨¡åéè¦æ»¡æåº¦æ°æ®è¯·ç¨ |
| | | * {@code com.ruoyi.satisfaction.api} ä¸çé¨é¢æ¥å£ã |
| | | */ |
| | | public interface SatisfactionSubtaskService { |
| | | |
| | | // ================================================================ éé¡¹å æ¯ |
| | | |
| | | /** |
| | | * ç»è®¡æ»¡æåº¦é项çç¾åæ¯ã |
| | | * <p> |
| | | * 注æï¼æ¬æ¹æ³å¼å¤´ä¼å
æ¸
çé夿ç»ï¼{@code selectRepeatDetailIds} / {@code deleteRepeatDetailByIds}ï¼ï¼ |
| | | * è¿æ¯åå®ç°å°±æçè¡ä¸ºã |
| | | */ |
| | | List<ServiceSubtaskDetailRatioExport> statQuestionOption( |
| | | List<Long> taskIds, Date startFinishTime, Date endFinishTime, |
| | | Date startOutHospTime, Date endOutHospTime, String scriptContent, |
| | | Double scoreStart, Double scoreEnd, String valueType, List<Long> subtaskIds); |
| | | |
| | | /** |
| | | * 满æåº¦å¯¼åºï¼éé¡¹å æ¯ã |
| | | */ |
| | | List<ServiceSubtaskDetailRatioExport> statMydQuestionOptionForExport( |
| | | List<Long> subtaskIds, String questiontext); |
| | | |
| | | /** |
| | | * æ ¹æ®åä»»å¡ ID ç»è®¡æ»¡æåº¦é项çç¾åæ¯ï¼æ»¡æåº¦ serviceType=6/14 ç¨ï¼ã |
| | | */ |
| | | List<ServiceSubtaskDetailRatioExport> statQuestionOptionBySubtaskIds( |
| | | List<Long> subtaskIds, Date startOutHospTime, Date endOutHospTime, |
| | | Date startFinishTime, Date endFinishTime, String scriptContent, |
| | | Double scoreStart, Double scoreEnd, String valueType); |
| | | |
| | | /** |
| | | * æç§å®¤/ç
åºå¯¹æ»¡æåº¦é¢ç®åå½ç±»ç»è®¡ã |
| | | */ |
| | | Map<String, Map<String, List<QuestionCountKsOrBqDTO>>> statQuestionOptionByKsOrBq(QuestionCountKsOrBqVO vo); |
| | | |
| | | /** |
| | | * é®é¢ç»æå æ¯ï¼çç«å德满æåº¦ç»è®¡ç¨ï¼ã |
| | | * <p> |
| | | * <b>ä¸åæçå·®å¼ï¼ä»
ç¾åï¼</b>ï¼åæå
¥åæ¯ {@code List<ServiceSubtaskRes>}ï¼ |
| | | * æ¹æ³å
é¨ä»ä¸æ½åº taskIds ä¸ subtaskIdsã为让满æåº¦æ¨¡åä¸ä¾èµ smartor çå®ä½ï¼ |
| | | * æ¹ä¸ºç´æ¥æ¥æ¶è¿ä¸¤ä¸ª id å表ï¼<b>å£å¾ä¸åæ¯å¤æå®å
¨ä¸å</b>ï¼ |
| | | * <ul> |
| | | * <li>serviceTypeList åæ¶å« 2 ä¸ 6/14 â è¿å {@code null}ï¼åæå³å¦æ¤ï¼è°ç¨æ¹æ®æ¤æç¤º"æä¸æ¯æ"ï¼ï¼</li> |
| | | * <li>å« 2 â èµ° {@link #statQuestionOption}ï¼æ taskid ç»è®¡ï¼ï¼</li> |
| | | * <li>å« 6/14 â èµ° {@link #statQuestionOptionBySubtaskIds}ï¼æ subtask id ç»è®¡ï¼ã</li> |
| | | * </ul> |
| | | * |
| | | * @param taskIds ä»»å¡ id å表ï¼éè®¿åæ¯ç¨ï¼ç±è°ç¨æ¹ä»æ¥è¯¢ç»ææ½åºï¼ |
| | | * @param subtaskIds åä»»å¡ id åè¡¨ï¼æ»¡æåº¦åæ¯ç¨ï¼ç±è°ç¨æ¹ä»æ¥è¯¢ç»ææ½åºï¼ |
| | | */ |
| | | List<ServiceSubtaskDetailRatioExport> getDetailRatio( |
| | | SltdMydTotalVO sltdMydTotalVO, List<SatisfactionSubtaskRef> subtaskRefs); |
| | | |
| | | // ================================================================ çç«åå¾·ï¼è¶å¿ä¸ç»´åº¦ |
| | | |
| | | /** |
| | | * çç«åå¾·æ£è
满æåº¦è¶å¿ï¼æå¨/æ/å¹´/æ¥è¡¥é¶ï¼ã |
| | | */ |
| | | List<MydTrendReqDTO> mydTrend(MydTrendReqVO mydTrendReqVO); |
| | | |
| | | /** |
| | | * çç«åå¾·æ£è
满æåº¦ââæç»´åº¦ï¼ç§å®¤/é¢åºï¼ç»è®¡ã |
| | | */ |
| | | List<MydTrendReqDTO> sltdMydTotalByDimension(MydTrendReqVO mydTrendReqVO); |
| | | |
| | | // ================================================================ é¨è¯å¾åæå |
| | | |
| | | /** |
| | | * é¨è¯æ»¡æåº¦ç»¼åå¾åæåï¼æç§å®¤æç
åºï¼ã |
| | | * <p> |
| | | * å
¥å缺çå¤çä¿çåå®ç°ï¼{@code dimensionType} 为空åç½® {@code "1"}ï¼ |
| | | * {@code serviceTypes} 为空åç½® {@code ["14"]}ï¼é¨è¯æ»¡æåº¦ï¼ã |
| | | */ |
| | | List<MzMydScoreRankDTO> mzMydScoreRank(MzMydScoreRankVO mzMydScoreRankVO); |
| | | /** |
| | | * ææºæ/é¢åº/æå¡ç±»å/åºé¢æ¶é´/ç§å®¤ç
åºååä»»å¡å¼ç¨ï¼åªå« idãtaskidï¼ã |
| | | * <p> |
| | | * ä¾ {@code /sltdMydTotalByScore} 使ç¨ï¼åå®ç°é个 serviceType è°ç¨ |
| | | * {@code getServiceSubtasks} å转æ {@code ServiceSubtaskRes}ï¼ç°æ¹ä¸ºæ¬æ¹æ³ã |
| | | */ |
| | | List<SatisfactionSubtaskRef> getMydSubtaskRefs(SatisfactionSubtaskQuery query); |
| | | /** |
| | | * è·å满æåº¦é®é¢åç±»ï¼è¯é³ + é®å·ï¼ï¼å¸¦ç¼åã |
| | | * <p> |
| | | * ä¾ç»å½é¾è·¯ä½¿ç¨ï¼å {@code smartor.UserExtInfoServiceImpl.getSatisfactionCategories}ï¼ã |
| | | */ |
| | | Map<String, Object> getSatisfactionCategories(String orgid); |
| | | |
| | | /** |
| | | * è·å满æåº¦å¼å¸¸é
ç½®é¢ç®ï¼è¯é³ + é®å·ï¼ï¼ç¨äºã满æåº¦å¼å¸¸é
ç½®ã页é¢ã |
| | | * <p> |
| | | * è¿ç§»è¯´æï¼å为 {@code com.smartor.service.IServiceSubtaskDetailTraceService#getSatisfactionExceptConfigQuestion}ï¼ |
| | | * æå¡å®ç°è½å¨é访å¼å¸¸è·è¸ª Service éï¼ä½é»è¾å®å
¨æ¯æ»¡æåº¦åç±»/é¢ç®çæ¥è¯¢ï¼ |
| | | * æ
ææ¨¡ååè¦æ±æ¬å
¥æ¬æ¨¡åã<b>è¿åç»æãåæ®µåãç鿡件åä¸åæä¸è´</b>ï¼ |
| | | * <pre> |
| | | * { |
| | | * "voiceDataList": [ {questionId, libtemplateid, questionContent, questionTopic, questionType, categoryName, categoryId}, ... ], |
| | | * "questionnaireDataList": [ åä¸ ] |
| | | * } |
| | | * </pre> |
| | | * <b>ä¿ççåæä¸å¯¹ç§°è¡ä¸º</b>ï¼ä¸è¦"ç»ä¸"ï¼ï¼ |
| | | * <ul> |
| | | * <li>{@code scriptType} 为空æ¶ï¼è¯é³ä¸é®å·<b>ä¸¤æ®µé½æ§è¡</b>ï¼ä¸¤ä¸ª key é½ä¼åºç°ï¼</li> |
| | | * <li>è¯é³ä¾§çåç±»åçæ¯æå¡æ¹æ³ï¼æ¼æ å<b>åªè¿åé¡¶å±åç±»</b>ï¼ï¼é®å·ä¾§ç¨çæ¯ Mapperï¼å<b>å
¨é¨</b>åç±»ï¼ï¼</li> |
| | | * <li>{@code type} ä¸ºç©ºæ¶æ {@code "myd"} è¿æ»¤ï¼å
¥åæå¼æ¶è¦çã</li> |
| | | * </ul> |
| | | * |
| | | * @param questionReqVO å
¥åï¼scriptTypeï¼1 è¯é³ / 2 é®å·ï¼ä¸ºç©ºå两è
ï¼typeï¼æ»¡æåº¦ç±»åï¼é»è®¤ mydï¼ |
| | | * @return è¯é³ä¸é®å·çé¢ç®å表 |
| | | */ |
| | | Map<String, Object> getSatisfactionExceptConfigQuestion(SatisfactionExceptConfigQuestionReqVO questionReqVO); |
| | | |
| | | /** |
| | | * é访ç»è®¡é¡µçãæ»¡æåº¦ææ°ãï¼æ»¡æåº¦é¢ç®æ»é / å¡«æ¥é / 宿æ¯ä¾ã |
| | | * <p> |
| | | * è¿ç§»è¯´æï¼å为 {@code com.smartor.service.impl.ServiceSubtaskServiceImpl#getSatisfactionIndex} |
| | | * ï¼ç§ææ¹æ³ï¼è¢« {@code getSfStatisticsJoy} è°ç¨ï¼ã |
| | | * <p> |
| | | * â ï¸ <b>åå®ç°ç¼ºé·å·²åæ ·ä¿ç</b>ï¼ç±äº {@code BigDecimal.add(...)} çè¿åå¼è¢«ä¸¢å¼ï¼ |
| | | * æ¬æ¹æ³å®é
䏿å®è¿å {@code {mydtmzl:0, mydtbl:0, wcbl:0.0}}ï¼ä½æ¥è¯¢ç
§æ§æ§è¡ï¼ã |
| | | * 详è§å®ç°ç±»ä¸ç注éã |
| | | * |
| | | * @param type "1"=æç§å®¤ï¼"2"=æç
åº |
| | | * @param code ç§å®¤/ç
åºç¼ç |
| | | * @param orgid æºæ id |
| | | * @param ivrCategoryid è¯é³æ»¡æåº¦åç±» idï¼å¯ä¸º nullï¼ |
| | | * @param svyCategoryid é®å·æ»¡æåº¦åç±» idï¼å¯ä¸º nullï¼ |
| | | * @return {@code mydtmzl}(Integer) / {@code mydtbl}(Integer) / {@code wcbl}(Double) |
| | | */ |
| | | Map<String, Object> getSatisfactionIndex(String type, String code, String orgid, |
| | | Long ivrCategoryid, Long svyCategoryid); |
| | | } |
| ÎļþÃû´Ó smartor/src/main/java/com/smartor/service/impl/PatSatisfactionServiceImpl.java ÐÞ¸Ä |
| | |
| | | package com.smartor.service.impl; |
| | | package com.ruoyi.satisfaction.service.impl; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | |
| | | import com.ruoyi.common.utils.ArrayListUtils; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.domain.DTO.ServiceSubtaskDetailDTO; |
| | | import com.smartor.domain.VO.PatSatisfactionReqVO; |
| | | import com.smartor.domain.VO.PatSatisfactionResVO; |
| | | import com.smartor.domain.entity.PatSatisfactionDetailEntity; |
| | | import com.smartor.domain.entity.SatisfactionStatQuery; |
| | | import com.smartor.domain.entity.ServiceSubtaskSatisfactionEntity; |
| | | import com.smartor.mapper.*; |
| | | import com.ruoyi.satisfaction.domain.vo.PatSatisfactionReqVO; |
| | | import com.ruoyi.satisfaction.domain.vo.PatSatisfactionResVO; |
| | | import com.ruoyi.satisfaction.domain.entity.PatSatisfactionDetailEntity; |
| | | import com.ruoyi.satisfaction.domain.entity.SatisfactionStatQuery; |
| | | import com.ruoyi.satisfaction.domain.entity.ServiceSubtaskSatisfactionEntity; |
| | | import com.ruoyi.satisfaction.mapper.PatSatisfactionMapper; |
| | | import com.ruoyi.satisfaction.mapper.SatisfactionMapper; |
| | | import com.ruoyi.satisfaction.mapper.SatisfactionScriptMapper; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionCategoryRow; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionIvrScriptRow; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionOptionScoreRow; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionScriptQuery; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionSvyScriptRow; |
| | | import com.ruoyi.satisfaction.domain.ServiceSubtaskDetailRatioExport; |
| | | import com.ruoyi.satisfaction.service.strategy.SatisfactionScoreStrategyResolver; |
| | | import com.ruoyi.satisfaction.service.strategy.SatisfactionSites; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.smartor.service.IPatSatisfactionService; |
| | | import com.ruoyi.satisfaction.domain.PatSatisfaction; |
| | | import com.ruoyi.satisfaction.service.IPatSatisfactionService; |
| | | |
| | | import static com.ruoyi.common.utils.SecurityUtils.getLoginUser; |
| | | |
| | |
| | | private PatSatisfactionMapper patSatisfactionMapper; |
| | | |
| | | @Autowired |
| | | private ServiceSubtaskMapper serviceSubtaskMapper; |
| | | private SatisfactionMapper satisfactionMapper; |
| | | |
| | | @Autowired |
| | | private ServiceSubtaskDetailMapper serviceSubtaskDetailMapper; |
| | | private SatisfactionScriptMapper satisfactionScriptMapper; |
| | | |
| | | /** |
| | | * ç«ç¹å£å¾çç¥è§£æå¨ã |
| | | * <p> |
| | | * æ¬ç±»ç {@code averageScoreByStat} å°±æ¯ãéç¨å£å¾ï¼ååï¼ãçç»¼åæ»¡æåº¦å¾åå£å¾ï¼ |
| | | * ç°æ¹ä¸ºå§æ {@link com.ruoyi.satisfaction.service.strategy.CommonSatisfactionScoreStrategy}ï¼ |
| | | * ä¸çç«åå¾·å£å¾ï¼{@code SltdSatisfactionScoreStrategy}ï¼éè¿åä¸çç¥æ¥å£å¹¶åï¼ |
| | | * é¿å
åä¸ä¸ªæ¦å¿µå¨ä¸¤å¤ååä¸ä»½å®ç°ã |
| | | */ |
| | | @Autowired |
| | | private IvrLibaTemplateScriptMapper ivrLibaTemplateScriptMapper; |
| | | |
| | | @Autowired |
| | | private IvrLibaScriptAssortMapper ivrLibaScriptAssortMapper; |
| | | |
| | | @Autowired |
| | | private SvyLibScriptCategoryMapper svyLibScriptCategoryMapper; |
| | | |
| | | @Autowired |
| | | private IvrLibaTemplateTargetoptionMapper ivrLibaTemplateTargetoptionMapper; |
| | | |
| | | @Autowired |
| | | private SvyLibTemplateTargetoptionMapper svyLibTemplateTargetoptionMapper; |
| | | |
| | | @Autowired |
| | | private SvyLibTemplateScriptMapper svyLibTemplateScriptMapper; |
| | | private SatisfactionScoreStrategyResolver satisfactionScoreStrategyResolver; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ£è
满æåº¦ |
| | |
| | | int[] personTotals = new int[2]; |
| | | |
| | | // åªæ¥æ¬æ¬¡æ¡ä»¶ä¸å®é
åå¨åªäº typeï¼åæ¥æ¯ææ¥è¿å
¨è¡¨çä¸ç¾ä¸ªå段æ¥åæ¥ï¼ä»
ç¨äºå¤æä¸é¢ä¸¤ä¸ªåæ¯æ¯å¦ä¸ºç©ºï¼ |
| | | List<String> types = serviceSubtaskMapper.selectSatisfactionSubtaskTypes(patSatisfactionReqVO); |
| | | List<String> types = satisfactionMapper.selectSatisfactionSubtaskTypes(patSatisfactionReqVO); |
| | | boolean hasVoice = types != null && types.contains("1"); |
| | | boolean hasQuestionnaire = types != null && types.contains("2"); |
| | | |
| | | if (hasVoice) { |
| | | //1. å
è·åivr_liba_script_assortçæ»¡æåº¦åç±»ID |
| | | IvrLibaScriptAssort ivrLibaScriptAssort = new IvrLibaScriptAssort(); |
| | | ivrLibaScriptAssort.setOrgid(patSatisfactionReqVO.getOrgid()); |
| | | List<IvrLibaScriptAssort> ivrLibaScriptAssorts = ivrLibaScriptAssortMapper.selectIvrLibaScriptAssortList(ivrLibaScriptAssort); |
| | | List<Long> mydIdList = ivrLibaScriptAssorts.stream().filter(item -> item.getType() != null && item.getType().contains("myd")).map(IvrLibaScriptAssort::getId).collect(Collectors.toList()); |
| | | List<SatisfactionCategoryRow> ivrLibaScriptAssorts = satisfactionScriptMapper.selectIvrCategoryList(ivrCategoryQuery(patSatisfactionReqVO)); |
| | | List<Long> mydIdList = ivrLibaScriptAssorts.stream().filter(item -> item.getType() != null && item.getType().contains("myd")).map(SatisfactionCategoryRow::getId).collect(Collectors.toList()); |
| | | |
| | | //2 åè·å该é®é¢æ»¡æåº¦åç±»ä¸çIvrLibaTemplateScriptçéå |
| | | List<IvrLibaTemplateScript> ivrLibaTemplateScripts = ivrLibaTemplateScriptMapper.queryLibTemplateIds(mydIdList); |
| | | List<SatisfactionIvrScriptRow> ivrLibaTemplateScripts = satisfactionScriptMapper.queryIvrScriptByAssort(assortQuery(mydIdList)); |
| | | |
| | | //3 䏿¬¡ç»è®¡å
¨é¨é®é¢çåéé/å¡«æ¥é/é项åå¼ï¼åæ¥æ¯æ¯ä¸ªé®é¢åæ¥ 3 æ¬¡ï¼ |
| | | List<SatScriptRef> scriptRefs = new ArrayList<>(); |
| | | for (IvrLibaTemplateScript ivrLibaTemplateScript : ivrLibaTemplateScripts) { |
| | | for (SatisfactionIvrScriptRow ivrLibaTemplateScript : ivrLibaTemplateScripts) { |
| | | scriptRefs.add(new SatScriptRef(ivrLibaTemplateScript.getTemplateid(), ivrLibaTemplateScript.getScriptid(), ivrLibaTemplateScript.getScriptContent())); |
| | | } |
| | | buildSatisfactionDetailEntities(patSatisfactionReqVO, "1", true, scriptRefs, patSatisfactionDetailEntities, personTotals); |
| | | } |
| | | |
| | | if (hasQuestionnaire) { |
| | | //1. å
è·åsvy_lib_script_categoryçæ»¡æåº¦åç±»ID |
| | | SvyLibScriptCategory svyLibScriptCategory = new SvyLibScriptCategory(); |
| | | svyLibScriptCategory.setOrgid(patSatisfactionReqVO.getOrgid()); |
| | | List<SvyLibScriptCategory> svyLibScriptCategories = svyLibScriptCategoryMapper.selectSvyLibScriptCategoryList(svyLibScriptCategory); |
| | | List<Long> mydIdList = svyLibScriptCategories.stream().filter(item -> item.getType() != null && item.getType().contains("myd")).map(SvyLibScriptCategory::getId).collect(Collectors.toList()); |
| | | List<SatisfactionCategoryRow> svyLibScriptCategories = satisfactionScriptMapper.selectSvyCategoryList(svyCategoryQuery(patSatisfactionReqVO)); |
| | | List<Long> mydIdList = svyLibScriptCategories.stream().filter(item -> item.getType() != null && item.getType().contains("myd")).map(SatisfactionCategoryRow::getId).collect(Collectors.toList()); |
| | | |
| | | //2 åè·å该é®é¢æ»¡æåº¦åç±»ä¸çIvrLibaTemplateScriptçéå |
| | | List<SvyLibTemplateScript> svyLibTemplateScripts = svyLibTemplateScriptMapper.querySvyLibTemplateIds(mydIdList); |
| | | List<SatisfactionSvyScriptRow> svyLibTemplateScripts = satisfactionScriptMapper.querySvyScriptByCategory(categoryQuery(mydIdList)); |
| | | |
| | | //3 䏿¬¡ç»è®¡å
¨é¨é®é¢çåéé/å¡«æ¥é/é项åå¼ï¼åæ¥æ¯æ¯ä¸ªé®é¢åæ¥ 3 æ¬¡ï¼ |
| | | List<SatScriptRef> scriptRefs = new ArrayList<>(); |
| | | for (SvyLibTemplateScript svyLibTemplateScript : svyLibTemplateScripts) { |
| | | for (SatisfactionSvyScriptRow svyLibTemplateScript : svyLibTemplateScripts) { |
| | | // é®å·çé项表æ svy_lib_template_script ç主é®å
³è |
| | | scriptRefs.add(new SatScriptRef(svyLibTemplateScript.getSvyid(), svyLibTemplateScript.getId(), svyLibTemplateScript.getScriptContent())); |
| | | } |
| | |
| | | int[] personTotals = new int[2]; |
| | | |
| | | // åªæ¥æ¬æ¬¡æ¡ä»¶ä¸å®é
åå¨åªäº typeï¼åæ¥æ¯ææ¥è¿å
¨è¡¨çä¸ç¾ä¸ªå段æ¥åæ¥ï¼ä»
ç¨äºå¤æä¸é¢ä¸¤ä¸ªåæ¯æ¯å¦ä¸ºç©ºï¼ |
| | | List<String> types = serviceSubtaskMapper.selectSatisfactionSubtaskTypes(patSatisfactionReqVO); |
| | | List<String> types = satisfactionMapper.selectSatisfactionSubtaskTypes(patSatisfactionReqVO); |
| | | boolean hasVoice = types != null && types.contains("1"); |
| | | boolean hasQuestionnaire = types != null && types.contains("2"); |
| | | |
| | | if (hasVoice) { |
| | | //1. å
è·åå
¥åä¸çç»´æ¤éå |
| | | IvrLibaTemplateScript iltscript = new IvrLibaTemplateScript(); |
| | | iltscript.setDimensionList(patSatisfactionReqVO.getDimensionList()); |
| | | |
| | | //2 åè·å该é®é¢æ»¡æåº¦åç±»ä¸çIvrLibaTemplateScriptçéå |
| | | List<IvrLibaTemplateScript> ivrLibaTemplateScripts = ivrLibaTemplateScriptMapper.selectILTSBydimension(iltscript); |
| | | List<SatisfactionIvrScriptRow> ivrLibaTemplateScripts = satisfactionScriptMapper.selectIvrScriptByDimension(dimensionQuery(patSatisfactionReqVO)); |
| | | if (CollectionUtils.isNotEmpty(ivrLibaTemplateScripts)) { |
| | | //3 䏿¬¡ç»è®¡å
¨é¨é®é¢çåéé/å¡«æ¥é/é项åå¼ï¼åæ¥æ¯æ¯ä¸ªé®é¢åæ¥ 3 æ¬¡ï¼ |
| | | List<SatScriptRef> scriptRefs = new ArrayList<>(); |
| | | for (IvrLibaTemplateScript ivrLibaTemplateScript : ivrLibaTemplateScripts) { |
| | | for (SatisfactionIvrScriptRow ivrLibaTemplateScript : ivrLibaTemplateScripts) { |
| | | scriptRefs.add(new SatScriptRef(ivrLibaTemplateScript.getTemplateid(), ivrLibaTemplateScript.getScriptid(), ivrLibaTemplateScript.getScriptContent())); |
| | | } |
| | | buildSatisfactionDetailEntities(patSatisfactionReqVO, "1", true, scriptRefs, patSatisfactionDetailEntities, personTotals); |
| | |
| | | |
| | | if (hasQuestionnaire) { |
| | | //1. å
è·åå
¥åä¸ç满æåº¦ç»´åº¦ |
| | | SvyLibTemplateScriptVO svyLibTemplateScriptVO = new SvyLibTemplateScriptVO(); |
| | | svyLibTemplateScriptVO.setDimensionList(patSatisfactionReqVO.getDimensionList()); |
| | | //2 åè·å该é®é¢æ»¡æåº¦åç±»ä¸çIvrLibaTemplateScriptçéå |
| | | List<SvyLibTemplateScript> svyLibTemplateScripts = svyLibTemplateScriptMapper.selectSLTScriptListBydimension(svyLibTemplateScriptVO); |
| | | List<SatisfactionSvyScriptRow> svyLibTemplateScripts = satisfactionScriptMapper.selectSvyScriptByDimension(dimensionQuery(patSatisfactionReqVO)); |
| | | if (CollectionUtils.isNotEmpty(svyLibTemplateScripts)) { |
| | | //3 䏿¬¡ç»è®¡å
¨é¨é®é¢çåéé/å¡«æ¥é/é项åå¼ï¼åæ¥æ¯æ¯ä¸ªé®é¢åæ¥ 3 æ¬¡ï¼ |
| | | List<SatScriptRef> scriptRefs = new ArrayList<>(); |
| | | for (SvyLibTemplateScript svyLibTemplateScript : svyLibTemplateScripts) { |
| | | for (SatisfactionSvyScriptRow svyLibTemplateScript : svyLibTemplateScripts) { |
| | | // é®å·çé项表æ svy_lib_template_script ç主é®å
³è |
| | | scriptRefs.add(new SatScriptRef(svyLibTemplateScript.getSvyid(), svyLibTemplateScript.getId(), svyLibTemplateScript.getScriptContent())); |
| | | } |
| | |
| | | Map<String, List<ScoreCount>> assortNameFillCountMap = new HashMap<>(); |
| | | |
| | | if (patSatisfactionReqVO.getType() == null || patSatisfactionReqVO.getType() == 1) { |
| | | //1. å
è·åivr_liba_script_assortçæ»¡æåº¦åç±»ID |
| | | IvrLibaScriptAssort ivrLibaScriptAssort = new IvrLibaScriptAssort(); |
| | | ivrLibaScriptAssort.setOrgid(patSatisfactionReqVO.getOrgid()); |
| | | List<IvrLibaScriptAssort> ivrLibaScriptAssorts = ivrLibaScriptAssortMapper.selectIvrLibaScriptAssortList(ivrLibaScriptAssort); |
| | | List<Long> mydIdList = ivrLibaScriptAssorts.stream().filter(item -> item.getType() != null && item.getType().contains("myd")).map(IvrLibaScriptAssort::getId).collect(Collectors.toList()); |
| | | List<SatisfactionCategoryRow> ivrLibaScriptAssorts = satisfactionScriptMapper.selectIvrCategoryList(ivrCategoryQuery(patSatisfactionReqVO)); |
| | | List<Long> mydIdList = ivrLibaScriptAssorts.stream().filter(item -> item.getType() != null && item.getType().contains("myd")).map(SatisfactionCategoryRow::getId).collect(Collectors.toList()); |
| | | |
| | | //2 åè·å该é®é¢æ»¡æåº¦åç±»ä¸çIvrLibaTemplateScriptçéå |
| | | List<IvrLibaTemplateScript> ivrLibaTemplateScripts = ivrLibaTemplateScriptMapper.queryLibTemplateIds(mydIdList); |
| | | List<SatisfactionIvrScriptRow> ivrLibaTemplateScripts = satisfactionScriptMapper.queryIvrScriptByAssort(assortQuery(mydIdList)); |
| | | |
| | | //2.1 䏿¬¡æ§ææ¬æ¬¡è¯·æ±å
¨é¨æ¨¡æ¿çåééãåæ¶äººæ°æ¥åæ¥ï¼åæ¥æ¯æ¯ä¸ªæ¨¡æ¿é®é¢åæ¥ä¸¤æ¬¡ï¼ |
| | | SatisfactionStatQuery statQuery = buildSatisfactionStatQuery(patSatisfactionReqVO, "1", |
| | | ivrLibaTemplateScripts.stream().map(IvrLibaTemplateScript::getTemplateid).collect(Collectors.toList())); |
| | | ivrLibaTemplateScripts.stream().map(SatisfactionIvrScriptRow::getTemplateid).collect(Collectors.toList())); |
| | | Map<Long, Long> sendCountMap = mapSatisfactionSendCount(statQuery); |
| | | SatisfactionFillStat fillStat = querySatisfactionFillStat(statQuery); |
| | | Map<Long, Long> fillPersonCountMap = mapSatisfactionFillPersonCount(statQuery); |
| | | |
| | | //3 æscriptAssortnameåç»,å¹¶è·åæ¯ä¸ªéåè¿è¡éåï¼è®¡ç®æ¯ä¸ªåç±»çæ»äººæ°åå¡«æ¥äººæ° |
| | | Map<String, List<IvrLibaTemplateScript>> scriptGroupByAssortName = ivrLibaTemplateScripts.stream().filter(item -> item.getScriptAssortname() != null).collect(Collectors.groupingBy(IvrLibaTemplateScript::getScriptAssortname)); |
| | | Map<String, List<SatisfactionIvrScriptRow>> scriptGroupByAssortName = ivrLibaTemplateScripts.stream().filter(item -> item.getScriptAssortname() != null).collect(Collectors.groupingBy(SatisfactionIvrScriptRow::getScriptAssortname)); |
| | | if (scriptGroupByAssortName != null && !scriptGroupByAssortName.isEmpty()) { |
| | | for (String assortNameKey : scriptGroupByAssortName.keySet()) { |
| | | // 该åç±»æ¶åçå»é模æ¿ï¼åé人æ°/åæ¶äººæ°é½ææ¨¡æ¿ç»è®¡ï¼ |
| | |
| | | //è·å该åç±»çå¡«æ¥æ»æ°éï¼åªç¨äºç®å¹³ååï¼æé¢ç®èåçè¡æ°ï¼ |
| | | List<ScoreCount> allFillCountList = new ArrayList<>(); |
| | | |
| | | List<IvrLibaTemplateScript> ivrLibaTemplateScriptList = scriptGroupByAssortName.get(assortNameKey); |
| | | for (IvrLibaTemplateScript ivrLibaTemplateScript : ivrLibaTemplateScriptList) { |
| | | List<SatisfactionIvrScriptRow> ivrLibaTemplateScriptList = scriptGroupByAssortName.get(assortNameKey); |
| | | for (SatisfactionIvrScriptRow ivrLibaTemplateScript : ivrLibaTemplateScriptList) { |
| | | Long templateId = ivrLibaTemplateScript.getTemplateid(); |
| | | if (templateId != null) { |
| | | categoryTemplateIds.add(templateId); |
| | |
| | | } |
| | | |
| | | if (patSatisfactionReqVO.getType() == null || patSatisfactionReqVO.getType() == 2) { |
| | | //1. å
è·åsvy_lib_script_categoryçæ»¡æåº¦åç±»ID |
| | | SvyLibScriptCategory svyLibScriptCategory = new SvyLibScriptCategory(); |
| | | svyLibScriptCategory.setOrgid(patSatisfactionReqVO.getOrgid()); |
| | | List<SvyLibScriptCategory> svyLibScriptCategories = svyLibScriptCategoryMapper.selectSvyLibScriptCategoryList(svyLibScriptCategory); |
| | | List<Long> mydIdList = svyLibScriptCategories.stream().filter(item -> item.getType() != null && item.getType().contains("myd")).map(SvyLibScriptCategory::getId).collect(Collectors.toList()); |
| | | List<SatisfactionCategoryRow> svyLibScriptCategories = satisfactionScriptMapper.selectSvyCategoryList(svyCategoryQuery(patSatisfactionReqVO)); |
| | | List<Long> mydIdList = svyLibScriptCategories.stream().filter(item -> item.getType() != null && item.getType().contains("myd")).map(SatisfactionCategoryRow::getId).collect(Collectors.toList()); |
| | | |
| | | //2 åè·å该é®é¢æ»¡æåº¦åç±»ä¸çIvrLibaTemplateScriptçéå |
| | | List<SvyLibTemplateScript> svyLibTemplateScripts = svyLibTemplateScriptMapper.querySvyLibTemplateIds(mydIdList); |
| | | List<SatisfactionSvyScriptRow> svyLibTemplateScripts = satisfactionScriptMapper.querySvyScriptByCategory(categoryQuery(mydIdList)); |
| | | |
| | | //2.1 䏿¬¡æ§ææ¬æ¬¡è¯·æ±å
¨é¨æ¨¡æ¿çåééãåæ¶äººæ°æ¥åæ¥ï¼åæ¥æ¯æ¯ä¸ªæ¨¡æ¿é®é¢åæ¥ä¸¤æ¬¡ï¼ |
| | | SatisfactionStatQuery statQuery = buildSatisfactionStatQuery(patSatisfactionReqVO, "2", |
| | | svyLibTemplateScripts.stream().map(SvyLibTemplateScript::getSvyid).collect(Collectors.toList())); |
| | | svyLibTemplateScripts.stream().map(SatisfactionSvyScriptRow::getSvyid).collect(Collectors.toList())); |
| | | Map<Long, Long> sendCountMap = mapSatisfactionSendCount(statQuery); |
| | | SatisfactionFillStat fillStat = querySatisfactionFillStat(statQuery); |
| | | Map<Long, Long> fillPersonCountMap = mapSatisfactionFillPersonCount(statQuery); |
| | | |
| | | //3 æscriptAssortnameåç»,å¹¶è·åæ¯ä¸ªéåè¿è¡éåï¼è®¡ç®æ¯ä¸ªåç±»çæ»äººæ°åå¡«æ¥äººæ° |
| | | Map<String, List<SvyLibTemplateScript>> scriptGroupByatCegoryName = svyLibTemplateScripts.stream().filter(item -> item.getCategoryName() != null).collect(Collectors.groupingBy(SvyLibTemplateScript::getCategoryName)); |
| | | Map<String, List<SatisfactionSvyScriptRow>> scriptGroupByatCegoryName = svyLibTemplateScripts.stream().filter(item -> item.getCategoryName() != null).collect(Collectors.groupingBy(SatisfactionSvyScriptRow::getCategoryName)); |
| | | if (scriptGroupByatCegoryName != null && !scriptGroupByatCegoryName.isEmpty()) { |
| | | for (String categoryNameKey : scriptGroupByatCegoryName.keySet()) { |
| | | // 该åç±»æ¶åçå»é模æ¿ï¼åé人æ°/åæ¶äººæ°é½ææ¨¡æ¿ç»è®¡ï¼ |
| | |
| | | //è·å该åç±»çå¡«æ¥æ»æ°éï¼åªç¨äºç®å¹³ååï¼æé¢ç®èåçè¡æ°ï¼ |
| | | List<ScoreCount> allFillCountList = new ArrayList<>(); |
| | | |
| | | List<SvyLibTemplateScript> svyLibTemplateScriptList = scriptGroupByatCegoryName.get(categoryNameKey); |
| | | for (SvyLibTemplateScript svyLibTemplateScript : svyLibTemplateScriptList) { |
| | | List<SatisfactionSvyScriptRow> svyLibTemplateScriptList = scriptGroupByatCegoryName.get(categoryNameKey); |
| | | for (SatisfactionSvyScriptRow svyLibTemplateScript : svyLibTemplateScriptList) { |
| | | Long templateId = svyLibTemplateScript.getSvyid(); |
| | | if (templateId != null) { |
| | | categoryTemplateIds.add(templateId); |
| | |
| | | subidAll += sendCountMap.getOrDefault(templateId, 0L); |
| | | fillCountAll += fillPersonCountMap.getOrDefault(templateId, 0L); |
| | | } |
| | | |
| | | |
| | | // è¿éå
è®°å½ä¸ä¸æ¯ä¸ªåç±»çæ»äººæ°åå¡«æ¥äººæ° |
| | | Map<String, Object> personCount = (Map<String, Object>) zzt.get(categoryNameKey); |
| | |
| | | return zzt; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Map<String, Object> satisfactionGraphDimension(PatSatisfactionReqVO patSatisfactionReqVO) { |
| | | //ç¨æ¥è®°å½æ±ç¶å¾ä¿¡æ¯ï¼key=满æåº¦ç»´åº¦åç§°ï¼value=该维度ä¸çæ»äººæ°åå¡«æ¥äººæ°ï¼ |
| | |
| | | Map<String, List<ScoreCount>> assortNameFillCountMap = new HashMap<>(); |
| | | |
| | | if (patSatisfactionReqVO.getType() == null || patSatisfactionReqVO.getType() == 1) { |
| | | //1. ä»å
¥åä¸è·å满æåº¦ç»´ç»´åº¦ |
| | | IvrLibaTemplateScript ivrLibaTemplateScript2 = new IvrLibaTemplateScript(); |
| | | ivrLibaTemplateScript2.setDimensionList(patSatisfactionReqVO.getDimensionList()); |
| | | |
| | | //2 åè·å该é®é¢æ»¡æåº¦åç±»ä¸çIvrLibaTemplateScriptçéå |
| | | List<IvrLibaTemplateScript> ivrLibaTemplateScripts = ivrLibaTemplateScriptMapper.selectILTSBydimension(ivrLibaTemplateScript2); |
| | | List<SatisfactionIvrScriptRow> ivrLibaTemplateScripts = satisfactionScriptMapper.selectIvrScriptByDimension(dimensionQuery(patSatisfactionReqVO)); |
| | | if (ivrLibaTemplateScripts != null && !ivrLibaTemplateScripts.isEmpty()) { |
| | | //3 ædimension维度åç»,å¹¶è·åæ¯ä¸ªéåè¿è¡éåï¼è®¡ç®æ¯ä¸ªåç±»çæ»äººæ°åå¡«æ¥äººæ° |
| | | List<IvrLibaTemplateScript> dimensionScripts = ivrLibaTemplateScripts.stream().filter(item -> item.getDimension() != null).collect(Collectors.toList()); |
| | | Map<String, List<IvrLibaTemplateScript>> groupByDimension = dimensionScripts.stream().collect(Collectors.groupingBy(IvrLibaTemplateScript::getDimension)); |
| | | List<SatisfactionIvrScriptRow> dimensionScripts = ivrLibaTemplateScripts.stream().filter(item -> item.getDimension() != null).collect(Collectors.toList()); |
| | | Map<String, List<SatisfactionIvrScriptRow>> groupByDimension = dimensionScripts.stream().collect(Collectors.groupingBy(SatisfactionIvrScriptRow::getDimension)); |
| | | |
| | | if (groupByDimension != null && !groupByDimension.isEmpty()) { |
| | | //3.1 䏿¬¡æ§ææ¬æ¬¡è¯·æ±å
¨é¨æ¨¡æ¿çåééãåæ¶äººæ°æ¥åæ¥ï¼åæ¥æ¯æ¯ä¸ªæ¨¡æ¿é®é¢åæ¥ä¸¤æ¬¡ï¼ |
| | | SatisfactionStatQuery statQuery = buildSatisfactionStatQuery(patSatisfactionReqVO, "1", |
| | | dimensionScripts.stream().map(IvrLibaTemplateScript::getTemplateid).collect(Collectors.toList())); |
| | | dimensionScripts.stream().map(SatisfactionIvrScriptRow::getTemplateid).collect(Collectors.toList())); |
| | | Map<Long, Long> sendCountMap = mapSatisfactionSendCount(statQuery); |
| | | SatisfactionFillStat fillStat = querySatisfactionFillStat(statQuery); |
| | | Map<Long, Long> fillPersonCountMap = mapSatisfactionFillPersonCount(statQuery); |
| | |
| | | //è·å该维度çå¡«æ¥åå¼åå¸ï¼åªç¨äºç®å¹³ååï¼ |
| | | List<ScoreCount> allFillCountList = new ArrayList<>(); |
| | | |
| | | List<IvrLibaTemplateScript> ivrLibaTemplateScriptList = groupByDimension.get(dimension); |
| | | for (IvrLibaTemplateScript ivrLibaTemplateScript : ivrLibaTemplateScriptList) { |
| | | List<SatisfactionIvrScriptRow> ivrLibaTemplateScriptList = groupByDimension.get(dimension); |
| | | for (SatisfactionIvrScriptRow ivrLibaTemplateScript : ivrLibaTemplateScriptList) { |
| | | Long templateId = ivrLibaTemplateScript.getTemplateid(); |
| | | if (templateId != null) { |
| | | dimensionTemplateIds.add(templateId); |
| | |
| | | |
| | | if (patSatisfactionReqVO.getType() == null || patSatisfactionReqVO.getType() == 2) { |
| | | //1. ä»å
¥åä¸è·å满æåº¦ç»´ç»´åº¦ |
| | | SvyLibTemplateScriptVO svyLibTemplateScriptVO = new SvyLibTemplateScriptVO(); |
| | | svyLibTemplateScriptVO.setDimensionList(patSatisfactionReqVO.getDimensionList()); |
| | | |
| | | //2 åè·å该é®é¢æ»¡æåº¦åç±»ä¸çIvrLibaTemplateScriptçéå |
| | | List<SvyLibTemplateScript> svyLibTemplateScripts = svyLibTemplateScriptMapper.selectSLTScriptListBydimension(svyLibTemplateScriptVO); |
| | | List<SatisfactionSvyScriptRow> svyLibTemplateScripts = satisfactionScriptMapper.selectSvyScriptByDimension(dimensionQuery(patSatisfactionReqVO)); |
| | | if (svyLibTemplateScripts != null && !svyLibTemplateScripts.isEmpty()) { |
| | | //3 ædimension维度åç»,å¹¶è·åæ¯ä¸ªéåè¿è¡éåï¼è®¡ç®æ¯ä¸ªåç±»çæ»äººæ°åå¡«æ¥äººæ° |
| | | List<SvyLibTemplateScript> dimensionScripts = svyLibTemplateScripts.stream().filter(item -> item.getDimension() != null).collect(Collectors.toList()); |
| | | Map<String, List<SvyLibTemplateScript>> groupByDimension = dimensionScripts.stream().collect(Collectors.groupingBy(SvyLibTemplateScript::getDimension)); |
| | | List<SatisfactionSvyScriptRow> dimensionScripts = svyLibTemplateScripts.stream().filter(item -> item.getDimension() != null).collect(Collectors.toList()); |
| | | Map<String, List<SatisfactionSvyScriptRow>> groupByDimension = dimensionScripts.stream().collect(Collectors.groupingBy(SatisfactionSvyScriptRow::getDimension)); |
| | | if (groupByDimension != null && !groupByDimension.isEmpty()) { |
| | | //3.1 䏿¬¡æ§ææ¬æ¬¡è¯·æ±å
¨é¨æ¨¡æ¿çåééãåæ¶äººæ°æ¥åæ¥ï¼åæ¥æ¯æ¯ä¸ªæ¨¡æ¿é®é¢åæ¥ä¸¤æ¬¡ï¼ |
| | | SatisfactionStatQuery statQuery = buildSatisfactionStatQuery(patSatisfactionReqVO, "2", |
| | | dimensionScripts.stream().map(SvyLibTemplateScript::getSvyid).collect(Collectors.toList())); |
| | | dimensionScripts.stream().map(SatisfactionSvyScriptRow::getSvyid).collect(Collectors.toList())); |
| | | Map<Long, Long> sendCountMap = mapSatisfactionSendCount(statQuery); |
| | | SatisfactionFillStat fillStat = querySatisfactionFillStat(statQuery); |
| | | Map<Long, Long> fillPersonCountMap = mapSatisfactionFillPersonCount(statQuery); |
| | |
| | | //è·å该åç±»çå¡«æ¥åå¼åå¸ï¼åªç¨äºç®å¹³ååï¼ |
| | | List<ScoreCount> allFillCountList = new ArrayList<>(); |
| | | |
| | | List<SvyLibTemplateScript> svyLibTemplateScriptList = groupByDimension.get(dimension); |
| | | for (SvyLibTemplateScript svyLibTemplateScript : svyLibTemplateScriptList) { |
| | | List<SatisfactionSvyScriptRow> svyLibTemplateScriptList = groupByDimension.get(dimension); |
| | | for (SatisfactionSvyScriptRow svyLibTemplateScript : svyLibTemplateScriptList) { |
| | | Long templateId = svyLibTemplateScript.getSvyid(); |
| | | if (templateId != null) { |
| | | dimensionTemplateIds.add(templateId); |
| | |
| | | subidAll += sendCountMap.getOrDefault(templateId, 0L); |
| | | fillCountAll += fillPersonCountMap.getOrDefault(templateId, 0L); |
| | | } |
| | | |
| | | |
| | | // è¿éå
è®°å½ä¸ä¸æ¯ä¸ªåç±»çæ»äººæ°åå¡«æ¥äººæ° |
| | | Map<String, Object> personCount = (Map<String, Object>) zzt.get(dimension); |
| | |
| | | return zzt; |
| | | } |
| | | |
| | | /** |
| | | * è·åæé«å |
| | | * |
| | | * @param options |
| | | * @return |
| | | */ |
| | | private Double maxScore(List<IvrLibaTemplateTargetoption> options) { |
| | | if (CollectionUtils.isEmpty(options)) return 0.0; |
| | | Double maxScore = options.stream() |
| | | .map(IvrLibaTemplateTargetoption::getScore) |
| | | .filter(scoreStr -> scoreStr != null && !scoreStr.isEmpty()) |
| | | .mapToDouble(Double::parseDouble) |
| | | .max() |
| | | .orElse(0.0); |
| | | return maxScore; |
| | | } |
| | | |
| | | /** |
| | | * è·åæä½å |
| | | * |
| | | * @param options |
| | | * @return |
| | | */ |
| | | private Double minScore(List<IvrLibaTemplateTargetoption> options) { |
| | | if (CollectionUtils.isEmpty(options)) return 0.0; |
| | | Double minScore = options.stream() |
| | | .map(IvrLibaTemplateTargetoption::getScore) |
| | | .filter(scoreStr -> scoreStr != null && !scoreStr.isEmpty()) |
| | | .mapToDouble(Double::parseDouble) |
| | | .min() |
| | | .orElse(0.0); |
| | | return minScore; |
| | | } |
| | | |
| | | /** |
| | | * è·åå¹³åå |
| | | * |
| | | * @param fillCount |
| | | * @return |
| | | */ |
| | | private Double averageScore(List<ServiceSubtaskDetailDTO> fillCount) { |
| | | if (CollectionUtils.isEmpty(fillCount)) return 0.0; |
| | | double sum = fillCount.stream().filter(dto -> dto.getScore() != null && !dto.getScore().isEmpty()).mapToDouble(dto -> Double.parseDouble(dto.getScore())).sum(); |
| | | return new BigDecimal(sum / fillCount.size()).setScale(1, RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | |
| | | // ==================== satisfactionGraph èåç»è®¡ï¼æ¿ä»£éä¸ªæ¨¡æ¿æ¥åºï¼ ==================== |
| | | // ==================== satisfactionGraph èåç»è®¡ï¼æ¿ä»£éä¸ªæ¨¡æ¿æ¥åºï¼ ==================== |
| | | |
| | | /** |
| | | * æå»ºèåç»è®¡å
¥åï¼å弿¥æºä¸å DtoConversionUtils.sourceToTarget(patSatisfactionReqVO, ServiceSubtaskSatisfactionEntity.class) ä¸è´ï¼ |
| | |
| | | private Map<Long, Long> mapSatisfactionSendCount(SatisfactionStatQuery statQuery) { |
| | | Map<Long, Long> sendCountMap = new HashMap<>(); |
| | | if (statQuery == null || CollectionUtils.isEmpty(statQuery.getLibTemplateIds())) return sendCountMap; |
| | | List<Map<String, Object>> rows = serviceSubtaskMapper.selectSatisfactionSendCount(statQuery); |
| | | List<Map<String, Object>> rows = satisfactionMapper.selectSatisfactionSendCount(statQuery); |
| | | if (CollectionUtils.isEmpty(rows)) return sendCountMap; |
| | | for (Map<String, Object> row : rows) { |
| | | Long templateId = toLong(row.get("libtemplateid")); |
| | |
| | | private Map<Long, Long> mapSatisfactionFillPersonCount(SatisfactionStatQuery statQuery) { |
| | | Map<Long, Long> fillPersonCountMap = new HashMap<>(); |
| | | if (statQuery == null || CollectionUtils.isEmpty(statQuery.getLibTemplateIds())) return fillPersonCountMap; |
| | | List<Map<String, Object>> rows = serviceSubtaskDetailMapper.selectSatisfactionFillPersonCount(statQuery); |
| | | List<Map<String, Object>> rows = satisfactionMapper.selectSatisfactionFillPersonCount(statQuery); |
| | | if (CollectionUtils.isEmpty(rows)) return fillPersonCountMap; |
| | | for (Map<String, Object> row : rows) { |
| | | Long templateId = toLong(row.get("libtemplateid")); |
| | |
| | | private SatisfactionFillStat querySatisfactionFillStat(SatisfactionStatQuery statQuery) { |
| | | SatisfactionFillStat fillStat = new SatisfactionFillStat(); |
| | | if (statQuery == null || CollectionUtils.isEmpty(statQuery.getLibTemplateIds())) return fillStat; |
| | | List<Map<String, Object>> rows = serviceSubtaskDetailMapper.selectSatisfactionFillStat(statQuery); |
| | | List<Map<String, Object>> rows = satisfactionMapper.selectSatisfactionFillStat(statQuery); |
| | | if (CollectionUtils.isEmpty(rows)) return fillStat; |
| | | for (Map<String, Object> row : rows) { |
| | | Long templateId = toLong(row.get("libtemplateid")); |
| | |
| | | /** |
| | | * è·åå¹³ååï¼èåçï¼åå¼ä¸æ¡æ°ï¼ |
| | | * <p> |
| | | * å£å¾ä¸ {@link #averageScore(List)} å®å
¨ä¸è´ï¼åå为å¯è§£æåå¼ä¹åï¼åæ¯ä¸ºæç»è¡æ°ï¼å
å«åå¼ä¸ºç©ºçè¡ï¼ã |
| | | * å£å¾ä¸å {@code averageScore(List)} å®å
¨ä¸è´ï¼åå为å¯è§£æåå¼ä¹åï¼åæ¯ä¸ºæç»è¡æ°ï¼å
å«åå¼ä¸ºç©ºçè¡ï¼ã |
| | | * 注æä¸è½æ¹æ sql ç avg() æãæåå¼çè¡æ°ãå忝ï¼å¦åè¿åç averageScore ä¼åã |
| | | * <p> |
| | | * <b>çç¥åï¼2026ï¼</b>ï¼çæ£çç®æ³å·²æ¶æå°ãéç¨å£å¾ï¼ååï¼ãçç¥ |
| | | * {@link com.ruoyi.satisfaction.service.strategy.CommonSatisfactionScoreStrategy}ï¼ |
| | | * æ¬æ¹æ³åªåå
¥åéé
ï¼æå
é¨ {@code ScoreCount} 转æç»ä¸çå æ¯è¡ï¼ã |
| | | * <b>计ç®ç»æä¸è¿ç§»åéä½ç¸å</b>ï¼ä¿ç 1 ä½ãHALF_UPï¼æ è¡æ¶ 0.0ï¼ã |
| | | */ |
| | | private Double averageScoreByStat(List<ScoreCount> fillCount) { |
| | | if (CollectionUtils.isEmpty(fillCount)) return 0.0; |
| | | double sum = 0.0; |
| | | long rows = 0L; |
| | | |
| | | // éé
æçç¥çç»ä¸å
¥åï¼åªå¸¦ score ä¸ count ä¸¤ä¸ªåæ®µï¼çç¥åªç¨å°è¿ä¸¤ä¸ªï¼ |
| | | List<ServiceSubtaskDetailRatioExport> rows = new ArrayList<>(fillCount.size()); |
| | | for (ScoreCount scoreCount : fillCount) { |
| | | if (scoreCount.getCount() <= 0L) continue; |
| | | rows += scoreCount.getCount(); |
| | | if (scoreCount.getScore() != null && !scoreCount.getScore().isEmpty()) { |
| | | sum += Double.parseDouble(scoreCount.getScore()) * scoreCount.getCount(); |
| | | } |
| | | if (scoreCount.getCount() <= 0L) continue; // ä¸åæä¸è´ï¼éæ£æ°çèåè¡ä¸åä¸ |
| | | ServiceSubtaskDetailRatioExport row = new ServiceSubtaskDetailRatioExport(); |
| | | row.setScore(scoreCount.getScore()); |
| | | row.setCount(String.valueOf(scoreCount.getCount())); |
| | | rows.add(row); |
| | | } |
| | | if (rows == 0L) return 0.0; |
| | | return new BigDecimal(sum / rows).setScale(1, RoundingMode.HALF_UP).doubleValue(); |
| | | |
| | | BigDecimal average = satisfactionScoreStrategyResolver |
| | | .resolve(SatisfactionSites.COMMON) |
| | | .comprehensiveScore(rows); |
| | | return average == null ? 0.0 : average.doubleValue(); |
| | | } |
| | | |
| | | /** |
| | |
| | | private SatisfactionFillStatByMatchedtext querySatisfactionFillStatByMatchedtext(SatisfactionStatQuery statQuery) { |
| | | SatisfactionFillStatByMatchedtext fillStat = new SatisfactionFillStatByMatchedtext(); |
| | | if (statQuery == null || CollectionUtils.isEmpty(statQuery.getLibTemplateIds())) return fillStat; |
| | | List<Map<String, Object>> rows = serviceSubtaskDetailMapper.selectSatisfactionFillStatByMatchedtext(statQuery); |
| | | List<Map<String, Object>> rows = satisfactionMapper.selectSatisfactionFillStatByMatchedtext(statQuery); |
| | | if (CollectionUtils.isEmpty(rows)) return fillStat; |
| | | for (Map<String, Object> row : rows) { |
| | | Long templateId = toLong(row.get("libtemplateid")); |
| | |
| | | .filter(Objects::nonNull).distinct().collect(Collectors.toList()); |
| | | if (CollectionUtils.isNotEmpty(scriptIds)) { |
| | | addTargetOptionScores(optionScores, voice |
| | | ? ivrLibaTemplateTargetoptionMapper.selectIvrLibaTargetoptionScores(scriptIds) |
| | | : svyLibTemplateTargetoptionMapper.selectSvyLibTargetoptionScores(scriptIds)); |
| | | ? satisfactionScriptMapper.selectIvrTargetOptionScores(scriptIds) |
| | | : satisfactionScriptMapper.selectSvyTargetOptionScores(scriptIds)); |
| | | } |
| | | if (scriptRefs.stream().anyMatch(ref -> ref.getOptionScriptId() == null)) { |
| | | optionScores.put(null, collectTargetOptionScores(voice |
| | | ? ivrLibaTemplateTargetoptionMapper.selectIvrLibaTargetoptionScores(null) |
| | | : svyLibTemplateTargetoptionMapper.selectSvyLibTargetoptionScores(null))); |
| | | ? satisfactionScriptMapper.selectIvrTargetOptionScores(null) |
| | | : satisfactionScriptMapper.selectSvyTargetOptionScores(null))); |
| | | } |
| | | return optionScores; |
| | | } |
| | | |
| | | private void addTargetOptionScores(Map<Long, List<String>> optionScores, List<Map<String, Object>> rows) { |
| | | private void addTargetOptionScores(Map<Long, List<String>> optionScores, |
| | | List<SatisfactionOptionScoreRow> rows) { |
| | | if (CollectionUtils.isEmpty(rows)) return; |
| | | for (Map<String, Object> row : rows) { |
| | | Long scriptId = toLong(row.get("scriptid")); |
| | | for (SatisfactionOptionScoreRow row : rows) { |
| | | Long scriptId = row.getScriptid(); |
| | | if (scriptId == null) continue; |
| | | Object score = row.get("score"); |
| | | optionScores.computeIfAbsent(scriptId, key -> new ArrayList<>()) |
| | | .add(score == null ? null : String.valueOf(score)); |
| | | .add(row.getScore()); |
| | | } |
| | | } |
| | | |
| | | private List<String> collectTargetOptionScores(List<Map<String, Object>> rows) { |
| | | private List<String> collectTargetOptionScores(List<SatisfactionOptionScoreRow> rows) { |
| | | List<String> scores = new ArrayList<>(); |
| | | if (CollectionUtils.isEmpty(rows)) return scores; |
| | | for (Map<String, Object> row : rows) { |
| | | Object score = row.get("score"); |
| | | scores.add(score == null ? null : String.valueOf(score)); |
| | | for (SatisfactionOptionScoreRow row : rows) { |
| | | scores.add(row.getScore()); |
| | | } |
| | | return scores; |
| | | } |
| | |
| | | return byTemplateQuestion.get(statKey(templateId, scriptContent)); |
| | | } |
| | | } |
| | | |
| | | // ==================== 满æåº¦æ¨¡ååï¼æ¥è¯¢å¯¹è±¡æé ==================== |
| | | // åå®ç°ç´æ¥ new smartor çå®ä½å½å
¥åï¼æ¨¡åååç»ä¸ç¨ SatisfactionScriptQueryï¼ |
| | | // è¿éæä¸å¤æé æ¶æä¸ºå¸®å©æ¹æ³ï¼æ¡ä»¶ä¸åæ¥éå对åºã |
| | | |
| | | /** 满æåº¦åç±»æ¥è¯¢ï¼orgid + type=mydï¼ */ |
| | | private SatisfactionScriptQuery ivrCategoryQuery(PatSatisfactionReqVO reqVO) { |
| | | SatisfactionScriptQuery q = new SatisfactionScriptQuery(); |
| | | q.setOrgid(reqVO.getOrgid()); |
| | | q.setType("myd"); |
| | | return q; |
| | | } |
| | | |
| | | /** 满æåº¦åç±»æ¥è¯¢ï¼é®å·ä¾§ï¼æ¡ä»¶åè¯é³ä¾§ï¼ */ |
| | | private SatisfactionScriptQuery svyCategoryQuery(PatSatisfactionReqVO reqVO) { |
| | | SatisfactionScriptQuery q = new SatisfactionScriptQuery(); |
| | | q.setOrgid(reqVO.getOrgid()); |
| | | q.setType("myd"); |
| | | return q; |
| | | } |
| | | |
| | | /** æè¯é³åç±» id åé®é¢ */ |
| | | private SatisfactionScriptQuery assortQuery(List<Long> scriptAssortids) { |
| | | SatisfactionScriptQuery q = new SatisfactionScriptQuery(); |
| | | q.setScriptAssortids(scriptAssortids); |
| | | return q; |
| | | } |
| | | |
| | | /** æé®å·åç±» id åé®é¢ */ |
| | | private SatisfactionScriptQuery categoryQuery(List<Long> scriptCategoryids) { |
| | | SatisfactionScriptQuery q = new SatisfactionScriptQuery(); |
| | | q.setScriptCategoryids(scriptCategoryids); |
| | | return q; |
| | | } |
| | | |
| | | /** æç»´åº¦åé®é¢ï¼è¯é³/é®å·å
±ç¨ï¼ä¸¤ä¾§ãdimensionList ä¸ºç©ºæ¶æ¯å¦æ¼ dimension IS NOT NULLãçå·®å¼å¨ SQL éä¿çï¼ */ |
| | | private SatisfactionScriptQuery dimensionQuery(PatSatisfactionReqVO reqVO) { |
| | | SatisfactionScriptQuery q = new SatisfactionScriptQuery(); |
| | | q.setDimensionList(reqVO.getDimensionList()); |
| | | return q; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.service.impl; |
| | | |
| | | import com.ruoyi.satisfaction.domain.ServiceSubtaskDetailRatioExport; |
| | | import com.ruoyi.satisfaction.domain.dto.MydTrendReqDTO; |
| | | import com.ruoyi.satisfaction.domain.dto.MzMydScoreRankDTO; |
| | | import com.ruoyi.satisfaction.domain.dto.QuestionCountKsOrBqDTO; |
| | | import com.ruoyi.satisfaction.domain.dto.ServiceSubtaskOptionStatDTO; |
| | | import com.ruoyi.satisfaction.domain.vo.MydTrendReqVO; |
| | | import com.ruoyi.satisfaction.domain.vo.MzMydScoreRankVO; |
| | | import com.ruoyi.satisfaction.domain.vo.QuestionCountKsOrBqVO; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionScriptQuery; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionSubtaskQuery; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionSubtaskRef; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionIvrScriptRow; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionSvyScriptRow; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionTaskRow; |
| | | import com.ruoyi.satisfaction.domain.vo.SatisfactionExceptConfigQuestionReqVO; |
| | | import com.ruoyi.satisfaction.domain.vo.SltdMydTotalVO; |
| | | import com.ruoyi.satisfaction.domain.row.SatisfactionCategoryRow; |
| | | import com.ruoyi.satisfaction.mapper.SatisfactionMapper; |
| | | import com.ruoyi.satisfaction.mapper.SatisfactionScriptMapper; |
| | | import com.ruoyi.satisfaction.service.SatisfactionSubtaskService; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Calendar; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 满æåº¦ãåä»»å¡ç»´åº¦ãç»è®¡æå¡ã |
| | | * <p> |
| | | * è¿ç§»è¯´æï¼æ¬ç±»æ¹æ³åæ£è½å¨é访主干ç大æä»¶ ServiceSubtaskServiceImpl ä¸ |
| | | * ï¼è¢«è§ä¸ºé访主干ç大æä»¶ï¼ï¼ç°æ´æ®µæ¬å
¥æ»¡æåº¦æ¨¡åï¼ä¸å¡é»è¾ä¸è¡æªæ¹ã |
| | | * <p> |
| | | * ä¸ {@link PatSatisfactionServiceImpl} çåå·¥ï¼ |
| | | * <ul> |
| | | * <li>{@code PatSatisfactionServiceImpl} ââ éç¨æ»¡æåº¦ç»è®¡ï¼ååä¸åå¾·å
±ç¨ï¼ï¼ |
| | | * <li>æ¬ç±» ââ <b>çç«å德导å</b>çç»è®¡ï¼éé¡¹å æ¯ãæç§å®¤/ç
åºãè¶å¿ãé¨è¯å¾åæåã |
| | | * è¿äºå
¥å£åæ¬æå¨é访æç» Controller ä¸ï¼è¿ç§»åä»ç±æ»¡æåº¦æ¨¡åç»ä¸æä¾ã</li> |
| | | * </ul> |
| | | * æ¬æ¨¡åèªå¸¦ SQLï¼ç´æ¥æ¥ {@code service_subtask} / {@code service_subtask_detail}ï¼ |
| | | * ä¸ä¾èµ smartor çä»»ä½å®ä½ï¼è°ç¨æ¹åªä¼ id å表ï¼ã |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class SatisfactionSubtaskServiceImpl implements SatisfactionSubtaskService { |
| | | |
| | | @Autowired |
| | | private SatisfactionMapper satisfactionMapper; |
| | | |
| | | @Autowired |
| | | private SatisfactionScriptMapper satisfactionScriptMapper; |
| | | |
| | | public List<ServiceSubtaskDetailRatioExport> statQuestionOption(List<Long> taskIds, Date startFinishTime, Date endFinishTime, Date startOutHospTime, Date endOutHospTime, String scriptContent, Double scoreStart, Double scoreEnd, String valueType, List<Long> subtaskIds) { |
| | | //å
æ¸
çä¸ä¸é夿°æ® |
| | | List<Long> repeatIds = satisfactionMapper.selectRepeatDetailIds(); |
| | | if (!CollectionUtils.isEmpty(repeatIds)) { |
| | | satisfactionMapper.deleteRepeatDetailByIds(repeatIds); |
| | | } |
| | | List<ServiceSubtaskDetailRatioExport> serviceSubtaskDetailRatioExports = satisfactionMapper.statQuestionOption(taskIds, startOutHospTime, endOutHospTime, startFinishTime, endFinishTime, scoreStart, scoreEnd, scriptContent, valueType, subtaskIds); |
| | | |
| | | // å¤ç targetvalueï¼æ & å岿夿¡è®°å½ |
| | | List<ServiceSubtaskDetailRatioExport> result = new ArrayList<>(); |
| | | for (ServiceSubtaskDetailRatioExport export : serviceSubtaskDetailRatioExports) { |
| | | if (StringUtils.isNotEmpty(export.getTargetvalue()) && export.getTargetvalue().contains("&")) { |
| | | String[] values = export.getTargetvalue().split("&"); |
| | | // 妿æå¤æ¡ç®æ å¼ï¼æåæå¤è¡ |
| | | for (String value : values) { |
| | | //å
å» result 䏿¥ä¸ä¸ï¼ææ²¡æè¿ä¸ª questiontext å对åºç targetvalue |
| | | //注æå¿
é¡»å¸¦ä¸ taskid ä¸èµ·å¹é
ï¼å¦å伿å«çä»»å¡çæ°æ®å¡«å°æ¬ä»»å¡çè¡ä¸ï¼ |
| | | //导è´å¯¼åºçãæ°é/æ¯ä¾ãå该è¡çãä»»å¡åç§°/ä»»å¡ç¼å·ã对ä¸ä¸ï¼åä¸ä»»å¡åä¸é¢åºç°ä¸¤ä¸ªä¸ååæ¯ï¼ |
| | | ServiceSubtaskDetailRatioExport existingExport = result.stream().filter(e -> Objects.equals(e.getTaskid(), export.getTaskid()) && e.getQuestiontext().equals(export.getQuestiontext()) && value.trim().equals(e.getTargetvalue())).findFirst().orElse(null); |
| | | if (existingExport != null && existingExport.getRatio().equals("0") && existingExport.getCount().equals("0")) { |
| | | //妿åå¨ï¼åå° result éçè¿ä¸ªé®é¢æå¯¹åºç Targetvalue=value è¿æ¡æ°æ®æ´æ°æå½åè¿æ¡æ°æ® |
| | | if (value.equals(export.getOptionresult())) { |
| | | existingExport.setRatio(export.getRatio()); |
| | | existingExport.setScore(export.getScore()); |
| | | existingExport.setCount(export.getCount()); |
| | | existingExport.setOptionresult(export.getOptionresult()); |
| | | } |
| | | } else if (existingExport != null && !existingExport.getRatio().equals("0")) { |
| | | continue; |
| | | } else { |
| | | ServiceSubtaskDetailRatioExport newExport = DtoConversionUtils.sourceToTarget(export, ServiceSubtaskDetailRatioExport.class); |
| | | newExport.setTargetvalue(value.trim()); // targetvalue æ¾ç¤ºå个é项 |
| | | if (!value.equals(export.getOptionresult())) { |
| | | newExport.setOptionresult(null); |
| | | newExport.setCount("0"); |
| | | newExport.setRatio("0"); |
| | | } |
| | | result.add(newExport); |
| | | } |
| | | } |
| | | } else { |
| | | // targetvalue ä¸å
å« &ï¼ç´æ¥æ·»å å°ç»æ |
| | | result.add(export); |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public List<ServiceSubtaskDetailRatioExport> statMydQuestionOptionForExport(List<Long> subtaskIds, String questiontext) { |
| | | List<ServiceSubtaskDetailRatioExport> result = new ArrayList<>(); |
| | | if (CollectionUtils.isEmpty(subtaskIds)) { |
| | | return result; |
| | | } |
| | | List<ServiceSubtaskOptionStatDTO> statList = satisfactionMapper.statMydQuestionOptionForExport(subtaskIds, questiontext); |
| | | if (CollectionUtils.isEmpty(statList)) { |
| | | return result; |
| | | } |
| | | return buildMydOptionRows(statList); |
| | | } |
| | | |
| | | /** |
| | | * æãä»»å¡+é¢ç®+é项ãçä½çç»è®¡æ¼æå¯¼åºçãé®é¢è¯¦æ
å æ¯ãè¡ |
| | | * <ul> |
| | | * <li>é项æ¸
åï¼é¢ç®é
ç½®è¿çéé¡¹å¨ targetvalueï¼ç¨ & è¿æ¥ï¼éï¼å
¨é¨ååºï¼æ²¡äººéçæ¾ç¤º 0</li> |
| | | * <li>æ°éï¼æ£è
éä¸çéé¡¹å¨ asrtext éï¼å¤é颿¯ãA&Bãï¼ï¼æ¯ä¸ªéä¸é¡¹åè®°ä¸æ¬¡äººæ°ï¼ä¸ä¸ªæ£è
åªç®ä¸æ¡æç»</li> |
| | | * <li>æ¯ä¾ï¼æ°é / 该é¢ä½çæ£è
æ°ï¼æä»¥åéé¢åé项æ°éä¹å = 该é¢ä½çæ£è
æ°</li> |
| | | * <li>åæ°ï¼è¯¥é项æç»ç score ä¹åï¼å¤éè¡æéä¸é¡¹ä»½æ°ååï¼ä¿è¯åé项忰ä¹å = æç»åæ°ä¹å</li> |
| | | * </ul> |
| | | */ |
| | | private static List<ServiceSubtaskDetailRatioExport> buildMydOptionRows(List<ServiceSubtaskOptionStatDTO> statList) { |
| | | List<ServiceSubtaskDetailRatioExport> result = new ArrayList<>(); |
| | | |
| | | // æãä»»å¡ + é¢ç®ãåç»ï¼ä¿æ SQL ç顺åºï¼å
é¢ç®åä»»å¡ï¼ |
| | | Map<String, List<ServiceSubtaskOptionStatDTO>> grouped = new LinkedHashMap<>(); |
| | | for (ServiceSubtaskOptionStatDTO stat : statList) { |
| | | String key = stat.getTaskid() + "\u0001" + stat.getQuestiontext(); |
| | | grouped.computeIfAbsent(key, k -> new ArrayList<>()).add(stat); |
| | | } |
| | | |
| | | for (List<ServiceSubtaskOptionStatDTO> group : grouped.values()) { |
| | | ServiceSubtaskOptionStatDTO first = group.get(0); |
| | | // é项 -> 人æ°ï¼long[1] 便äºç´¯å ï¼ï¼é¡ºåºå³åºç°é¡ºåº |
| | | Map<String, long[]> countMap = new LinkedHashMap<>(); |
| | | Map<String, BigDecimal> scoreMap = new LinkedHashMap<>(); |
| | | |
| | | for (ServiceSubtaskOptionStatDTO stat : group) { |
| | | // targetvalue = æ¬é¢ææéé¡¹çæ¸
åï¼æ²¡äººéçä¹è¦ååºæ¥ |
| | | List<String> options = splitOptions(stat.getTargetvalue()); |
| | | // asrtext = æ£è
å®é
éä¸çé项ï¼å¤éé¢ä¼æ¯ãéä¸é¡¹1&éä¸é¡¹2ã |
| | | List<String> chosenOptions = splitOptions(stat.getOptionresult()); |
| | | for (String option : options) { |
| | | countMap.computeIfAbsent(option, k -> new long[1]); |
| | | scoreMap.computeIfAbsent(option, k -> BigDecimal.ZERO); |
| | | } |
| | | |
| | | long patientCount = stat.getPatientCount() == null ? 0L : stat.getPatientCount(); |
| | | BigDecimal scoreSum = stat.getScoreSum() == null ? BigDecimal.ZERO : stat.getScoreSum(); |
| | | |
| | | if (!chosenOptions.isEmpty()) { |
| | | BigDecimal[] scoreParts = splitScore(scoreSum, chosenOptions.size()); |
| | | for (int i = 0; i < chosenOptions.size(); i++) { |
| | | String chosen = chosenOptions.get(i); |
| | | // éä¸çé项å¯è½ä¸å¨é
ç½®æ¸
åéï¼å岿°æ®ï¼ï¼è¡¥ä¸è¡ |
| | | countMap.computeIfAbsent(chosen, k -> new long[1]); |
| | | scoreMap.computeIfAbsent(chosen, k -> BigDecimal.ZERO); |
| | | countMap.get(chosen)[0] += patientCount; |
| | | scoreMap.put(chosen, scoreMap.get(chosen).add(scoreParts[i])); |
| | | } |
| | | } else if (options.size() == 1) { |
| | | // 没æ asrtextï¼æªç/æ åºçï¼æ¶ï¼åªæå¯ä¸é项æè½ç¡®å®å½å± |
| | | countMap.get(options.get(0))[0] += patientCount; |
| | | scoreMap.put(options.get(0), scoreMap.get(options.get(0)).add(scoreSum)); |
| | | } |
| | | } |
| | | |
| | | long total = 0L; |
| | | for (long[] count : countMap.values()) total += count[0]; |
| | | |
| | | for (Map.Entry<String, long[]> entry : countMap.entrySet()) { |
| | | long count = entry.getValue()[0]; |
| | | ServiceSubtaskDetailRatioExport row = new ServiceSubtaskDetailRatioExport(); |
| | | row.setQuestiontext(first.getQuestiontext()); |
| | | row.setOptionresult(entry.getKey()); |
| | | row.setTargetvalue(entry.getKey()); |
| | | row.setCount(String.valueOf(count)); |
| | | row.setRatio(formatRatio(count, total)); |
| | | row.setScore(formatScore(scoreMap.get(entry.getKey()))); |
| | | row.setTaskname(first.getTaskName()); |
| | | row.setTaskid(first.getTaskid()); |
| | | row.setValueType(first.getValueType()); |
| | | result.add(row); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æä¸æ¡æç»çåæ°æéä¸é¡¹ä»½æ°ååï¼ä½æ°è¡¥ç»ç¬¬ä¸ä¸ªï¼ä¿è¯å份ä¹å = ååæ° |
| | | */ |
| | | private static BigDecimal[] splitScore(BigDecimal total, int parts) { |
| | | BigDecimal[] result = new BigDecimal[parts]; |
| | | if (parts <= 0) { |
| | | return result; |
| | | } |
| | | BigDecimal each = total.divide(BigDecimal.valueOf(parts), 2, RoundingMode.HALF_UP); |
| | | for (int i = 0; i < parts; i++) { |
| | | result[i] = each; |
| | | } |
| | | result[0] = result[0].add(total.subtract(each.multiply(BigDecimal.valueOf(parts)))); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æåé¢ç®é
ç½®çé项ï¼å¤ä¸ªéé¡¹ç¨ & è¿æ¥ï¼ï¼é¡ºå¸¦å»æå
¨è§/åè§ç©ºç½ |
| | | */ |
| | | private static List<String> splitOptions(String targetvalue) { |
| | | List<String> options = new ArrayList<>(); |
| | | if (StringUtils.isEmpty(targetvalue)) { |
| | | return options; |
| | | } |
| | | for (String part : targetvalue.split("&")) { |
| | | String option = trimAll(part); |
| | | if (StringUtils.isNotEmpty(option) && !options.contains(option)) { |
| | | options.add(option); |
| | | } |
| | | } |
| | | return options; |
| | | } |
| | | |
| | | /** |
| | | * æ¯ä¾ï¼æ°é / 该é¢ä½çæ£è
æ°ï¼ä¿ç两ä½å°æ° |
| | | */ |
| | | private static String formatRatio(long count, long total) { |
| | | if (total <= 0) { |
| | | return "0.00%"; |
| | | } |
| | | return BigDecimal.valueOf(count * 100.0 / total).setScale(2, RoundingMode.HALF_UP).toPlainString() + "%"; |
| | | } |
| | | |
| | | /** |
| | | * åæ°ä¹åï¼å»æå¤ä½çå°æ°ä½ï¼0.00 -> 0ï¼ |
| | | */ |
| | | private static String formatScore(BigDecimal score) { |
| | | if (score == null) { |
| | | return "0"; |
| | | } |
| | | BigDecimal value = score.stripTrailingZeros(); |
| | | if (value.scale() < 0) { |
| | | value = value.setScale(0); |
| | | } |
| | | return value.toPlainString(); |
| | | } |
| | | |
| | | public Map<String, Map<String, List<QuestionCountKsOrBqDTO>>> statQuestionOptionByKsOrBq(QuestionCountKsOrBqVO vo) { |
| | | |
| | | // 1. æ¥æç» |
| | | List<QuestionCountKsOrBqDTO> sourceList = satisfactionMapper.statQuestionOptionByKsOrBq(vo); |
| | | if (CollectionUtils.isEmpty(sourceList)) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | |
| | | // 2. 夿æç§å®¤è¿æ¯æç
åº |
| | | boolean byDept = vo.getLeaveldeptcodes() != null; |
| | | boolean byDistrict = !byDept && vo.getLeavehospitaldistrictcodes() != null; |
| | | if (!byDept && !byDistrict) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | |
| | | // 3. key = ç§å®¤/ç
åº + é¢ç® + é项 |
| | | Map<String, QuestionCountKsOrBqDTO> map = new LinkedHashMap<>(); |
| | | |
| | | for (QuestionCountKsOrBqDTO dto : sourceList) { |
| | | |
| | | if (StringUtils.isEmpty(dto.getTargetvalue())) { |
| | | continue; |
| | | } |
| | | |
| | | // åç»åï¼ç§å®¤ æ ç
åº |
| | | String groupName = byDept ? dto.getDeptname() : dto.getLeavehospitaldistrictname(); |
| | | if (StringUtils.isEmpty(groupName)) { |
| | | continue; |
| | | } |
| | | |
| | | String asrtext = trimAll(dto.getAsrtext()); // ç¨æ·å®é
éä¸çé项 |
| | | String questionText = trimAll(dto.getQuestionText()); // é¢ç® |
| | | if (StringUtils.isEmpty(questionText)) { |
| | | continue; |
| | | } |
| | | |
| | | // æå targetvalueï¼æ¯ä¸ªé项é½è¦æä¸æ¡è®°å½ |
| | | for (String raw : dto.getTargetvalue().split("&")) { |
| | | |
| | | String option = trimAll(raw); |
| | | if (option.isEmpty()) { |
| | | continue; |
| | | } |
| | | |
| | | // key = ç§å®¤/ç
åº + é¢ç® + é项 |
| | | String key = buildKey(groupName, questionText, option); |
| | | |
| | | QuestionCountKsOrBqDTO item = map.get(key); |
| | | if (item == null) { |
| | | item = DtoConversionUtils.sourceToTarget(dto, QuestionCountKsOrBqDTO.class); |
| | | item.setTargetvalue(option); |
| | | item.setAsrtext(option); |
| | | item.setQuestionText(dto.getQuestionText()); |
| | | item.setAnswerCount("0"); |
| | | item.setSingleScore("0"); |
| | | map.put(key, item); |
| | | } |
| | | |
| | | // åªæå½åé项 == ç¨æ·å®é
éä¸çéé¡¹ï¼æç´¯å |
| | | if (option.equals(asrtext)) { |
| | | int count = parseCount(item.getAnswerCount()) + 1; |
| | | item.setAnswerCount(String.valueOf(count)); |
| | | |
| | | BigDecimal totalScore = new BigDecimal(item.getSingleScore()) |
| | | .add(new BigDecimal(dto.getSingleScore() == null ? "0" : dto.getSingleScore())); |
| | | item.setSingleScore(totalScore.toPlainString()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 4. 计ç®å¹³åå |
| | | for (QuestionCountKsOrBqDTO dto : map.values()) { |
| | | String answerCount = dto.getAnswerCount(); |
| | | String singleScore = dto.getSingleScore(); |
| | | |
| | | BigDecimal avg; |
| | | if (StringUtils.isEmpty(answerCount) |
| | | || BigDecimal.ZERO.compareTo(new BigDecimal(answerCount.trim())) == 0) { |
| | | avg = BigDecimal.ZERO; |
| | | } else { |
| | | avg = new BigDecimal(singleScore == null ? "0" : singleScore) |
| | | .divide(new BigDecimal(answerCount.trim()), 2, RoundingMode.HALF_UP); |
| | | } |
| | | dto.setAvgScore(avg.toPlainString()); |
| | | } |
| | | |
| | | // 5. 转æ Map<String, Map<String, List<QuestionCountKsOrBqDTO>>> |
| | | // 第ä¸å± keyï¼ç§å®¤/ç
åº |
| | | // 第äºå± keyï¼é¢ç® |
| | | // 第äºå± valueï¼è¯¥é¢ç®ä¸çææé项å表 |
| | | Map<String, Map<String, List<QuestionCountKsOrBqDTO>>> result = new LinkedHashMap<>(); |
| | | |
| | | for (QuestionCountKsOrBqDTO dto : map.values()) { |
| | | |
| | | // åç»å |
| | | String groupName = byDept ? dto.getDeptname() : dto.getLeavehospitaldistrictname(); |
| | | if (StringUtils.isEmpty(groupName)) { |
| | | continue; |
| | | } |
| | | |
| | | // é¢ç®å |
| | | String questionText = dto.getQuestionText(); |
| | | if (StringUtils.isEmpty(questionText)) { |
| | | continue; |
| | | } |
| | | |
| | | // 第ä¸å±ï¼ç§å®¤/ç
åº |
| | | Map<String, List<QuestionCountKsOrBqDTO>> questionMap = |
| | | result.computeIfAbsent(groupName, k -> new LinkedHashMap<>()); |
| | | |
| | | // 第äºå±ï¼é¢ç® |
| | | List<QuestionCountKsOrBqDTO> optionList = |
| | | questionMap.computeIfAbsent(questionText, k -> new ArrayList<>()); |
| | | |
| | | optionList.add(dto); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public List<ServiceSubtaskDetailRatioExport> statQuestionOptionBySubtaskIds(List<Long> subtaskIds, Date startOutHospTime, Date endOutHospTime, Date startFinishTime, Date endFinishTime, String scriptContent, Double scoreStart, Double scoreEnd, String valueType) { |
| | | //å
æ¸
çä¸ä¸é夿°æ® |
| | | List<Long> repeatIds = satisfactionMapper.selectRepeatDetailIds(); |
| | | if (!CollectionUtils.isEmpty(repeatIds)) { |
| | | satisfactionMapper.deleteRepeatDetailByIds(repeatIds); |
| | | } |
| | | |
| | | List<ServiceSubtaskDetailRatioExport> serviceSubtaskDetailRatioExports = satisfactionMapper.statQuestionOptionBySubtaskIds(subtaskIds, startOutHospTime, endOutHospTime, startFinishTime, endFinishTime, scoreStart, scoreEnd, scriptContent, valueType); |
| | | // SQL å·²æãé¢ç® + éé¡¹ãæ±æ»æ°éï¼è¿éåæé¢ç®åå¹¶ï¼ä¸å模æ¿ç targetvalue é项顺åºä¸åï¼åä¸é项伿æå¤è¡ï¼ï¼ |
| | | // å¹¶ææ²¡äººéçé项补æ 0 è¡ãæåé项æ°éä¹åéç®æ¯ä¾ |
| | | return mergeMydOptionRows(serviceSubtaskDetailRatioExports); |
| | | } |
| | | |
| | | /** |
| | | * æ SQL è¿åçãé¢ç® + é项ãæç»åå¹¶æãä¸è¡ä¸ä¸ªé项ã |
| | | * <ul> |
| | | * <li>åä¸é¢ç®ä¸ç¸å optionresult çæ°éç´¯å ï¼åå®ç°éå°ååéé¡¹ç´æ¥ continueï¼ |
| | | * æ¯ä¸ªé项åªä¼ä¿çç¬¬ä¸æ¡æç»çæ°éï¼å¤ä»»å¡/夿£è
ç项æ°å
¨è¢«ä¸¢æï¼åç«¯ãæ°éãæ°¸è¿åªæ 1</li> |
| | | * <li>é项æ¸
åå targetvalueï¼ç¨ & è¿æ¥ï¼ï¼æ²¡äººéçé项补 0 è¡ï¼å端åºå®å
åæè½æ¸²æ</li> |
| | | * <li>æ¯ä¾ = 该é项æ°é / 该é¢åé项æ°éä¹åï¼ä¿è¯ä¸éé¢åé项æ¯ä¾å计 100%</li> |
| | | * </ul> |
| | | * |
| | | * @param rows SQL æç» |
| | | */ |
| | | private List<ServiceSubtaskDetailRatioExport> mergeMydOptionRows(List<ServiceSubtaskDetailRatioExport> rows) { |
| | | List<ServiceSubtaskDetailRatioExport> result = new ArrayList<>(); |
| | | if (CollectionUtils.isEmpty(rows)) { |
| | | return result; |
| | | } |
| | | |
| | | // key -> é项 -> æ°éï¼ç¨ LinkedHashMap ä¿åºï¼éé¡¹é¡ºåºæ²¿ç¨é®å·é
ç½® targetvalue çé¡ºåº |
| | | Map<String, Map<String, long[]>> countMap = new LinkedHashMap<>(); |
| | | Map<String, Map<String, String>> scoreMap = new LinkedHashMap<>(); |
| | | Map<String, ServiceSubtaskDetailRatioExport> templateMap = new LinkedHashMap<>(); |
| | | |
| | | for (ServiceSubtaskDetailRatioExport row : rows) { |
| | | if (row == null) { |
| | | continue; |
| | | } |
| | | String key = row.getQuestiontext(); |
| | | if (key == null) { |
| | | continue; |
| | | } |
| | | Map<String, long[]> counts = countMap.computeIfAbsent(key, k -> new LinkedHashMap<>()); |
| | | Map<String, String> scores = scoreMap.computeIfAbsent(key, k -> new LinkedHashMap<>()); |
| | | templateMap.putIfAbsent(key, row); |
| | | |
| | | // é¢ç®é
ç½®çé项æ¸
åï¼æ²¡äººéçé项ä¹è¦ååºæ¥ï¼æ°é为 0ï¼ |
| | | for (String option : splitOptions(row.getTargetvalue())) { |
| | | counts.computeIfAbsent(option, k -> new long[1]); |
| | | } |
| | | |
| | | // æ£è
å®é
éä¸çé项ï¼å¤éé¢ asrtext æ¯ãé项1&é项2ãï¼åé/é®ç颿¯æ´æ®µææ¬ |
| | | List<String> chosenOptions = "2".equals(row.getValueType()) |
| | | ? splitOptions(row.getOptionresult()) |
| | | : singleOption(row.getOptionresult()); |
| | | if (chosenOptions.isEmpty()) { |
| | | // æªä½çï¼ä¸è¿ä»»ä½é项ï¼ä¹ä¸è¿åæ¯ |
| | | continue; |
| | | } |
| | | long count = parseCount(row.getCount()); |
| | | for (String chosen : chosenOptions) { |
| | | // éä¸çé项å¯è½ä¸å¨é
ç½®æ¸
åéï¼å岿°æ®ï¼ï¼è¡¥ä¸è¡ï¼æ°éä¸è½ä¸¢ |
| | | counts.computeIfAbsent(chosen, k -> new long[1])[0] += count; |
| | | if (StringUtils.isNotEmpty(row.getScore()) && StringUtils.isEmpty(scores.get(chosen))) { |
| | | scores.put(chosen, row.getScore()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (Map.Entry<String, Map<String, long[]>> entry : countMap.entrySet()) { |
| | | ServiceSubtaskDetailRatioExport template = templateMap.get(entry.getKey()); |
| | | Map<String, String> scores = scoreMap.get(entry.getKey()); |
| | | long total = 0L; |
| | | for (long[] count : entry.getValue().values()) { |
| | | total += count[0]; |
| | | } |
| | | for (Map.Entry<String, long[]> optionEntry : entry.getValue().entrySet()) { |
| | | String option = optionEntry.getKey(); |
| | | long count = optionEntry.getValue()[0]; |
| | | ServiceSubtaskDetailRatioExport merged = DtoConversionUtils.sourceToTarget(template, ServiceSubtaskDetailRatioExport.class); |
| | | merged.setQuestiontext(template.getQuestiontext()); |
| | | merged.setTargetvalue(option); |
| | | // 没人éçé项 optionresult 置空ï¼å端æ targetvalue å
åºå±ç¤ºï¼ä¿æåæå±ç¤ºå£å¾ |
| | | merged.setOptionresult(count > 0 ? option : null); |
| | | merged.setCount(String.valueOf(count)); |
| | | merged.setRatio(formatRatio(count, total)); |
| | | merged.setScore(StringUtils.isNotEmpty(scores.get(option)) ? scores.get(option) : template.getScore()); |
| | | result.add(merged); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * åé/é®çé¢çä½çææ¬ï¼ä¸æ & æï¼é¿å
æé®çé¢çææ¬çæ¡æå |
| | | */ |
| | | private static List<String> singleOption(String answer) { |
| | | List<String> options = new ArrayList<>(); |
| | | String text = trimAll(answer); |
| | | if (StringUtils.isNotEmpty(text)) { |
| | | options.add(text); |
| | | } |
| | | return options; |
| | | } |
| | | |
| | | /** |
| | | * æ ååé®å·çæ¡ææ¬ï¼å»æ A/B/C/D å忝åç¼ååç»ç©ºæ ¼ |
| | | * ä¾å¦ "A æ¯" -> "æ¯"ï¼"B å¦" -> "å¦" |
| | | */ |
| | | private String normalizeOptionAnswer(String answer) { |
| | | if (StringUtils.isBlank(answer)) { |
| | | return ""; |
| | | } |
| | | String trimmed = answer.trim(); |
| | | if (trimmed.length() >= 3 && trimmed.charAt(1) == ' ') { |
| | | char firstChar = trimmed.charAt(0); |
| | | if (firstChar >= 'A' && firstChar <= 'Z') { |
| | | return trimmed.substring(2).trim(); |
| | | } |
| | | } |
| | | return trimmed; |
| | | } |
| | | |
| | | public List<MydTrendReqDTO> mydTrend(MydTrendReqVO mydTrendReqVO) { |
| | | List<MydTrendReqDTO> list = satisfactionMapper.mydTrend(mydTrendReqVO.getStartFinishTime(), mydTrendReqVO.getEndFinishTime(), mydTrendReqVO.getType()); |
| | | if (mydTrendReqVO.getType().equals("week")) list = getWeekDate(mydTrendReqVO, list); |
| | | if (mydTrendReqVO.getType().equals("year")) list = getYearDate(mydTrendReqVO, list); |
| | | if (mydTrendReqVO.getType().equals("month")) list = getMonthDate(mydTrendReqVO, list); |
| | | if (mydTrendReqVO.getType().equals("day")) list = getDayDate(mydTrendReqVO, list); |
| | | return list; |
| | | } |
| | | |
| | | public List<MydTrendReqDTO> sltdMydTotalByDimension(MydTrendReqVO mydTrendReqVO) { |
| | | List<MydTrendReqDTO> list = null; |
| | | if (mydTrendReqVO.getDimensionType().equals("1")) |
| | | list = satisfactionMapper.sltdMydTotalByDimension(mydTrendReqVO.getStartFinishTime(), mydTrendReqVO.getEndFinishTime(), mydTrendReqVO.getType()); |
| | | else if (mydTrendReqVO.getDimensionType().equals("2")) |
| | | list = satisfactionMapper.sltdMydTotalByYQ(mydTrendReqVO.getStartFinishTime(), mydTrendReqVO.getEndFinishTime(), mydTrendReqVO.getType()); |
| | | |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * é®é¢ç»æå æ¯ |
| | | * |
| | | * @param sltdMydTotalVO |
| | | * @param taskIds ä»»å¡ id å表ï¼é访 serviceType=2 åæ¯ä½¿ç¨ï¼ |
| | | * @param subtaskIds åä»»å¡ id åè¡¨ï¼æ»¡æåº¦ serviceType=6/14 åæ¯ä½¿ç¨ï¼ |
| | | * @return |
| | | */ |
| | | public List<ServiceSubtaskDetailRatioExport> getDetailRatio(SltdMydTotalVO sltdMydTotalVO, List<SatisfactionSubtaskRef> subtaskRefs) { |
| | | List<ServiceSubtaskDetailRatioExport> serviceSubtaskDetailRatioExports = null; |
| | | List<String> serviceTypeList = sltdMydTotalVO.getServiceTypeList(); |
| | | if (CollectionUtils.isEmpty(serviceTypeList)) { |
| | | log.warn("getDetailRatio æªä¼ serviceTypeListï¼æ æ³ç»è®¡é®é¢å æ¯"); |
| | | return serviceSubtaskDetailRatioExports; |
| | | } |
| | | // 夿å£å¾ï¼2=éè®¿ï¼æ taskid ç»è®¡ï¼ï¼6/14=满æåº¦ï¼æ subtask id ç»è®¡ï¼ |
| | | boolean hasFollowUp = serviceTypeList.contains("2"); |
| | | boolean hasSatisfaction = serviceTypeList.contains("6") || serviceTypeList.contains("14"); |
| | | if (hasFollowUp && hasSatisfaction) { |
| | | //serviceTypeï¼å³æéè®¿åææ»¡æåº¦ï¼ææ¶æ²¡æ³ç»è®¡ |
| | | log.warn("getDetailRatio æä¸æ¯æåæ¶ç»è®¡é访(2)䏿»¡æåº¦(6/14)ï¼serviceTypeList={}", serviceTypeList); |
| | | return serviceSubtaskDetailRatioExports; |
| | | } |
| | | if (hasFollowUp) { |
| | | //è·åserviceSubtaskListä¸çæætaskid |
| | | List<Long> taskIds = subtaskRefs.stream().map(SatisfactionSubtaskRef::getTaskid).filter(ObjectUtils::isNotEmpty).distinct().collect(Collectors.toList()); |
| | | //忶另䏿¬æ¬¡å¯¼åºçåä»»å¡ idï¼è®©ãé®é¢è¯¦æ
å æ¯ãåªç»è®¡è¿æ¹æ£è
ï¼ä¸ãæ£è
é访信æ¯è¡¨åãå£å¾ä¸è´ |
| | | List<Long> subtaskIds = subtaskRefs.stream().map(SatisfactionSubtaskRef::getId).filter(ObjectUtils::isNotEmpty).distinct().collect(Collectors.toList()); |
| | | serviceSubtaskDetailRatioExports = statQuestionOption(taskIds, sltdMydTotalVO.getStartFinishTime(), sltdMydTotalVO.getEndFinishTime(), sltdMydTotalVO.getStartOutHospTime(), sltdMydTotalVO.getEndOutHospTime(), sltdMydTotalVO.getQuestionContent(), sltdMydTotalVO.getStartScore(), sltdMydTotalVO.getEndScore(), sltdMydTotalVO.getValueType(), subtaskIds); |
| | | } else if (hasSatisfaction) { |
| | | //满æåº¦ç»è®¡ ï¼éè¿ subtask ç id å»ç»è®¡ï¼ |
| | | List<Long> subtaskIds = subtaskRefs.stream().map(SatisfactionSubtaskRef::getId).collect(Collectors.toList()); |
| | | serviceSubtaskDetailRatioExports = statQuestionOptionBySubtaskIds(subtaskIds, sltdMydTotalVO.getStartOutHospTime(), sltdMydTotalVO.getEndOutHospTime(), sltdMydTotalVO.getStartFinishTime(), sltdMydTotalVO.getEndFinishTime(), sltdMydTotalVO.getQuestionContent(), sltdMydTotalVO.getStartScore(), sltdMydTotalVO.getEndScore(), sltdMydTotalVO.getValueType()); |
| | | } else { |
| | | log.warn("getDetailRatio æä¸æ¯æç serviceTypeList={}ï¼ä»
æ¯æ 2 æ 6/14ï¼", serviceTypeList); |
| | | } |
| | | return serviceSubtaskDetailRatioExports; |
| | | } |
| | | |
| | | |
| | | private static String trimAll(String s) { |
| | | if (s == null) { |
| | | return ""; |
| | | } |
| | | int start = 0; |
| | | int end = s.length(); |
| | | while (start < end && isBlankChar(s.charAt(start))) { |
| | | start++; |
| | | } |
| | | while (end > start && isBlankChar(s.charAt(end - 1))) { |
| | | end--; |
| | | } |
| | | return s.substring(start, end); |
| | | } |
| | | |
| | | |
| | | private String buildKey(String groupName, String questionText, String option) { |
| | | return groupName + "\u0001" + questionText + "\u0001" + option; |
| | | } |
| | | |
| | | |
| | | private static int parseCount(String s) { |
| | | if (StringUtils.isEmpty(s)) { |
| | | return 0; |
| | | } |
| | | try { |
| | | return Integer.parseInt(s.trim()); |
| | | } catch (NumberFormatException e) { |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | |
| | | private List<MydTrendReqDTO> getWeekDate(MydTrendReqVO mydTrendReqVO, List<MydTrendReqDTO> list) { |
| | | // 1. è®¡ç®æ»å¨æ°ï¼å SQL éçå
¬å¼ä¿æä¸è´ï¼ |
| | | long days = (mydTrendReqVO.getEndFinishTime().getTime() - mydTrendReqVO.getStartFinishTime().getTime()) / (1000L * 60 * 60 * 24); |
| | | int totalWeeks = (int) (days / 7) + 1; |
| | | |
| | | // 2. å·²ææ°æ®ï¼period -> totalScore |
| | | Map<Integer, String> exist = new HashMap<>(); |
| | | for (MydTrendReqDTO row : list) { |
| | | // period æ¯æ°åï¼å¯è½æ¯ Integer / Long / BigDecimalï¼ç»ä¸è½¬ int |
| | | int p = Integer.parseInt(StringUtils.isNotEmpty(row.getPeriod()) ? row.getPeriod() : "0"); |
| | | exist.put(p, row.getTotalScore() != null ? row.getTotalScore() : "0"); |
| | | // ä¸é¢è¿è¡æä½ çåé»è¾ä¿çï¼è½ç¶çèµ·æ¥æç¹å¤ä½ï¼ |
| | | exist.put(p, String.valueOf(row.getTotalScore() != null ? row.getTotalScore() : 0)); |
| | | } |
| | | |
| | | // 3. è¡¥å
¨ 1..totalWeeks |
| | | List<MydTrendReqDTO> result = new ArrayList<>(totalWeeks); |
| | | |
| | | // è·åæ´ä½çå¼å§æ¶é´ |
| | | long startTimeMillis = mydTrendReqVO.getStartFinishTime().getTime(); |
| | | long endTimeMillis = mydTrendReqVO.getEndFinishTime().getTime(); |
| | | long oneWeekMillis = 7L * 24 * 60 * 60 * 1000; // ä¸å¨çæ¯«ç§æ° |
| | | |
| | | for (int i = 1; i <= totalWeeks; i++) { |
| | | MydTrendReqDTO row = new MydTrendReqDTO(); |
| | | row.setPeriod(String.valueOf(i)); |
| | | row.setTotalScore(exist.getOrDefault(i, "0")); |
| | | |
| | | // -------- æ°å¢ï¼è®¾ç½®æ¯å¨ç startDate å endDate -------- |
| | | // å½åå¨å¼å§æ¶é´ = æ´ä½å¼å§æ¶é´ + (i - 1) * 7天 |
| | | long currentStartMillis = startTimeMillis + (long) (i - 1) * oneWeekMillis; |
| | | |
| | | // å½åå¨ç»ææ¶é´ = å½åå¨å¼å§æ¶é´ + 7天 - 1毫ç§ï¼ä¿è¯æ¯è¿ä¸å¨çæåä¸å»ï¼ |
| | | long currentEndMillis = currentStartMillis + oneWeekMillis - 1; |
| | | |
| | | // å¦ææ¯æåä¸å¨ï¼ç»ææ¶é´ä¸è½è¶
è¿æ´ä½ç endTime |
| | | if (i == totalWeeks) { |
| | | currentEndMillis = endTimeMillis; |
| | | } |
| | | |
| | | row.setStartDate(new Date(currentStartMillis)); |
| | | row.setEndDate(new Date(currentEndMillis)); |
| | | // ---------------------------------------------------- |
| | | |
| | | result.add(row); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | private List<MydTrendReqDTO> getYearDate(MydTrendReqVO mydTrendReqVO, List<MydTrendReqDTO> list) { |
| | | // è·åæ´ä½å¼å§åç»ææ¶é´ |
| | | Date startTime = mydTrendReqVO.getStartFinishTime(); |
| | | Date endTime = mydTrendReqVO.getEndFinishTime(); |
| | | |
| | | // 1. 计ç®å¹´ä»½èå´ |
| | | // ä½¿ç¨ Calendar è·åèµ·å§å¹´ä»½åç»æå¹´ä»½ |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(startTime); |
| | | int startYear = cal.get(Calendar.YEAR); |
| | | |
| | | cal.setTime(endTime); |
| | | int endYear = cal.get(Calendar.YEAR); |
| | | |
| | | // æ»å¹´æ° (å
å«é¦å°¾) |
| | | int totalYears = endYear - startYear + 1; |
| | | |
| | | // 2. å·²ææ°æ®ï¼period -> totalScore (å设 period åçæ¯å¹´ä»½å符串ï¼å¦ "2024") |
| | | Map<String, String> exist = new HashMap<>(); |
| | | for (MydTrendReqDTO row : list) { |
| | | String period = row.getPeriod() != null ? row.getPeriod() : ""; |
| | | exist.put(period, row.getTotalScore() != null ? row.getTotalScore() : "0"); |
| | | } |
| | | |
| | | // 3. è¡¥å
¨ææå¹´ä»½ |
| | | List<MydTrendReqDTO> result = new ArrayList<>(totalYears); |
| | | |
| | | for (int i = 0; i < totalYears; i++) { |
| | | int currentYear = startYear + i; |
| | | String periodKey = String.valueOf(currentYear); |
| | | |
| | | MydTrendReqDTO row = new MydTrendReqDTO(); |
| | | row.setPeriod(periodKey); |
| | | // å¦ææ²¡æè¯¥å¹´ä»½çæ°æ®ï¼é»è®¤ç» "0" |
| | | row.setTotalScore(exist.getOrDefault(periodKey, "0")); |
| | | |
| | | // -------- 设置该年份ç startDate å endDate -------- |
| | | Calendar yearCal = Calendar.getInstance(); |
| | | // 设置为该年ç 1æ1æ¥ 00:00:00 |
| | | yearCal.set(currentYear, Calendar.JANUARY, 1, 0, 0, 0); |
| | | yearCal.set(Calendar.MILLISECOND, 0); |
| | | row.setStartDate(yearCal.getTime()); |
| | | |
| | | // 设置为该年ç 12æ31æ¥ 23:59:59 |
| | | yearCal.set(currentYear, Calendar.DECEMBER, 31, 23, 59, 59); |
| | | yearCal.set(Calendar.MILLISECOND, 999); |
| | | row.setEndDate(yearCal.getTime()); |
| | | // ---------------------------------------------------- |
| | | |
| | | result.add(row); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | private List<MydTrendReqDTO> getMonthDate(MydTrendReqVO mydTrendReqVO, List<MydTrendReqDTO> list) { |
| | | // è·åæ´ä½å¼å§åç»ææ¶é´ |
| | | Date startTime = mydTrendReqVO.getStartFinishTime(); |
| | | Date endTime = mydTrendReqVO.getEndFinishTime(); |
| | | |
| | | // 1. è®¡ç®æä»½èå´ |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(startTime); |
| | | int startYear = cal.get(Calendar.YEAR); |
| | | int startMonth = cal.get(Calendar.MONTH); // 注æï¼Calendar.MONTH ä» 0 å¼å§ |
| | | |
| | | cal.setTime(endTime); |
| | | int endYear = cal.get(Calendar.YEAR); |
| | | int endMonth = cal.get(Calendar.MONTH); |
| | | |
| | | // æ»ææ° = (ç»æå¹´ - å¼å§å¹´) * 12 + (ç»ææ - å¼å§æ) + 1 |
| | | int totalMonths = (endYear - startYear) * 12 + (endMonth - startMonth) + 1; |
| | | |
| | | // 2. å·²ææ°æ®ï¼period -> totalScore (period åçæ¯æä»½å符串ï¼å¦ "2024-06") |
| | | Map<String, String> exist = new HashMap<>(); |
| | | for (MydTrendReqDTO row : list) { |
| | | String period = row.getPeriod() != null ? row.getPeriod() : ""; |
| | | exist.put(period, row.getTotalScore() != null ? row.getTotalScore() : "0"); |
| | | } |
| | | |
| | | // 3. è¡¥å
¨æææä»½ |
| | | List<MydTrendReqDTO> result = new ArrayList<>(totalMonths); |
| | | |
| | | Calendar monthCal = Calendar.getInstance(); |
| | | monthCal.set(startYear, startMonth, 1, 0, 0, 0); |
| | | monthCal.set(Calendar.MILLISECOND, 0); |
| | | |
| | | for (int i = 0; i < totalMonths; i++) { |
| | | int currentYear = monthCal.get(Calendar.YEAR); |
| | | int currentMonth = monthCal.get(Calendar.MONTH) + 1; // 转æ 1-12 æ |
| | | |
| | | // æ¼æ¥ periodï¼æ ¼å¼ï¼yyyy-MMï¼æ¯å¦ "2024-06" |
| | | // å¦æä½ å¸ææ¯ "2024-6"ï¼å¯ä»¥æ String.format æ¹æ currentMonth |
| | | String periodKey = String.format("%04d-%02d", currentYear, currentMonth); |
| | | |
| | | MydTrendReqDTO row = new MydTrendReqDTO(); |
| | | row.setPeriod(periodKey); |
| | | row.setTotalScore(exist.getOrDefault(periodKey, "0")); |
| | | |
| | | // -------- 设置该æç startDate å endDate -------- |
| | | // 彿å¼å§æ¶é´ï¼1å· 00:00:00.000 |
| | | Calendar startCal = (Calendar) monthCal.clone(); |
| | | row.setStartDate(startCal.getTime()); |
| | | |
| | | // å½æç»ææ¶é´ï¼ä¸ä¸ªæ1å· 00:00:00.000 å 1 æ¯«ç§ |
| | | Calendar endCal = (Calendar) monthCal.clone(); |
| | | endCal.add(Calendar.MONTH, 1); |
| | | endCal.add(Calendar.MILLISECOND, -1); |
| | | row.setEndDate(endCal.getTime()); |
| | | // ---------------------------------------------------- |
| | | |
| | | result.add(row); |
| | | |
| | | // è¿å
¥ä¸ä¸ä¸ªæ |
| | | monthCal.add(Calendar.MONTH, 1); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | private List<MydTrendReqDTO> getDayDate(MydTrendReqVO mydTrendReqVO, List<MydTrendReqDTO> list) { |
| | | // è·åæ´ä½å¼å§åç»ææ¶é´ |
| | | Date startTime = mydTrendReqVO.getStartFinishTime(); |
| | | Date endTime = mydTrendReqVO.getEndFinishTime(); |
| | | |
| | | // 1. è®¡ç®æ»å¤©æ° |
| | | long oneDayMillis = 24L * 60 * 60 * 1000; |
| | | // 注æï¼è¿éåªç®æ¥æå·®ï¼ä¸èèæ¶åç§ï¼å¦åå¯è½å·®ä¸å¤© |
| | | Calendar startCal = Calendar.getInstance(); |
| | | startCal.setTime(startTime); |
| | | startCal.set(Calendar.HOUR_OF_DAY, 0); |
| | | startCal.set(Calendar.MINUTE, 0); |
| | | startCal.set(Calendar.SECOND, 0); |
| | | startCal.set(Calendar.MILLISECOND, 0); |
| | | |
| | | Calendar endCal = Calendar.getInstance(); |
| | | endCal.setTime(endTime); |
| | | endCal.set(Calendar.HOUR_OF_DAY, 0); |
| | | endCal.set(Calendar.MINUTE, 0); |
| | | endCal.set(Calendar.SECOND, 0); |
| | | endCal.set(Calendar.MILLISECOND, 0); |
| | | |
| | | long days = (endCal.getTimeInMillis() - startCal.getTimeInMillis()) / oneDayMillis; |
| | | int totalDays = (int) days + 1; |
| | | |
| | | // 2. å·²ææ°æ®ï¼period -> totalScore (period åçæ¯æ¥æå符串ï¼å¦ "2024-06-01") |
| | | Map<String, String> exist = new HashMap<>(); |
| | | for (MydTrendReqDTO row : list) { |
| | | String period = row.getPeriod() != null ? row.getPeriod() : ""; |
| | | exist.put(period, row.getTotalScore() != null ? row.getTotalScore() : "0"); |
| | | } |
| | | |
| | | // 3. è¡¥å
¨æææ¥æ |
| | | List<MydTrendReqDTO> result = new ArrayList<>(totalDays); |
| | | |
| | | Calendar dayCal = (Calendar) startCal.clone(); |
| | | for (int i = 0; i < totalDays; i++) { |
| | | // æ¼æ¥ periodï¼æ ¼å¼ï¼yyyy-MM-dd |
| | | String periodKey = String.format("%04d-%02d-%02d", dayCal.get(Calendar.YEAR), dayCal.get(Calendar.MONTH) + 1, dayCal.get(Calendar.DAY_OF_MONTH)); |
| | | |
| | | MydTrendReqDTO row = new MydTrendReqDTO(); |
| | | row.setPeriod(periodKey); |
| | | row.setTotalScore(exist.getOrDefault(periodKey, "0")); |
| | | |
| | | // -------- 设置该天ç startDate å endDate -------- |
| | | Calendar startOfDay = (Calendar) dayCal.clone(); |
| | | row.setStartDate(startOfDay.getTime()); |
| | | |
| | | Calendar endOfDay = (Calendar) dayCal.clone(); |
| | | endOfDay.set(Calendar.HOUR_OF_DAY, 23); |
| | | endOfDay.set(Calendar.MINUTE, 59); |
| | | endOfDay.set(Calendar.SECOND, 59); |
| | | endOfDay.set(Calendar.MILLISECOND, 999); |
| | | row.setEndDate(endOfDay.getTime()); |
| | | // ---------------------------------------------------- |
| | | |
| | | result.add(row); |
| | | |
| | | // è¿å
¥ä¸ä¸å¤© |
| | | dayCal.add(Calendar.DAY_OF_MONTH, 1); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public List<MzMydScoreRankDTO> mzMydScoreRank(MzMydScoreRankVO mzMydScoreRankVO) { |
| | | if (StringUtils.isEmpty(mzMydScoreRankVO.getDimensionType())) { |
| | | mzMydScoreRankVO.setDimensionType("1"); |
| | | } |
| | | if (CollectionUtils.isEmpty(mzMydScoreRankVO.getServiceTypes())) { |
| | | List<String> list=new ArrayList<>(Arrays.asList("14")); |
| | | mzMydScoreRankVO.setServiceTypes(list); |
| | | } |
| | | List<MzMydScoreRankDTO> list = satisfactionMapper.selectMzMydScoreRank(mzMydScoreRankVO); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | // 忬¡ï¼SQL å·²æç»¼åå¾åéåºè¿åï¼è¿é顺åºç¼å· |
| | | for (int i = 0; i < list.size(); i++) { |
| | | list.get(i).setRank(i + 1); |
| | | } |
| | | return list; |
| | | } |
| | | /** |
| | | * æ¯å¦ç©ºç½å符ï¼å«å
¨è§ç©ºæ ¼ï¼ã |
| | | * <p> |
| | | * è¿ç§»è¯´æï¼å为 ServiceSubtaskServiceImpl çç§æéææ¹æ³ï¼æ»¡æåº¦æ¹æ³ç¨å°ï¼trimAllï¼ï¼ä¸å¹¶æ¬å
¥ã |
| | | */ |
| | | private static Boolean isBlankChar(char c) { |
| | | return c == '\u3000' // å
¨è§ç©ºæ ¼ |
| | | || c == ' ' // åè§ç©ºæ ¼ |
| | | || c == '\t' || c == '\n' || c == '\r' || c == '\f' || Character.isWhitespace(c); |
| | | } |
| | | /** |
| | | * ææºæ/é¢åº/æå¡ç±»å/åºé¢æ¶é´/ç§å®¤ç
åºååä»»å¡å¼ç¨ï¼åªå« idãtaskidï¼ã |
| | | * <p> |
| | | * åå®ç°èµ° {@code serviceSubtaskService.getServiceSubtasks(ServiceSubtaskEntity)}ï¼ |
| | | * è¯¥æ¹æ³ä½äºé访主干 Service ä¸ä¾èµ patArchiveServiceï¼ä¸è½æ¬ï¼ |
| | | * è¿éç¨æ»¡æåº¦ä¸ç¨æ¥è¯¢å¤ç°å
¶<b>å®é
ç¨å°çæ¡ä»¶å£å¾</b>ï¼éæ¡è§ mapper XML 注éï¼ã |
| | | */ |
| | | @Override |
| | | public List<SatisfactionSubtaskRef> getMydSubtaskRefs(SatisfactionSubtaskQuery query) { |
| | | if (query == null) { |
| | | return new ArrayList<>(); |
| | | } |
| | | List<SatisfactionSubtaskRef> refs = satisfactionMapper.selectMydSubtaskRefs(query); |
| | | return refs == null ? new ArrayList<>() : refs; |
| | | } |
| | | // ==================== 满æåº¦åç±»ï¼ä¾ç»å½é¾è·¯ï¼å¸¦ç¼åï¼ ==================== |
| | | |
| | | /** |
| | | * 满æåº¦åç±»ç¼å key åç¼ï¼ä¸è¿ç§»åä¸è´ï¼ |
| | | */ |
| | | private static final String SATISFACTION_CACHE_KEY = "satisfaction:categories:"; |
| | | |
| | | /** |
| | | * 满æåº¦åç±»ç¼åæ¶é¿ï¼åéï¼ä¸è¿ç§»åä¸è´ï¼ |
| | | */ |
| | | private static final int SATISFACTION_CACHE_TTL = 30; |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | /** |
| | | * è·å满æåº¦é®é¢åç±»ï¼è¯é³ + é®å·ï¼ï¼å¸¦ Redis ç¼åã |
| | | * <p> |
| | | * è¿ç§»è¯´æï¼å为 {@code smartor.UserExtInfoServiceImpl.getSatisfactionCategories}ï¼ |
| | | * å å±äºæ»¡æåº¦é»è¾ï¼ææ¨¡ååè¦æ±æ¬å
¥æ¬æ¨¡åï¼ç¼å key ä¸ TTL ä¿æåå¼ã |
| | | */ |
| | | @Override |
| | | @SuppressWarnings("unchecked") |
| | | public Map<String, Object> getSatisfactionCategories(String orgid) { |
| | | // å
æ¥ç¼å |
| | | String cacheKey = SATISFACTION_CACHE_KEY + orgid; |
| | | Map<String, Object> cached = redisCache.getCacheObject(cacheKey); |
| | | if (cached != null) { |
| | | return cached; |
| | | } |
| | | |
| | | Map<String, Object> satisfactionCategories = new HashMap<>(); |
| | | |
| | | // è·åè¯é³é®é¢åç±» |
| | | List<SatisfactionCategoryRow> ivrLibaScriptAssorts = |
| | | satisfactionScriptMapper.selectIvrCategoryList(categoryQueryByOrgid(orgid)); |
| | | List<Map<String, Object>> categoryList = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(ivrLibaScriptAssorts)) { |
| | | for (SatisfactionCategoryRow assort : ivrLibaScriptAssorts) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("categoryid", assort.getId()); |
| | | map.put("categoryName", assort.getName()); |
| | | categoryList.add(map); |
| | | } |
| | | } |
| | | satisfactionCategories.put("voiceCategories", categoryList); |
| | | |
| | | // è·åé®å·é®é¢åç±» |
| | | List<SatisfactionCategoryRow> svyLibScriptCategories = |
| | | satisfactionScriptMapper.selectSvyCategoryList(categoryQueryByOrgid(orgid)); |
| | | List<Map<String, Object>> questionnaireCategorys = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(svyLibScriptCategories)) { |
| | | for (SatisfactionCategoryRow scriptCategory : svyLibScriptCategories) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("categoryid", scriptCategory.getId()); |
| | | map.put("categoryName", scriptCategory.getName()); |
| | | questionnaireCategorys.add(map); |
| | | } |
| | | } |
| | | satisfactionCategorysPut(satisfactionCategories, questionnaireCategorys); |
| | | |
| | | // åå
¥ç¼å |
| | | redisCache.setCacheObject(cacheKey, satisfactionCategories, SATISFACTION_CACHE_TTL, TimeUnit.MINUTES); |
| | | |
| | | return satisfactionCategories; |
| | | } |
| | | |
| | | /** |
| | | * ä¸åæä¸è´ï¼é®å为 {@code questionnaireCategorys} |
| | | */ |
| | | private void satisfactionCategorysPut(Map<String, Object> target, List<Map<String, Object>> value) { |
| | | target.put("questionnaireCategorys", value); |
| | | } |
| | | |
| | | /** |
| | | * ææºææé 满æåº¦åç±»æ¥è¯¢ï¼orgid + type=mydï¼ä¸åæä¸è´ï¼ |
| | | */ |
| | | private SatisfactionScriptQuery categoryQueryByOrgid(String orgid) { |
| | | SatisfactionScriptQuery q = new SatisfactionScriptQuery(); |
| | | q.setOrgid(orgid); |
| | | q.setType("myd"); |
| | | return q; |
| | | } |
| | | |
| | | // ==================== 满æåº¦å¼å¸¸é
ç½®é¢ç® ==================== |
| | | |
| | | /** |
| | | * è·å满æåº¦å¼å¸¸é
ç½®é¢ç®ï¼è¯é³ + é®å·ï¼ã |
| | | * <p> |
| | | * è¿ç§»è¯´æï¼åå®ç°ä½äº {@code com.smartor.service.impl.ServiceSubtaskDetailTraceServiceImpl}ï¼ |
| | | * ç°æ´æ®µæ¬å
¥æ¬æ¨¡åã忥çè°ç¨é¾æ¯ï¼ |
| | | * <pre> |
| | | * è¯é³åç±»ï¼IvrLibaScriptAssortServiceImpl.selectIvrLibaScriptAssortList â æå¡æ¹æ³ï¼ä¼æåç±»ãæ¼ææ ãï¼åªè¿åé¡¶å± |
| | | * è¯é³é¢ç®ï¼IvrLibaTemplateScriptServiceImpl.selectIvrLibaTemplateScriptList(scriptAssortid=X) â é个åç±»è°ç¨ |
| | | * é®å·åç±»ï¼SvyLibScriptCategoryMapper.selectSvyLibScriptCategoryList â ç´æ¥ Mapperï¼è¿åãå
¨é¨ãåç±» |
| | | * é®å·é¢ç®ï¼SvyLibTemplateScriptServiceImpl.selectSvyLibTemplateScriptList(categoryid=Y) â é个åç±»è°ç¨ |
| | | * </pre> |
| | | * 为ä¸ä¾èµ smartor çæ¨¡æ¿/åç±»å®ä½ï¼è¿éæ¹ææ¬æ¨¡åçåªè¯»æ¥è¯¢å¤ç°ï¼å¹¶ä¸ï¼ |
| | | * <ul> |
| | | * <li>è¯é³åç±»ï¼ä»ç¶æé¡¶å±è¿æ»¤ï¼{@code pid == null || pid == -1}ï¼ï¼ä¸åæå¡æ¹æ³çç»æéä¸è´ï¼</li> |
| | | * <li>é®å·åç±»ï¼ä¸è¿æ»¤é¡¶å±ï¼åå
¨é¨ï¼ä¸å Mapper è°ç¨ä¸è´ï¼</li> |
| | | * <li>é¢ç®ï¼åææ¯æåç±»é个æ¥è¯¢åç´¯å ï¼ä¸¤æ¡ list statement é½<b>没æ order by</b>ï¼ |
| | | * æä»¥åå¹¶æä¸æ¬¡ {@code in (...)} æ¥è¯¢çç»æéä¸é次æ¥è¯¢çå¹¶éä¸è´ |
| | | * ï¼éåç¸åãé¡ºåºæ¬æ¥å°±æªå®ä¹ï¼ï¼</li> |
| | | * <li>åç±» id å表为空æ¶<b>䏿¥</b>ï¼åæå°±æ¯å¨ {@code if (isNotEmpty)} éææ¥ï¼ï¼ |
| | | * å¯¹åºæ¬æ¨¡å SQL é"ids 为空å䏿¼ in æ¡ä»¶"çåæ³å¿
é¡»é è¿ä¸ªå¤æå
ä½ï¼ |
| | | * å¦åä¼éåæ"å
¨è¡¨æ¥è¯¢"ã</li> |
| | | * </ul> |
| | | */ |
| | | @Override |
| | | public Map<String, Object> getSatisfactionExceptConfigQuestion(SatisfactionExceptConfigQuestionReqVO questionReqVO) { |
| | | // åå§åç»æé |
| | | Map<String, Object> result = new HashMap<>(); |
| | | |
| | | // ---------------------------------------------------------------- è¯é³ |
| | | if (StringUtils.isEmpty(questionReqVO.getScriptType()) || questionReqVO.getScriptType().equals("1")) { |
| | | List<Map<String, Object>> voicetDataList = new ArrayList<>(); |
| | | |
| | | // è·å满æåº¦çåç±»ï¼type é»è®¤ mydï¼å
¥åæå¼åè¦ç ââ ä¸åæä¸è´ï¼ |
| | | List<Long> assortIdList = selectIvrTopCategoryIds(questionReqVO.getType()); |
| | | |
| | | // ç¨æ¥è®°å½æ»¡æåº¦çææé®é¢ |
| | | if (CollectionUtils.isNotEmpty(assortIdList)) { |
| | | SatisfactionScriptQuery scriptQuery = new SatisfactionScriptQuery(); |
| | | scriptQuery.setScriptAssortids(assortIdList); |
| | | List<SatisfactionIvrScriptRow> ivrScripts = |
| | | satisfactionScriptMapper.queryIvrScriptByAssort(scriptQuery); |
| | | if (CollectionUtils.isNotEmpty(ivrScripts)) { |
| | | for (SatisfactionIvrScriptRow ivrScript : ivrScripts) { |
| | | Map<String, Object> voicetData = new HashMap<>(); |
| | | voicetData.put("questionId", ivrScript.getId()); |
| | | voicetData.put("libtemplateid", ivrScript.getTemplateid()); |
| | | voicetData.put("questionContent", ivrScript.getScriptContent()); |
| | | voicetData.put("questionTopic", ivrScript.getScriptTopic()); |
| | | voicetData.put("questionType", ivrScript.getScriptType()); |
| | | voicetData.put("categoryName", ivrScript.getScriptAssortname()); |
| | | voicetData.put("categoryId", ivrScript.getScriptAssortid()); |
| | | voicetDataList.add(voicetData); |
| | | } |
| | | } |
| | | } |
| | | // è¯é³æ°æ®è¿åéå |
| | | result.put("voiceDataList", voicetDataList); |
| | | } |
| | | |
| | | // ---------------------------------------------------------------- é®å· |
| | | if (StringUtils.isEmpty(questionReqVO.getScriptType()) || questionReqVO.getScriptType().equals("2")) { |
| | | List<Map<String, Object>> questionnaireDataList = new ArrayList<>(); |
| | | |
| | | // è·å满æåº¦çåç±»ï¼é®å·ä¾§åæç´æ¥æ¥ Mapperï¼åå
¨é¨åç±»ï¼ä¸æ¼æ ãä¸çé¡¶å±ï¼ |
| | | List<Long> categoryIdList = selectSvyCategoryIds(questionReqVO.getType()); |
| | | |
| | | // ç¨æ¥è®°å½æ»¡æåº¦çææé®é¢ |
| | | if (CollectionUtils.isNotEmpty(categoryIdList)) { |
| | | SatisfactionScriptQuery scriptQuery = new SatisfactionScriptQuery(); |
| | | scriptQuery.setScriptCategoryids(categoryIdList); |
| | | List<SatisfactionSvyScriptRow> svyScripts = |
| | | satisfactionScriptMapper.querySvyScriptByCategory(scriptQuery); |
| | | if (CollectionUtils.isNotEmpty(svyScripts)) { |
| | | for (SatisfactionSvyScriptRow svyScript : svyScripts) { |
| | | Map<String, Object> svyData = new HashMap<>(); |
| | | svyData.put("questionId", svyScript.getId()); |
| | | svyData.put("libtemplateid", svyScript.getSvyid()); |
| | | svyData.put("questionContent", svyScript.getScriptContent()); |
| | | svyData.put("questionTopic", svyScript.getScriptTopic()); |
| | | svyData.put("questionType", svyScript.getScriptType()); |
| | | svyData.put("categoryName", svyScript.getCategoryName()); |
| | | svyData.put("categoryId", svyScript.getCategoryid()); |
| | | questionnaireDataList.add(svyData); |
| | | } |
| | | } |
| | | } |
| | | // é®å·æ°æ®è¿åéå |
| | | result.put("questionnaireDataList", questionnaireDataList); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * åè¯é³ä¾§æ»¡æåº¦åç±» idï¼<b>åªåé¡¶å±</b>ï¼å¤ç°åæå¡æ¹æ³æ¼æ åçè¿åå¼ï¼ã |
| | | * |
| | | * @param type 满æåº¦ç±»åï¼ä¸ºç©ºæ¶ç¨ {@code "myd"} |
| | | */ |
| | | private List<Long> selectIvrTopCategoryIds(String type) { |
| | | SatisfactionScriptQuery query = new SatisfactionScriptQuery(); |
| | | query.setType(StringUtils.isEmpty(type) ? "myd" : type); |
| | | // åææ²¡æä¼ orgidï¼è¿éä¿æä¸è´ï¼orgid ä¸ºç©ºæ¶ SQL 䏿¼è¯¥æ¡ä»¶ï¼ |
| | | List<SatisfactionCategoryRow> rows = satisfactionScriptMapper.selectIvrCategoryList(query); |
| | | List<Long> ids = new ArrayList<>(); |
| | | if (CollectionUtils.isNotEmpty(rows)) { |
| | | for (SatisfactionCategoryRow row : rows) { |
| | | // ä¸ IvrLibaScriptAssortServiceImpl æ¼æ æ¶çé¡¶å±å¤æéåä¸è´ |
| | | if (row.getPid() == null || row.getPid() == -1) { |
| | | ids.add(row.getId()); |
| | | } |
| | | } |
| | | } |
| | | return ids; |
| | | } |
| | | |
| | | /** |
| | | * åé®å·ä¾§æ»¡æåº¦åç±» idï¼<b>åå
¨é¨</b>ï¼å¤ç°å Mapper è°ç¨çè¿åå¼ï¼ã |
| | | * |
| | | * @param type 满æåº¦ç±»åï¼ä¸ºç©ºæ¶ç¨ {@code "myd"} |
| | | */ |
| | | private List<Long> selectSvyCategoryIds(String type) { |
| | | SatisfactionScriptQuery query = new SatisfactionScriptQuery(); |
| | | query.setType(StringUtils.isEmpty(type) ? "myd" : type); |
| | | List<SatisfactionCategoryRow> rows = satisfactionScriptMapper.selectSvyCategoryList(query); |
| | | List<Long> ids = new ArrayList<>(); |
| | | if (CollectionUtils.isNotEmpty(rows)) { |
| | | for (SatisfactionCategoryRow row : rows) { |
| | | ids.add(row.getId()); |
| | | } |
| | | } |
| | | return ids; |
| | | } |
| | | |
| | | // ==================== éè®¿ãæ»¡æåº¦ææ°ã ==================== |
| | | |
| | | /** |
| | | * ãæ»¡æåº¦é¢ç®åééãç»è®¡æ¶ä½¿ç¨çåä»»å¡åéç¶æï¼ä¸åå®ç°ä¸è´ï¼3ã5ã6ï¼ |
| | | */ |
| | | private static final List<Long> SATISFACTION_INDEX_SENDSTATES = |
| | | Collections.unmodifiableList(Arrays.asList(3L, 5L, 6L)); |
| | | |
| | | /** |
| | | * é访ç»è®¡é¡µçãæ»¡æåº¦ææ°ãï¼æ»¡æåº¦é¢ç®æ»é / å¡«æ¥é / 宿æ¯ä¾ã |
| | | * <p> |
| | | * è¿ç§»è¯´æï¼å为 {@code com.smartor.service.impl.ServiceSubtaskServiceImpl#getSatisfactionIndex} |
| | | * çç§ææ¹æ³ï¼è¢« {@code getSfStatisticsJoy} è°ç¨ãå®çåæ°å¯¹è±¡æ¯ |
| | | * ãæ»¡æåº¦é¢ç®ãï¼æ {@code ivrCategoryid} / {@code svyCategoryid} è¯å«ï¼ä¸ |
| | | * ãæ»¡æåº¦å¡«æ¥æç»ãï¼å±äºæ»¡æåº¦å£å¾ï¼æ
æ¬å
¥æ¬æ¨¡åã |
| | | * <p> |
| | | * <b>ä¸åå®ç°éæ¡å¯¹åºï¼</b> |
| | | * <ol> |
| | | * <li>{@code type="1"} ç¨ {@code deptcode} å¹é
ä»»å¡ï¼{@code type="2"} ç¨ |
| | | * {@code leavehospitaldistrictcode} å¹é
ä»»å¡ï¼äºæ¥ï¼é½å¸¦ orgidï¼ï¼</li> |
| | | * <li>è¯é³ä»»å¡ï¼é¢ç®æ° = 该模æ¿ä¸ {@code script_assortid = ivrCategoryid} çé¢ç®æ°ï¼ |
| | | * æ»é += é¢ç®æ° à åééï¼{@code sendstate in (3,5,6)}ï¼ï¼</li> |
| | | * <li>é®å·ä»»å¡ï¼åä¸ï¼ç¨ {@code categoryid = svyCategoryid}ï¼</li> |
| | | * <li>å¡«æ¥éï¼æ {@code taskid + categoryid(æä»»å¡ç±»ååè¯é³/é®å·) + orgid} æ°æç»æ¡æ°ï¼</li> |
| | | * <li>宿æ¯ä¾ = å¡«æ¥é / æ»éï¼ä¿ç 2 ä½ï¼HALF_UPï¼ï¼æ»é为 0 æ¶ä¸º {@code 0.0}ã</li> |
| | | * </ol> |
| | | * |
| | | * <h3>â ï¸ åå®ç°å·²ç¥ç¼ºé·ï¼æ¬æ¬¡<b>åæ ·ä¿ç</b>ï¼æªä¿®å¤ï¼</h3> |
| | | * å代ç ç¨çæ¯ {@code mydtmzlsum.add(new BigDecimal(n))} ââ |
| | | * {@link BigDecimal} æ¯ä¸å¯åç±»ï¼{@code add} çè¿å弿²¡æè¢«èµååéï¼ |
| | | * å æ¤<b>ææç´¯å 齿¯æ æç</b>ï¼æ¬æ¹æ³å®é
ä¸<b>æå®è¿å</b> |
| | | * {@code {mydtmzl: 0, mydtbl: 0, wcbl: 0.0}}ï¼ |
| | | * åæ¶å 为累å è¯å¥ä»å¨å¾ªç¯éï¼<b>æ¯æ¬¡è°ç¨ä¾æ§ä¼ç宿§è¡é£ 5 æ¡æ¥è¯¢</b>ã |
| | | * <p> |
| | | * è¿ç§»æ¶æ"è¡ä¸ºä¸å"ååä¸åæªæ¹ï¼è¿æ æç´¯å ä¹ä¿çï¼ï¼ |
| | | * è¥ç´æ¥ææ¥è¯¢ç»ææ¹æå¸¸éï¼è½ç¶è¿åå¼ç¸åï¼ä½ä¼æ¹åæ°æ®åºååï¼ |
| | | * è¥æ {@code add} æ¹æ {@code xxx = xxx.add(...)}ï¼å伿¹åé访ç»è®¡é¡µçæ¾ç¤ºå¼ã |
| | | * 两ç§é½è¶
åºæ¬æ¬¡"模ååã䏿¹è¡ä¸º"çèå´ï¼æ
çå¾
åç¬ç¡®è®¤ã |
| | | * è¯¦è§ {@code doc/满æåº¦æ¨¡åå_æ§è¡è¿åº¦.md} çéç项ã |
| | | * |
| | | * @param type "1"=æç§å®¤ï¼"2"=æç
åºï¼ä¸åæä¸è´ï¼ |
| | | * @param code ç§å®¤ç¼ç æç
åºç¼ç |
| | | * @param orgid æºæ id |
| | | * @param ivrCategoryid è¯é³æ»¡æåº¦åç±» idï¼å¯ä¸º nullï¼ä¸º null æ¶è¯¥æ¡ä»¶ä¸çæï¼ |
| | | * @param svyCategoryid é®å·æ»¡æåº¦åç±» idï¼å¯ä¸º nullï¼ä¸º null æ¶è¯¥æ¡ä»¶ä¸çæï¼ |
| | | * @return å« {@code mydtmzl}(Integer) / {@code mydtbl}(Integer) / {@code wcbl}(Double) ç Map |
| | | */ |
| | | @Override |
| | | public Map<String, Object> getSatisfactionIndex(String type, String code, String orgid, |
| | | Long ivrCategoryid, Long svyCategoryid) { |
| | | // åææ¯ type.equals("1")ï¼è°ç¨æ¹åªä¼ åé¢é "1"/"2"ï¼è¿éç¨å¸¸éå¨åç价䏿´å®å
¨ |
| | | List<SatisfactionTaskRow> serviceTasks = null; |
| | | if ("1".equals(type)) { |
| | | serviceTasks = satisfactionMapper.selectSatisfactionServiceTasks(orgid, code, null); |
| | | } else if ("2".equals(type)) { |
| | | serviceTasks = satisfactionMapper.selectSatisfactionServiceTasks(orgid, null, code); |
| | | } |
| | | |
| | | // è·å满æåº¦é¢ç®æ»é |
| | | BigDecimal mydtmzlsum = new BigDecimal(0); |
| | | // è·å满æåº¦é¢ç®å¡«æ¥é |
| | | BigDecimal mydtblsum = new BigDecimal(0); |
| | | if (CollectionUtils.isNotEmpty(serviceTasks)) { |
| | | for (SatisfactionTaskRow serviceTask : serviceTasks) { |
| | | if (serviceTask.getType().equals("1")) { |
| | | // è¯é³ |
| | | Long templateid = serviceTask.getTemplateid(); |
| | | int scriptCount = satisfactionMapper.countIvrTaskTemplateScripts( |
| | | templateid, serviceTask.getOrgid(), ivrCategoryid); |
| | | if (scriptCount > 0) { |
| | | // éè¦å
计ç®åºåééï¼åä¹ä»¥å个é®å¸æ»¡æåº¦é¢ç®æ°éï¼å¾å°æ»¡æåº¦é¢ç®æ»éï¼å
å«äºæªåçï¼ |
| | | int subtaskCount = satisfactionMapper.countSubtaskBySendstates( |
| | | serviceTask.getTaskid(), SATISFACTION_INDEX_SENDSTATES); |
| | | if (subtaskCount > 0) { |
| | | int mydtmzlCount = scriptCount * subtaskCount; |
| | | // â ï¸ åå®ç°ç¼ºé·ï¼add çè¿åå¼è¢«ä¸¢å¼ï¼BigDecimal ä¸å¯åï¼ï¼æ¤å¤åæ ·ä¿ç |
| | | mydtmzlsum.add(new BigDecimal(mydtmzlCount)); |
| | | } |
| | | } |
| | | } else if (serviceTask.getType().equals("2")) { |
| | | // é®å· |
| | | int scriptCount = satisfactionMapper.countSvyTaskTemplateScripts( |
| | | serviceTask.getTemplateid(), serviceTask.getOrgid(), svyCategoryid); |
| | | if (scriptCount > 0) { |
| | | int subtaskCount = satisfactionMapper.countSubtaskBySendstates( |
| | | serviceTask.getTaskid(), SATISFACTION_INDEX_SENDSTATES); |
| | | if (subtaskCount > 0) { |
| | | int mydtmzlCount = scriptCount * subtaskCount; |
| | | // â ï¸ åå®ç°ç¼ºé·ï¼åä¸ï¼åæ ·ä¿ç |
| | | mydtmzlsum.add(new BigDecimal(mydtmzlCount)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // è·å满æåº¦é¢ç®å¡«æ¥é |
| | | Long categoryid = null; |
| | | if (serviceTask.getType().equals("1")) categoryid = ivrCategoryid; |
| | | if (serviceTask.getType().equals("2")) categoryid = svyCategoryid; |
| | | int detailCount = satisfactionMapper.countSubtaskDetail( |
| | | serviceTask.getTaskid(), categoryid, serviceTask.getOrgid()); |
| | | if (detailCount > 0) { |
| | | // â ï¸ åå®ç°ç¼ºé·ï¼åä¸ï¼åæ ·ä¿ç |
| | | mydtblsum.add(new BigDecimal(detailCount)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | // 满æåº¦é¢ç®æ»é |
| | | map.put("mydtmzl", mydtmzlsum.intValue()); |
| | | map.put("mydtbl", mydtblsum.intValue()); |
| | | map.put("wcbl", 0.0); |
| | | if (mydtmzlsum.intValue() != 0) { |
| | | map.put("wcbl", mydtblsum.divide(mydtmzlsum, 2, RoundingMode.HALF_UP).doubleValue()); |
| | | } |
| | | return map; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.service.strategy; |
| | | |
| | | import com.ruoyi.satisfaction.domain.ServiceSubtaskDetailRatioExport; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * éç¨å£å¾ï¼åå使ç¨ï¼çç»¼åæ»¡æåº¦å¾åçç¥ã |
| | | * <p> |
| | | * <b>å£å¾ä¸åå®ç°å®å
¨ä¸è´</b>ï¼çäº {@code PatSatisfactionServiceImpl#averageScoreByStat}ï¼ï¼ |
| | | * <pre> |
| | | * åå = Σ(å¯è§£æç score à 该åå¼çæç»è¡æ°) |
| | | * 忝 = å
¨é¨æç»è¡æ°ï¼<b>å
å«åå¼ä¸ºç©ºçè¡</b>ï¼ |
| | | * ç»æ = åå / 忝ï¼ä¿ç 1 ä½ãHALF_UPï¼æ è¡æ¶ 0.0 |
| | | * </pre> |
| | | * â ï¸ ä¸¤ä¸ª"ä¸è½æ¹"çç¹ï¼å注é已强è°ï¼è¿éåæ ·ä¿çï¼ï¼ |
| | | * <ol> |
| | | * <li>忝æ¯<b>æç»è¡æ°</b>ï¼ä¸æ¯"æåå¼çè¡æ°" ââ æ¹æåè
伿¹å {@code averageScore}ï¼</li> |
| | | * <li>åå¼è§£æç¨ {@code Double.parseDouble}ï¼èå¼ä¼æ {@code NumberFormatException} |
| | | * ï¼åå®ç°å³å¦æ¤ï¼æªå try/catchï¼ä¿æä¸è´ï¼ã</li> |
| | | * </ol> |
| | | */ |
| | | @Component |
| | | public class CommonSatisfactionScoreStrategy implements SatisfactionScoreStrategy { |
| | | |
| | | /** |
| | | * éç¨å£å¾çä¿ç使°ï¼1 ä½ï¼ä¸ {@code averageScoreByStat} ä¸è´ï¼ |
| | | */ |
| | | private static final int SCALE = 1; |
| | | |
| | | @Override |
| | | public String site() { |
| | | return SatisfactionSites.COMMON; |
| | | } |
| | | |
| | | @Override |
| | | public String siteName() { |
| | | return "éç¨å£å¾ï¼ååï¼"; |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal comprehensiveScore(List<ServiceSubtaskDetailRatioExport> rows) { |
| | | if (CollectionUtils.isEmpty(rows)) { |
| | | return BigDecimal.ZERO.setScale(SCALE); |
| | | } |
| | | |
| | | double sum = 0.0; |
| | | long totalRows = 0L; |
| | | for (ServiceSubtaskDetailRatioExport row : rows) { |
| | | long count = parseCount(row.getCount()); |
| | | // ä¸åæä¸è´ï¼éæ£æ°çèåè¡ç´æ¥è·³è¿ |
| | | if (count <= 0L) continue; |
| | | totalRows += count; |
| | | String score = row.getScore(); |
| | | if (score != null && !score.isEmpty()) { |
| | | sum += Double.parseDouble(score) * count; |
| | | } |
| | | } |
| | | if (totalRows == 0L) { |
| | | return BigDecimal.ZERO.setScale(SCALE); |
| | | } |
| | | return new BigDecimal(sum / totalRows).setScale(SCALE, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | /** |
| | | * æç»è¡æ°è§£æï¼ä¸ {@code ScoreCount.getCount()} çä»·ï¼åå§æ¯ longï¼è¿éä»å符串åï¼ |
| | | */ |
| | | private long parseCount(String count) { |
| | | if (count == null || count.isEmpty()) { |
| | | return 0L; |
| | | } |
| | | try { |
| | | return Long.parseLong(count.trim()); |
| | | } catch (NumberFormatException e) { |
| | | return 0L; |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.service.strategy; |
| | | |
| | | import com.ruoyi.satisfaction.domain.ServiceSubtaskDetailRatioExport; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 满æåº¦ãç«ç¹å£å¾ãçç¥ï¼<b>ä¸ä¸ªç«ç¹ä¸å¥ç»¼å满æåº¦å¾åå£å¾</b>ã |
| | | * <p> |
| | | * è¿æ¯æ¬æ¨¡åç¨æ¥åºåãååãä¸ãçç«åå¾·ã䏤奿»¡æåº¦å£å¾ç<b>çç¥æ¥å£</b>ï¼ |
| | | * <ul> |
| | | * <li>{@link CommonSatisfactionScoreStrategy}ï¼{@link SatisfactionSites#COMMON}ï¼ââ éç¨/ååå£å¾ï¼</li> |
| | | * <li>{@link SltdSatisfactionScoreStrategy}ï¼{@link SatisfactionSites#SLTD}ï¼ââ çç«åå¾·å£å¾ã</li> |
| | | * </ul> |
| | | * ç± {@link SatisfactionScoreStrategyResolver} æç«ç¹æ è¯éæ©å®ç°ï¼è°ç¨æ¹ï¼Controller / Serviceï¼ |
| | | * åªä¾èµæ¬æ¥å£ + è§£æå¨ï¼ä¸åèªå·±åç«ç¹åæ¯ ââ 以忰å¢ç«ç¹åªéæ°å¢ä¸ä¸ªå®ç°ç±»ã |
| | | * <p> |
| | | * <b>å
¥åç»ä¸ä¸º</b>{@code List<ServiceSubtaskDetailRatioExport>}ï¼"é®é¢è¯¦æ
å æ¯"è¡ï¼é项 + æ°é + åå¼ï¼ï¼ |
| | | * å 为两个ç«ç¹ç综è¯å
¥å£æ¿å°ç齿¯è¿ä¸ªç»æã |
| | | */ |
| | | public interface SatisfactionScoreStrategy { |
| | | |
| | | /** |
| | | * ç«ç¹æ è¯ï¼è§èå¼ï¼åèª {@link SatisfactionSites}ï¼ |
| | | */ |
| | | String site(); |
| | | |
| | | /** |
| | | * ç«ç¹åç§°ï¼ä¸æï¼ç¨äºææ¡£ä¸æ¥å¿ï¼ |
| | | */ |
| | | String siteName(); |
| | | |
| | | /** |
| | | * 计ç®ãç»¼åæ»¡æåº¦å¾åãã |
| | | * <p> |
| | | * è¿åå¼è¯ä¹ç±åç«ç¹å£å¾èªè¡å®ä¹ï¼éç¨å£å¾æ¯<b>å¹³åå</b>ä¿ç 1 ä½ï¼ |
| | | * åå¾·å£å¾æ¯<b>ç¾åå¶å æå¾å</b>ä¿ç 2 ä½ï¼ï¼è°ç¨æ¹æç«ç¹æ¢æçº¦å®åç°ã |
| | | * |
| | | * @param rows åä¸éé¢ï¼æå䏿¹ï¼çéé¡¹å æ¯è¡ |
| | | * @return å¾åï¼<b>æ æ³è®¡ç®æ¶è¿å {@code null}</b>ï¼è°ç¨æ¹æç«ç¹æ¢æçº¦å®åéï¼ä¾å¦åå¾·åé为 "0.00"ï¼ |
| | | */ |
| | | BigDecimal comprehensiveScore(List<ServiceSubtaskDetailRatioExport> rows); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.service.strategy; |
| | | |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.TreeSet; |
| | | |
| | | /** |
| | | * 满æåº¦ç«ç¹å£å¾çç¥è§£æå¨ã |
| | | * <p> |
| | | * ç± Spring 注å
¥å
¨é¨ {@link SatisfactionScoreStrategy} å®ç°ï¼æç«ç¹æ è¯éæ©ï¼ |
| | | * ç«ç¹ä¸ºç©ºææªç¥æ¶<b>åè½å°éç¨å£å¾</b>å¹¶æ WARNï¼ä¿è¯è°ç¨æ¹æ°¸è¿ä¸ä¼å 为 |
| | | * "ä¼ äºä¸ªæ²¡è§è¿çç«ç¹"è失败ï¼ã |
| | | * <p> |
| | | * ç¨æ³ï¼ |
| | | * <pre> |
| | | * BigDecimal score = resolver.resolve(SatisfactionSites.SLTD).comprehensiveScore(rows); |
| | | * </pre> |
| | | * 以忰å¢ç«ç¹ï¼åªå ä¸ä¸ª {@code SatisfactionScoreStrategy} å®ç°ç±»å³å¯ï¼æ¬ç±»æ éæ¹å¨ã |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class SatisfactionScoreStrategyResolver { |
| | | |
| | | private final Map<String, SatisfactionScoreStrategy> strategies; |
| | | |
| | | private final SatisfactionScoreStrategy fallback; |
| | | |
| | | public SatisfactionScoreStrategyResolver(List<SatisfactionScoreStrategy> strategyList) { |
| | | Map<String, SatisfactionScoreStrategy> map = new LinkedHashMap<>(); |
| | | if (strategyList != null) { |
| | | for (SatisfactionScoreStrategy strategy : strategyList) { |
| | | map.put(SatisfactionSites.normalize(strategy.site()), strategy); |
| | | } |
| | | } |
| | | this.strategies = Collections.unmodifiableMap(map); |
| | | this.fallback = map.get(SatisfactionSites.COMMON); |
| | | if (this.fallback == null) { |
| | | // åªå¯è½å¨é
ç½®é误æ¶åçï¼éç¨å£å¾å®ç°è¢«è¯¯å ï¼ï¼å°½æ©æ´é² |
| | | throw new ServiceException("满æåº¦æ¨¡å缺å°éç¨å£å¾çç¥å®ç°ï¼site=" + SatisfactionSites.COMMON + "ï¼"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æç«ç¹åçç¥ï¼æªç¥ç«ç¹åè½å°éç¨å£å¾å¹¶æ WARN |
| | | * |
| | | * @param site ç«ç¹æ è¯ï¼{@link SatisfactionSites} ä¸ç常éï¼æå
¶å«åï¼ |
| | | */ |
| | | public SatisfactionScoreStrategy resolve(String site) { |
| | | String key = SatisfactionSites.normalize(site); |
| | | SatisfactionScoreStrategy strategy = strategies.get(key); |
| | | if (strategy == null) { |
| | | log.warn("ãæ»¡æåº¦ãæªæ¾å°ç«ç¹å£å¾çç¥ site={}ï¼åè½å°éç¨å£å¾ï¼{}ï¼", site, SatisfactionSites.COMMON); |
| | | return fallback; |
| | | } |
| | | return strategy; |
| | | } |
| | | |
| | | /** |
| | | * 已注åçç«ç¹æ è¯ï¼ä¾æ ¡éª/ææ¡£ä½¿ç¨ï¼ |
| | | */ |
| | | public Set<String> supportedSites() { |
| | | return Collections.unmodifiableSet(new TreeSet<>(strategies.keySet())); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.service.strategy; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 满æåº¦ãç«ç¹å£å¾ãæ è¯ã |
| | | * <p> |
| | | * æ¬æ¨¡åç¨<b>çç¥</b>åºå䏤奿»¡æåº¦å£å¾ï¼è§ {@link SatisfactionScoreStrategy}ï¼ï¼ |
| | | * <table border="1"> |
| | | * <tr><th>ç«ç¹</th><th>æ è¯</th><th>å£å¾</th></tr> |
| | | * <tr> |
| | | * <td>éç¨ï¼åå使ç¨ï¼åå¾·ä¹å¤ç¨å
¶ä¸ç 4 个éç¨ç«¯ç¹ï¼</td> |
| | | * <td>{@link #COMMON}ï¼{@code "common"}ï¼å«å {@code "nanhua"}ï¼</td> |
| | | * <td>{@link CommonSatisfactionScoreStrategy}ï¼ææç»ç {@code score} åæ®µæ±å¹³åï¼åæ¯å«åå¼ä¸ºç©ºçè¡ï¼</td> |
| | | * </tr> |
| | | * <tr> |
| | | * <td>çç«åå¾·</td> |
| | | * <td>{@link #SLTD}ï¼{@code "sltd"}ï¼</td> |
| | | * <td>{@link SltdSatisfactionScoreStrategy}ï¼æé项< b>ææ¡</b>å¤å®äºæ¡£å¹¶å æï¼1/0.8/0.6/0.4/0.2ï¼ï¼ç¾åå¶</td> |
| | | * </tr> |
| | | * </table> |
| | | * <p> |
| | | * <b>为ä»ä¹ä¸¤å¥å£å¾å¿
é¡»åå¼</b>ï¼åå¾·çå岿°æ®é {@code score} æ {@code 0}ã{@code 0000000001} |
| | | * è¿ç±»èå¼ï¼æ {@code score} æ±å¹³å伿å¾ååºå®æ 0 æ 100ï¼æä»¥åå¾·åªè½æéé¡¹ææ¡å¤æ¡£ï¼ |
| | | * èéç¨å£å¾çååæ°æ®æ²¡æè¿ä¸ªé®é¢ï¼æ¹ç¨ææ¡å¤æ¡£åèä¼è®©ç»æä¸è¿ç§»åä¸ä¸è´ã |
| | | * å æ¤è¿éä¸å"ç»ä¸ç®æ³"ï¼èæ¯ç¨çç¥æ¾å¼åºåã |
| | | */ |
| | | public final class SatisfactionSites { |
| | | |
| | | /** |
| | | * éç¨å£å¾ï¼åå使ç¨ï¼åå¾·ç 4 个éç¨ç«¯ç¹ä¹èµ°å®ï¼ |
| | | */ |
| | | public static final String COMMON = "common"; |
| | | |
| | | /** |
| | | * çç«åå¾·å£å¾ |
| | | */ |
| | | public static final String SLTD = "sltd"; |
| | | |
| | | /** |
| | | * ç«ç¹å«å â è§èç«ç¹æ è¯ï¼ååæ²¡æç¬å å£å¾ï¼å½å°éç¨å£å¾ï¼ |
| | | */ |
| | | private static final Map<String, String> ALIASES; |
| | | |
| | | static { |
| | | Map<String, String> aliases = new LinkedHashMap<>(); |
| | | aliases.put("nanhua", COMMON); |
| | | aliases.put("éç¨", COMMON); |
| | | aliases.put("åå¾·", SLTD); |
| | | aliases.put("sld", SLTD); |
| | | ALIASES = Collections.unmodifiableMap(aliases); |
| | | } |
| | | |
| | | private SatisfactionSites() { |
| | | } |
| | | |
| | | /** |
| | | * å½ä¸åç«ç¹æ è¯ï¼å»ç©ºç½ã转å°åãæå«åæ å°ï¼ç©ºå¼è¿å {@link #COMMON} |
| | | */ |
| | | public static String normalize(String site) { |
| | | if (site == null) { |
| | | return COMMON; |
| | | } |
| | | String key = site.trim().toLowerCase(java.util.Locale.ROOT); |
| | | if (key.isEmpty()) { |
| | | return COMMON; |
| | | } |
| | | String mapped = ALIASES.get(key); |
| | | return mapped == null ? key : mapped; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.service.strategy; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.satisfaction.domain.ServiceSubtaskDetailRatioExport; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * çç«åå¾·å£å¾çç»¼åæ»¡æåº¦å¾åçç¥ï¼äºæ¡£å æï¼ç¾åå¶ï¼ã |
| | | * <p> |
| | | * ç®æ³ä»å {@code ServiceSubtaskDetailController#calcMydScore} åå
¶ 4 ä¸ªç§æå©æ |
| | | * <b>åæ ·æ¬å
¥</b>ï¼ä¸è¡æªæ¹ï¼ä»
æè¿åå¼ç± {@code String} æ¹ä¸º {@link BigDecimal} 以便ç»ä¸çç¥ç¾åï¼ |
| | | * "æ ææé¡¹æ°"è¿ç±»æ
åµç±è¿å {@code null} 表达ï¼è°ç¨æ¹ä»åé为 {@code "0.00"}ï¼å¯¹å¤ç»æä¸åï¼ã |
| | | * <p> |
| | | * å£å¾ï¼ |
| | | * <pre> |
| | | * ç»¼åæ»¡æåº¦ = (徿»¡ææ°Ã1 + æ»¡ææ°Ã0.8 + ä¸è¬æ°Ã0.6 + 䏿»¡ææ°Ã0.4 + å¾ä¸æ»¡ææ°Ã0.2) |
| | | * / (äºæ¡£é¡¹æ°ä¹å) à 100%ï¼ä¿ç 2 ä½ |
| | | * </pre> |
| | | * <b>为ä»ä¹æéé¡¹ææ¡å¤æ¡£ãè䏿¯ç¨æç»ç {@code score} åæ®µ</b>ï¼ |
| | | * å岿°æ®é {@code score} æ {@code 0}ã{@code 0000000001} è¿ç±»èå¼ï¼ |
| | | * æ {@code score} ç®ä¼æå¾ååºå®æ 0 æ 100ã |
| | | * <p> |
| | | * è·³è¿çè¡ï¼å¤éè¡ï¼{@code valueType=2}ï¼ã以åãä¸éç¨ / æªç / æçãï¼ä¸å¨äºæ¡£éï¼ |
| | | * æ¢ä¸è¿ååä¹ä¸è¿åæ¯ï¼ã |
| | | */ |
| | | @Component |
| | | public class SltdSatisfactionScoreStrategy implements SatisfactionScoreStrategy { |
| | | |
| | | /** |
| | | * å¤éé¢çé®é¢ç±»å |
| | | */ |
| | | private static final String VALUE_TYPE_MULTIPLE = "2"; |
| | | |
| | | /** |
| | | * 满æåº¦äºæ¡£é项ï¼é¡ºåºä¸æé顺åºä¸è´ï¼ |
| | | */ |
| | | private static final String[] MYD_SCORE_OPTIONS = {"徿»¡æ", "满æ", "ä¸è¬", "䏿»¡æ", "å¾ä¸æ»¡æ"}; |
| | | |
| | | /** |
| | | * 满æåº¦äºæ¡£æéï¼å¾æ»¡æ 1ãæ»¡æ 0.8ãä¸è¬ 0.6ã䏿»¡æ 0.4ãå¾ä¸æ»¡æ 0.2 |
| | | */ |
| | | private static final BigDecimal[] MYD_SCORE_WEIGHTS = { |
| | | new BigDecimal("1"), new BigDecimal("0.8"), new BigDecimal("0.6"), new BigDecimal("0.4"), new BigDecimal("0.2")}; |
| | | |
| | | @Override |
| | | public String site() { |
| | | return SatisfactionSites.SLTD; |
| | | } |
| | | |
| | | @Override |
| | | public String siteName() { |
| | | return "çç«åå¾·å£å¾"; |
| | | } |
| | | |
| | | /** |
| | | * 计ç®ä¸éé¢ç满æåº¦ç»¼åå¾åï¼ç¾åå¶ï¼ä¿ç两ä½å°æ°ï¼ã |
| | | * |
| | | * @param exportList åä¸éé¢ç®çé项ç»è®¡æç» |
| | | * @return ç¾åå¶ç»¼åå¾åï¼æ ææé¡¹æ°æ¶è¿å {@code null}ï¼è°ç¨æ¹åç°ä¸º "0.00"ï¼ |
| | | */ |
| | | @Override |
| | | public BigDecimal comprehensiveScore(List<ServiceSubtaskDetailRatioExport> exportList) { |
| | | if (CollectionUtils.isEmpty(exportList)) return null; |
| | | |
| | | BigDecimal scoreSum = BigDecimal.ZERO; //ååï¼Î£(æ¡£ä½æé à 项æ°) |
| | | BigDecimal countSum = BigDecimal.ZERO; //忝ï¼äºæ¡£é¡¹æ°ä¹å |
| | | |
| | | for (ServiceSubtaskDetailRatioExport detail : exportList) { |
| | | //å¤éé¢ä¸è¡æ¯å¤ä¸ªé项çåå¼ä¹åï¼åæ¯åªç® 1 项ï¼ä¼æå¾åç®é«ï¼ä¸è®¡å
¥ç»¼åå¾å |
| | | if (VALUE_TYPE_MULTIPLE.equals(detail.getValueType())) continue; |
| | | //ãä¸éç¨ãä¸å¨å
¬å¼çäºæ¡£éï¼ä¸è®¡å
¥ç»¼åå¾å |
| | | if (isNotApplicable(detail)) continue; |
| | | |
| | | int optionIndex = mydScoreOptionIndex(detail.getOptionresult()); |
| | | BigDecimal count = parseDecimal(detail.getCount()); |
| | | if (optionIndex < 0 || count == null || count.signum() <= 0) continue; |
| | | |
| | | scoreSum = scoreSum.add(MYD_SCORE_WEIGHTS[optionIndex].multiply(count)); |
| | | countSum = countSum.add(count); |
| | | } |
| | | |
| | | if (countSum.signum() <= 0) return null; |
| | | |
| | | return scoreSum.divide(countSum, 6, RoundingMode.HALF_UP) |
| | | .multiply(BigDecimal.valueOf(100)) |
| | | .setScale(2, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | /** |
| | | * éé¡¹ææ¡ â æ»¡æåº¦äºæ¡£ä¸æ ï¼å¾æ»¡æ 0ãæ»¡æ 1ãä¸è¬ 2ã䏿»¡æ 3ãå¾ä¸æ»¡æ 4ï¼ï¼ä¸å¨äºæ¡£éè¿å -1 |
| | | */ |
| | | private int mydScoreOptionIndex(String optionresult) { |
| | | if (StringUtils.isEmpty(optionresult)) return -1; |
| | | String text = optionresult.trim(); |
| | | for (int i = 0; i < MYD_SCORE_OPTIONS.length; i++) { |
| | | if (MYD_SCORE_OPTIONS[i].equals(text)) return i; |
| | | } |
| | | //å
¼å®¹ãA 徿»¡æããB.满æãè¿ç±»å¸¦é项åºå·åç¼çå岿°æ® |
| | | if (text.length() > 2 && (text.charAt(1) == ' ' || text.charAt(1) == '.' || text.charAt(1) == 'ã')) { |
| | | String stripped = text.substring(2).trim(); |
| | | for (int i = 0; i < MYD_SCORE_OPTIONS.length; i++) { |
| | | if (MYD_SCORE_OPTIONS[i].equals(stripped)) return i; |
| | | } |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | /** |
| | | * æ¯å¦ãä¸éç¨ãé项 |
| | | */ |
| | | private boolean isNotApplicable(ServiceSubtaskDetailRatioExport detail) { |
| | | return containsNotApplicable(detail.getOptionresult()) || containsNotApplicable(detail.getTargetvalue()); |
| | | } |
| | | |
| | | private boolean containsNotApplicable(String optionText) { |
| | | if (StringUtils.isEmpty(optionText)) return false; |
| | | String text = optionText.trim(); |
| | | return text.contains("ä¸éç¨") || text.contains("æªç") || text.contains("æç"); |
| | | } |
| | | |
| | | /** |
| | | * å符串转 BigDecimalï¼ç©ºå¼/éæ³å¼è¿å null |
| | | */ |
| | | private BigDecimal parseDecimal(String value) { |
| | | if (StringUtils.isEmpty(value)) return null; |
| | | try { |
| | | return new BigDecimal(value.trim()); |
| | | } catch (NumberFormatException e) { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| ÎļþÃû´Ó smartor/src/main/java/com/smartor/common/MydOptionRatioChartBuilder.java ÐÞ¸Ä |
| | |
| | | package com.smartor.common; |
| | | package com.ruoyi.satisfaction.support; |
| | | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.smartor.domain.ServiceSubtaskDetailRatioExport; |
| | | import com.ruoyi.satisfaction.domain.ServiceSubtaskDetailRatioExport; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.util.CellRangeAddress; |
| | | import org.apache.poi.xddf.usermodel.chart.AxisCrosses; |
| | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 导åºãé®é¢è¯¦æ
å æ¯å¾è¡¨ãSheet çæå»ºå¨ |
| | | * 导åºãé®é¢è¯¦æ
å æ¯å¾è¡¨ãSheet çæå»ºå¨ã |
| | | * <p> |
| | | * æä»»å¡åç§°åç»ï¼æ¯ä¸ªä»»å¡åä¸åæ°æ®ï¼è¡=é¢ç®ï¼å=é项ï¼å¼=æ°éï¼ï¼å¹¶å¨æ°æ®å³ä¾§ç»ä¸å¼ æ±ç¶å¾ã |
| | | * <p> |
| | | * <b>è¿ç§»è¯´æ</b>ï¼å类为 {@code com.smartor.common.MydOptionRatioChartBuilder}ã |
| | | * å®å¤ççæ°æ®æ¯æ»¡æåº¦æ¨¡åç {@link ServiceSubtaskDetailRatioExport} |
| | | * ï¼å³"é®é¢è¯¦æ
å æ¯"ç»æè¡ï¼ï¼å±äºæ»¡æåº¦å¯¼åºé¾è·¯çä¸é¨åï¼ |
| | | * å æ¤é满æåº¦ä¸èµ·æ¬å
¥æ¬æ¨¡åãæ¬å®¶å<b>é»è¾ä¸è¡æªæ¹</b>ï¼åªè°æ´äºå
åä¸ importã |
| | | * <p> |
| | | * è°ç¨æ¹ï¼é访导åºç {@code ServiceSubtaskController#patItemExport}ï¼éè¿ |
| | | * {@code SatisfactionFacade#getQuestionOptionRatio} æ¿å°æ°æ®ååäº¤ç»æ¬ç±»ï¼ |
| | | * ä¸ç´æ¥æ¥è§¦æ»¡æåº¦æ¨¡åå
é¨ç Service / Mapperã |
| | | * |
| | | * @author smartor |
| | | */ |
| ÎļþÃû´Ó smartor/src/main/resources/mapper/smartor/PatSatisfactionMapper.xml ÐÞ¸Ä |
| | |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.smartor.mapper.PatSatisfactionMapper"> |
| | | <mapper namespace="com.ruoyi.satisfaction.mapper.PatSatisfactionMapper"> |
| | | |
| | | <resultMap type="com.smartor.domain.PatSatisfaction" id="PatSatisfactionResult"> |
| | | <resultMap type="com.ruoyi.satisfaction.domain.PatSatisfaction" id="PatSatisfactionResult"> |
| | | <result property="id" column="id"/> |
| | | <result property="patName" column="pat_name"/> |
| | | <result property="patCode" column="pat_code"/> |
| | |
| | | from pat_satisfaction |
| | | </sql> |
| | | |
| | | <select id="selectPatSatisfactionList" parameterType="com.smartor.domain.PatSatisfaction" |
| | | <select id="selectPatSatisfactionList" parameterType="com.ruoyi.satisfaction.domain.PatSatisfaction" |
| | | resultMap="PatSatisfactionResult"> |
| | | <include refid="selectPatSatisfactionVo"/> |
| | | where 1=1 |
| | |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertPatSatisfaction" parameterType="com.smartor.domain.PatSatisfaction"> |
| | | <insert id="insertPatSatisfaction" parameterType="com.ruoyi.satisfaction.domain.PatSatisfaction"> |
| | | insert into pat_satisfaction |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id, |
| | |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updatePatSatisfaction" parameterType="com.smartor.domain.PatSatisfaction"> |
| | | <update id="updatePatSatisfaction" parameterType="com.ruoyi.satisfaction.domain.PatSatisfaction"> |
| | | update pat_satisfaction |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="patName != null">pat_name = |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.satisfaction.mapper.SatisfactionMapper"> |
| | | <!-- |
| | | 满æåº¦ç»è®¡æ¥è¯¢ï¼åå + åå¾·å
±ç¨çæ°æ®è®¿é®å±ï¼ã |
| | | 忬æ£è½å¨ smartor ç ServiceSubtaskMapper.xml éï¼æ»¡æåº¦æ¨¡åååéä¸å°æ¤å¤ã |
| | | |
| | | 注æï¼ |
| | | 1) è¿äº SQL åªè¯» service_subtask / service_subtask_detail / service_taskï¼ä¸åä»»ä½åæä½ï¼ |
| | | 2) ä¸å¾ä½¿ç¨å
¨éå®ç±»åï¼ä¸ä¾èµ typeAliasesPackage å«åï¼ |
| | | 3) 忬ç¨äºæ¿æ¥ ServiceSubtask å®ä½ç selectSatisfactionSubtaskList ä¸ querySendCount 已确认 |
| | | 为æ»ä»£ç ï¼é¶è°ç¨ç¹ï¼å¹¶å é¤ï¼å æ¤æ¬æä»¶ä¸ä¾èµä»»ä½å
±äº« <sql> çæ®µã |
| | | --> |
| | | |
| | | <select id="selectSatisfactionSendCount" parameterType="com.ruoyi.satisfaction.domain.entity.SatisfactionStatQuery" |
| | | resultType="java.util.Map"> |
| | | select libtemplateid as libtemplateid, count(distinct id) as cnt |
| | | from service_subtask |
| | | where del_flag = 0 |
| | | <if test="orgid != null and orgid != ''"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | <if test="campusid != null and campusid != ''"> |
| | | and campusid = #{campusid} |
| | | </if> |
| | | <if test="type != null and type != ''">and type = #{type}</if> |
| | | <if test="startTime != null"> |
| | | and visit_time >= #{startTime} |
| | | </if> |
| | | <if test="endTime != null"> |
| | | and visit_time < date_add(#{endTime}, interval 1 day) |
| | | </if> |
| | | <if test="libTemplateIds != null and libTemplateIds.size() > 0"> |
| | | and libtemplateid IN |
| | | <foreach collection="libTemplateIds" item="libTemplateId" open="(" separator="," close=")"> |
| | | #{libTemplateId} |
| | | </foreach> |
| | | </if> |
| | | <if test="(hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0) or (deptcodes != null and deptcodes.size() > 0)"> |
| | | AND ( |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0"> |
| | | leavehospitaldistrictcode IN |
| | | <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="(" |
| | | separator="," |
| | | close=")"> |
| | | #{hospitaldistrictcode} |
| | | </foreach> |
| | | </if> |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0 and deptcodes != null and deptcodes.size() > 0"> |
| | | OR |
| | | </if> |
| | | <if test="deptcodes != null and deptcodes.size() > 0"> |
| | | deptcode IN |
| | | <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | ) |
| | | </if> |
| | | group by libtemplateid |
| | | </select> |
| | | |
| | | <select id="selectSatisfactionSubtaskTypes" parameterType="com.ruoyi.satisfaction.domain.vo.PatSatisfactionReqVO" |
| | | resultType="java.lang.String"> |
| | | select distinct type |
| | | from service_subtask |
| | | where del_flag = 0 |
| | | <if test="questionType != null">and type = #{questionType}</if> |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0"> |
| | | AND leavehospitaldistrictcode IN |
| | | <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="(" separator="," |
| | | close=")"> |
| | | #{hospitaldistrictcode} |
| | | </foreach> |
| | | </if> |
| | | <if test="deptcodes != null and deptcodes.size() > 0"> |
| | | AND deptcode IN |
| | | <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | <if test="serviceTypes != null and serviceTypes.size() > 0"> |
| | | AND service_type IN |
| | | <foreach collection="serviceTypes" item="serviceType" open="(" separator="," close=")"> |
| | | #{serviceType} |
| | | </foreach> |
| | | </if> |
| | | <if test="startTime != null and endTime != null"> |
| | | AND visit_time >= #{startTime} |
| | | AND visit_time < date_add(#{endTime}, interval 1 day) |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="mydTrend" resultType="com.ruoyi.satisfaction.domain.dto.MydTrendReqDTO"> |
| | | SELECT CASE #{type} |
| | | WHEN 'year' THEN DATE_FORMAT(d.create_time, '%Y') |
| | | WHEN 'quarter' THEN CONCAT(YEAR(d.create_time), '-Q', QUARTER(d.create_time)) |
| | | WHEN 'month' THEN DATE_FORMAT(d.create_time, '%Y-%m') |
| | | WHEN 'week' THEN FLOOR(DATEDIFF(d.create_time, #{startFinishTime}) / 7) + 1 |
| | | ELSE DATE_FORMAT(d.create_time, '%Y-%m-%d') |
| | | END AS period, |
| | | ROUND(avg(d.score), 2) AS totalScore |
| | | FROM service_subtask_detail d |
| | | JOIN service_task t ON d.taskid = t.taskid |
| | | WHERE t.service_type IN (14) |
| | | AND t.del_flag = 0 |
| | | AND d.del_flag = 0 |
| | | AND d.create_time >= #{startFinishTime} |
| | | AND d.create_time < DATE_ADD(#{endFinishTime}, INTERVAL 1 DAY) |
| | | GROUP BY period |
| | | ORDER BY period; |
| | | </select> |
| | | |
| | | <select id="sltdMydTotalByDimension" resultType="com.ruoyi.satisfaction.domain.dto.MydTrendReqDTO"> |
| | | SELECT |
| | | p.period, |
| | | dim.dimension, |
| | | IFNULL(ROUND(SUM(d.score), 2), 0) AS totalScore |
| | | FROM ( |
| | | <!-- çææ¥è¯¢èå´å
å®é
åºç°è¿çæ¶é´æ®µ --> |
| | | SELECT DISTINCT |
| | | CASE #{type} |
| | | WHEN 'year' THEN DATE_FORMAT(d.create_time, '%Y') |
| | | WHEN 'quarter' THEN CONCAT(YEAR(d.create_time), '-Q', QUARTER(d.create_time)) |
| | | WHEN 'month' THEN DATE_FORMAT(d.create_time, '%Y-%m') |
| | | WHEN 'week' THEN FLOOR(DATEDIFF(d.create_time, #{startFinishTime}) / 7) + 1 |
| | | ELSE DATE_FORMAT(d.create_time, '%Y-%m-%d') |
| | | END AS period |
| | | FROM service_subtask_detail d |
| | | WHERE d.del_flag = 0 |
| | | AND d.create_time >= #{startFinishTime} |
| | | AND d.create_time < #{endFinishTime} |
| | | ) p |
| | | CROSS JOIN ( |
| | | <!-- ææéè¦å±ç¤ºç dimension --> |
| | | SELECT DISTINCT dimension |
| | | FROM service_subtask_detail |
| | | WHERE del_flag = 0 |
| | | AND dimension IS NOT NULL |
| | | ) dim |
| | | LEFT JOIN service_task t |
| | | ON t.service_type IN (6, 14) |
| | | AND t.del_flag = 0 |
| | | LEFT JOIN service_subtask_detail d |
| | | ON d.taskid = t.taskid |
| | | AND d.del_flag = 0 |
| | | AND d.dimension = dim.dimension |
| | | AND CASE #{type} |
| | | WHEN 'year' THEN DATE_FORMAT(d.create_time, '%Y') |
| | | WHEN 'quarter' THEN CONCAT(YEAR(d.create_time), '-Q', QUARTER(d.create_time)) |
| | | WHEN 'month' THEN DATE_FORMAT(d.create_time, '%Y-%m') |
| | | WHEN 'week' THEN FLOOR(DATEDIFF(d.create_time, #{startFinishTime}) / 7) + 1 |
| | | ELSE DATE_FORMAT(d.create_time, '%Y-%m-%d') |
| | | END = p.period |
| | | AND d.create_time >= #{startFinishTime} |
| | | AND d.create_time < #{endFinishTime} |
| | | GROUP BY p.period, dim.dimension |
| | | ORDER BY p.period, dim.dimension |
| | | </select> |
| | | |
| | | <select id="sltdMydTotalByYQ" resultType="com.ruoyi.satisfaction.domain.dto.MydTrendReqDTO"> |
| | | SELECT p.period, |
| | | c.campusid, |
| | | IFNULL(ROUND(AVG(d.score), 2), 0) AS totalScore |
| | | FROM ( |
| | | -- çææ¥è¯¢èå´å
å®é
åºç°è¿çæ¶é´æ®µ |
| | | SELECT DISTINCT CASE #{type} |
| | | WHEN 'year' THEN DATE_FORMAT(d.create_time, '%Y') |
| | | WHEN 'quarter' THEN CONCAT(YEAR(d.create_time), '-Q', QUARTER(d.create_time)) |
| | | WHEN 'month' THEN DATE_FORMAT(d.create_time, '%Y-%m') |
| | | WHEN 'week' THEN FLOOR(DATEDIFF(d.create_time, #{startFinishTime}) / 7) + 1 |
| | | ELSE DATE_FORMAT(d.create_time, '%Y-%m-%d') |
| | | END AS period |
| | | FROM service_subtask_detail d |
| | | WHERE d.del_flag = 0 |
| | | AND d.create_time >= #{startFinishTime} |
| | | AND d.create_time < #{endFinishTime}) p |
| | | CROSS JOIN ( |
| | | -- ææéè¦å±ç¤ºçé¢åº |
| | | SELECT DISTINCT campusid |
| | | FROM service_task |
| | | WHERE service_type IN (6, 14) |
| | | AND del_flag = 0 |
| | | AND campusid IS NOT NULL) c |
| | | LEFT JOIN service_task t |
| | | ON t.campusid = c.campusid |
| | | AND t.service_type IN (6, 14) |
| | | AND t.del_flag = 0 |
| | | LEFT JOIN service_subtask_detail d |
| | | ON d.taskid = t.taskid |
| | | AND d.del_flag = 0 |
| | | AND CASE #{type} |
| | | WHEN 'year' THEN DATE_FORMAT(d.create_time, '%Y') |
| | | WHEN 'quarter' THEN CONCAT(YEAR(d.create_time), '-Q', QUARTER(d.create_time)) |
| | | WHEN 'month' THEN DATE_FORMAT(d.create_time, '%Y-%m') |
| | | WHEN 'week' THEN FLOOR(DATEDIFF(d.create_time, #{startFinishTime}) / 7) + 1 |
| | | ELSE DATE_FORMAT(d.create_time, '%Y-%m-%d') |
| | | END = p.period |
| | | AND d.create_time >= #{startFinishTime} |
| | | AND d.create_time < #{endFinishTime} |
| | | GROUP BY p.period, c.campusid |
| | | ORDER BY p.period, c.campusid; |
| | | </select> |
| | | |
| | | <select id="statMydQuestionOptionForExport" resultType="com.ruoyi.satisfaction.domain.dto.ServiceSubtaskOptionStatDTO"> |
| | | SELECT |
| | | t.taskid AS taskid, |
| | | t.task_name AS taskName, |
| | | d.questiontext AS questiontext, |
| | | d.asrtext AS optionresult, |
| | | d.targetvalue AS targetvalue, |
| | | d.value_type AS valueType, |
| | | COUNT(DISTINCT s.id) AS patientCount, |
| | | SUM(COALESCE(CAST(d.score AS DECIMAL(18,2)), 0)) AS scoreSum |
| | | FROM |
| | | service_task t |
| | | INNER JOIN service_subtask s ON s.taskid = t.taskid |
| | | INNER JOIN service_subtask_detail d ON d.sub_id = s.id |
| | | WHERE 1=1 |
| | | AND s.del_flag = '0' |
| | | AND d.del_flag = 0 |
| | | <if test="subtaskIds != null and subtaskIds.size() > 0"> |
| | | AND s.id IN |
| | | <foreach collection="subtaskIds" item="subtaskId" open="(" separator="," close=")"> |
| | | #{subtaskId} |
| | | </foreach> |
| | | </if> |
| | | <!-- ä¸ä¼ å任塿¶ç´æ¥æ¥ä¸å°æ°æ®ï¼é¿å
误ç»è®¡å
¨é --> |
| | | <if test="subtaskIds == null or subtaskIds.size() == 0"> |
| | | AND 1 = 0 |
| | | </if> |
| | | <if test="questiontext != null and questiontext != ''"> |
| | | AND d.questiontext LIKE CONCAT('%', #{questiontext}, '%') |
| | | </if> |
| | | <!-- å䏿£è
åä¸é¢ç®åªä¿çææ°ä¸æ¡ï¼éçä¸éå¤è®¡å
¥æ°é --> |
| | | AND d.id = ( |
| | | SELECT MAX(d2.id) |
| | | FROM service_subtask_detail d2 |
| | | WHERE d2.sub_id = d.sub_id |
| | | AND d2.questiontext <=> d.questiontext |
| | | AND d2.del_flag = '0' |
| | | ) |
| | | GROUP BY |
| | | t.taskid, |
| | | t.task_name, |
| | | d.questiontext, |
| | | d.asrtext, |
| | | d.targetvalue, |
| | | d.value_type |
| | | <!-- æä»»å¡åç§°åç»å±ç¤ºï¼å
ä»»å¡åç§°ãåä»»å¡ç¼å·ï¼åä¸ä»»å¡çé¢ç®/é项è¿ç»æå --> |
| | | ORDER BY |
| | | t.task_name, |
| | | t.taskid, |
| | | d.questiontext |
| | | </select> |
| | | |
| | | <select id="statQuestionOption" resultType="com.ruoyi.satisfaction.domain.ServiceSubtaskDetailRatioExport"> |
| | | SELECT |
| | | d.questiontext AS questiontext, |
| | | t.taskid AS taskid, |
| | | t.task_name AS taskName, |
| | | d.asrtext AS optionresult, |
| | | d.score AS score, |
| | | d.targetvalue AS targetvalue, |
| | | d.value_type AS valueType, |
| | | COUNT(*) AS count, |
| | | CONCAT(ROUND(COUNT(*) * 100.0 / t2.total_count, 2), '%') AS ratio |
| | | FROM |
| | | service_task t |
| | | INNER JOIN service_subtask s ON s.taskid = t.taskid |
| | | INNER JOIN service_subtask_detail d ON d.sub_id = s.id |
| | | INNER JOIN ( |
| | | SELECT |
| | | t.taskid, |
| | | d.questiontext, |
| | | COUNT(*) AS total_count |
| | | FROM |
| | | service_task t |
| | | INNER JOIN service_subtask s ON s.taskid = t.taskid |
| | | INNER JOIN service_subtask_detail d ON d.sub_id = s.id |
| | | WHERE 1=1 |
| | | <if test="taskIds != null and taskIds.size() > 0"> |
| | | AND t.taskid IN |
| | | <foreach collection="taskIds" item="taskId" open="(" separator="," close=")"> |
| | | #{taskId} |
| | | </foreach> |
| | | </if> |
| | | <!-- ä¼ äº subtaskIds åªç»è®¡è¿æ¹åä»»å¡ï¼æ¬æ¬¡å¯¼åºçæ£è
ï¼ --> |
| | | <if test="subtaskIds != null and subtaskIds.size() > 0"> |
| | | AND s.id IN |
| | | <foreach collection="subtaskIds" item="subtaskId" open="(" separator="," close=")"> |
| | | #{subtaskId} |
| | | </foreach> |
| | | </if> |
| | | <if test="valueType != null">AND d.value_type = #{valueType}</if> |
| | | <if test="scoreStart != null">AND d.score >= #{scoreStart}</if> |
| | | <if test="scoreEnd != null">AND d.score <= #{scoreEnd}</if> |
| | | <if test="questiontext != null and questiontext != ''">and d.questiontext like concat('%', #{questiontext}, |
| | | '%') |
| | | </if> |
| | | and s.sendstate=6 |
| | | and d.del_flag=0 |
| | | <!-- 忝å¿
é¡»åæç»ç¨åä¸å¥æ¶é´æ¡ä»¶ï¼å¦åéäºæ¶é´èå´åæ¯ä¾ä¼æå
¨éåå²è¢«ç¨é --> |
| | | <if test="startOutHospTime != null"> |
| | | AND date_format(s.endtime,'%y%m%d') >= date_format(#{startOutHospTime},'%y%m%d') |
| | | </if> |
| | | <if test="endOutHospTime != null"> |
| | | AND date_format(s.endtime,'%y%m%d') <= date_format(#{endOutHospTime},'%y%m%d') |
| | | </if> |
| | | <if test="startFinishTime != null"> |
| | | AND date_format(s.finishtime,'%y%m%d') >= date_format(#{startFinishTime},'%y%m%d') |
| | | </if> |
| | | <if test="endFinishTime != null"> |
| | | AND date_format(s.finishtime,'%y%m%d') <= date_format(#{endFinishTime},'%y%m%d') |
| | | </if> |
| | | GROUP BY |
| | | t.taskid, |
| | | d.questiontext |
| | | ) t2 ON t2.taskid = t.taskid AND t2.questiontext = d.questiontext |
| | | WHERE 1=1 |
| | | <if test="taskIds != null and taskIds.size() > 0"> |
| | | AND t.taskid IN |
| | | <foreach collection="taskIds" item="taskId" open="(" separator="," close=")"> |
| | | #{taskId} |
| | | </foreach> |
| | | </if> |
| | | <if test="subtaskIds != null and subtaskIds.size() > 0"> |
| | | AND s.id IN |
| | | <foreach collection="subtaskIds" item="subtaskId" open="(" separator="," close=")"> |
| | | #{subtaskId} |
| | | </foreach> |
| | | </if> |
| | | <if test="valueType != null">AND d.value_type = #{valueType}</if> |
| | | <if test="scoreStart != null">AND d.score >= #{scoreStart}</if> |
| | | <if test="scoreEnd != null">AND d.score <= #{scoreEnd}</if> |
| | | <if test="questiontext != null and questiontext != ''">and d.questiontext like concat('%', #{questiontext}, |
| | | '%') |
| | | </if> |
| | | AND s.sendstate = 6 |
| | | and d.del_flag=0 |
| | | <if test="startOutHospTime != null"> |
| | | AND date_format(s.endtime,'%y%m%d') >= date_format(#{startOutHospTime},'%y%m%d') |
| | | </if> |
| | | <if test="endOutHospTime != null"> |
| | | AND date_format(s.endtime,'%y%m%d') <= date_format(#{endOutHospTime},'%y%m%d') |
| | | </if> |
| | | <if test="startFinishTime != null"> |
| | | AND date_format(s.finishtime,'%y%m%d') >= date_format(#{startFinishTime},'%y%m%d') |
| | | </if> |
| | | <if test="endFinishTime != null"> |
| | | AND date_format(s.finishtime,'%y%m%d') <= date_format(#{endFinishTime},'%y%m%d') |
| | | </if> |
| | | GROUP BY |
| | | t.taskid, |
| | | d.questiontext, |
| | | d.score, |
| | | d.targetvalue, |
| | | d.asrtext, |
| | | d.value_type |
| | | ORDER BY |
| | | d.questiontext, |
| | | t.taskid |
| | | </select> |
| | | |
| | | <select id="statQuestionOptionBySubtaskIds" resultType="com.ruoyi.satisfaction.domain.ServiceSubtaskDetailRatioExport"> |
| | | SELECT |
| | | d.questiontext AS questiontext, |
| | | <!-- æç»å·²æãé¢ç® + éé¡¹ãæ±æ»ï¼ä»»å¡/ç§å®¤/ç
åºåªæ¯é带信æ¯ï¼å¿
é¡»ç¨èå彿°åå¼ï¼MySQL ONLY_FULL_GROUP_BYï¼ --> |
| | | MAX(t.taskid) AS taskid, |
| | | MAX(t.task_name) AS taskName, |
| | | d.asrtext AS optionresult, |
| | | d.score AS score, |
| | | MAX(s.deptcode) AS deptcode, |
| | | MAX(s.deptname) AS deptname, |
| | | MAX(s.leavehospitaldistrictcode) AS leavehospitaldistrictcode, |
| | | MAX(s.leavehospitaldistrictname) AS leavehospitaldistrictname, |
| | | d.targetvalue AS targetvalue, |
| | | d.value_type AS valueType, |
| | | COUNT(*) AS count, |
| | | CONCAT(ROUND(COUNT(*) * 100.0 / t2.total_count, 2), '%') AS ratio |
| | | FROM |
| | | service_task t |
| | | INNER JOIN service_subtask s ON s.taskid = t.taskid |
| | | INNER JOIN service_subtask_detail d ON d.sub_id = s.id |
| | | <!-- å»éï¼åä¸åä»»å¡åä¸é¢ç®åªä¿çææ°ä¸æ¡ï¼é¿å
éç/éå¤åè°æåä¸éé¢éå¤è®¡å
¥é¡¹æ°ï¼ä¸ mzMydScoreRank å£å¾ä¸è´ï¼ --> |
| | | AND d.id = ( |
| | | SELECT MAX(d2.id) |
| | | FROM service_subtask_detail d2 |
| | | WHERE d2.sub_id = d.sub_id |
| | | AND d2.questiontext <=> d.questiontext |
| | | AND d2.del_flag = '0' |
| | | ) |
| | | INNER JOIN ( |
| | | <!-- 忝 = 该é¢åé项项æ°ä¹åï¼æªä½çç空 asrtext ä¸è¿åæ¯ï¼ï¼è¿æ ·ä¸éé¢åé项æ¯ä¾åè®¡ææ¯ 100% --> |
| | | SELECT |
| | | x.questiontext AS questiontext, |
| | | SUM(x.option_count) AS total_count |
| | | FROM ( |
| | | SELECT |
| | | d.questiontext, |
| | | d.asrtext, |
| | | COUNT(*) AS option_count |
| | | FROM |
| | | service_task t |
| | | INNER JOIN service_subtask s ON s.taskid = t.taskid |
| | | INNER JOIN service_subtask_detail d ON d.sub_id = s.id |
| | | <!-- å»éï¼åæ¯ï¼è¯¥é¢ææçå·æ»æ°ï¼ä¸æç»å£å¾ä¿æä¸è´ï¼ä¿è¯åé项æ¯ä¾å计 100% --> |
| | | AND d.id = ( |
| | | SELECT MAX(d4.id) |
| | | FROM service_subtask_detail d4 |
| | | WHERE d4.sub_id = d.sub_id |
| | | AND d4.questiontext <=> d.questiontext |
| | | AND d4.del_flag = '0' |
| | | ) |
| | | WHERE 1=1 |
| | | <if test="subtaskIds != null and subtaskIds.size() > 0"> |
| | | AND s.id IN |
| | | <foreach collection="subtaskIds" item="subtaskId" open="(" separator="," close=")"> |
| | | #{subtaskId} |
| | | </foreach> |
| | | </if> |
| | | <if test="valueType != null">AND d.value_type >= #{valueType}</if> |
| | | <if test="scoreStart != null">AND d.score >= #{scoreStart}</if> |
| | | <if test="scoreEnd != null">AND d.score <= #{scoreEnd}</if> |
| | | <if test="questiontext != null and questiontext != ''">and d.questiontext like concat('%', #{questiontext}, |
| | | '%') |
| | | </if> |
| | | AND s.sendstate = 6 |
| | | AND d.del_flag=0 |
| | | <!-- 忝䏿ç»ç¨åä¸å¥æ¶é´æ¡ä»¶ï¼å¦åéäºæ¥æåºé´ååé项æ¯ä¾å计ä¸å° 100% --> |
| | | <if test="startOutHospTime != null"> |
| | | AND date_format(s.endtime,'%y%m%d') >= date_format(#{startOutHospTime},'%y%m%d') |
| | | </if> |
| | | <if test="endOutHospTime != null"> |
| | | AND date_format(s.endtime,'%y%m%d') <= date_format(#{endOutHospTime},'%y%m%d') |
| | | </if> |
| | | <if test="startFinishTime != null"> |
| | | AND date_format(s.finishtime,'%y%m%d') >= date_format(#{startFinishTime},'%y%m%d') |
| | | </if> |
| | | <if test="endFinishTime != null"> |
| | | AND date_format(s.finishtime,'%y%m%d') <= date_format(#{endFinishTime},'%y%m%d') |
| | | </if> |
| | | <!-- æªä½çï¼asrtext 为空ï¼çæç»ä¸è®¡å
¥åæ¯ --> |
| | | AND d.asrtext IS NOT NULL AND TRIM(d.asrtext) <> '' |
| | | GROUP BY d.questiontext, d.asrtext |
| | | ) x |
| | | GROUP BY x.questiontext |
| | | ) t2 ON t2.questiontext = d.questiontext |
| | | WHERE 1=1 |
| | | <!-- å»éï¼æç»è¡åä¸åä»»å¡åä¸é¢ç®åªä¿çææ°ä¸æ¡ï¼éçä¸éå¤è®¡å
¥é¡¹æ° --> |
| | | AND d.id = ( |
| | | SELECT MAX(d3.id) |
| | | FROM service_subtask_detail d3 |
| | | WHERE d3.sub_id = d.sub_id |
| | | AND d3.questiontext <=> d.questiontext |
| | | AND d3.del_flag = '0' |
| | | ) |
| | | <if test="subtaskIds != null and subtaskIds.size() > 0"> |
| | | AND s.id IN |
| | | <foreach collection="subtaskIds" item="subtaskId" open="(" separator="," close=")"> |
| | | #{subtaskId} |
| | | </foreach> |
| | | </if> |
| | | AND s.sendstate = 6 |
| | | AND d.del_flag=0 |
| | | <!-- æªä½çï¼asrtext 为空ï¼ä¸ç®ä»»ä½éé¡¹ï¼æç»éç´æ¥æé¤ï¼é¿å
åºç°ç©ºéé¡¹è¡ --> |
| | | AND d.asrtext IS NOT NULL AND TRIM(d.asrtext) <> '' |
| | | <if test="valueType != null">AND d.value_type >= #{valueType}</if> |
| | | <if test="scoreStart != null">AND d.score >= #{scoreStart}</if> |
| | | <if test="scoreEnd != null">AND d.score <= #{scoreEnd}</if> |
| | | <if test="questiontext != null and questiontext != ''">and d.questiontext like concat('%', #{questiontext}, |
| | | '%') |
| | | </if> |
| | | <if test="startOutHospTime != null"> |
| | | AND date_format(s.endtime,'%y%m%d') >= date_format(#{startOutHospTime},'%y%m%d') |
| | | </if> |
| | | <if test="endOutHospTime != null"> |
| | | AND date_format(s.endtime,'%y%m%d') <= date_format(#{endOutHospTime},'%y%m%d') |
| | | </if> |
| | | <if test="startFinishTime != null"> |
| | | AND date_format(s.finishtime,'%y%m%d') >= date_format(#{startFinishTime},'%y%m%d') |
| | | </if> |
| | | <if test="endFinishTime != null"> |
| | | AND date_format(s.finishtime,'%y%m%d') <= date_format(#{endFinishTime},'%y%m%d') |
| | | </if> |
| | | <!-- åªæãé¢ç® + éé¡¹ãæ±æ»ï¼åæ¥ GROUP BY å¸¦ä¸ taskid/ç§å®¤/ç
åºï¼åä¸ä¸ªé项被ææå¤è¡ãæ¯è¡æ°é齿¯ 1ï¼ |
| | | å端/å¯¼åºæ¿å°çãæ°éã就永è¿åä¸äºç´¯å --> |
| | | GROUP BY |
| | | d.questiontext, |
| | | d.asrtext, |
| | | d.score, |
| | | d.targetvalue, |
| | | d.value_type |
| | | ORDER BY |
| | | d.questiontext, |
| | | MIN(t.taskid) |
| | | </select> |
| | | |
| | | <select id="statQuestionOptionByKsOrBq" resultType="com.ruoyi.satisfaction.domain.dto.QuestionCountKsOrBqDTO" |
| | | parameterType="com.ruoyi.satisfaction.domain.vo.QuestionCountKsOrBqVO"> |
| | | SELECT |
| | | s.deptname AS deptname, |
| | | s.leavehospitaldistrictname AS leavehospitaldistrictname, |
| | | d.questiontext AS questionText, |
| | | d.targetvalue AS targetvalue, -- ææéé¡¹æ¼æ¥ |
| | | d.asrtext AS asrtext, -- ç¨æ·å®é
éä¸çé项 |
| | | d.score AS singleScore -- åæ¡è®°å½çåæ° |
| | | FROM service_subtask_detail d |
| | | JOIN service_subtask s ON d.sub_id = s.id |
| | | WHERE s.del_flag = 0 |
| | | AND d.del_flag = 0 |
| | | AND s.service_type IN ('6', '14') |
| | | <if test="taskTemplateid != null"> |
| | | AND s.templateid = #{taskTemplateid} |
| | | </if> |
| | | <if test="endFinishTime != null"> |
| | | AND d.create_time < #{endFinishTime} |
| | | </if> |
| | | <if test="startFinishTime != null"> |
| | | AND d.create_time >= #{startFinishTime} |
| | | </if> |
| | | <if test="deptOrDistrict ==1"> |
| | | <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0"> |
| | | AND leavehospitaldistrictcode IN |
| | | <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" |
| | | separator="," |
| | | close=")"> |
| | | #{leavehospitaldistrictcode} |
| | | </foreach> |
| | | </if> |
| | | <if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0"> |
| | | AND deptcode IN |
| | | <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator="," |
| | | close=")"> |
| | | #{leaveldeptcode} |
| | | </foreach> |
| | | </if> |
| | | </if> |
| | | <if test="deptOrDistrict ==2"> |
| | | <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0"> |
| | | AND leavehospitaldistrictcode IN |
| | | <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" |
| | | separator="," |
| | | close=")"> |
| | | #{leavehospitaldistrictcode} |
| | | </foreach> |
| | | </if> |
| | | <if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0"> |
| | | OR deptcode IN |
| | | <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator="," |
| | | close=")"> |
| | | #{leaveldeptcode} |
| | | </foreach> |
| | | </if> |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectMzMydScoreRank" parameterType="com.ruoyi.satisfaction.domain.vo.MzMydScoreRankVO" |
| | | resultType="com.ruoyi.satisfaction.domain.dto.MzMydScoreRankDTO"> |
| | | SELECT |
| | | t.code AS code, |
| | | t.name AS name, |
| | | ROUND(AVG(t.w) * 100, 2) AS score, |
| | | COUNT(*) AS itemCount |
| | | FROM ( |
| | | SELECT |
| | | <choose> |
| | | <when test='dimensionType == "2"'> |
| | | s.leavehospitaldistrictcode AS code, |
| | | s.leavehospitaldistrictname AS name, |
| | | </when> |
| | | <otherwise> |
| | | s.deptcode AS code, |
| | | s.deptname AS name, |
| | | </otherwise> |
| | | </choose> |
| | | CAST(d.score AS DECIMAL(10,4)) AS w |
| | | FROM service_subtask s |
| | | INNER JOIN service_subtask_detail d ON d.sub_id = s.id |
| | | WHERE s.del_flag = '0' |
| | | AND d.del_flag = '0' |
| | | AND s.sendstate = 6 |
| | | <if test="serviceTypes != null and serviceTypes.size() > 0"> |
| | | AND service_type IN |
| | | <foreach collection="serviceTypes" item="serviceType" open="(" separator="," |
| | | close=")"> |
| | | #{serviceType} |
| | | </foreach> |
| | | </if> |
| | | <!-- <!– åªåå
¬å¼éçäºæ¡£æéï¼ç©ºå¼/0/æªççæ¢ä¸è¿ååä¹ä¸è¿åæ¯ –>--> |
| | | <!-- AND CAST(d.score AS DECIMAL(10,4)) IN (1, 0.8, 0.6, 0.4, 0.2)--> |
| | | <!-- åä¸åä»»å¡åä¸é¢ç®åªä¿çææ°ä¸æ¡ï¼é¿å
éç被éå¤è®¡å
¥é¡¹æ° --> |
| | | AND d.id = ( |
| | | SELECT MAX(d2.id) |
| | | FROM service_subtask_detail d2 |
| | | WHERE d2.sub_id = d.sub_id |
| | | AND d2.questiontext <=> d.questiontext |
| | | AND d2.del_flag = '0' |
| | | ) |
| | | <if test="orgid != null and orgid != ''"> |
| | | AND s.orgid = #{orgid} |
| | | </if> |
| | | <if test="campusid != null and campusid != ''"> |
| | | AND s.campusid = #{campusid} |
| | | </if> |
| | | <if test="startFinishTime != null"> |
| | | AND s.finishtime >= #{startFinishTime} |
| | | </if> |
| | | <if test="endFinishTime != null"> |
| | | AND s.finishtime < DATE_ADD(#{endFinishTime}, INTERVAL 1 DAY) |
| | | </if> |
| | | <if test="questionText != null and questionText != ''">and d.questiontext like concat('%', #{questionText}, |
| | | '%') |
| | | </if> |
| | | <choose> |
| | | <when test='dimensionType == "2"'> |
| | | AND s.leavehospitaldistrictcode IS NOT NULL AND s.leavehospitaldistrictcode <> '' |
| | | AND s.leavehospitaldistrictname IS NOT NULL AND s.leavehospitaldistrictname <> '' |
| | | <if test="districtCodes != null and districtCodes.size() > 0"> |
| | | AND s.leavehospitaldistrictcode IN |
| | | <foreach collection="districtCodes" item="districtCode" open="(" separator="," close=")"> |
| | | #{districtCode} |
| | | </foreach> |
| | | </if> |
| | | </when> |
| | | <otherwise> |
| | | AND s.deptcode IS NOT NULL AND s.deptcode <> '' |
| | | AND s.deptname IS NOT NULL AND s.deptname <> '' |
| | | <if test="deptCodes != null and deptCodes.size() > 0"> |
| | | AND s.deptcode IN |
| | | <foreach collection="deptCodes" item="deptCode" open="(" separator="," close=")"> |
| | | #{deptCode} |
| | | </foreach> |
| | | </if> |
| | | </otherwise> |
| | | </choose> |
| | | ) t |
| | | GROUP BY t.code, t.name |
| | | ORDER BY AVG(t.w) DESC, COUNT(*) DESC |
| | | <if test="limit != null and limit > 0"> |
| | | LIMIT #{limit} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectSatisfactionFillStat" parameterType="com.ruoyi.satisfaction.domain.entity.SatisfactionStatQuery" |
| | | resultType="java.util.Map"> |
| | | select ss.libtemplateid as libtemplateid, |
| | | ssd.questiontext as questiontext, |
| | | ssd.score as score, |
| | | count(*) as cnt |
| | | from service_subtask_detail ssd |
| | | join service_subtask ss on ss.id = ssd.sub_id |
| | | where ssd.del_flag = 0 |
| | | and ss.del_flag = 0 |
| | | <if test="orgid != null and orgid != ''"> |
| | | and ss.orgid = #{orgid} |
| | | </if> |
| | | <if test="campusid != null and campusid != ''"> |
| | | and ss.campusid = #{campusid} |
| | | </if> |
| | | <if test="type != null and type != ''">and ss.type = #{type}</if> |
| | | <if test="startTime != null"> |
| | | and ss.visit_time >= #{startTime} |
| | | </if> |
| | | <if test="endTime != null"> |
| | | and ss.visit_time < date_add(#{endTime}, interval 1 day) |
| | | </if> |
| | | <if test="libTemplateIds != null and libTemplateIds.size() > 0"> |
| | | and ss.libtemplateid IN |
| | | <foreach collection="libTemplateIds" item="libTemplateId" open="(" separator="," close=")"> |
| | | #{libTemplateId} |
| | | </foreach> |
| | | </if> |
| | | <if test="(hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0) or (deptcodes != null and deptcodes.size() > 0)"> |
| | | AND ( |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0"> |
| | | ss.leavehospitaldistrictcode IN |
| | | <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="(" |
| | | separator="," |
| | | close=")"> |
| | | #{hospitaldistrictcode} |
| | | </foreach> |
| | | </if> |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0 and deptcodes != null and deptcodes.size() > 0"> |
| | | OR |
| | | </if> |
| | | <if test="deptcodes != null and deptcodes.size() > 0"> |
| | | ss.deptcode IN |
| | | <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | ) |
| | | </if> |
| | | group by ss.libtemplateid, ssd.questiontext, ssd.score |
| | | </select> |
| | | |
| | | <select id="selectSatisfactionFillStatByMatchedtext" parameterType="com.ruoyi.satisfaction.domain.entity.SatisfactionStatQuery" |
| | | resultType="java.util.Map"> |
| | | select ss.libtemplateid as libtemplateid, |
| | | ssd.questiontext as questiontext, |
| | | ssd.matchedtext as matchedtext, |
| | | ssd.score as score, |
| | | count(*) as cnt, |
| | | min(ssd.targetvalue) as targetvalue |
| | | from service_subtask_detail ssd |
| | | join service_subtask ss on ss.id = ssd.sub_id |
| | | where ssd.del_flag = 0 |
| | | and ss.del_flag = 0 |
| | | <if test="orgid != null and orgid != ''"> |
| | | and ss.orgid = #{orgid} |
| | | </if> |
| | | <if test="campusid != null and campusid != ''"> |
| | | and ss.campusid = #{campusid} |
| | | </if> |
| | | <if test="type != null and type != ''">and ss.type = #{type}</if> |
| | | <if test="startTime != null"> |
| | | and ss.visit_time >= #{startTime} |
| | | </if> |
| | | <if test="endTime != null"> |
| | | and ss.visit_time < date_add(#{endTime}, interval 1 day) |
| | | </if> |
| | | <if test="libTemplateIds != null and libTemplateIds.size() > 0"> |
| | | and ss.libtemplateid IN |
| | | <foreach collection="libTemplateIds" item="libTemplateId" open="(" separator="," close=")"> |
| | | #{libTemplateId} |
| | | </foreach> |
| | | </if> |
| | | <if test="(hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0) or (deptcodes != null and deptcodes.size() > 0)"> |
| | | AND ( |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0"> |
| | | ss.leavehospitaldistrictcode IN |
| | | <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="(" |
| | | separator="," |
| | | close=")"> |
| | | #{hospitaldistrictcode} |
| | | </foreach> |
| | | </if> |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0 and deptcodes != null and deptcodes.size() > 0"> |
| | | OR |
| | | </if> |
| | | <if test="deptcodes != null and deptcodes.size() > 0"> |
| | | ss.deptcode IN |
| | | <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | ) |
| | | </if> |
| | | group by ss.libtemplateid, ssd.questiontext, ssd.matchedtext, ssd.score |
| | | </select> |
| | | |
| | | <select id="selectSatisfactionFillPersonCount" parameterType="com.ruoyi.satisfaction.domain.entity.SatisfactionStatQuery" |
| | | resultType="java.util.Map"> |
| | | select ss.libtemplateid as libtemplateid, |
| | | count(distinct ssd.sub_id) as cnt |
| | | from service_subtask_detail ssd |
| | | join service_subtask ss on ss.id = ssd.sub_id |
| | | where ssd.del_flag = 0 |
| | | and ss.del_flag = 0 |
| | | <if test="orgid != null and orgid != ''"> |
| | | and ss.orgid = #{orgid} |
| | | </if> |
| | | <if test="campusid != null and campusid != ''"> |
| | | and ss.campusid = #{campusid} |
| | | </if> |
| | | <if test="type != null and type != ''">and ss.type = #{type}</if> |
| | | <if test="startTime != null"> |
| | | and ss.visit_time >= #{startTime} |
| | | </if> |
| | | <if test="endTime != null"> |
| | | and ss.visit_time < date_add(#{endTime}, interval 1 day) |
| | | </if> |
| | | <if test="libTemplateIds != null and libTemplateIds.size() > 0"> |
| | | and ss.libtemplateid IN |
| | | <foreach collection="libTemplateIds" item="libTemplateId" open="(" separator="," close=")"> |
| | | #{libTemplateId} |
| | | </foreach> |
| | | </if> |
| | | <if test="(hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0) or (deptcodes != null and deptcodes.size() > 0)"> |
| | | AND ( |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0"> |
| | | ss.leavehospitaldistrictcode IN |
| | | <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="(" |
| | | separator="," |
| | | close=")"> |
| | | #{hospitaldistrictcode} |
| | | </foreach> |
| | | </if> |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0 and deptcodes != null and deptcodes.size() > 0"> |
| | | OR |
| | | </if> |
| | | <if test="deptcodes != null and deptcodes.size() > 0"> |
| | | ss.deptcode IN |
| | | <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | ) |
| | | </if> |
| | | group by ss.libtemplateid |
| | | </select> |
| | | <!-- ================================================ éå¤æç»æ¸
çï¼æ»¡æåº¦ç»è®¡åç½®ï¼ |
| | | åå± ServiceSubtaskDetailMapper.xmlï¼åªææ»¡æåº¦ç»è®¡è°ç¨ï¼å·²æ ¸å®ï¼ï¼æ
ä¸å¹¶æ¬å
¥ã |
| | | 注æ deleteRepeatDetailByIds æ¯ãåæä½ãï¼æ id é»è¾å é¤é夿ç»ï¼del_flag=1ï¼ã --> |
| | | |
| | | <select id="selectRepeatDetailIds" resultType="Long"> |
| | | SELECT d1.id |
| | | FROM service_subtask_detail d1 |
| | | INNER JOIN ( |
| | | SELECT sub_id, questiontext, |
| | | MAX(create_time) AS max_create_time, |
| | | MAX(id) AS keep_id |
| | | FROM service_subtask_detail |
| | | WHERE del_flag = 0 |
| | | GROUP BY sub_id, questiontext |
| | | HAVING COUNT(*) > 1 |
| | | ) d2 ON d1.sub_id = d2.sub_id |
| | | AND d1.questiontext = d2.questiontext |
| | | AND ( |
| | | d1.create_time < d2.max_create_time |
| | | OR (d1.create_time = d2.max_create_time AND d1.id < d2.keep_id) |
| | | ) |
| | | WHERE d1.del_flag = 0 |
| | | </select> |
| | | |
| | | <update id="deleteRepeatDetailByIds"> |
| | | UPDATE service_subtask_detail |
| | | SET del_flag = 1 |
| | | WHERE del_flag = 0 |
| | | AND id IN |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </update> |
| | | <!-- ================================================ åä»»å¡ï¼æ»¡æåº¦ç»è®¡åæ°ï¼ |
| | | 对åºå getServiceSubtasks â selectServiceSubtaskList 䏿»¡æåº¦å®é
ç¨å°çå£å¾ã |
| | | åææ é»è®¤æåº/å页ï¼è¿éåæ ·ä¸å ãä»
å idãtaskid 两åã --> |
| | | <select id="selectMydSubtaskRefs" |
| | | resultType="com.ruoyi.satisfaction.domain.row.SatisfactionSubtaskRef"> |
| | | SELECT id, taskid |
| | | FROM service_subtask |
| | | WHERE del_flag = 0 |
| | | <if test="q.orgid != null and q.orgid != ''"> |
| | | AND orgid = #{q.orgid} |
| | | </if> |
| | | <if test="q.campusid != null and q.campusid != ''"> |
| | | AND campusid = #{q.campusid} |
| | | </if> |
| | | <if test="q.serviceType != null"> |
| | | AND service_type = #{q.serviceType} |
| | | </if> |
| | | <if test="q.startOutHospTime != null"> |
| | | AND date_format(endtime,'%y%m%d') >= date_format(#{q.startOutHospTime},'%y%m%d') |
| | | </if> |
| | | <if test="q.endOutHospTime != null"> |
| | | AND date_format(endtime,'%y%m%d') <= date_format(#{q.endOutHospTime},'%y%m%d') |
| | | </if> |
| | | <if test="q.deptOrDistrict==1"> |
| | | <if test="q.leavehospitaldistrictcodes != null and q.leavehospitaldistrictcodes.size() > 0"> |
| | | AND leavehospitaldistrictcode IN |
| | | <foreach collection="q.leavehospitaldistrictcodes" item="districtcode" open="(" separator="," close=")"> |
| | | #{districtcode} |
| | | </foreach> |
| | | </if> |
| | | </if> |
| | | <if test="q.leaveldeptcodes != null and q.leaveldeptcodes.size() > 0"> |
| | | AND deptcode IN |
| | | <foreach collection="q.leaveldeptcodes" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- ================================================================ |
| | | éè®¿ãæ»¡æåº¦ææ°ãåæ°ï¼å ServiceSubtaskServiceImpl#getSatisfactionIndex ç¨å°ç 5 æ¡æ¥è¯¢ï¼ |
| | | |
| | | åå®ç°ä¾æ¬¡è°ç¨äº 5 个ä¸å模åç statementï¼ |
| | | ServiceTaskMapper.selectServiceTaskList |
| | | IvrTaskTemplateScriptMapper.selectIvrTaskTemplateScriptList |
| | | SvyTaskTemplateScriptMapper.selectSvyTaskTemplateScriptList |
| | | ServiceSubtaskMapper.selectServiceSubtaskBySendstate |
| | | ServiceSubtaskDetailMapper.selectServiceSubtaskDetailList |
| | | è°ç¨æ¹åªç¨å°å®ä»¬ç size()/è¥å¹²å段ï¼å æ¤è¿éåå䏿¡ãçä»·ä¸ç²¾ç®ãçæ¥è¯¢ï¼ |
| | | - åªä¿çè°ç¨æ¹çæ£è®¾ç½®è¿çæ¡ä»¶ï¼éæ¡å¯¹ç
§å statement ç <if>ï¼ï¼ |
| | | - 计æ°åºæ¯ç´æ¥ç¨ count(*)ï¼ä¸ Java ä¾§ .size() å®å
¨çä»·ï¼ï¼ |
| | | - ç¨å°ç service_task / ivr_task_template_script / svy_task_template_script |
| | | æ¯ãé访任å¡ä¸æ¨¡æ¿ãè¡¨ï¼æ¬æ¨¡å对å®ä»¬åªåãåªè¯»ãæ¥è¯¢ï¼ä¸åã |
| | | ================================================================ --> |
| | | |
| | | <!-- åï¼ServiceTaskMapper.selectServiceTaskList |
| | | è°ç¨æ¹åªè®¾äº (deptcode + orgid) æ (leavehospitaldistrictcode + orgid)ï¼ |
| | | 两è
äºæ¥ï¼æä»¥ä¸æ¡ SQL è¦ç忥çä¸¤ä¸ªåæ¯ã |
| | | 注æ REGEXP çåæ³ä¸å statement éåä¸è´ï¼å¹é
éå·åéçç¼ç 串ï¼ã --> |
| | | <select id="selectSatisfactionServiceTasks" |
| | | resultType="com.ruoyi.satisfaction.domain.row.SatisfactionTaskRow"> |
| | | select taskid, |
| | | templateid, |
| | | type, |
| | | orgid |
| | | from service_task |
| | | where 1=1 |
| | | and del_flag = 0 |
| | | <if test="deptcode != null and deptcode != ''"> |
| | | and deptcode REGEXP CONCAT('(^|,)', #{deptcode}, '(,|$)') |
| | | </if> |
| | | <if test="leavehospitaldistrictcode != null and leavehospitaldistrictcode != ''"> |
| | | and leavehospitaldistrictcode REGEXP CONCAT('(^|,)', #{leavehospitaldistrictcode}, '(,|$)') |
| | | </if> |
| | | <if test="orgid != null and orgid != ''"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | order by update_time desc, taskid desc |
| | | </select> |
| | | |
| | | <!-- åï¼IvrTaskTemplateScriptMapper.selectIvrTaskTemplateScriptListï¼åªç¨å° 3 个æ¡ä»¶ï¼ --> |
| | | <select id="countIvrTaskTemplateScripts" resultType="int"> |
| | | select count(*) |
| | | from ivr_task_template_script |
| | | where 1=1 |
| | | and del_flag = 0 |
| | | <if test="templateID != null"> |
| | | and templateID = #{templateID} |
| | | </if> |
| | | <if test="orgid != null and orgid != ''"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | <if test="scriptAssortid != null"> |
| | | and script_assortid = #{scriptAssortid} |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- åï¼SvyTaskTemplateScriptMapper.selectSvyTaskTemplateScriptListï¼åªç¨å° 3 个æ¡ä»¶ï¼ --> |
| | | <select id="countSvyTaskTemplateScripts" resultType="int"> |
| | | select count(*) |
| | | from svy_task_template_script |
| | | where del_flag = 0 |
| | | <if test="templateID != null"> |
| | | and templateID = #{templateID} |
| | | </if> |
| | | <if test="orgid != null and orgid != ''"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | <if test="categoryid != null"> |
| | | and categoryid = #{categoryid} |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- åï¼ServiceSubtaskMapper.selectServiceSubtaskBySendstate |
| | | è°ç¨æ¹åªè®¾äº taskid ä¸ sendstates(3,5,6)ï¼orgid æªè®¾ç½®ï¼æ
è¿éä¸å«è¯¥æ¡ä»¶ã --> |
| | | <select id="countSubtaskBySendstates" resultType="int"> |
| | | select count(*) |
| | | from service_subtask |
| | | where 1=1 |
| | | and del_flag = 0 |
| | | <if test="taskid != null"> |
| | | and taskid = #{taskid} |
| | | </if> |
| | | <if test="sendstates != null"> |
| | | AND sendstate IN |
| | | <foreach collection="sendstates" item="sendstate" open="(" separator="," close=")"> |
| | | #{sendstate} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- åï¼ServiceSubtaskDetailMapper.selectServiceSubtaskDetailList |
| | | â ï¸ åæã没æã del_flag æ¡ä»¶ï¼è¿éåæ ·ä¸å ï¼é¿å
å£å¾ååã |
| | | categoryid ä»
å¨ä»»å¡ç±»å为è¯é³/é®å·æ¶æè¢«åå®ç°è®¾ç½®ï¼æ
ç¨ <if> ä¿ä½"ä¸è®¾å³ä¸è¿æ»¤"ã --> |
| | | <select id="countSubtaskDetail" resultType="int"> |
| | | select count(*) |
| | | from service_subtask_detail |
| | | where 1=1 |
| | | <if test="taskid != null"> |
| | | and taskid = #{taskid} |
| | | </if> |
| | | <if test="categoryid != null"> |
| | | and categoryid = #{categoryid} |
| | | </if> |
| | | <if test="orgid != null and orgid != ''"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.satisfaction.mapper.SatisfactionScriptMapper"> |
| | | |
| | | <!-- |
| | | 满æåº¦ç»è®¡åãæ»¡æåº¦åç±» / 模æ¿é®é¢ / é项åå¼ãçåªè¯»æ¥è¯¢ã |
| | | |
| | | ä¸ smartor åå®ç°çå·®å¼ï¼å»æä¸ºä¹ï¼ä¸ä¸æ¹å£å¾ï¼ï¼ |
| | | 1) åæç¨ resultMap + å
±äº« <sql> çæ®µï¼selectXxxVoï¼ï¼èçæ®µè¢«åæä»¶éå
¶å® |
| | | éæ»¡æåº¦æ¥è¯¢å
±ç¨ãè¿éãä¸å¤å¶ç段ãï¼æ¹ä¸ºæ¾å¼ååºæ»¡æåº¦çæ£ç¨å°çåï¼ |
| | | é¿å
åä¸ä»½ SQL 两å¤ç»´æ¤ã |
| | | 2) å®å
¨ä¸å¼ç¨ smartor çç±»åï¼ä¸å¾ç¨å
¨éå®ç±»åæ java.util.Mapã |
| | | 3) å
¨é¨æ¯åªè¯»æ¥è¯¢ï¼ä¸å¯¹ ivr_liba_* / svy_lib_* åä»»ä½åæä½ã |
| | | |
| | | å£å¾è¦ç¹ï¼å¿
é¡»ä¸åæéåä¸è´ï¼ï¼ |
| | | - queryIvrScriptByAssort / querySvyScriptByCategoryï¼ids 为空æ¶ä¸æ¼ IN æ¡ä»¶ï¼ |
| | | - selectIvrScriptByDimensionï¼dimensionList ä¸ºç©ºæ¶æ¼ `dimension IS NOT NULL`ï¼ |
| | | - selectSvyScriptByDimensionï¼dimensionList 为空æ¶ã䏿¼ã该æ¡ä»¶ï¼ä¸¤ä¾§ä¸ä¸è´æ¯åæè¡ä¸ºï¼ï¼ |
| | | - selectIvr/SvyTargetOptionScoresï¼scriptIds 为 null æ¶ä¸æ¼è¿æ»¤ï¼çäºåå
¨é¨åå¼ã |
| | | --> |
| | | |
| | | <!-- ================================================ 满æåº¦åç±»ï¼è¯é³ä¾§ï¼ |
| | | åï¼IvrLibaScriptAssortMapper.selectIvrLibaScriptAssortList |
| | | åæ where é del_flag=0 åºç°ä¸¤æ¬¡ï¼ç段å䏿¬¡ãæ«å°¾å䏿¬¡ï¼ï¼ç»æçä»·äºä¸æ¬¡ï¼è¿éä¿ç䏿¬¡ã |
| | | 注æï¼è¿éåçæ¯ãåå§è¡ãï¼èåæå¡æ¹æ³ selectIvrLibaScriptAssortList ä¼æè¡æ¼ææ ã |
| | | åªè¿åé¡¶å±ï¼pid is null or pid = -1ï¼ãéè¦é¡¶å±è¯ä¹çè°ç¨æ¹å¿
é¡»èªå·±æ pid è¿æ»¤ã --> |
| | | <select id="selectIvrCategoryList" |
| | | resultType="com.ruoyi.satisfaction.domain.row.SatisfactionCategoryRow"> |
| | | select id, |
| | | index_assort_name as name, |
| | | type, |
| | | pid |
| | | from ivr_liba_script_assort |
| | | where del_flag = 0 |
| | | <if test="q.type != null and q.type != ''"> |
| | | and type like concat('%', #{q.type}, '%') |
| | | </if> |
| | | <if test="q.orgid != null and q.orgid != ''"> |
| | | and orgid = #{q.orgid} |
| | | </if> |
| | | order by seqno asc |
| | | </select> |
| | | |
| | | <!-- ================================================ 满æåº¦åç±»ï¼é®å·ä¾§ï¼ |
| | | åï¼SvyLibScriptCategoryMapper.selectSvyLibScriptCategoryList |
| | | ï¼è¯¥ statement å®é
å®ä¹å¨ SvyLibTopicCategoryMapper.xmlï¼namespace 䏿件åä¸ä¸è´ï¼ |
| | | 注æï¼é®å·ä¾§åæå°±æ¯ç´æ¥åãå
¨é¨è¡ãï¼ä¸æ¼æ ãä¸çé¡¶å±ï¼ï¼ä¸è¯é³ä¾§ä¸åã --> |
| | | <select id="selectSvyCategoryList" |
| | | resultType="com.ruoyi.satisfaction.domain.row.SatisfactionCategoryRow"> |
| | | select id, |
| | | name, |
| | | type, |
| | | pid |
| | | from svy_lib_script_category |
| | | where del_flag = 0 |
| | | <if test="q.type != null and q.type != ''"> |
| | | and type like concat('%', #{q.type}, '%') |
| | | </if> |
| | | <if test="q.orgid != null and q.orgid != ''"> |
| | | and orgid = #{q.orgid} |
| | | </if> |
| | | order by seqno asc |
| | | </select> |
| | | |
| | | <!-- ================================================ æè¯é³åç±»åé®é¢ |
| | | åï¼IvrLibaTemplateScriptMapper.queryLibTemplateIds |
| | | å¦å¤ï¼ã满æåº¦å¼å¸¸é
ç½®é¢ç®ãæ¥å£èµ°çæ¯ IvrLibaTemplateScriptMapper.selectIvrLibaTemplateScriptList |
| | | ï¼åª set scriptAssortidï¼ï¼å
¶æææ¡ä»¶åæ ·æ¯ del_flag=0 + script_assortid è¿æ»¤ï¼ |
| | | ä¸¤æ¡ statement é½ã没æ order byãï¼å æ¤æ¬æ¥è¯¢å¯ä¸å¹¶æå¡ä¸¤å¤ï¼ |
| | | 为äºè®©è¯¥æ¥å£æ¿å° questionId / questionTopic / questionType / categoryIdï¼ |
| | | è¿éé¢å¤å¤å idãscript_topicãscript_typeãscript_assortid ååï¼ç»è®¡å£å¾ä¸ä½¿ç¨å®ä»¬ï¼ã --> |
| | | <select id="queryIvrScriptByAssort" |
| | | resultType="com.ruoyi.satisfaction.domain.row.SatisfactionIvrScriptRow"> |
| | | select id, |
| | | templateid, |
| | | scriptid, |
| | | script_content, |
| | | script_assortname, |
| | | script_assortid, |
| | | script_topic, |
| | | script_type, |
| | | dimension |
| | | from ivr_liba_template_script |
| | | where del_flag = 0 |
| | | <if test="q.scriptAssortids != null and q.scriptAssortids.size() > 0"> |
| | | and script_assortid in |
| | | <foreach item="scriptAssortid" collection="q.scriptAssortids" open="(" separator="," close=")"> |
| | | #{scriptAssortid} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- ================================================ æé®å·åç±»åé®é¢ |
| | | åï¼SvyLibTemplateScriptMapper.querySvyLibTemplateIds |
| | | 注æï¼åæ¶å svyid ä¸ id ââ èåç»è®¡ç¨ svyidï¼é项åå¼å
³èç¨ idï¼ä¸åæä¸è´ï¼ |
| | | å¦å¤ï¼ã满æåº¦å¼å¸¸é
ç½®é¢ç®ãæ¥å£èµ°çæ¯ SvyLibTemplateScriptMapper.selectSvyLibTemplateScriptList |
| | | ï¼åª set categoryidï¼ï¼å
¶æææ¡ä»¶æ¯ 1=1 + del_flag=0 + categoryid è¿æ»¤ï¼ |
| | | ä¸¤æ¡ statement é½ã没æ order byãï¼å æ¤æ¬æ¥è¯¢å¯ä¸å¹¶æå¡ä¸¤å¤ï¼ |
| | | è¿éé¢å¤å¤å script_topicãscript_typeãcategoryid ä¸åï¼ç»è®¡å£å¾ä¸ä½¿ç¨å®ä»¬ï¼ã --> |
| | | <select id="querySvyScriptByCategory" |
| | | resultType="com.ruoyi.satisfaction.domain.row.SatisfactionSvyScriptRow"> |
| | | select id, |
| | | svyid, |
| | | script_content, |
| | | categoryName, |
| | | categoryid, |
| | | script_topic, |
| | | script_type, |
| | | dimension |
| | | from svy_lib_template_script |
| | | where del_flag = 0 |
| | | <if test="q.scriptCategoryids != null and q.scriptCategoryids.size() > 0"> |
| | | and categoryid in |
| | | <foreach item="scriptCategoryid" collection="q.scriptCategoryids" open="(" separator="," close=")"> |
| | | #{scriptCategoryid} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- ================================================ æç»´åº¦åé®é¢ï¼è¯é³ä¾§ï¼ |
| | | åï¼IvrLibaTemplateScriptMapper.selectILTSBydimension |
| | | å£å¾è¦ç¹ï¼dimensionList ä¸ºç©ºæ¶æ¼ `dimension IS NOT NULL`ï¼é®å·ä¾§ä¸æ¼ï¼ä¸¤ä¾§ä¸åæ¯åæè¡ä¸ºï¼ --> |
| | | <select id="selectIvrScriptByDimension" |
| | | resultType="com.ruoyi.satisfaction.domain.row.SatisfactionIvrScriptRow"> |
| | | select templateid, |
| | | scriptid, |
| | | script_content, |
| | | script_assortname, |
| | | dimension |
| | | from ivr_liba_template_script |
| | | <where> |
| | | del_flag = 0 |
| | | <if test="q.dimensionList != null and q.dimensionList.size() > 0"> |
| | | and dimension in |
| | | <foreach item="dimension" collection="q.dimensionList" open="(" separator="," close=")"> |
| | | #{dimension} |
| | | </foreach> |
| | | </if> |
| | | <if test="q.dimensionList == null or q.dimensionList.size() == 0"> |
| | | and dimension IS NOT NULL |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!-- ================================================ æç»´åº¦åé®é¢ï¼é®å·ä¾§ï¼ |
| | | åï¼SvyLibTemplateScriptMapper.selectSLTScriptListBydimension |
| | | å£å¾è¦ç¹ï¼dimensionList 为空æ¶ã䏿¼ãdimension IS NOT NULLï¼çäºå
¨è¡¨ del_flag=0ï¼ï¼ |
| | | èåç¨çæ¨¡æ¿ id ä¸é项å
³è id 齿¯ svyid --> |
| | | <select id="selectSvyScriptByDimension" |
| | | resultType="com.ruoyi.satisfaction.domain.row.SatisfactionSvyScriptRow"> |
| | | select svyid, |
| | | svyid as id, |
| | | script_content, |
| | | categoryName, |
| | | dimension |
| | | from svy_lib_template_script |
| | | <where> |
| | | del_flag = 0 |
| | | <if test="q.dimensionList != null and q.dimensionList.size() > 0"> |
| | | and dimension in |
| | | <foreach item="dimension" collection="q.dimensionList" open="(" separator="," close=")"> |
| | | #{dimension} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!-- ================================================ é项åå¼ï¼è¯é³ä¾§ï¼ |
| | | åï¼IvrLibaTemplateTargetoptionMapper.selectIvrLibaTargetoptionScores |
| | | å£å¾è¦ç¹ï¼scriptIds 为 null æ¶ä¸æ¼è¿æ»¤ï¼çäºå该表å
¨é¨åå¼ï¼ --> |
| | | <select id="selectIvrTargetOptionScores" |
| | | resultType="com.ruoyi.satisfaction.domain.row.SatisfactionOptionScoreRow"> |
| | | select scriptid as scriptid, score as score |
| | | from ivr_liba_template_targetoption |
| | | where del_flag = 0 |
| | | <if test="scriptIds != null and scriptIds.size() > 0"> |
| | | and scriptid IN |
| | | <foreach collection="scriptIds" item="scriptId" open="(" separator="," close=")"> |
| | | #{scriptId} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- ================================================ é项åå¼ï¼é®å·ä¾§ï¼ |
| | | åï¼SvyLibTemplateTargetoptionMapper.selectSvyLibTargetoptionScores --> |
| | | <select id="selectSvyTargetOptionScores" |
| | | resultType="com.ruoyi.satisfaction.domain.row.SatisfactionOptionScoreRow"> |
| | | select scriptid as scriptid, score as score |
| | | from svy_lib_template_targetoption |
| | | where del_flag = 0 |
| | | <if test="scriptIds != null and scriptIds.size() > 0"> |
| | | and scriptid IN |
| | | <foreach collection="scriptIds" item="scriptId" open="(" separator="," close=")"> |
| | | #{scriptId} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.api; |
| | | |
| | | import com.ruoyi.common.core.service.IConfigService; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.satisfaction.config.SatisfactionAvailabilityInterceptor; |
| | | import com.ruoyi.satisfaction.config.SatisfactionProperties; |
| | | import com.ruoyi.satisfaction.config.SatisfactionSwitch; |
| | | import com.ruoyi.satisfaction.config.SatisfactionWebConfig; |
| | | import com.ruoyi.satisfaction.service.strategy.CommonSatisfactionScoreStrategy; |
| | | import com.ruoyi.satisfaction.service.strategy.SatisfactionScoreStrategyResolver; |
| | | import com.ruoyi.satisfaction.service.strategy.SatisfactionSites; |
| | | import com.ruoyi.satisfaction.service.strategy.SltdSatisfactionScoreStrategy; |
| | | import org.springframework.context.annotation.AnnotationConfigApplicationContext; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 满æåº¦æ¨¡åç <b>çå® Spring 容å¨</b>è£
é
æ ¡éªï¼ä¸ä¾èµ JUnitï¼ä¹ä¸ä¾èµæ°æ®åºï¼ã |
| | | * <p> |
| | | * 为ä»ä¹éè¦è¿ä¸ªæ£æ¥ï¼æ¬æ¨¡åçå 个"éææ ¡éª"ï¼Mapper ä¸è´æ§ãéè¡çä»·ãçç¥çä»·ï¼é½åªè½è¯æ |
| | | * <b>代ç å
容</b>æ£ç¡®ï¼è¯æä¸äº <b>Spring è½æ Bean è£
èµ·æ¥</b>ãå®é
踩è¿ä¸¤ä¸ªåï¼ |
| | | * <ol> |
| | | * <li>{@link SatisfactionFacade} æä¸¤ä¸ªå
¬å¼æé å¨ï¼Spring å "æé å¨ä¸å¯ä¸"éåæ¾æ åæé å¨ |
| | | * â å¯å¨æ {@code No default constructor found}ï¼</li> |
| | | * <li>{@code SatisfactionApi} çæç±»åæ¥æ¾ä¼æé¨é¢<b>èªå·±</b>å½å
åºåé |
| | | * â é¨é¢æè¯·æ±è½¬åç»èªå·± â {@code StackOverflowError}ã</li> |
| | | * </ol> |
| | | * æä»¥è¿éç´æ¥èµ·ä¸ä¸ªçå®ç {@link AnnotationConfigApplicationContext}ï¼åªæ³¨åæ¬æ¨¡å |
| | | * <b>ä¸ä¾èµ Mapper / æ°æ®åº</b>çé£äº Beanï¼éªè¯è£
é
ä¸å¼å
³è¡ä¸ºã |
| | | * <p> |
| | | * å¼å
³æ¬èº«åå¨ {@code sys_config} åæ°è¡¨éï¼é® {@code satisfaction.enabled}ï¼è¿è¡æ¶ç读ï¼ï¼ |
| | | * å æ¤è¿éç¨ä¸ä¸ªåç {@link IConfigService} 模æåæ°è¡¨ï¼éªè¯ãåæ°è¡¨ä¼å
ãyml å
åºãã |
| | | */ |
| | | public final class SatisfactionContextCheck { |
| | | |
| | | private static int failed = 0; |
| | | |
| | | private SatisfactionContextCheck() { |
| | | } |
| | | |
| | | /** |
| | | * åçå
é¨å®ç°ï¼çå®åºæ¯éæ¯ DefaultSatisfactionApiï¼å®éè¦ Mapper/Redisï¼èµ·ä¸äºè½»é容å¨ï¼ |
| | | */ |
| | | public static class StubApi implements SatisfactionApi { |
| | | |
| | | /** |
| | | * åç±»æ¥è¯¢è¢«è°ç¨ç次æ°ï¼ç¨æ¥è¯æ"åæ°è¡¨å
³éæ¶é¨é¢ç¡®å®æ²¡æè½¬åç»å®ç°" |
| | | */ |
| | | static final java.util.concurrent.atomic.AtomicInteger CALLS = new java.util.concurrent.atomic.AtomicInteger(); |
| | | |
| | | @Override |
| | | public boolean isEnabled() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getSatisfactionCategories(String orgid) { |
| | | CALLS.incrementAndGet(); |
| | | return Collections.singletonMap("fromStub", orgid); |
| | | } |
| | | |
| | | @Override |
| | | public SatisfactionExportBundle getQuestionOptionRatioExport(List<Long> subtaskIds, String questiontext) { |
| | | return SatisfactionExportBundle.empty(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean hasSatisfactionCategory(String orgid) { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getSatisfactionIndex(String type, String code, String orgid, |
| | | Long ivrCategoryid, Long svyCategoryid) { |
| | | return SatisfactionFacade.emptySatisfactionIndex(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¢éï¼ä»¥"æè§è
"身份注å
¥ {@code ObjectProvider<SatisfactionApi>}ï¼çå®¹å¨æç±»åè½æ¾å°è°ã |
| | | * <p> |
| | | * å®ä¸æ¯ {@code SatisfactionApi} çå®ç°ï¼æä»¥ä¸åå¨"èªå¼ç¨è¢«æé¤"çæ
åµï¼ |
| | | * å æ¤å®çå°çå°±æ¯å®æ´çåééå ââ ç¨æ¥è¯æ"模åå
³éæ¶å®¹å¨ä¼æé¨é¢èªå·±å½åé"ã |
| | | */ |
| | | public static class ProviderProbe { |
| | | |
| | | @org.springframework.beans.factory.annotation.Autowired |
| | | private org.springframework.beans.factory.ObjectProvider<SatisfactionApi> provider; |
| | | |
| | | SatisfactionApi rawCandidate() { |
| | | return provider.getIfAvailable(); |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println("=== åºæ¯ 1ï¼åæ°è¡¨ satisfaction.enabled=trueï¼ä¸åå¨å
é¨å®ç°ï¼DefaultSatisfactionApi çè§è²ï¼==="); |
| | | try (AnnotationConfigApplicationContext ctx = context(true, true, ContextCheckConfig.SYS_ON)) { |
| | | SatisfactionFacade facade = ctx.getBean(SatisfactionFacade.class); |
| | | check("é¨é¢è½è¢« Spring å®ä¾åï¼æé å¨ä¸åæ§ä¹ï¼", "true", String.valueOf(facade != null)); |
| | | check("å¯ç¨æ¶ isEnabled()", "true", String.valueOf(facade.isEnabled())); |
| | | check("åå°çæ¯ãå
é¨å®ç°ãè䏿¯é¨é¢èªå·±ï¼stub æ orgid åæ ·åå¡«ï¼", "ORG1", |
| | | String.valueOf(facade.getSatisfactionCategories("ORG1").get("fromStub"))); |
| | | check("é¨é¢åæ¶æ¯ ISatisfactionCategoryService", |
| | | "true", String.valueOf(ctx.getBean(com.ruoyi.common.core.service.ISatisfactionCategoryService.class) == facade)); |
| | | // 容å¨éåºæ 2 个 SatisfactionApiï¼é¨é¢èªå·± + å
é¨å®ç°ï¼é¨é¢ä¹å®ç°è¯¥æ¥å£ï¼è¿æ¯è®¾è®¡ä½¿ç¶ï¼ |
| | | check("容å¨å
SatisfactionApi å®ç°æ° = é¨é¢ 1 + å
é¨å®ç° 1", "2", |
| | | String.valueOf(ctx.getBeansOfType(SatisfactionApi.class).size())); |
| | | check("å¼å
³è¯»åçé®åæ¯ sys_config ç satisfaction.enabled", SatisfactionSwitch.CONFIG_KEY, |
| | | String.valueOf(SatisfactionSwitch.CONFIG_KEY)); |
| | | |
| | | SatisfactionScoreStrategyResolver resolver = ctx.getBean(SatisfactionScoreStrategyResolver.class); |
| | | check("ç«ç¹çç¥è§£æå¨è£
é
æåï¼æ¯æç«ç¹ = [common, sltd]", "[common, sltd]", |
| | | String.valueOf(resolver.supportedSites())); |
| | | check("æªç¥ç«ç¹åè½å°éç¨å£å¾", SatisfactionSites.COMMON, |
| | | resolver.resolve("ä¸åå¨çç«ç¹").site()); |
| | | } |
| | | |
| | | System.out.println(); |
| | | System.out.println("=== åºæ¯ 2ï¼åæ°è¡¨ satisfaction.enabled=trueï¼ä½ã没æãå
é¨å®ç°ï¼æ¨¡å没被æè¿åºç¨ï¼==="); |
| | | try (AnnotationConfigApplicationContext ctx = context(true, false, ContextCheckConfig.SYS_ON)) { |
| | | SatisfactionFacade facade = ctx.getBean(SatisfactionFacade.class); |
| | | check("æ å®ç°æ¶ isEnabled() 为 false", "false", String.valueOf(facade.isEnabled())); |
| | | // å
³é®ï¼ä¸è½æé¨é¢èªå·±å½å®ç°ï¼å¦åè¿éä¼ StackOverflowError |
| | | String result; |
| | | try { |
| | | result = String.valueOf(facade.getSatisfactionCategories("ORG1").isEmpty()); |
| | | } catch (StackOverflowError e) { |
| | | result = "StackOverflowError"; |
| | | } |
| | | check("æ å®ç°æ¶åç±»æ¥è¯¢è¿å空 Mapï¼ä¸ä¼èªå¼ç¨éå½ï¼", "true", result); |
| | | check("æ å®ç°æ¶å æ¯å¯¼åºå
为空", "true", |
| | | String.valueOf(facade.getQuestionOptionRatioExport(Collections.singletonList(1L), null).isEmpty())); |
| | | check("æ å®ç°æ¶æ»¡æåº¦ææ°ä¸ºå
¨é¶ Map", "0", |
| | | String.valueOf(facade.getSatisfactionIndex("1", "D001", "ORG1", null, null).get("mydtmzl"))); |
| | | |
| | | // åè¯ï¼ç´æ¥é®å®¹å¨"æç±»åæåªäº SatisfactionApi åé"ï¼ç宿¯å¦æé¨é¢èªå·±ç®è¿å»ã |
| | | // è¥è¿éè¿åçæ¯é¨é¢èªå·±ï¼å°±è¯´æ"èªå¼ç¨å
åº"ç¡®å®åå¨ï¼é¨é¢éç self è¿æ»¤æ¯å¿
è¦çã |
| | | ProviderProbe probe = ctx.getBean(ProviderProbe.class); |
| | | check("æ å®ç°æ¶ï¼å®¹å¨æç±»ååªæ¾å°é¨é¢èªå·±ï¼è¯æèªå¼ç¨å
åºåå¨ï¼", "true", |
| | | String.valueOf(probe.rawCandidate() == facade)); |
| | | check("ä½é¨é¢ä¸ä¼æ'èªå·±'彿å®ç°ï¼self è¿æ»¤çæï¼", "false", |
| | | String.valueOf(facade.isEnabled())); |
| | | } |
| | | |
| | | System.out.println(); |
| | | System.out.println("=== åºæ¯ 3ï¼åæ°è¡¨ satisfaction.enabled=falseï¼å®ç° Bean ä¾ç¶åå¨ï¼ä½é¨é¢å¿
é¡»ä¸è½¬åï¼==="); |
| | | StubApi.CALLS.set(0); |
| | | try (AnnotationConfigApplicationContext ctx = context(true, true, ContextCheckConfig.SYS_OFF)) { |
| | | SatisfactionFacade facade = ctx.getBean(SatisfactionFacade.class); |
| | | check("å
³éæ¶ isEnabled() 为 false", "false", String.valueOf(facade.isEnabled())); |
| | | String result; |
| | | try { |
| | | result = String.valueOf(facade.getSatisfactionCategories("ORG1").isEmpty()); |
| | | } catch (StackOverflowError e) { |
| | | result = "StackOverflowError"; |
| | | } |
| | | check("å
³éæ¶åç±»æ¥è¯¢è¿å空 Mapï¼ä¸ä¼èªéå½ï¼", "true", result); |
| | | check("å
³éæ¶ä¸åè°ç¨å
é¨å®ç°ï¼stub è°ç¨æ¬¡æ° = 0ï¼", "0", |
| | | String.valueOf(StubApi.CALLS.get())); |
| | | |
| | | SatisfactionAvailabilityInterceptor interceptor = ctx.getBean(SatisfactionAvailabilityInterceptor.class); |
| | | String thrown = "(æªæå¼å¸¸)"; |
| | | try { |
| | | interceptor.preHandle(null, null, null); |
| | | } catch (Exception e) { |
| | | thrown = e.getClass().getSimpleName() + "|" + e.getMessage(); |
| | | } |
| | | check("å
³éæ¶æ¦æªå¨æ ServiceException", "true", String.valueOf(thrown.startsWith("ServiceException|"))); |
| | | check("å
³éæ¶é误æç¤ºæç¡®", "true", |
| | | String.valueOf(thrown.contains("satisfaction.enabled=false") && thrown.contains("æ¥å£ä¸å¯ç¨"))); |
| | | |
| | | check("å
³éæ¶åä¿æ¤è·¯å¾è§å 7 æ¡", "7", |
| | | String.valueOf(SatisfactionWebConfig.guardedPathPatterns().size())); |
| | | } |
| | | |
| | | System.out.println(); |
| | | System.out.println("=== åºæ¯ 4ï¼åæ°è¡¨ã没æãsatisfaction.enabled è¿ä¸è¡æ¶ï¼åè½ application.ymlï¼é»è®¤ trueï¼==="); |
| | | try (AnnotationConfigApplicationContext ctx = context(true, true, ContextCheckConfig.SYS_MISSING)) { |
| | | SatisfactionFacade facade = ctx.getBean(SatisfactionFacade.class); |
| | | check("åæ°è¡ç¼ºå¤±ãyml é»è®¤ true æ¶ isEnabled() 为 true", "true", String.valueOf(facade.isEnabled())); |
| | | } |
| | | try (AnnotationConfigApplicationContext ctx = context(false, true, ContextCheckConfig.SYS_MISSING)) { |
| | | SatisfactionFacade facade = ctx.getBean(SatisfactionFacade.class); |
| | | check("åæ°è¡ç¼ºå¤±ãyml=false æ¶ isEnabled() 为 false", "false", String.valueOf(facade.isEnabled())); |
| | | } |
| | | |
| | | System.out.println(); |
| | | System.out.println("=== åºæ¯ 5ï¼å®¹å¨éãæ²¡æãIConfigService æ¶ï¼ç¬ç«/æµè¯ç¯å¢ï¼å¿
é¡»è½å¯å¨ä¸æ yml å
åº ==="); |
| | | try (AnnotationConfigApplicationContext ctx = context(true, true, null, false)) { |
| | | SatisfactionFacade facade = ctx.getBean(SatisfactionFacade.class); |
| | | check("æ é
ç½®æå¡æ¶é¨é¢ä»è½è£
é
å¹¶å¯å¨", "true", String.valueOf(facade != null)); |
| | | check("æ é
ç½®æå¡æ¶æ yml å
åºï¼trueï¼", "true", String.valueOf(facade.isEnabled())); |
| | | } |
| | | |
| | | System.out.println(); |
| | | if (failed == 0) { |
| | | System.out.println("===== 满æåº¦æ¨¡å Spring è£
é
æ ¡éªå
¨é¨éè¿ ====="); |
| | | } else { |
| | | System.out.println("===== 满æåº¦æ¨¡å Spring è£
é
æ ¡éªå¤±è´¥ " + failed + " 项 ====="); |
| | | System.exit(1); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * åæ°è¡¨çæ¨¡æåå¼ |
| | | */ |
| | | static final class ContextCheckConfig { |
| | | /** åæ°è¡åå¨ä¸ä¸º true */ |
| | | static final String SYS_ON = "true"; |
| | | /** åæ°è¡åå¨ä¸ä¸º false */ |
| | | static final String SYS_OFF = "false"; |
| | | /** åæ°è¡ä¸åå¨ */ |
| | | static final String SYS_MISSING = null; |
| | | |
| | | private ContextCheckConfig() { |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * èµ·ä¸ä¸ªåªå«æ¬æ¨¡å"æ Mapper ä¾èµ"Bean ççå®å®¹å¨ |
| | | * |
| | | * @param ymlEnabled application.yml é satisfaction.enabled çåå¼ï¼å
åºç¨ï¼ |
| | | * @param withDelegate æ¯å¦æ³¨åå
é¨å®ç°ï¼DefaultSatisfactionApi çè§è²ï¼ |
| | | * @param sysConfigValue 模æ sys_config é satisfaction.enabled çé®å¼ï¼null=没æè¿ä¸è¡ |
| | | */ |
| | | private static AnnotationConfigApplicationContext context(boolean ymlEnabled, boolean withDelegate, |
| | | final String sysConfigValue) { |
| | | return context(ymlEnabled, withDelegate, sysConfigValue, true); |
| | | } |
| | | |
| | | /** |
| | | * @param withConfigService 容å¨éæ¯å¦æ³¨å {@link IConfigService}ï¼false 模æç¬ç«/æµè¯ç¯å¢ï¼ |
| | | */ |
| | | private static AnnotationConfigApplicationContext context(boolean ymlEnabled, boolean withDelegate, |
| | | final String sysConfigValue, boolean withConfigService) { |
| | | AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); |
| | | SatisfactionProperties properties = new SatisfactionProperties(); |
| | | properties.setEnabled(ymlEnabled); |
| | | ctx.registerBean(SatisfactionProperties.class, () -> properties); |
| | | ctx.register(SatisfactionFacade.class, |
| | | SatisfactionSwitch.class, |
| | | SatisfactionAvailabilityInterceptor.class, |
| | | SatisfactionWebConfig.class, |
| | | SatisfactionScoreStrategyResolver.class, |
| | | CommonSatisfactionScoreStrategy.class, |
| | | SltdSatisfactionScoreStrategy.class, |
| | | ProviderProbe.class); |
| | | if (withConfigService) { |
| | | // åçåæ°é
ç½®æå¡ï¼åªè®¤ satisfaction.enabled è¿ä¸ä¸ªé®ï¼å¼ç± sysConfigValue å³å® |
| | | ctx.registerBean("stubConfigService", IConfigService.class, () -> (IConfigService) configKey -> |
| | | SatisfactionSwitch.CONFIG_KEY.equals(configKey) ? sysConfigValue : ""); |
| | | } |
| | | if (withDelegate) { |
| | | ctx.registerBean("stubSatisfactionApi", SatisfactionApi.class, StubApi::new); |
| | | } |
| | | ctx.refresh(); |
| | | return ctx; |
| | | } |
| | | |
| | | private static void check(String key, String expected, String actual) { |
| | | boolean ok = expected.equals(actual); |
| | | if (!ok) { |
| | | failed++; |
| | | } |
| | | System.out.println("[" + (ok ? "OK" : "FAIL") + "] " + key + " ææ=" + expected + " å®é
=" + actual); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.satisfaction.api; |
| | | |
| | | import com.ruoyi.common.core.service.ISatisfactionCategoryService; |
| | | import com.ruoyi.satisfaction.config.SatisfactionAvailabilityInterceptor; |
| | | import com.ruoyi.satisfaction.config.SatisfactionProperties; |
| | | import com.ruoyi.satisfaction.config.SatisfactionSwitch; |
| | | import com.ruoyi.satisfaction.config.SatisfactionWebConfig; |
| | | import com.ruoyi.satisfaction.domain.ServiceSubtaskDetailRatioExport; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 满æåº¦å¼å
³ä¸é¨é¢è¡ä¸ºæ ¡éªï¼ä¸ä¾èµ JUnitï¼å¯ç´æ¥ç¨æ¨¡å classpath è¿è¡ï¼ã |
| | | * <p> |
| | | * å¼å
³å·²ä» {@code application.yml} æªå° {@code sys_config} åæ°è¡¨ç |
| | | * {@code satisfaction.enabled}ï¼è¿è¡æ¶ç读ï¼ï¼å æ¤è¿ééªè¯ä¸ä»¶äºï¼ |
| | | * <ol> |
| | | * <li><b>åæ°è¡¨ä¼å
</b>ï¼{@code sys_config} æå¼æ¶ä»¥å®ä¸ºåï¼åä¸ä»½ yml é
ç½®ä¸å¯å¼å¯å
³ï¼</li> |
| | | * <li><b>yml å
åº</b>ï¼{@code sys_config} 没æè¿ä¸è¡æ¶åè½ {@code satisfaction.enabled}ï¼é»è®¤ trueï¼ï¼</li> |
| | | * <li><b>å
³éæ¶ä¸æå¼å¸¸</b>ï¼é¨é¢è¿åå®å
¨ç©ºå¼ï¼ä¸æ»¡æåº¦ç«¯ç¹æ¿å°çæ¯ãæç¡®é误ãè䏿¯ 404ã</li> |
| | | * </ol> |
| | | */ |
| | | public final class SatisfactionSwitchCheck { |
| | | |
| | | private static int failed = 0; |
| | | |
| | | /** sys_config éçãå·²å¼å¯ã模æå¼ */ |
| | | private static final String SYS_ON = "true"; |
| | | |
| | | /** sys_config éçãå·²å
³éãæ¨¡æå¼ */ |
| | | private static final String SYS_OFF = "false"; |
| | | |
| | | /** sys_config éãæ²¡æè¿ä¸è¡ã */ |
| | | private static final String SYS_MISSING = null; |
| | | |
| | | private SatisfactionSwitchCheck() { |
| | | } |
| | | |
| | | /** åå®ç°ï¼ç¨äºéªè¯"å¯ç¨"è·¯å¾ */ |
| | | static class StubApi implements SatisfactionApi { |
| | | @Override |
| | | public boolean isEnabled() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getSatisfactionCategories(String orgid) { |
| | | return Collections.singletonMap("voiceCategories", Collections.singletonList(orgid)); |
| | | } |
| | | |
| | | @Override |
| | | public SatisfactionExportBundle getQuestionOptionRatioExport(List<Long> subtaskIds, String questiontext) { |
| | | return new SatisfactionExportBundle( |
| | | Collections.singletonList(new ServiceSubtaskDetailRatioExport()), |
| | | ServiceSubtaskDetailRatioExport.class, workbook -> { }); |
| | | } |
| | | |
| | | @Override |
| | | public boolean hasSatisfactionCategory(String orgid) { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getSatisfactionIndex(String type, String code, String orgid, |
| | | Long ivrCategoryid, Long svyCategoryid) { |
| | | return SatisfactionFacade.emptySatisfactionIndex(); |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | // ---------------- å¯ç¨ï¼yml å
åº ---------------- |
| | | SatisfactionProperties on = new SatisfactionProperties(); // é»è®¤ enabled=true |
| | | SatisfactionFacade onFacade = new SatisfactionFacade(on, new StubApi(), SYS_MISSING); |
| | | |
| | | check("å¯ç¨æ¶ isEnabled()", "true", String.valueOf(onFacade.isEnabled())); |
| | | check("å¯ç¨æ¶åç±»æ¥è¯¢æç»æ", "true", |
| | | String.valueOf(!onFacade.getSatisfactionCategories("ORG1").isEmpty())); |
| | | SatisfactionExportBundle onBundle = onFacade.getQuestionOptionRatioExport(Collections.singletonList(1L), null); |
| | | check("å¯ç¨æ¶å æ¯å¯¼åºå
æè¡", "true", String.valueOf(!onBundle.isEmpty())); |
| | | check("å¯ç¨æ¶å æ¯å¯¼åºå
带è¡ç±»åä¸å¾è¡¨æå»ºå¨", "true", |
| | | String.valueOf(onBundle.getRowClass() != null && onBundle.getChartBuilder() != null)); |
| | | check("å¯ç¨æ¶ hasSatisfactionCategory", "true", String.valueOf(onFacade.hasSatisfactionCategory("ORG1"))); |
| | | |
| | | // ---------------- å¯ç¨ï¼yml 为 falseï¼ä½åæ°è¡¨è¯´ trueï¼åæ°è¡¨ä¼å
ï¼ ---------------- |
| | | SatisfactionProperties ymlOff = new SatisfactionProperties(); |
| | | ymlOff.setEnabled(false); |
| | | SatisfactionFacade sysOnFacade = new SatisfactionFacade(ymlOff, new StubApi(), SYS_ON); |
| | | check("åæ°è¡¨=true è¦ç yml=false æ¶ isEnabled()", "true", String.valueOf(sysOnFacade.isEnabled())); |
| | | check("åæ°è¡¨=true è¦ç yml=false æ¶åç±»æ¥è¯¢æç»æ", "true", |
| | | String.valueOf(!sysOnFacade.getSatisfactionCategories("ORG1").isEmpty())); |
| | | |
| | | // ---------------- å
³éï¼åæ°è¡¨ falseï¼å®ç° Bean ä¾ç¶åå¨ ---------------- |
| | | SatisfactionFacade offFacade = new SatisfactionFacade(on, new StubApi(), SYS_OFF); |
| | | |
| | | check("å
³éæ¶ isEnabled()", "false", String.valueOf(offFacade.isEnabled())); |
| | | check("å
³éæ¶åç±»æ¥è¯¢è¿å空 Mapï¼å³ä½¿å®ç°è¿å¨ä¹ä¸è½¬åï¼", "true", |
| | | String.valueOf(offFacade.getSatisfactionCategories("ORG1").isEmpty())); |
| | | SatisfactionExportBundle offBundle = offFacade.getQuestionOptionRatioExport(Collections.singletonList(1L), null); |
| | | check("å
³éæ¶å æ¯å¯¼åºå
为空", "true", String.valueOf(offBundle.isEmpty())); |
| | | check("å
³éæ¶å æ¯å¯¼åºå
ä¸å¸¦å¾è¡¨æå»ºå¨ï¼å¯¼åºç
§å¸¸å®æï¼", "true", |
| | | String.valueOf(offBundle.getChartBuilder() == null)); |
| | | check("å
³éæ¶ hasSatisfactionCategory", "false", String.valueOf(offFacade.hasSatisfactionCategory("ORG1"))); |
| | | |
| | | // ---------------- å
³éï¼åæ°è¡¨ç¼ºå¤± + yml falseï¼å
åºçæï¼ ---------------- |
| | | SatisfactionFacade ymlOnlyOff = new SatisfactionFacade(ymlOff, new StubApi(), SYS_MISSING); |
| | | check("åæ°è¡¨ç¼ºå¤±ãyml=false æ¶ isEnabled()", "false", String.valueOf(ymlOnlyOff.isEnabled())); |
| | | |
| | | // ---------------- å
³éï¼åæ°è¡¨ç¼ºå¤± + æ å®ç° Beanï¼æ¨¡åæ ¹æ¬ä¸å¨ä¾èµéï¼ ---------------- |
| | | SatisfactionFacade noImplFacade = new SatisfactionFacade(on, (SatisfactionApi) null, SYS_MISSING); |
| | | check("åæ°è¡¨ç¼ºå¤±ãæ å®ç° Bean æ¶ isEnabled()", "false", String.valueOf(noImplFacade.isEnabled())); |
| | | |
| | | // å
³éæ¶åå¤è°ç¨ä¸åºæå¼å¸¸ |
| | | boolean noException = true; |
| | | try { |
| | | for (int i = 0; i < 3; i++) { |
| | | offFacade.getSatisfactionCategories(null); |
| | | offFacade.getQuestionOptionRatioExport(null, null); |
| | | offFacade.hasSatisfactionCategory(null); |
| | | } |
| | | } catch (Exception e) { |
| | | noException = false; |
| | | System.out.println(" å¼å¸¸: " + e); |
| | | } |
| | | check("å
³éæ¶åå¤è°ç¨ä¸æå¼å¸¸", "true", String.valueOf(noException)); |
| | | |
| | | // ---------------- ç»å½é¾è·¯çæ¥å£æ´é²ï¼ç¬¬ 9 æ¥ï¼ ---------------- |
| | | // ruoyi-system éè¿ ruoyi-common ç ISatisfactionCategoryService æç±»åæ¥æ¾å®ç°ï¼ |
| | | // å æ¤é¨é¢å¿
é¡»å®ç°è¯¥æ¥å£ï¼æè½"å
³éæ¶è¿å空 Map èä¸å½±åç»å½"ã |
| | | check("é¨é¢å®ç° ISatisfactionCategoryServiceï¼ç»å½é¾è·¯ææ¥å£æ¥æ¾ï¼", "true", |
| | | String.valueOf(onFacade instanceof ISatisfactionCategoryService)); |
| | | check("ææ¥å£è°ç¨ï¼å¯ç¨ï¼è¿åé空", "true", |
| | | String.valueOf(!((ISatisfactionCategoryService) onFacade).getSatisfactionCategories("ORG1").isEmpty())); |
| | | check("ææ¥å£è°ç¨ï¼å
³éï¼è¿å空 Map ä¸ä¸æå¼å¸¸", "true", |
| | | String.valueOf(((ISatisfactionCategoryService) offFacade).getSatisfactionCategories("ORG1").isEmpty())); |
| | | |
| | | // ---------------- 满æåº¦ææ°ï¼å
³éæ¶å¿
é¡»æ¯å¯ç¨çå
¨é¶ Mapï¼ä¸è½è®©è°ç¨æ¹ NPEï¼ ---------------- |
| | | Map<String, Object> offIndex = offFacade.getSatisfactionIndex("1", "D001", "ORG1", null, null); |
| | | check("å
³éæ¶æ»¡æåº¦ææ°è¿åå
¨é¶ mydtmzl", "0", String.valueOf(offIndex.get("mydtmzl"))); |
| | | check("å
³éæ¶æ»¡æåº¦ææ°è¿åå
¨é¶ mydtbl", "0", String.valueOf(offIndex.get("mydtbl"))); |
| | | check("å
³éæ¶æ»¡æåº¦ææ°è¿åå
¨é¶ wcbl", "0.0", String.valueOf(offIndex.get("wcbl"))); |
| | | check("å
³éæ¶æ»¡æåº¦ææ°é®é½å
¨ï¼ä¸ä¼è®©è°ç¨æ¹ NPEï¼", "true", |
| | | String.valueOf(offIndex.containsKey("mydtmzl") && offIndex.containsKey("mydtbl") |
| | | && offIndex.containsKey("wcbl"))); |
| | | |
| | | // ---------------- å¼å
³çæ´æ°ï¼æ¹ sys_config åèªå¨çæï¼10 ç§ç¼åè¿æï¼ ---------------- |
| | | SatisfactionProperties hot = new SatisfactionProperties(); |
| | | final String[] configValue = { SYS_OFF }; |
| | | SatisfactionSwitch hotSwitch = hotSwitch(hot, configValue); |
| | | check("çæ´æ°åï¼åæ°è¡¨=falseï¼", "false", String.valueOf(hotSwitch.isEnabled())); |
| | | configValue[0] = SYS_ON; |
| | | check("ç¼åæªè¿ææ¶ä»è¿åæ§å¼ï¼è¿ç¨å
10 ç§ç¼åï¼", "false", String.valueOf(hotSwitch.isEnabled())); |
| | | hotSwitch.invalidateCache(); |
| | | check("ç¼å失æåè¯»å°æ°å¼ï¼æ¹æ true ç«å³çæï¼", "true", String.valueOf(hotSwitch.isEnabled())); |
| | | |
| | | // ---------------- å
³éæ¶è°ç¨æ»¡æåº¦ç«¯ç¹å¿
é¡»æ¿å°ãæç¡®é误ãè䏿¯ 404 ---------------- |
| | | SatisfactionAvailabilityInterceptor offInterceptor = |
| | | new SatisfactionAvailabilityInterceptor(offFacade.getSatisfactionSwitch()); |
| | | SatisfactionAvailabilityInterceptor onInterceptor = |
| | | new SatisfactionAvailabilityInterceptor(onFacade.getSatisfactionSwitch()); |
| | | |
| | | check("å¯ç¨æ¶æ¦æªå¨æ¾è¡", "true", String.valueOf(onInterceptor.preHandle(null, null, null))); |
| | | |
| | | String thrown = "(æªæå¼å¸¸)"; |
| | | try { |
| | | offInterceptor.preHandle(null, null, null); |
| | | } catch (Exception e) { |
| | | thrown = e.getClass().getName() + "|" + e.getMessage(); |
| | | } |
| | | check("å
³éæ¶æ¦æªå¨æ ServiceException", "true", |
| | | String.valueOf(thrown.startsWith("com.ruoyi.common.exception.ServiceException|"))); |
| | | check("å
³éæ¶é误æç¤ºæç¡®ï¼å« satisfaction.enabled=false 䏿¥å£ä¸å¯ç¨ï¼", "true", |
| | | String.valueOf(thrown.contains("satisfaction.enabled=false") && thrown.contains("æ¥å£ä¸å¯ç¨"))); |
| | | |
| | | // è¢«æ¦æªç端ç¹å¿
é¡»æ¯æ¬æ¨¡åç 17 个ï¼ä¸ä¸è½ç¢°å°é访/å
¶å®ä¸å¡çè·¯å¾ |
| | | List<String> guarded = SatisfactionWebConfig.guardedPathPatterns(); |
| | | check("åå¼å
³ä¿æ¤çè·¯å¾æ°é = 1 个éé
+ 5 个åå¾· + 1 个å¼å¸¸é
ç½®é¢ = 7 æ¡è§å", "7", |
| | | String.valueOf(guarded.size())); |
| | | check("åä¿æ¤è·¯å¾ä¸å«é访导åºçå
¶å®ä¸å¡ç«¯ç¹", "false", |
| | | String.valueOf(guarded.contains("/smartor/serviceSubtask/patItemExport") |
| | | || guarded.contains("/smartor/serviceSubtask/getSfStatisticsJoy") |
| | | || guarded.contains("/smartor/subtaskAnswer/saveMYDQuestionAnswer"))); |
| | | |
| | | System.out.println(); |
| | | if (failed == 0) { |
| | | System.out.println("===== 满æåº¦å¼å
³ä¸é¨é¢æ ¡éªå
¨é¨éè¿ ====="); |
| | | } else { |
| | | System.out.println("===== 满æåº¦å¼å
³ä¸é¨é¢æ ¡éªå¤±è´¥ " + failed + " 项 ====="); |
| | | System.exit(1); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * é ä¸ä¸ªã{@code sys_config} çå¼å¯ä»¥è¢«ä¸éæ¹æãçå¼å
³ï¼ç¨äºéªè¯ç¼åä¸çæ´æ°ã |
| | | */ |
| | | private static SatisfactionSwitch hotSwitch(SatisfactionProperties properties, final String[] configValue) { |
| | | return new SatisfactionSwitch(properties, new org.springframework.beans.factory.ObjectProvider<com.ruoyi.common.core.service.IConfigService>() { |
| | | private final com.ruoyi.common.core.service.IConfigService service = |
| | | configKey -> configValue[0]; |
| | | |
| | | @Override |
| | | public com.ruoyi.common.core.service.IConfigService getObject(Object... args) { |
| | | return service; |
| | | } |
| | | |
| | | @Override |
| | | public com.ruoyi.common.core.service.IConfigService getIfAvailable() { |
| | | return service; |
| | | } |
| | | |
| | | @Override |
| | | public com.ruoyi.common.core.service.IConfigService getIfUnique() { |
| | | return service; |
| | | } |
| | | |
| | | @Override |
| | | public com.ruoyi.common.core.service.IConfigService getObject() { |
| | | return service; |
| | | } |
| | | |
| | | @Override |
| | | public java.util.stream.Stream<com.ruoyi.common.core.service.IConfigService> stream() { |
| | | return java.util.stream.Stream.of(service); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | private static void check(String key, String expected, String actual) { |
| | | boolean ok = expected.equals(actual); |
| | | if (!ok) { |
| | | failed++; |
| | | } |
| | | System.out.println((ok ? "[OK] " : "[FAIL] ") + key + " ææ=" + expected + " å®é
=" + actual); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.common.core.service.IUserExtInfoService; |
| | | import com.ruoyi.common.core.service.ISatisfactionCategoryService; |
| | | import com.ruoyi.system.mapper.SysUserDeptMapper; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | } |
| | | sysUser.setBelongDepts(list); |
| | | // 设置满æåº¦åç±»ï¼èµ°ç¼åï¼ |
| | | sysUser.setSatisfactionCategories(userExtInfoService.getSatisfactionCategories(sysUser.getOrgid())); |
| | | // 满æåº¦æ¨¡åååï¼ä¸åç»ç± smartor ç IUserExtInfoServiceï¼ |
| | | // æ¹ä¸ºæ ruoyi-common ç ISatisfactionCategoryService æ¥å£æ¥æ¾å®ç° |
| | | // ï¼å®ç°å¨ ruoyi-satisfactionï¼ç±å¸¸é©»é¨é¢ä¿è¯"模åå
³é/缺失æ¶è¿å空 Map"ï¼ |
| | | sysUser.setSatisfactionCategories(loadSatisfactionCategories(sysUser.getOrgid())); |
| | | } |
| | | return sysUser; |
| | | } |
| | | |
| | | /** |
| | | * å®å
¨å°è·å满æåº¦åç±»ã |
| | | * <p> |
| | | * 满æåº¦æ¨¡åå¯ä»¥è¢«é
ç½®å
³éï¼{@code sys_config} åæ° {@code satisfaction.enabled=false}ï¼ï¼ä¹å¯ä»¥æ´ä½ä¸å¨ä¾èµéï¼ |
| | | * è¿ä¸¤ç§æ
åµä¸é½å¿
é¡»<b>ä¸å½±åç»å½ä¸»æµç¨</b>ï¼å æ¤è¿éï¼ |
| | | * <ul> |
| | | * <li>容å¨é没æ {@code ISatisfactionCategoryService} å®ç°æ¶è¿å空 Mapï¼</li> |
| | | * <li>è°ç¨è¿ç¨ä¸æä»»ä½å¼å¸¸ä¹åªè®°æ¥å¿å¹¶è¿å空 Mapã</li> |
| | | * </ul> |
| | | * |
| | | * @param orgid æºæID |
| | | * @return 满æåº¦åç±»ï¼ä¸å¯ç¨æ¶è¿å空 Mapï¼ä¸ä¼è¿å nullï¼ |
| | | */ |
| | | private Map<String, Object> loadSatisfactionCategories(String orgid) { |
| | | try { |
| | | ISatisfactionCategoryService satisfactionCategoryService = |
| | | SpringUtils.getBean(ISatisfactionCategoryService.class); |
| | | if (satisfactionCategoryService == null) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | Map<String, Object> categories = satisfactionCategoryService.getSatisfactionCategories(orgid); |
| | | return categories == null ? Collections.emptyMap() : categories; |
| | | } catch (Exception e) { |
| | | log.warn("è·å满æåº¦å类失败ï¼å·²éçº§ä¸ºç©ºç»æï¼ä¸å½±åç»å½ï¼ãorgid={}", orgid, e); |
| | | return Collections.emptyMap(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ædeptCodeå»é |
| | | */ |
| | | private List<SysUserDept> distinctByDeptCode(List<SysUserDept> list) { |
| | |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-message</artifactId> |
| | | </dependency> |
| | | <!-- |
| | | 满æåº¦æ¨¡åï¼smartor åªéè¿å®ç对å¤é¨é¢ SatisfactionFacade åæ»¡æåº¦æ°æ® |
| | | ï¼éè®¿å¯¼åº patItemExportãé访ç»è®¡ getSfStatisticsJoyï¼ï¼ä¸ç´æ¥ä¾èµå
¶å
é¨ Service/Mapperã |
| | | 注æï¼ruoyi-satisfaction åªä¾èµ ruoyi-commonï¼å æ¤ä¸ä¼ä¸æ¬æ¨¡åå½¢æå¾ªç¯ä¾èµã |
| | | --> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-satisfaction</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.smartor.domain; |
| | | |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * çç«å德鍿¥è¯éé失败记å½å¯¹è±¡ pat_med_outhosp_error |
| | | * <p> |
| | | * 鍿¥è¯æ°æ®ééæ¶ï¼åæ¡è®°å½è½¬æ¢å¤±è´¥ãæ£è
æ¡£æ¡å¤ç失败æå
¥åºå¤±è´¥ï¼ä¸å䏿æ´è½®ééï¼ |
| | | * èæ¯æåå§æ°æ®åå¼å¸¸ä¿¡æ¯åè¿è¿å¼ 表交ç»äººå·¥å¤çï¼ä¿è¯ééè¿åº¦ä¸è¢«åæ¡èæ°æ®é»æã |
| | | * å䏿¡è®°å½åä¸ç±»é误åªä¿çä¸è¡ï¼å¯ä¸ç´¢å¼ uk_serialnum_typeï¼ï¼éå¤å¤±è´¥ç´¯å fail_countã |
| | | * |
| | | * @author smartor |
| | | */ |
| | | @Data |
| | | @ApiModel("鍿¥è¯éé失败记å½") |
| | | public class PatMedOuthospError extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 主é®ID */ |
| | | @ApiModelProperty("主é®ID") |
| | | private Long id; |
| | | |
| | | /** è¯çè®°å½å·ï¼healthcareRecordNoï¼ï¼äººå·¥éæ¨æ¶æè¿ä¸ªå®ä½ */ |
| | | @ApiModelProperty("è¯çè®°å½å·") |
| | | private String serialnum; |
| | | |
| | | /** é¨è¯å· */ |
| | | @ApiModelProperty("é¨è¯å·") |
| | | private String outhospno; |
| | | |
| | | /** æ£è
å§å */ |
| | | @ApiModelProperty("æ£è
å§å") |
| | | private String patname; |
| | | |
| | | /** ç
åå· */ |
| | | @ApiModelProperty("ç
åå·") |
| | | private String patno; |
| | | |
| | | /** é¢åºID */ |
| | | @ApiModelProperty("é¢åºID") |
| | | private String campusid; |
| | | |
| | | /** æºæID */ |
| | | @ApiModelProperty("æºæID") |
| | | private String orgid; |
| | | |
| | | /** å°±è¯æ¶é´ */ |
| | | @ApiModelProperty("å°±è¯æ¶é´") |
| | | private Date admitdate; |
| | | |
| | | /** é鿥æ yyyy-MM-dd */ |
| | | @ApiModelProperty("é鿥æ") |
| | | private String gatherDate; |
| | | |
| | | /** é误类åï¼CONVERT-æ°æ®è½¬æ¢å¤±è´¥ ARCHIVE-æ£è
æ¡£æ¡å¤ç失败 INSERT-å
¥åºå¤±è´¥ */ |
| | | @ApiModelProperty("é误类å") |
| | | private String errorType; |
| | | |
| | | /** å¼å¸¸ä¿¡æ¯ */ |
| | | @ApiModelProperty("å¼å¸¸ä¿¡æ¯") |
| | | private String errorMsg; |
| | | |
| | | /** æ¥å£è¿åçåå§è®°å½JSONï¼äººå·¥ä¿®å¤å坿®æ¤éæ¨ */ |
| | | @ApiModelProperty("åå§è®°å½JSON") |
| | | private String rawData; |
| | | |
| | | /** ç´¯è®¡å¤±è´¥æ¬¡æ° */ |
| | | @ApiModelProperty("累计失败次æ°") |
| | | private Integer failCount; |
| | | |
| | | /** å¤çç¶æï¼0å¾
å¤ç 1å·²å¤ç 2å·²å¿½ç¥ */ |
| | | @ApiModelProperty("å¤çç¶æ") |
| | | private String handleStatus; |
| | | |
| | | /** å¤ç夿³¨ */ |
| | | @ApiModelProperty("å¤ç夿³¨") |
| | | private String handleRemark; |
| | | } |
| | |
| | | package com.smartor.mapper; |
| | | |
| | | import com.smartor.domain.IvrLibaTemplateScript; |
| | | import com.smartor.domain.VO.PatSatisfactionReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.smartor.mapper; |
| | | |
| | | import com.smartor.domain.PatMedOuthospError; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 鍿¥è¯éé失败记å½Mapperæ¥å£ |
| | | * |
| | | * @author smartor |
| | | */ |
| | | @Mapper |
| | | public interface PatMedOuthospErrorMapper { |
| | | |
| | | /** |
| | | * åå
¥éé失败记å½ï¼å䏿¡è®°å½åä¸ç±»é误åªä¿çä¸è¡ï¼éå¤å¤±è´¥ç´¯å fail_countï¼ |
| | | * |
| | | * @param error å¤±è´¥è®°å½ |
| | | * @return ç»æ |
| | | */ |
| | | int insertPatMedOuthospError(PatMedOuthospError error); |
| | | |
| | | /** |
| | | * æ¥è¯¢éé失败记å½å表ï¼äººå·¥å¤çç¨ï¼ |
| | | * |
| | | * @param error æ¥è¯¢æ¡ä»¶ï¼handleStatus / errorType / serialnum / gatherDateï¼ |
| | | * @return 失败记å½éå |
| | | */ |
| | | List<PatMedOuthospError> selectPatMedOuthospErrorList(PatMedOuthospError error); |
| | | |
| | | /** |
| | | * 人工å¤çï¼æ´æ°å¤çç¶æå夿³¨ |
| | | * |
| | | * @param error å¤±è´¥è®°å½ |
| | | * @return ç»æ |
| | | */ |
| | | int updateHandleStatus(PatMedOuthospError error); |
| | | } |
| | |
| | | import com.smartor.domain.ServiceSubtaskDetail; |
| | | import com.smartor.domain.ServiceSubtaskDetailTarget; |
| | | import com.smartor.domain.ServiceSubtaskDetailVO; |
| | | import com.smartor.domain.entity.SatisfactionStatQuery; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | public ServiceSubtaskDetail selectServiceSubtaskDetailByCalldetailid(String calldetailid); |
| | | |
| | | public List<ServiceSubtaskDetailDTO> queryFillCount(@Param("subids") List<Long> subids, @Param("questiontext") String questiontext); |
| | | |
| | | /** |
| | | * 满æåº¦æ±ç¶å¾ï¼ä¸æ¬¡æ§ç»è®¡æ¬æ¬¡è¯·æ±å
¨é¨æ¨¡æ¿çå¡«æ¥é |
| | | * ï¼æ libtemplateid + questiontext + score åç»ï¼åªåä¼ åå¼ä¸æ¡æ°ï¼ä¸åä¼ æç»è¡ï¼ |
| | | * <p> |
| | | * æ¿ä»£ queryFillCount ç N+1 åæ³ï¼è§ PatSatisfactionServiceImpl#satisfactionGraph |
| | | * |
| | | * @param query èåæ¥è¯¢æ¡ä»¶ |
| | | * @return æ¯è¡å« libtemplateidãquestiontextãscoreãcnt |
| | | */ |
| | | public List<Map<String, Object>> selectSatisfactionFillStat(SatisfactionStatQuery query); |
| | | |
| | | /** |
| | | * 满æåº¦ç»è®¡ï¼ä¸æ¬¡æ§ç»è®¡æ¬æ¬¡è¯·æ±å
¨é¨é®é¢çå¡«æ¥éï¼æ 模æ¿+é®é¢+matchedtext+score åç»ï¼ |
| | | * <p> |
| | | * ç¨äº statistics / statisticsByDimension çãåé项æ°éåå æ¯ãï¼æ¿ä»£é个é®é¢æ§è¡ç |
| | | * queryFillCountï¼é£ä¸æ¥ä¼å
æ¥åºå ä¸ä¸ª sub_id åæ¼è¿ IN(...)ï¼å¹¶æçº¦åä¸è¡æç»ä¼ å Javaï¼ã |
| | | * |
| | | * @param query èåæ¥è¯¢æ¡ä»¶ |
| | | * @return æ¯è¡å« libtemplateidãquestiontextãmatchedtextãscoreãcntãtargetvalue |
| | | */ |
| | | public List<Map<String, Object>> selectSatisfactionFillStatByMatchedtext(SatisfactionStatQuery query); |
| | | |
| | | /** |
| | | * 满æåº¦æ±ç¶å¾ï¼ä¸æ¬¡æ§ç»è®¡æ¬æ¬¡è¯·æ±å
¨é¨æ¨¡æ¿çãåæ¶äººæ°ã |
| | | * ï¼æ libtemplateid åç»ï¼count(distinct sub_id)ï¼åä¸ä¸ªäººçäºå¤éé¢åªç®ä¸äººï¼ |
| | | * <p> |
| | | * satisfactionGraph / satisfactionGraphDimension çåæ¶äººæ°å¿
é¡»æ¯äººæ°å£å¾ï¼ |
| | | * ä¸è½å selectSatisfactionFillStat 飿 ·æé¢ç®æ±æ»çæ¡è¡æ°ï¼é£æ¯é¢éå£å¾ï¼ |
| | | * |
| | | * @param query èåæ¥è¯¢æ¡ä»¶ |
| | | * @return æ¯è¡å« libtemplateidãcntï¼è¯¥æ¨¡æ¿å·²åæ¶ç份æ°/人æ°ï¼ |
| | | */ |
| | | public List<Map<String, Object>> selectSatisfactionFillPersonCount(SatisfactionStatQuery query); |
| | | |
| | | /** |
| | | * æ scriptid æ¹éç»è®¡å¡«åè®°å½æ°ï¼ä¸æ¬¡ SQL æ¿ä»£é个 scriptid æ¥æç»ï¼ |
| | |
| | | */ |
| | | public int deleteServiceSubtaskDetailByCalldetailids(String[] calldetailids); |
| | | |
| | | |
| | | /** |
| | | * ææ ç»è®¡ |
| | | * |
| | |
| | | * @return ææ ç»è®¡ |
| | | */ |
| | | public List<ServiceSubtaskDetailTarget> countPatByTarget(Long targetid); |
| | | |
| | | /** |
| | | * æ¥è¯¢å个subidéå¤çdetailæ°æ®IDå表 |
| | | * |
| | | * @return éå¤è®°å½IDå表 |
| | | */ |
| | | public List<Long> selectRepeatDetailIds(); |
| | | |
| | | /** |
| | | * æ ¹æ®IDå表æ¹éæ è®°éå¤detailæ°æ®ä¸ºå é¤ |
| | | * |
| | | * @param ids éå¤è®°å½IDå表 |
| | | * @return æ´æ°è¡æ° |
| | | */ |
| | | public Integer deleteRepeatDetailByIds(@Param("ids") List<Long> ids); |
| | | } |
| | |
| | | package com.smartor.mapper; |
| | | |
| | | import com.smartor.domain.*; |
| | | import com.smartor.domain.DTO.MydTrendReqDTO; |
| | | import com.smartor.domain.DTO.MzMydScoreRankDTO; |
| | | import com.smartor.domain.DTO.QuestionCountKsOrBqDTO; |
| | | import com.smartor.domain.DTO.ServiceSubtaskOptionStatDTO; |
| | | import com.smartor.domain.VO.PatSatisfactionReqVO; |
| | | import com.smartor.domain.VO.HeLibraryCountVO; |
| | | import com.smartor.domain.VO.MzMydScoreRankVO; |
| | | import com.smartor.domain.VO.QuestionCountKsOrBqVO; |
| | | import com.smartor.domain.VO.ServiceSubtaskCotinueCountVO; |
| | | import com.smartor.domain.entity.ServiceSubtaskEntity; |
| | | import com.smartor.domain.entity.ServiceSubtaskSatisfactionEntity; |
| | | import com.smartor.domain.entity.SatisfactionStatQuery; |
| | | import org.apache.ibatis.annotations.MapKey; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | */ |
| | | public List<ServiceSubtask> selectServiceSubtaskList(ServiceSubtaskEntity serviceSubtaskVO); |
| | | |
| | | public List<ServiceSubtask> selectSatisfactionSubtaskList(PatSatisfactionReqVO serviceSubtaskVO); |
| | | |
| | | |
| | | /** |
| | | * ç¨äºè¡¥å¿æ¥è¯¢ |
| | |
| | | */ |
| | | public int countActiveByScheduleIdAndLoop(@Param("scheduleId") Long scheduleId, @Param("loopCount") Long loopCount); |
| | | |
| | | public List<MydTrendReqDTO> mydTrend(@Param("startFinishTime") Date startFinishTime, @Param("endFinishTime") Date endFinishTime, @Param("type") String type); |
| | | |
| | | |
| | | public List<MydTrendReqDTO> sltdMydTotalByDimension(@Param("startFinishTime") Date startFinishTime, @Param("endFinishTime") Date endFinishTime, @Param("type") String type); |
| | | |
| | | |
| | | public List<MydTrendReqDTO> sltdMydTotalByYQ(@Param("startFinishTime") Date startFinishTime, @Param("endFinishTime") Date endFinishTime, @Param("type") String type); |
| | | |
| | | |
| | | /** |
| | | * ä»»å¡ç»ï¼appltype=5ï¼ï¼æåæä¸è½®æ¬¡çå
¨é¨ subtaskï¼ç¨äºå
éå°ä¸ä¸è½®ï¼ã |
| | |
| | | */ |
| | | PatMedRes selectVisitCount(PatMedReq patMedReq); |
| | | |
| | | List<Long> querySendCount(ServiceSubtaskSatisfactionEntity serviceSubtaskSatisfactionEntity); |
| | | |
| | | |
| | | /** |
| | | * 满æåº¦æ±ç¶å¾ï¼ä¸æ¬¡æ§ç»è®¡æ¬æ¬¡è¯·æ±å
¨é¨æ¨¡æ¿çåééï¼æ libtemplateid åç»ï¼ |
| | | * <p> |
| | | * æ¿ä»£é个模æ¿è°ç¨ querySendCount ç N+1 åæ³ï¼è§ PatSatisfactionServiceImpl#satisfactionGraph |
| | | * |
| | | * @param query èåæ¥è¯¢æ¡ä»¶ |
| | | * @return æ¯è¡å« libtemplateidãcnt |
| | | */ |
| | | List<Map<String, Object>> selectSatisfactionSendCount(SatisfactionStatQuery query); |
| | | |
| | | |
| | | /** |
| | | * 满æåº¦ç»è®¡ï¼åªæ¥æ¬æ¬¡æ¡ä»¶ä¸å®é
åå¨åªäº typeï¼1 è¯é³ / 2 é®å·ï¼ |
| | | * <p> |
| | | * æ¿ä»£ selectSatisfactionSubtaskList ââ åæ¹æ³ä¼ææ¥è¿å
¨è¡¨çä¸ç¾ä¸ªå段æ¥åæ¥ï¼ |
| | | * è°ç¨æ¹å´åªç¨å®å¤æãè¯é³åæ¯/é®å·åæ¯æ¯å¦ä¸ºç©ºãï¼è§ |
| | | * PatSatisfactionServiceImpl#statistics / #statisticsByDimension |
| | | * |
| | | * @param patSatisfactionReqVO æ¥è¯¢æ¡ä»¶ï¼ä¸å selectSatisfactionSubtaskList å®å
¨ä¸è´ï¼ |
| | | * @return å»éåç type å表ï¼å¯è½å« nullï¼ |
| | | */ |
| | | List<String> selectSatisfactionSubtaskTypes(PatSatisfactionReqVO patSatisfactionReqVO); |
| | | |
| | | |
| | | /** |
| | | * æç
åºåç»ç»è®¡å»¶ç»æ¤çæ°é |
| | |
| | | */ |
| | | List<ServiceSubtask> gethelibraryCountHyperlink(HeLibraryCountVO heLibraryCountVO); |
| | | |
| | | /** |
| | | * ç»è®¡é®é¢çé项çç¾åæ¯ |
| | | * |
| | | * @param taskIds ä»»å¡ ID å表 (ç¨äºæå¡ç±»å 2) |
| | | * @param subtaskIds åä»»å¡ ID å表ï¼å¯éï¼ãä¼ äºå°±åªç»è®¡è¿æ¹åä»»å¡ï¼å³æ¬æ¬¡å¯¼åºçæ£è
ï¼ï¼ |
| | | * ä¸ä¼ åç»è®¡è¿äºä»»å¡ä¸çå
¨é¨çå·ï¼ä¿æåè¡ä¸º |
| | | * @param startOutHospTime |
| | | * @param endOutHospTime |
| | | * @return |
| | | */ |
| | | List<ServiceSubtaskDetailRatioExport> statQuestionOption(@Param("taskIds") List<Long> taskIds, @Param("startOutHospTime") Date startOutHospTime, @Param("endOutHospTime") Date endOutHospTime, @Param("startFinishTime") Date startFinishTime, @Param("endFinishTime") Date endFinishTime, @Param("scoreStart") Double scoreStart, @Param("scoreEnd") Double scoreEnd, @Param("questiontext") String questiontext, @Param("valueType") String valueType, @Param("subtaskIds") List<Long> subtaskIds); |
| | | |
| | | |
| | | /** |
| | | * 导åºãé®é¢è¯¦æ
å æ¯ãä¸ç¨ç»è®¡ï¼ææ¬æ¬¡å¯¼åºçåä»»å¡ç»è®¡ï¼ |
| | | * <p> |
| | | * æ°é = éæ©è¯¥éé¡¹çæ£è
æ°ï¼å䏿£è
åä¸é¢åªåææ°ä¸æ¡æç»ï¼ï¼åæ° = 该é项æç»ç score ä¹åã |
| | | * |
| | | * @param subtaskIds æ¬æ¬¡å¯¼åºçåä»»å¡ IDï¼å¿
ä¼ ï¼ä¸ºç©ºåæ¥ä¸å°æ°æ®ï¼ |
| | | * @param questiontext é®é¢å
容ï¼å¯éï¼æ¨¡ç³å¹é
ï¼ |
| | | */ |
| | | List<ServiceSubtaskOptionStatDTO> statMydQuestionOptionForExport(@Param("subtaskIds") List<Long> subtaskIds, @Param("questiontext") String questiontext); |
| | | |
| | | |
| | | /** |
| | | * æ ¹æ®åä»»å¡ ID ç»è®¡é®é¢çé项çç¾åæ¯ï¼ç¨äºæ»¡æåº¦ç»è®¡ serviceType=6ï¼ |
| | | * |
| | | * @param subtaskIds åä»»å¡ ID å表 (åªè½å个 taskid ä¸çææåä»»å¡ id) |
| | | * @param startOutHospTime |
| | | * @param endOutHospTime |
| | | * @return |
| | | */ |
| | | List<ServiceSubtaskDetailRatioExport> statQuestionOptionBySubtaskIds(@Param("subtaskIds") List<Long> subtaskIds, @Param("startOutHospTime") Date startOutHospTime, @Param("endOutHospTime") Date endOutHospTime, @Param("startFinishTime") Date startFinishTime, @Param("endFinishTime") Date endFinishTime, @Param("scoreStart") Double scoreStart, @Param("scoreEnd") Double scoreEnd, @Param("questiontext") String questiontext, @Param("valueType") String valueType); |
| | | |
| | | |
| | | /** |
| | | * æ ¹æ®ç§å®¤ãç
åºãé¢ç®ç±»åç»è®¡çç§å®¤ãç
åºè¯å |
| | | * @param questionCountKsOrBqVO |
| | | * @return |
| | | */ |
| | | List<QuestionCountKsOrBqDTO> statQuestionOptionByKsOrBq(QuestionCountKsOrBqVO questionCountKsOrBqVO); |
| | | |
| | | |
| | | /** |
| | | * é¨è¯æ»¡æåº¦ç»¼åå¾åæåï¼æç§å®¤æç
åºï¼ |
| | | * <p> |
| | | * ç»¼åæ»¡æåº¦ = Σ(è¯åæç»æé) / è¯åæç»æ¡æ° à 100%ï¼ |
| | | * æéåªå 1ã0.8ã0.6ã0.4ã0.2 äºæ¡£ã |
| | | * |
| | | * @param mzMydScoreRankVO æ¥è¯¢æ¡ä»¶ï¼dimensionTypeãserviceTypeãæ¶é´åºé´ãç§å®¤/ç
åºç¼å·ãorgid/campusidï¼ |
| | | * @return æ¯ä¸ªç§å®¤/ç
åºç综åå¾åä¸é¡¹æ°ï¼å·²æç»¼åå¾åéåº |
| | | */ |
| | | List<MzMydScoreRankDTO> selectMzMydScoreRank(MzMydScoreRankVO mzMydScoreRankVO); |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.smartor.message; |
| | | |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.message.sms.provider.ls.LishuiMessageConfig; |
| | | import com.ruoyi.message.sms.provider.ls.LishuiMessageConfigProvider; |
| | | import com.ruoyi.system.domain.SysConfig; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.smartor.common.LSHospTokenUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 丽水çä¿¡æºæçº§é
ç½®å®ç°ã |
| | | * <p> |
| | | * ç»ä¸äºåå
ä¸å¥å¹¶åçæ¥è¯¢æ¹å¼ï¼ |
| | | * <ul> |
| | | * <li>{@code RyTask.ls 忝}ï¼ææºææ¥ {@code ls.msg.info}ï¼</li> |
| | | * <li>{@code ServiceSubtaskServiceImpl.smsSubTask}ï¼ç¨ {@code MsgLSEnum}ï¼å·²åºå¼ï¼ï¼</li> |
| | | * <li>{@code SmsRecordsServiceImpl.sendSMS}ï¼åæ¯ç¬¬ä¸å¥ï¼æ¬è½®å·²æ¹ä¸ºå§æåéæ¹ï¼ã</li> |
| | | * </ul> |
| | | * ç°å¨å¯ä¸å
¥å£å°±æ¯æ¬ç±»ï¼è¯» {@code sys_config} 表ç {@code ls.msg.info}ï¼ææºæï¼ï¼ |
| | | * token èµ° {@code LSHospTokenUtil}ã |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class LishuiMessageConfigProviderImpl implements LishuiMessageConfigProvider { |
| | | |
| | | /** |
| | | * ä¸½æ°´æºæçº§é
ç½®çé
置项 keyï¼ä¸åå®ç°ä¸è´ï¼ |
| | | */ |
| | | private static final String CONFIG_KEY = "ls.msg.info"; |
| | | |
| | | private final ISysConfigService configService; |
| | | |
| | | public LishuiMessageConfigProviderImpl(ISysConfigService configService) { |
| | | this.configService = configService; |
| | | } |
| | | |
| | | @Override |
| | | public LishuiMessageConfig getConfig(String orgid) { |
| | | if (StringUtils.isEmpty(orgid)) { |
| | | return null; |
| | | } |
| | | SysConfig query = new SysConfig(); |
| | | query.setConfigKey(CONFIG_KEY); |
| | | query.setOrgid(orgid); |
| | | List<SysConfig> sysConfigs = configService.selectConfigList(query); |
| | | if (CollectionUtils.isEmpty(sysConfigs)) { |
| | | log.warn("ãLishuiMessageConfigProviderImplãæºæ {} æªé
ç½® {}", orgid, CONFIG_KEY); |
| | | return null; |
| | | } |
| | | |
| | | String configValue = sysConfigs.get(0).getConfigValue(); |
| | | Map<String, String> msgInfo = new HashMap<>(); |
| | | if (StringUtils.isNotEmpty(configValue)) { |
| | | try { |
| | | msgInfo = new ObjectMapper().readValue(configValue, Map.class); |
| | | } catch (Exception e) { |
| | | log.error("ãLishuiMessageConfigProviderImplãè§£æ {} 失败ï¼orgidï¼{}ï¼valueï¼{}ï¼errï¼{}", |
| | | CONFIG_KEY, orgid, configValue, e.getMessage(), e); |
| | | return null; |
| | | } |
| | | } |
| | | log.info("-----------丽水çä¿¡é
ç½® map çå¼ä¸ºï¼{}", msgInfo); |
| | | |
| | | LishuiMessageConfig config = new LishuiMessageConfig(); |
| | | config.setOrgid(orgid); |
| | | config.setAddress(msgInfo.get("address")); |
| | | config.setZuHuId(msgInfo.get("ZuHuID")); |
| | | config.setZuHuMc(msgInfo.get("ZuHuMC")); |
| | | config.setSendPersonId(msgInfo.get("sendPersonId")); |
| | | config.setSendPersonName(msgInfo.get("sendPersonName")); |
| | | config.setTokenUrl(msgInfo.get("tokenUrl")); |
| | | return config; |
| | | } |
| | | |
| | | @Override |
| | | public String getToken(String orgid, String tokenUrl) { |
| | | return LSHospTokenUtil.getToken(orgid, tokenUrl); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.smartor.message; |
| | | |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.ruoyi.common.enums.WxGZHEnum; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.message.wechat.WechatMpConfig; |
| | | import com.ruoyi.message.wechat.WechatMpConfigProvider; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 微信å
¬ä¼å·æºæçº§é
ç½®å®ç°ï¼æ¶å£åå
æ£è½å¨ä¸ä¸ªç±»éç {@code WxGZHEnum.getDescByCode(orgid)} |
| | | * è°ç¨ï¼{@code RyTask} / {@code RedisMqReceiver} / {@code ServiceSubtaskServiceImpl}ï¼ã |
| | | * <p> |
| | | * é
ç½®æºä¼å
çº§ï¼ |
| | | * <ol> |
| | | * <li>{@code sys_config} 表 key = {@code wx.mp.config.<orgid>}ï¼å¼å½¢å¦ |
| | | * {@code {"appid":"xx","appSecret":"yy","address":"zz"}} ââ ä¾¿äºæ°æºæä¸æ¹ä»£ç æ¥å
¥ï¼</li> |
| | | * <li>代ç å
{@link WxGZHEnum} æä¸¾ï¼ä¿æåæé
ç½®æºä¸åï¼è¡ä¸ºä¸çº¿ä¸ä¸è´ï¼ã</li> |
| | | * </ol> |
| | | * åæ¶æãæ List 䏿 å appid/appSecret/addressãè¿ç§èå¼±åæ³æ¹æäºæ¾å¼å段åå¼ã |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class WechatMpConfigProviderImpl implements WechatMpConfigProvider { |
| | | |
| | | /** |
| | | * æºæçº§å
¬ä¼å·é
ç½®çé
置项 key åç¼ |
| | | */ |
| | | private static final String CONFIG_KEY_PREFIX = "wx.mp.config."; |
| | | |
| | | private final ISysConfigService configService; |
| | | |
| | | public WechatMpConfigProviderImpl(ISysConfigService configService) { |
| | | this.configService = configService; |
| | | } |
| | | |
| | | @Override |
| | | public WechatMpConfig getConfig(String orgid) { |
| | | if (StringUtils.isEmpty(orgid)) { |
| | | return null; |
| | | } |
| | | |
| | | //ä¼å
åæ°æ®åºé
ç½®ï¼æ¯ææ°æºæï¼ |
| | | WechatMpConfig fromDb = readFromDb(orgid); |
| | | if (fromDb != null && fromDb.isComplete()) { |
| | | return fromDb; |
| | | } |
| | | |
| | | WechatMpConfig config = new WechatMpConfig(); |
| | | config.setOrgid(orgid); |
| | | for (WxGZHEnum item : WxGZHEnum.values()) { |
| | | if (orgid.equals(item.getOrgid())) { |
| | | config.setAppid(item.getAppid()); |
| | | config.setAppSecret(item.getAppSecret()); |
| | | config.setAddress(item.getAddress()); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (!config.isComplete()) { |
| | | log.warn("ãWechatMpConfigProviderImplãæºæ {} çå
¬ä¼å·é
ç½®ä¸å®æ´ï¼{}", orgid, config); |
| | | } |
| | | return config; |
| | | } |
| | | |
| | | private WechatMpConfig readFromDb(String orgid) { |
| | | try { |
| | | String value = configService.selectConfigByKey(CONFIG_KEY_PREFIX + orgid, orgid); |
| | | if (StringUtils.isEmpty(value)) { |
| | | return null; |
| | | } |
| | | Map<String, String> map = new ObjectMapper().readValue(value, Map.class); |
| | | WechatMpConfig config = new WechatMpConfig(); |
| | | config.setOrgid(orgid); |
| | | config.setAppid(map.get("appid")); |
| | | config.setAppSecret(map.get("appSecret")); |
| | | config.setAddress(map.get("address")); |
| | | return config; |
| | | } catch (Exception e) { |
| | | log.warn("ãWechatMpConfigProviderImplã读å {} é
置失败ï¼orgidï¼{}ï¼errï¼{}", |
| | | CONFIG_KEY_PREFIX + orgid, orgid, e.getMessage()); |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.smartor.domain.DTO.DetailTraceDealDTO; |
| | | import com.smartor.domain.ServiceSubtaskDetailTrace; |
| | | import com.smartor.domain.VO.DetailTraceDealVO; |
| | | import com.smartor.domain.VO.SatisfactionExceptConfigQuestionReqVO; |
| | | import com.smartor.domain.VO.ServiceSubtaskDetailTraceVO; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | |
| | | */ |
| | | public int deleteServiceSubtaskDetailTtraceById(Long id); |
| | | |
| | | /** |
| | | * è·å满æåº¦å¼å¸¸é
ç½®é¢ç® |
| | | * @param questionReqVO |
| | | * @return |
| | | */ |
| | | public Map<String, Object> getSatisfactionExceptConfigQuestion(SatisfactionExceptConfigQuestionReqVO questionReqVO); |
| | | |
| | | } |
| | |
| | | |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.domain.DTO.MydTrendReqDTO; |
| | | import com.smartor.domain.DTO.MzMydScoreRankDTO; |
| | | import com.smartor.domain.DTO.QuestionCountKsOrBqDTO; |
| | | import com.smartor.domain.DTO.QuestionResultDTO; |
| | | import com.smartor.domain.ServiceSubtask; |
| | | import com.smartor.domain.VO.*; |
| | | import com.smartor.domain.entity.ServiceSubtaskEntity; |
| | |
| | | |
| | | public PhoneCallBackSHVO processResust(PhoneCallResultYQVO phoneCallReqYQVO); |
| | | |
| | | /** |
| | | * é®é¢ç»æå æ¯ |
| | | * |
| | | * @param QuestionResultVO |
| | | * @param serviceSubtaskRes |
| | | * @return |
| | | */ |
| | | public List<ServiceSubtaskDetailRatioExport> getDetailRatio(SltdMydTotalVO sltdMydTotalVO, List<ServiceSubtaskRes> serviceSubtaskRes); |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | Map<String, Object> smsSubTask(Long subid); |
| | | |
| | | /** |
| | | * ç»è®¡é®é¢çé项çç¾åæ¯ (ç¨äºæå¡ç±»å 2) |
| | | * |
| | | * @param taskIds ä»»å¡ ID å表 |
| | | * @param subtaskIds åä»»å¡ ID å表ï¼å¯éï¼ï¼ä¼ äºå°±åªç»è®¡è¿æ¹åä»»å¡ï¼æ¬æ¬¡å¯¼åºçæ£è
ï¼ï¼åæ¯ä¹ç¨å䏿¹æ°æ® |
| | | * @return |
| | | */ |
| | | public List<ServiceSubtaskDetailRatioExport> statQuestionOption(List<Long> taskIds, Date startFinishTime, Date endFinishTime, Date startOutHospTime, Date endOutHospTime, String scriptContent, Double scoreStart, Double scoreEnd, String valueType, List<Long> subtaskIds); |
| | | |
| | | |
| | | /** |
| | | * 导åºãé®é¢è¯¦æ
å æ¯ãä¸ç¨ç»è®¡ï¼åªç»è®¡æ¬æ¬¡å¯¼åºçè¿æ¹æ£è
ï¼ |
| | | * <p> |
| | | * æ°é = éæ©è¯¥éé¡¹çæ£è
æ°ï¼æ¯ä¾ = æ°é / 该é¢ä½çæ£è
æ°ï¼åæ° = 该é项æç» score ä¹åï¼ |
| | | * ä»»å¡åç§°/ä»»å¡ç¼å· = service_task.task_name / taskidã |
| | | * |
| | | * @param subtaskIds æ¬æ¬¡å¯¼åºçåä»»å¡ ID |
| | | * @param questiontext é®é¢å
容ï¼å¯éï¼ |
| | | */ |
| | | public List<ServiceSubtaskDetailRatioExport> statMydQuestionOptionForExport(List<Long> subtaskIds, String questiontext); |
| | | |
| | | |
| | | /** |
| | | * æ ¹æ®åä»»å¡ ID ç»è®¡é®é¢çé项çç¾åæ¯ï¼ç¨äºæ»¡æåº¦ç»è®¡ serviceType=6ï¼ |
| | | * |
| | | * @param subtaskIds åä»»å¡ ID å表 |
| | | * @return |
| | | */ |
| | | public List<ServiceSubtaskDetailRatioExport> statQuestionOptionBySubtaskIds(List<Long> subtaskIds, Date startOutHospTime, Date endOutHospTime, Date startFinishTime, Date endFinishTime, String scriptContent, Double scoreStart, Double scoreEnd, String valueType); |
| | | |
| | | |
| | | public Map<String, Map<String, List<QuestionCountKsOrBqDTO>>> statQuestionOptionByKsOrBq(QuestionCountKsOrBqVO questionCountKsOrBqVO); |
| | | |
| | | |
| | | public String scanGenerateSubtask(ServiceTask serviceTaskVo); |
| | | |
| | | public List<MydTrendReqDTO> mydTrend(MydTrendReqVO mydTrendReqVO); |
| | | |
| | | |
| | | /** |
| | | * æ ¹æ®æ¶é´ç»åº¦è¿è¡å¯¹æ¯æ»¡æåº¦åæ° |
| | | * @param mydTrendReqVO |
| | | * @return |
| | | */ |
| | | public List<MydTrendReqDTO> sltdMydTotalByDimension(MydTrendReqVO mydTrendReqVO); |
| | | |
| | | |
| | | public Integer matchOptionIndex(String url, String questionText, String voiceText, List<IvrTaskTemplateTargetoption> options, String uuid); |
| | | |
| | | /** |
| | | * é¨è¯æ»¡æåº¦ç»¼åå¾åæåï¼æç§å®¤æç
åºï¼ |
| | | * <p> |
| | | * ç»¼åæ»¡æåº¦ = Σ(è¯åæç»æé) / è¯åæç»æ¡æ° à 100%ï¼ |
| | | * æéåªå 1ã0.8ã0.6ã0.4ã0.2 äºæ¡£ã |
| | | * |
| | | * @param mzMydScoreRankVO æ¥è¯¢æ¡ä»¶ |
| | | * @return æåç»æï¼å·²æç»¼åå¾åéåºå¹¶å¡«å
忬¡ï¼ä» 1 å¼å§ï¼ |
| | | */ |
| | | public List<MzMydScoreRankDTO> mzMydScoreRank(MzMydScoreRankVO mzMydScoreRankVO); |
| | | |
| | | } |
| | |
| | | import com.smartor.domain.*; |
| | | import com.smartor.domain.DTO.DetailTraceDealDTO; |
| | | import com.smartor.domain.VO.DetailTraceDealVO; |
| | | import com.smartor.domain.VO.SatisfactionExceptConfigQuestionReqVO; |
| | | import com.smartor.domain.VO.ServiceSubtaskDetailTraceVO; |
| | | import com.smartor.mapper.ServiceSubtaskDetailMapper; |
| | | import com.smartor.mapper.ServiceSubtaskDetailTraceMapper; |
| | |
| | | public int deleteServiceSubtaskDetailTtraceById(Long id) { |
| | | return serviceSubtaskDetailTraceMapper.deleteServiceSubtaskDetailTtraceById(id); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getSatisfactionExceptConfigQuestion(SatisfactionExceptConfigQuestionReqVO questionReqVO) { |
| | | // åå§åç»æé |
| | | Map<String, Object> result = new HashMap<>(); |
| | | |
| | | if (StringUtils.isEmpty(questionReqVO.getScriptType()) || questionReqVO.getScriptType().equals("1")) { |
| | | List<Map<String, Object>> voicetDataList = new ArrayList<>(); |
| | | //è·å满æåº¦çåç±» |
| | | IvrLibaScriptAssort ivrLibaScriptAssort = new IvrLibaScriptAssort(); |
| | | ivrLibaScriptAssort.setType("myd"); |
| | | if (!StringUtils.isEmpty(questionReqVO.getType())) ivrLibaScriptAssort.setType(questionReqVO.getType()); |
| | | List<IvrLibaScriptAssortVO> ivrLibaScriptAssortVOS = iIvrLibaScriptAssortService.selectIvrLibaScriptAssortList(ivrLibaScriptAssort); |
| | | List<Long> assortIdList = Optional.ofNullable(ivrLibaScriptAssortVOS).filter(list -> !list.isEmpty()).map(list -> list.stream().map(IvrLibaScriptAssortVO::getId).collect(Collectors.toList())).orElse(Collections.emptyList()); |
| | | |
| | | //ç¨æ¥è®°å½æ»¡æåº¦çææé®é¢ |
| | | List<IvrLibaTemplateScript> ivrLibaTemplateScriptList = new ArrayList<>(); |
| | | if (CollectionUtils.isNotEmpty(assortIdList)) { |
| | | for (Long assortId : assortIdList) { |
| | | IvrLibaTemplateScript ivrLibaTemplateScript = new IvrLibaTemplateScript(); |
| | | ivrLibaTemplateScript.setScriptAssortid(assortId); |
| | | List<IvrLibaTemplateScript> ivrLibaTemplateScripts = iIvrLibaTemplateScriptService.selectIvrLibaTemplateScriptList(ivrLibaTemplateScript); |
| | | ivrLibaTemplateScriptList.addAll(ivrLibaTemplateScripts); |
| | | } |
| | | for (IvrLibaTemplateScript ivrLibaTemplateScript : ivrLibaTemplateScriptList) { |
| | | Map<String, Object> voicetData = new HashMap<>(); |
| | | voicetData.put("questionId", ivrLibaTemplateScript.getId()); |
| | | voicetData.put("libtemplateid", ivrLibaTemplateScript.getTemplateid()); |
| | | voicetData.put("questionContent", ivrLibaTemplateScript.getScriptContent()); |
| | | voicetData.put("questionTopic", ivrLibaTemplateScript.getScriptTopic()); |
| | | voicetData.put("questionType", ivrLibaTemplateScript.getScriptType()); |
| | | voicetData.put("categoryName", ivrLibaTemplateScript.getScriptAssortname()); |
| | | voicetData.put("categoryId", ivrLibaTemplateScript.getScriptAssortid()); |
| | | voicetDataList.add(voicetData); |
| | | } |
| | | } |
| | | //è¯é³æ°æ®è¿åéå |
| | | result.put("voiceDataList", voicetDataList); |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(questionReqVO.getScriptType()) || questionReqVO.getScriptType().equals("2")) { |
| | | List<Map<String, Object>> questionnaireDataList = new ArrayList<>(); |
| | | //è·å满æåº¦çåç±» |
| | | SvyLibScriptCategory svyLibScriptCategory = new SvyLibScriptCategory(); |
| | | svyLibScriptCategory.setType("myd"); |
| | | if (!StringUtils.isEmpty(questionReqVO.getType())) svyLibScriptCategory.setType(questionReqVO.getType()); |
| | | List<SvyLibScriptCategory> svyLibScriptCategoryVOS = svyLibScriptCategoryMapper.selectSvyLibScriptCategoryList(svyLibScriptCategory); |
| | | List<Long> assortIdList = Optional.ofNullable(svyLibScriptCategoryVOS).filter(list -> !list.isEmpty()).map(list -> list.stream().map(SvyLibScriptCategory::getId).collect(Collectors.toList())).orElse(Collections.emptyList()); |
| | | |
| | | //ç¨æ¥è®°å½æ»¡æåº¦çææé®é¢ |
| | | List<SvyLibTemplateScript> svyLibTemplateScriptList = new ArrayList<>(); |
| | | if (CollectionUtils.isNotEmpty(assortIdList)) { |
| | | for (Long categoryid : assortIdList) { |
| | | SvyLibTemplateScript svyLibTemplateScript = new SvyLibTemplateScript(); |
| | | svyLibTemplateScript.setCategoryid(categoryid); |
| | | List<SvyLibTemplateScript> svyLibTemplateScripts = isvyLibTemplateScriptService.selectSvyLibTemplateScriptList(svyLibTemplateScript); |
| | | svyLibTemplateScriptList.addAll(svyLibTemplateScripts); |
| | | } |
| | | for (SvyLibTemplateScript svyLibTemplateScript : svyLibTemplateScriptList) { |
| | | Map<String, Object> voicetData = new HashMap<>(); |
| | | voicetData.put("questionId", svyLibTemplateScript.getId()); |
| | | voicetData.put("libtemplateid", svyLibTemplateScript.getSvyid()); |
| | | voicetData.put("questionContent", svyLibTemplateScript.getScriptContent()); |
| | | voicetData.put("questionTopic", svyLibTemplateScript.getScriptTopic()); |
| | | voicetData.put("questionType", svyLibTemplateScript.getScriptType()); |
| | | voicetData.put("categoryName", svyLibTemplateScript.getCategoryName()); |
| | | voicetData.put("categoryId", svyLibTemplateScript.getCategoryid()); |
| | | questionnaireDataList.add(voicetData); |
| | | } |
| | | } |
| | | //é®å·æ°æ®è¿åéå |
| | | result.put("questionnaireDataList", questionnaireDataList); |
| | | } |
| | | return result; |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.core.service.IConfigService; |
| | | import com.ruoyi.satisfaction.api.SatisfactionFacade; |
| | | import com.ruoyi.message.sms.provider.sltd.ws.MessageSend; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.*; |
| | |
| | | @Slf4j |
| | | @Service |
| | | public class ServiceSubtaskServiceImpl implements IServiceSubtaskService { |
| | | |
| | | /** |
| | | * 满æåº¦æ¨¡å对å¤é¨é¢ï¼å¸¸é©» Beanï¼ã |
| | | * <p> |
| | | * é访ç»è®¡éçãæ»¡æåº¦ææ°ãï¼{@code getSfStatisticsJoy}ï¼åªè½éè¿å®åæ°ï¼ |
| | | * 满æåº¦æ¨¡åå
³éæ¶é¨é¢è¿åå
¨é¶ Mapï¼ä¸å½±åé访ç»è®¡çå
¶å®å段ä¸å¯å¨ã |
| | | */ |
| | | @Autowired |
| | | private SatisfactionFacade satisfactionFacade; |
| | | |
| | | @Autowired |
| | | private ServiceSubtaskMapper serviceSubtaskMapper; |
| | | |
| | |
| | | // return map; |
| | | // } |
| | | |
| | | |
| | | /** |
| | | * ç»è®¡ä»»å¡åç§ç¶æçæ°éï¼å·²ä¼åï¼ |
| | | * ä¼å说æï¼ |
| | |
| | | svyTaskTemplateService.deleteSvyTaskTemplateBySvyid(serviceSubtask.getTemplateid()); |
| | | } else if (serviceSubtask.getType().equals("1")) |
| | | ivrTaskTemplateService.deleteIvrTaskTemplateByID(serviceSubtask.getTemplateid()); |
| | | |
| | | |
| | | String tempName = svyTaskTemplateService.selectSvyTaskTemplateBySvyid(Long.valueOf(taskTempid)).getSvyname(); |
| | | serviceSubtask.setTemplateid(taskTempid.longValue()); |
| | |
| | | return phoneCallBackYQVO; |
| | | } |
| | | |
| | | |
| | | private String getObject(ServiceSubtask serviceSubtask, String scriptContent) { |
| | | Map<String, Map<String, String>> param = getParam(serviceSubtask.getTaskid()); |
| | | for (Map<String, String> map : param.values()) { |
| | |
| | | |
| | | return scriptContent; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * è·åä»»å¡éçéé
符 |
| | |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * é¨ç»®ä»»å¡æå |
| | |
| | | log.info("-----------å®é
æåççµè¯æ°æ®éï¼{}", CollectionUtils.isNotEmpty(pullTaskVOList) ? pullTaskVOList.size() : null); |
| | | return pullTaskVOList; |
| | | } |
| | | |
| | | |
| | | private List<PullTaskVO> getPullTaskList(List<String> subIds, String cacheName) { |
| | | log.error("任塿åsubIdsç弿¯å¤å°ï¼{}", subIds); |
| | |
| | | |
| | | return pullTaskVOList; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Integer saveQuestionAnswerPhone(ServiceSubTaskDetailReq serviceSubTaskDetailReq) { |
| | |
| | | return jsRates; |
| | | } |
| | | |
| | | |
| | | public List<ServiceSubtaskStatistic> getSfStatisticsExport(ServiceSubtaskCountReq serviceSubtaskCountReq) { |
| | | List<ServiceSubtaskStatistic> sfStatistics = getSfStatistics(serviceSubtaskCountReq); |
| | | // æ·»å æ»è®¡è¡ |
| | |
| | | if (CollectionUtils.isNotEmpty(serviceSubtaskStatistics)) { |
| | | for (ServiceSubtaskStatistic serviceSubtaskStatistic : serviceSubtaskStatistics) { |
| | | //æææ»¡æåº¦æ°é |
| | | //满æåº¦æ¨¡åååï¼æ»¡æåº¦ææ°æ®æ¤æ¹ä¸ºè°ç¨æ»¡æåº¦æ¨¡åé¨é¢ï¼ |
| | | //模åå
³éæ¶é¨é¢è¿åå
¨é¶ Mapï¼ä¸è¢«è¿ç§»å®ç°çå®é
è¾åºä¸è´ï¼ï¼ä¸å½±åé访ç»è®¡å
¶å®å段ã |
| | | if (CollectionUtils.isNotEmpty(serviceSubtaskCountReq.getDeptcodes())) { |
| | | Map<String, Object> satisfactionIndex = getSatisfactionIndex("1", serviceSubtaskStatistic.getDeptcode(), orgid, serviceSubtaskCountReq.getIvrCategoryid(), serviceSubtaskCountReq.getSvyCategoryid()); |
| | | Map<String, Object> satisfactionIndex = satisfactionFacade.getSatisfactionIndex("1", serviceSubtaskStatistic.getDeptcode(), orgid, serviceSubtaskCountReq.getIvrCategoryid(), serviceSubtaskCountReq.getSvyCategoryid()); |
| | | serviceSubtaskStatistic.setJoyAllCount(satisfactionIndex.get("mydtmzl") != null ? (Integer) satisfactionIndex.get("mydtmzl") : 0); |
| | | serviceSubtaskStatistic.setJoyCount(satisfactionIndex.get("mydtbl") != null ? (Integer) satisfactionIndex.get("mydtbl") : 0); |
| | | serviceSubtaskStatistic.setJoyTotal((Double) satisfactionIndex.get("wcbl")); |
| | | } else if (CollectionUtils.isNotEmpty(serviceSubtaskCountReq.getLeavehospitaldistrictcodes())) { |
| | | Map<String, Object> satisfactionIndex = getSatisfactionIndex("2", serviceSubtaskStatistic.getLeavehospitaldistrictcode(), orgid, serviceSubtaskCountReq.getIvrCategoryid(), serviceSubtaskCountReq.getSvyCategoryid()); |
| | | Map<String, Object> satisfactionIndex = satisfactionFacade.getSatisfactionIndex("2", serviceSubtaskStatistic.getLeavehospitaldistrictcode(), orgid, serviceSubtaskCountReq.getIvrCategoryid(), serviceSubtaskCountReq.getSvyCategoryid()); |
| | | serviceSubtaskStatistic.setJoyAllCount(satisfactionIndex.get("mydtmzl") != null ? (Integer) satisfactionIndex.get("mydtmzl") : 0); |
| | | serviceSubtaskStatistic.setJoyCount(satisfactionIndex.get("mydtbl") != null ? (Integer) satisfactionIndex.get("mydtbl") : 0); |
| | | serviceSubtaskStatistic.setJoyTotal((Double) satisfactionIndex.get("wcbl")); |
| | |
| | | |
| | | return serviceSubtaskStatistics; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * è·å满æåº¦é¢ç®æ»é |
| | | * type : 1-ç§å®¤ 2ç
åº |
| | | * code: ç§å®¤æç
åºcode |
| | | * |
| | | * @return |
| | | */ |
| | | private Map<String, Object> getSatisfactionIndex(String type, String code, String orgid, Long ivrCategoryid, Long svyCategoryid) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<ServiceTask> serviceTasks = null; |
| | | if (type.equals("1")) { |
| | | ServiceTask serviceTask = new ServiceTask(); |
| | | serviceTask.setDeptcode(code); |
| | | serviceTask.setOrgid(orgid); |
| | | serviceTasks = serviceTaskService.selectServiceTaskList(serviceTask); |
| | | } else if (type.equals("2")) { |
| | | ServiceTask serviceTask = new ServiceTask(); |
| | | serviceTask.setLeavehospitaldistrictcode(code); |
| | | serviceTask.setOrgid(orgid); |
| | | serviceTasks = serviceTaskService.selectServiceTaskList(serviceTask); |
| | | } |
| | | |
| | | //è·å满æåº¦é¢ç®æ»é |
| | | BigDecimal mydtmzlsum = new BigDecimal(0); |
| | | //è·å满æåº¦é¢ç®å¡«æ¥é |
| | | BigDecimal mydtblsum = new BigDecimal(0); |
| | | if (CollectionUtils.isNotEmpty(serviceTasks)) { |
| | | //è·å满æåº¦é¢ç®æ»é |
| | | for (ServiceTask serviceTask : serviceTasks) { |
| | | if (serviceTask.getType().equals("1")) { |
| | | //è¯é³ |
| | | Long templateid = serviceTask.getTemplateid(); |
| | | IvrTaskTemplateScript ivrTaskTemplateScript = new IvrTaskTemplateScript(); |
| | | ivrTaskTemplateScript.setTemplateID(templateid); |
| | | ivrTaskTemplateScript.setOrgid(serviceTask.getOrgid()); |
| | | //å
é»è®¤ä¸º1å§ï¼assortid=1 ä»£è¡¨æ¯æ»¡æåº¦ |
| | | ivrTaskTemplateScript.setScriptAssortid(ivrCategoryid); |
| | | List<IvrTaskTemplateScript> ivrTaskTemplateScripts = iIvrTaskTemplateScriptService.selectIvrTaskTemplateScriptList(ivrTaskTemplateScript); |
| | | if (CollectionUtils.isNotEmpty(ivrTaskTemplateScripts)) { |
| | | //éè¦å
计ç®åºåééï¼åä¹ä»¥å个é®å¸æ»¡æåº¦é¢ç®æ°éï¼å¾å°æ»¡æåº¦é¢ç®æ»éï¼å
å«äºæªåçï¼ |
| | | ServiceSubtaskEntity serviceSubtaskVO = new ServiceSubtaskEntity(); |
| | | serviceSubtaskVO.setTaskid(serviceTask.getTaskid()); |
| | | List<Long> sendstates = new ArrayList<>(Arrays.asList(3L, 5L, 6L)); |
| | | serviceSubtaskVO.setSendstates(sendstates); |
| | | List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskBySendstate(serviceSubtaskVO); |
| | | if (CollectionUtils.isNotEmpty(serviceSubtaskList)) { |
| | | int mydtmzlCount = ivrTaskTemplateScripts.size() * serviceSubtaskList.size(); |
| | | mydtmzlsum.add(new BigDecimal(mydtmzlCount)); |
| | | } |
| | | |
| | | } |
| | | } else if (serviceTask.getType().equals("2")) { |
| | | //é®å· |
| | | SvyTaskTemplateScript svyTaskTemplateScript = new SvyTaskTemplateScript(); |
| | | svyTaskTemplateScript.setTemplateID(serviceTask.getTemplateid()); |
| | | svyTaskTemplateScript.setOrgid(serviceTask.getOrgid()); |
| | | svyTaskTemplateScript.setCategoryid(svyCategoryid); |
| | | List<SvyTaskTemplateScript> svyTaskTemplateScriptList = svyTaskTemplateScriptService.selectSvyTaskTemplateScriptList(svyTaskTemplateScript); |
| | | if (CollectionUtils.isNotEmpty(svyTaskTemplateScriptList)) { |
| | | ServiceSubtaskEntity serviceSubtaskEntity = new ServiceSubtaskEntity(); |
| | | serviceSubtaskEntity.setTaskid(serviceTask.getTaskid()); |
| | | List<Long> sendstates = new ArrayList<>(Arrays.asList(3L, 5L, 6L)); |
| | | serviceSubtaskEntity.setSendstates(sendstates); |
| | | List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskBySendstate(serviceSubtaskEntity); |
| | | if (CollectionUtils.isNotEmpty(serviceSubtaskList)) { |
| | | int mydtmzlCount = svyTaskTemplateScriptList.size() * serviceSubtaskList.size(); |
| | | mydtmzlsum.add(new BigDecimal(mydtmzlCount)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //è·å满æåº¦é¢ç®å¡«æ¥é |
| | | ServiceSubtaskDetail serviceSubtaskDetail = new ServiceSubtaskDetail(); |
| | | serviceSubtaskDetail.setTaskid(serviceTask.getTaskid()); |
| | | if (serviceTask.getType().equals("1")) serviceSubtaskDetail.setCategoryid(ivrCategoryid); |
| | | if (serviceTask.getType().equals("2")) serviceSubtaskDetail.setCategoryid(svyCategoryid); |
| | | serviceSubtaskDetail.setOrgid(serviceTask.getOrgid()); |
| | | List<ServiceSubtaskDetail> serviceSubtaskDetails = serviceSubtaskDetailMapper.selectServiceSubtaskDetailList(serviceSubtaskDetail); |
| | | if (CollectionUtils.isNotEmpty(serviceSubtaskDetails)) |
| | | mydtblsum.add(new BigDecimal(serviceSubtaskDetails.size())); |
| | | } |
| | | |
| | | |
| | | } |
| | | //满æåº¦é¢ç®æ»é |
| | | map.put("mydtmzl", mydtmzlsum.intValue()); |
| | | map.put("mydtbl", mydtblsum.intValue()); |
| | | map.put("wcbl", 0.0); |
| | | if (mydtmzlsum.intValue() != 0) { |
| | | map.put("wcbl", mydtblsum.divide(mydtmzlsum, 2, RoundingMode.HALF_UP).doubleValue()); |
| | | } |
| | | |
| | | return map; |
| | | } |
| | | |
| | | |
| | | private ServiceSubtaskStatistic getStatistic(List<ServiceSubtask> serviceSubtaskList, String followUpCountStyle, Integer visitCount) { |
| | | ServiceSubtaskStatistic serviceSubtaskStatistic = new ServiceSubtaskStatistic(); |
| | |
| | | return serviceSubtaskStatistic; |
| | | } |
| | | |
| | | |
| | | private ServiceSubtaskStatistic getStatisticJoy(List<ServiceSubtask> serviceSubtaskList, List<ServiceSubtaskCount> joySubCount) { |
| | | ServiceSubtaskStatistic serviceSubtaskStatistic = new ServiceSubtaskStatistic(); |
| | | //æ ¼å¼å为两ä½å°æ°çç¾åæ¯ |
| | |
| | | if (subCounts == null) { |
| | | subCounts = new ArrayList<>(); |
| | | } |
| | | |
| | | |
| | | for (ServiceSubtask serviceSubtask : serviceSubtaskList) { |
| | | List<ServiceSubtaskCount> subCountTemp = subCounts.stream().filter(r -> r.getSubTaskId().equals(serviceSubtask.getId())).collect(Collectors.toList()); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * è·åé访ç»è®¡æ¯ä¾ |
| | | * |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @param serviceSubtask |
| | | * @param preachform |
| | |
| | | serviceSubtaskPreachform1.setSendstate(failSendstate); |
| | | serviceSubtaskPreachform1.setRemark(remark); |
| | | serviceSubtaskPreachformMapper.updateServiceSubtaskPreachform(serviceSubtaskPreachform1); |
| | | |
| | | |
| | | //妿å½åçpreachformå·²ç»æ¯æåä¸ä¸ªäºï¼é£ç´æ¥å°serviceSubtaskçsendstateç¶ææ¹æ5å°±è¡äº(å
¨å¤±è´¥äº) |
| | | if (serviceSubtaskPreachform1.getSort() == spSize.size() && failSendstate.equals("4")) { |
| | |
| | | } |
| | | return visitTime; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * è®¡ç®æ»è®¡è¡ |
| | |
| | | serviceOutPath.setUrl(url); |
| | | iServiceOutPathService.updateServiceOutPath(serviceOutPath); |
| | | |
| | | |
| | | //hisæ£è
idæ ¡éªï¼ä¸åå®ç°ä¸è´ï¼å
æ ¡éªè¿ä¸é¡¹ï¼ |
| | | if (StringUtils.isEmpty(serviceSubtask.getPatidHis())) { |
| | | resultMap.put("code", -1); |
| | |
| | | return resultMap; |
| | | } |
| | | return resultMap; |
| | | } |
| | | @Override |
| | | public List<ServiceSubtaskDetailRatioExport> statQuestionOption(List<Long> taskIds, Date startFinishTime, Date endFinishTime, Date startOutHospTime, Date endOutHospTime, String scriptContent, Double scoreStart, Double scoreEnd, String valueType, List<Long> subtaskIds) { |
| | | //å
æ¸
çä¸ä¸é夿°æ® |
| | | List<Long> repeatIds = serviceSubtaskDetailMapper.selectRepeatDetailIds(); |
| | | if (!CollectionUtils.isEmpty(repeatIds)) { |
| | | serviceSubtaskDetailMapper.deleteRepeatDetailByIds(repeatIds); |
| | | } |
| | | List<ServiceSubtaskDetailRatioExport> serviceSubtaskDetailRatioExports = serviceSubtaskMapper.statQuestionOption(taskIds, startOutHospTime, endOutHospTime, startFinishTime, endFinishTime, scoreStart, scoreEnd, scriptContent, valueType, subtaskIds); |
| | | |
| | | // å¤ç targetvalueï¼æ & å岿夿¡è®°å½ |
| | | List<ServiceSubtaskDetailRatioExport> result = new ArrayList<>(); |
| | | for (ServiceSubtaskDetailRatioExport export : serviceSubtaskDetailRatioExports) { |
| | | if (StringUtils.isNotEmpty(export.getTargetvalue()) && export.getTargetvalue().contains("&")) { |
| | | String[] values = export.getTargetvalue().split("&"); |
| | | // 妿æå¤æ¡ç®æ å¼ï¼æåæå¤è¡ |
| | | for (String value : values) { |
| | | //å
å» result 䏿¥ä¸ä¸ï¼ææ²¡æè¿ä¸ª questiontext å对åºç targetvalue |
| | | //注æå¿
é¡»å¸¦ä¸ taskid ä¸èµ·å¹é
ï¼å¦å伿å«çä»»å¡çæ°æ®å¡«å°æ¬ä»»å¡çè¡ä¸ï¼ |
| | | //导è´å¯¼åºçãæ°é/æ¯ä¾ãå该è¡çãä»»å¡åç§°/ä»»å¡ç¼å·ã对ä¸ä¸ï¼åä¸ä»»å¡åä¸é¢åºç°ä¸¤ä¸ªä¸ååæ¯ï¼ |
| | | ServiceSubtaskDetailRatioExport existingExport = result.stream().filter(e -> Objects.equals(e.getTaskid(), export.getTaskid()) && e.getQuestiontext().equals(export.getQuestiontext()) && value.trim().equals(e.getTargetvalue())).findFirst().orElse(null); |
| | | if (existingExport != null && existingExport.getRatio().equals("0") && existingExport.getCount().equals("0")) { |
| | | //妿åå¨ï¼åå° result éçè¿ä¸ªé®é¢æå¯¹åºç Targetvalue=value è¿æ¡æ°æ®æ´æ°æå½åè¿æ¡æ°æ® |
| | | if (value.equals(export.getOptionresult())) { |
| | | existingExport.setRatio(export.getRatio()); |
| | | existingExport.setScore(export.getScore()); |
| | | existingExport.setCount(export.getCount()); |
| | | existingExport.setOptionresult(export.getOptionresult()); |
| | | } |
| | | } else if (existingExport != null && !existingExport.getRatio().equals("0")) { |
| | | continue; |
| | | } else { |
| | | ServiceSubtaskDetailRatioExport newExport = DtoConversionUtils.sourceToTarget(export, ServiceSubtaskDetailRatioExport.class); |
| | | newExport.setTargetvalue(value.trim()); // targetvalue æ¾ç¤ºå个é项 |
| | | if (!value.equals(export.getOptionresult())) { |
| | | newExport.setOptionresult(null); |
| | | newExport.setCount("0"); |
| | | newExport.setRatio("0"); |
| | | } |
| | | result.add(newExport); |
| | | } |
| | | } |
| | | } else { |
| | | // targetvalue ä¸å
å« &ï¼ç´æ¥æ·»å å°ç»æ |
| | | result.add(export); |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<ServiceSubtaskDetailRatioExport> statMydQuestionOptionForExport(List<Long> subtaskIds, String questiontext) { |
| | | List<ServiceSubtaskDetailRatioExport> result = new ArrayList<>(); |
| | | if (CollectionUtils.isEmpty(subtaskIds)) { |
| | | return result; |
| | | } |
| | | List<ServiceSubtaskOptionStatDTO> statList = serviceSubtaskMapper.statMydQuestionOptionForExport(subtaskIds, questiontext); |
| | | if (CollectionUtils.isEmpty(statList)) { |
| | | return result; |
| | | } |
| | | return buildMydOptionRows(statList); |
| | | } |
| | | |
| | | /** |
| | | * æãä»»å¡+é¢ç®+é项ãçä½çç»è®¡æ¼æå¯¼åºçãé®é¢è¯¦æ
å æ¯ãè¡ |
| | | * <ul> |
| | | * <li>é项æ¸
åï¼é¢ç®é
ç½®è¿çéé¡¹å¨ targetvalueï¼ç¨ & è¿æ¥ï¼éï¼å
¨é¨ååºï¼æ²¡äººéçæ¾ç¤º 0</li> |
| | | * <li>æ°éï¼æ£è
éä¸çéé¡¹å¨ asrtext éï¼å¤é颿¯ãA&Bãï¼ï¼æ¯ä¸ªéä¸é¡¹åè®°ä¸æ¬¡äººæ°ï¼ä¸ä¸ªæ£è
åªç®ä¸æ¡æç»</li> |
| | | * <li>æ¯ä¾ï¼æ°é / 该é¢ä½çæ£è
æ°ï¼æä»¥åéé¢åé项æ°éä¹å = 该é¢ä½çæ£è
æ°</li> |
| | | * <li>åæ°ï¼è¯¥é项æç»ç score ä¹åï¼å¤éè¡æéä¸é¡¹ä»½æ°ååï¼ä¿è¯åé项忰ä¹å = æç»åæ°ä¹å</li> |
| | | * </ul> |
| | | */ |
| | | private static List<ServiceSubtaskDetailRatioExport> buildMydOptionRows(List<ServiceSubtaskOptionStatDTO> statList) { |
| | | List<ServiceSubtaskDetailRatioExport> result = new ArrayList<>(); |
| | | |
| | | // æãä»»å¡ + é¢ç®ãåç»ï¼ä¿æ SQL ç顺åºï¼å
é¢ç®åä»»å¡ï¼ |
| | | Map<String, List<ServiceSubtaskOptionStatDTO>> grouped = new LinkedHashMap<>(); |
| | | for (ServiceSubtaskOptionStatDTO stat : statList) { |
| | | String key = stat.getTaskid() + "\u0001" + stat.getQuestiontext(); |
| | | grouped.computeIfAbsent(key, k -> new ArrayList<>()).add(stat); |
| | | } |
| | | |
| | | for (List<ServiceSubtaskOptionStatDTO> group : grouped.values()) { |
| | | ServiceSubtaskOptionStatDTO first = group.get(0); |
| | | // é项 -> 人æ°ï¼long[1] 便äºç´¯å ï¼ï¼é¡ºåºå³åºç°é¡ºåº |
| | | Map<String, long[]> countMap = new LinkedHashMap<>(); |
| | | Map<String, BigDecimal> scoreMap = new LinkedHashMap<>(); |
| | | |
| | | for (ServiceSubtaskOptionStatDTO stat : group) { |
| | | // targetvalue = æ¬é¢ææéé¡¹çæ¸
åï¼æ²¡äººéçä¹è¦ååºæ¥ |
| | | List<String> options = splitOptions(stat.getTargetvalue()); |
| | | // asrtext = æ£è
å®é
éä¸çé项ï¼å¤éé¢ä¼æ¯ãéä¸é¡¹1&éä¸é¡¹2ã |
| | | List<String> chosenOptions = splitOptions(stat.getOptionresult()); |
| | | for (String option : options) { |
| | | countMap.computeIfAbsent(option, k -> new long[1]); |
| | | scoreMap.computeIfAbsent(option, k -> BigDecimal.ZERO); |
| | | } |
| | | |
| | | long patientCount = stat.getPatientCount() == null ? 0L : stat.getPatientCount(); |
| | | BigDecimal scoreSum = stat.getScoreSum() == null ? BigDecimal.ZERO : stat.getScoreSum(); |
| | | |
| | | if (!chosenOptions.isEmpty()) { |
| | | BigDecimal[] scoreParts = splitScore(scoreSum, chosenOptions.size()); |
| | | for (int i = 0; i < chosenOptions.size(); i++) { |
| | | String chosen = chosenOptions.get(i); |
| | | // éä¸çé项å¯è½ä¸å¨é
ç½®æ¸
åéï¼å岿°æ®ï¼ï¼è¡¥ä¸è¡ |
| | | countMap.computeIfAbsent(chosen, k -> new long[1]); |
| | | scoreMap.computeIfAbsent(chosen, k -> BigDecimal.ZERO); |
| | | countMap.get(chosen)[0] += patientCount; |
| | | scoreMap.put(chosen, scoreMap.get(chosen).add(scoreParts[i])); |
| | | } |
| | | } else if (options.size() == 1) { |
| | | // 没æ asrtextï¼æªç/æ åºçï¼æ¶ï¼åªæå¯ä¸é项æè½ç¡®å®å½å± |
| | | countMap.get(options.get(0))[0] += patientCount; |
| | | scoreMap.put(options.get(0), scoreMap.get(options.get(0)).add(scoreSum)); |
| | | } |
| | | } |
| | | |
| | | long total = 0L; |
| | | for (long[] count : countMap.values()) total += count[0]; |
| | | |
| | | for (Map.Entry<String, long[]> entry : countMap.entrySet()) { |
| | | long count = entry.getValue()[0]; |
| | | ServiceSubtaskDetailRatioExport row = new ServiceSubtaskDetailRatioExport(); |
| | | row.setQuestiontext(first.getQuestiontext()); |
| | | row.setOptionresult(entry.getKey()); |
| | | row.setTargetvalue(entry.getKey()); |
| | | row.setCount(String.valueOf(count)); |
| | | row.setRatio(formatRatio(count, total)); |
| | | row.setScore(formatScore(scoreMap.get(entry.getKey()))); |
| | | row.setTaskname(first.getTaskName()); |
| | | row.setTaskid(first.getTaskid()); |
| | | row.setValueType(first.getValueType()); |
| | | result.add(row); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æä¸æ¡æç»çåæ°æéä¸é¡¹ä»½æ°ååï¼ä½æ°è¡¥ç»ç¬¬ä¸ä¸ªï¼ä¿è¯å份ä¹å = ååæ° |
| | | */ |
| | | private static BigDecimal[] splitScore(BigDecimal total, int parts) { |
| | | BigDecimal[] result = new BigDecimal[parts]; |
| | | if (parts <= 0) { |
| | | return result; |
| | | } |
| | | BigDecimal each = total.divide(BigDecimal.valueOf(parts), 2, RoundingMode.HALF_UP); |
| | | for (int i = 0; i < parts; i++) { |
| | | result[i] = each; |
| | | } |
| | | result[0] = result[0].add(total.subtract(each.multiply(BigDecimal.valueOf(parts)))); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æåé¢ç®é
ç½®çé项ï¼å¤ä¸ªéé¡¹ç¨ & è¿æ¥ï¼ï¼é¡ºå¸¦å»æå
¨è§/åè§ç©ºç½ |
| | | */ |
| | | private static List<String> splitOptions(String targetvalue) { |
| | | List<String> options = new ArrayList<>(); |
| | | if (StringUtils.isEmpty(targetvalue)) { |
| | | return options; |
| | | } |
| | | for (String part : targetvalue.split("&")) { |
| | | String option = trimAll(part); |
| | | if (StringUtils.isNotEmpty(option) && !options.contains(option)) { |
| | | options.add(option); |
| | | } |
| | | } |
| | | return options; |
| | | } |
| | | |
| | | /** |
| | | * æ¯ä¾ï¼æ°é / 该é¢ä½çæ£è
æ°ï¼ä¿ç两ä½å°æ° |
| | | */ |
| | | private static String formatRatio(long count, long total) { |
| | | if (total <= 0) { |
| | | return "0.00%"; |
| | | } |
| | | return BigDecimal.valueOf(count * 100.0 / total).setScale(2, RoundingMode.HALF_UP).toPlainString() + "%"; |
| | | } |
| | | |
| | | /** |
| | | * åæ°ä¹åï¼å»æå¤ä½çå°æ°ä½ï¼0.00 -> 0ï¼ |
| | | */ |
| | | private static String formatScore(BigDecimal score) { |
| | | if (score == null) { |
| | | return "0"; |
| | | } |
| | | BigDecimal value = score.stripTrailingZeros(); |
| | | if (value.scale() < 0) { |
| | | value = value.setScale(0); |
| | | } |
| | | return value.toPlainString(); |
| | | } |
| | | |
| | | /* |
| | | * æ ¹æ®ç§å®¤æç
åºç»è®¡é®å·é项(ç§å®¤ãé¢ç®æ¥è¯¢çç§å®¤è¯å表) |
| | | */ |
| | | @Override |
| | | public Map<String, Map<String, List<QuestionCountKsOrBqDTO>>> statQuestionOptionByKsOrBq(QuestionCountKsOrBqVO vo) { |
| | | |
| | | // 1. æ¥æç» |
| | | List<QuestionCountKsOrBqDTO> sourceList = serviceSubtaskMapper.statQuestionOptionByKsOrBq(vo); |
| | | if (CollectionUtils.isEmpty(sourceList)) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | |
| | | // 2. 夿æç§å®¤è¿æ¯æç
åº |
| | | boolean byDept = vo.getLeaveldeptcodes() != null; |
| | | boolean byDistrict = !byDept && vo.getLeavehospitaldistrictcodes() != null; |
| | | if (!byDept && !byDistrict) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | |
| | | // 3. key = ç§å®¤/ç
åº + é¢ç® + é项 |
| | | Map<String, QuestionCountKsOrBqDTO> map = new LinkedHashMap<>(); |
| | | |
| | | for (QuestionCountKsOrBqDTO dto : sourceList) { |
| | | |
| | | if (StringUtils.isEmpty(dto.getTargetvalue())) { |
| | | continue; |
| | | } |
| | | |
| | | // åç»åï¼ç§å®¤ æ ç
åº |
| | | String groupName = byDept ? dto.getDeptname() : dto.getLeavehospitaldistrictname(); |
| | | if (StringUtils.isEmpty(groupName)) { |
| | | continue; |
| | | } |
| | | |
| | | String asrtext = trimAll(dto.getAsrtext()); // ç¨æ·å®é
éä¸çé项 |
| | | String questionText = trimAll(dto.getQuestionText()); // é¢ç® |
| | | if (StringUtils.isEmpty(questionText)) { |
| | | continue; |
| | | } |
| | | |
| | | // æå targetvalueï¼æ¯ä¸ªé项é½è¦æä¸æ¡è®°å½ |
| | | for (String raw : dto.getTargetvalue().split("&")) { |
| | | |
| | | String option = trimAll(raw); |
| | | if (option.isEmpty()) { |
| | | continue; |
| | | } |
| | | |
| | | // key = ç§å®¤/ç
åº + é¢ç® + é项 |
| | | String key = buildKey(groupName, questionText, option); |
| | | |
| | | QuestionCountKsOrBqDTO item = map.get(key); |
| | | if (item == null) { |
| | | item = DtoConversionUtils.sourceToTarget(dto, QuestionCountKsOrBqDTO.class); |
| | | item.setTargetvalue(option); |
| | | item.setAsrtext(option); |
| | | item.setQuestionText(dto.getQuestionText()); |
| | | item.setAnswerCount("0"); |
| | | item.setSingleScore("0"); |
| | | map.put(key, item); |
| | | } |
| | | |
| | | // åªæå½åé项 == ç¨æ·å®é
éä¸çéé¡¹ï¼æç´¯å |
| | | if (option.equals(asrtext)) { |
| | | int count = parseCount(item.getAnswerCount()) + 1; |
| | | item.setAnswerCount(String.valueOf(count)); |
| | | |
| | | BigDecimal totalScore = new BigDecimal(item.getSingleScore()) |
| | | .add(new BigDecimal(dto.getSingleScore() == null ? "0" : dto.getSingleScore())); |
| | | item.setSingleScore(totalScore.toPlainString()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 4. 计ç®å¹³åå |
| | | for (QuestionCountKsOrBqDTO dto : map.values()) { |
| | | String answerCount = dto.getAnswerCount(); |
| | | String singleScore = dto.getSingleScore(); |
| | | |
| | | BigDecimal avg; |
| | | if (StringUtils.isEmpty(answerCount) |
| | | || BigDecimal.ZERO.compareTo(new BigDecimal(answerCount.trim())) == 0) { |
| | | avg = BigDecimal.ZERO; |
| | | } else { |
| | | avg = new BigDecimal(singleScore == null ? "0" : singleScore) |
| | | .divide(new BigDecimal(answerCount.trim()), 2, RoundingMode.HALF_UP); |
| | | } |
| | | dto.setAvgScore(avg.toPlainString()); |
| | | } |
| | | |
| | | // 5. 转æ Map<String, Map<String, List<QuestionCountKsOrBqDTO>>> |
| | | // 第ä¸å± keyï¼ç§å®¤/ç
åº |
| | | // 第äºå± keyï¼é¢ç® |
| | | // 第äºå± valueï¼è¯¥é¢ç®ä¸çææé项å表 |
| | | Map<String, Map<String, List<QuestionCountKsOrBqDTO>>> result = new LinkedHashMap<>(); |
| | | |
| | | for (QuestionCountKsOrBqDTO dto : map.values()) { |
| | | |
| | | // åç»å |
| | | String groupName = byDept ? dto.getDeptname() : dto.getLeavehospitaldistrictname(); |
| | | if (StringUtils.isEmpty(groupName)) { |
| | | continue; |
| | | } |
| | | |
| | | // é¢ç®å |
| | | String questionText = dto.getQuestionText(); |
| | | if (StringUtils.isEmpty(questionText)) { |
| | | continue; |
| | | } |
| | | |
| | | // 第ä¸å±ï¼ç§å®¤/ç
åº |
| | | Map<String, List<QuestionCountKsOrBqDTO>> questionMap = |
| | | result.computeIfAbsent(groupName, k -> new LinkedHashMap<>()); |
| | | |
| | | // 第äºå±ï¼é¢ç® |
| | | List<QuestionCountKsOrBqDTO> optionList = |
| | | questionMap.computeIfAbsent(questionText, k -> new ArrayList<>()); |
| | | |
| | | optionList.add(dto); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<ServiceSubtaskDetailRatioExport> statQuestionOptionBySubtaskIds(List<Long> subtaskIds, Date startOutHospTime, Date endOutHospTime, Date startFinishTime, Date endFinishTime, String scriptContent, Double scoreStart, Double scoreEnd, String valueType) { |
| | | //å
æ¸
çä¸ä¸é夿°æ® |
| | | List<Long> repeatIds = serviceSubtaskDetailMapper.selectRepeatDetailIds(); |
| | | if (!CollectionUtils.isEmpty(repeatIds)) { |
| | | serviceSubtaskDetailMapper.deleteRepeatDetailByIds(repeatIds); |
| | | } |
| | | |
| | | List<ServiceSubtaskDetailRatioExport> serviceSubtaskDetailRatioExports = serviceSubtaskMapper.statQuestionOptionBySubtaskIds(subtaskIds, startOutHospTime, endOutHospTime, startFinishTime, endFinishTime, scoreStart, scoreEnd, scriptContent, valueType); |
| | | // SQL å·²æãé¢ç® + éé¡¹ãæ±æ»æ°éï¼è¿éåæé¢ç®åå¹¶ï¼ä¸å模æ¿ç targetvalue é项顺åºä¸åï¼åä¸é项伿æå¤è¡ï¼ï¼ |
| | | // å¹¶ææ²¡äººéçé项补æ 0 è¡ãæåé项æ°éä¹åéç®æ¯ä¾ |
| | | return mergeMydOptionRows(serviceSubtaskDetailRatioExports); |
| | | } |
| | | |
| | | /** |
| | | * æ SQL è¿åçãé¢ç® + é项ãæç»åå¹¶æãä¸è¡ä¸ä¸ªé项ã |
| | | * <ul> |
| | | * <li>åä¸é¢ç®ä¸ç¸å optionresult çæ°éç´¯å ï¼åå®ç°éå°ååéé¡¹ç´æ¥ continueï¼ |
| | | * æ¯ä¸ªé项åªä¼ä¿çç¬¬ä¸æ¡æç»çæ°éï¼å¤ä»»å¡/夿£è
ç项æ°å
¨è¢«ä¸¢æï¼åç«¯ãæ°éãæ°¸è¿åªæ 1</li> |
| | | * <li>é项æ¸
åå targetvalueï¼ç¨ & è¿æ¥ï¼ï¼æ²¡äººéçé项补 0 è¡ï¼å端åºå®å
åæè½æ¸²æ</li> |
| | | * <li>æ¯ä¾ = 该é项æ°é / 该é¢åé项æ°éä¹åï¼ä¿è¯ä¸éé¢åé项æ¯ä¾å计 100%</li> |
| | | * </ul> |
| | | * |
| | | * @param rows SQL æç» |
| | | */ |
| | | private List<ServiceSubtaskDetailRatioExport> mergeMydOptionRows(List<ServiceSubtaskDetailRatioExport> rows) { |
| | | List<ServiceSubtaskDetailRatioExport> result = new ArrayList<>(); |
| | | if (CollectionUtils.isEmpty(rows)) { |
| | | return result; |
| | | } |
| | | |
| | | // key -> é项 -> æ°éï¼ç¨ LinkedHashMap ä¿åºï¼éé¡¹é¡ºåºæ²¿ç¨é®å·é
ç½® targetvalue çé¡ºåº |
| | | Map<String, Map<String, long[]>> countMap = new LinkedHashMap<>(); |
| | | Map<String, Map<String, String>> scoreMap = new LinkedHashMap<>(); |
| | | Map<String, ServiceSubtaskDetailRatioExport> templateMap = new LinkedHashMap<>(); |
| | | |
| | | for (ServiceSubtaskDetailRatioExport row : rows) { |
| | | if (row == null) { |
| | | continue; |
| | | } |
| | | String key = row.getQuestiontext(); |
| | | if (key == null) { |
| | | continue; |
| | | } |
| | | Map<String, long[]> counts = countMap.computeIfAbsent(key, k -> new LinkedHashMap<>()); |
| | | Map<String, String> scores = scoreMap.computeIfAbsent(key, k -> new LinkedHashMap<>()); |
| | | templateMap.putIfAbsent(key, row); |
| | | |
| | | // é¢ç®é
ç½®çé项æ¸
åï¼æ²¡äººéçé项ä¹è¦ååºæ¥ï¼æ°é为 0ï¼ |
| | | for (String option : splitOptions(row.getTargetvalue())) { |
| | | counts.computeIfAbsent(option, k -> new long[1]); |
| | | } |
| | | |
| | | // æ£è
å®é
éä¸çé项ï¼å¤éé¢ asrtext æ¯ãé项1&é项2ãï¼åé/é®ç颿¯æ´æ®µææ¬ |
| | | List<String> chosenOptions = "2".equals(row.getValueType()) |
| | | ? splitOptions(row.getOptionresult()) |
| | | : singleOption(row.getOptionresult()); |
| | | if (chosenOptions.isEmpty()) { |
| | | // æªä½çï¼ä¸è¿ä»»ä½é项ï¼ä¹ä¸è¿åæ¯ |
| | | continue; |
| | | } |
| | | long count = parseCount(row.getCount()); |
| | | for (String chosen : chosenOptions) { |
| | | // éä¸çé项å¯è½ä¸å¨é
ç½®æ¸
åéï¼å岿°æ®ï¼ï¼è¡¥ä¸è¡ï¼æ°éä¸è½ä¸¢ |
| | | counts.computeIfAbsent(chosen, k -> new long[1])[0] += count; |
| | | if (StringUtils.isNotEmpty(row.getScore()) && StringUtils.isEmpty(scores.get(chosen))) { |
| | | scores.put(chosen, row.getScore()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (Map.Entry<String, Map<String, long[]>> entry : countMap.entrySet()) { |
| | | ServiceSubtaskDetailRatioExport template = templateMap.get(entry.getKey()); |
| | | Map<String, String> scores = scoreMap.get(entry.getKey()); |
| | | long total = 0L; |
| | | for (long[] count : entry.getValue().values()) { |
| | | total += count[0]; |
| | | } |
| | | for (Map.Entry<String, long[]> optionEntry : entry.getValue().entrySet()) { |
| | | String option = optionEntry.getKey(); |
| | | long count = optionEntry.getValue()[0]; |
| | | ServiceSubtaskDetailRatioExport merged = DtoConversionUtils.sourceToTarget(template, ServiceSubtaskDetailRatioExport.class); |
| | | merged.setQuestiontext(template.getQuestiontext()); |
| | | merged.setTargetvalue(option); |
| | | // 没人éçé项 optionresult 置空ï¼å端æ targetvalue å
åºå±ç¤ºï¼ä¿æåæå±ç¤ºå£å¾ |
| | | merged.setOptionresult(count > 0 ? option : null); |
| | | merged.setCount(String.valueOf(count)); |
| | | merged.setRatio(formatRatio(count, total)); |
| | | merged.setScore(StringUtils.isNotEmpty(scores.get(option)) ? scores.get(option) : template.getScore()); |
| | | result.add(merged); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * åé/é®çé¢çä½çææ¬ï¼ä¸æ & æï¼é¿å
æé®çé¢çææ¬çæ¡æå |
| | | */ |
| | | private static List<String> singleOption(String answer) { |
| | | List<String> options = new ArrayList<>(); |
| | | String text = trimAll(answer); |
| | | if (StringUtils.isNotEmpty(text)) { |
| | | options.add(text); |
| | | } |
| | | return options; |
| | | } |
| | | |
| | | /** |
| | | * æ ååé®å·çæ¡ææ¬ï¼å»æ A/B/C/D å忝åç¼ååç»ç©ºæ ¼ |
| | | * ä¾å¦ "A æ¯" -> "æ¯"ï¼"B å¦" -> "å¦" |
| | | */ |
| | | private String normalizeOptionAnswer(String answer) { |
| | | if (StringUtils.isBlank(answer)) { |
| | | return ""; |
| | | } |
| | | String trimmed = answer.trim(); |
| | | if (trimmed.length() >= 3 && trimmed.charAt(1) == ' ') { |
| | | char firstChar = trimmed.charAt(0); |
| | | if (firstChar >= 'A' && firstChar <= 'Z') { |
| | | return trimmed.substring(2).trim(); |
| | | } |
| | | } |
| | | return trimmed; |
| | | } |
| | | |
| | | private Boolean saveServiceSubtaskDetail(ServiceSubtask serviceSubtask) { |
| | |
| | | return content; |
| | | } |
| | | |
| | | /** |
| | | * 满æåº¦è¶å¿æ¥è¯¢ |
| | | * |
| | | * @param mydTrendReqVO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<MydTrendReqDTO> mydTrend(MydTrendReqVO mydTrendReqVO) { |
| | | List<MydTrendReqDTO> list = serviceSubtaskMapper.mydTrend(mydTrendReqVO.getStartFinishTime(), mydTrendReqVO.getEndFinishTime(), mydTrendReqVO.getType()); |
| | | if (mydTrendReqVO.getType().equals("week")) list = getWeekDate(mydTrendReqVO, list); |
| | | if (mydTrendReqVO.getType().equals("year")) list = getYearDate(mydTrendReqVO, list); |
| | | if (mydTrendReqVO.getType().equals("month")) list = getMonthDate(mydTrendReqVO, list); |
| | | if (mydTrendReqVO.getType().equals("day")) list = getDayDate(mydTrendReqVO, list); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<MydTrendReqDTO> sltdMydTotalByDimension(MydTrendReqVO mydTrendReqVO) { |
| | | List<MydTrendReqDTO> list = null; |
| | | if (mydTrendReqVO.getDimensionType().equals("1")) |
| | | list = serviceSubtaskMapper.sltdMydTotalByDimension(mydTrendReqVO.getStartFinishTime(), mydTrendReqVO.getEndFinishTime(), mydTrendReqVO.getType()); |
| | | else if (mydTrendReqVO.getDimensionType().equals("2")) |
| | | list = serviceSubtaskMapper.sltdMydTotalByYQ(mydTrendReqVO.getStartFinishTime(), mydTrendReqVO.getEndFinishTime(), mydTrendReqVO.getType()); |
| | | |
| | | return list; |
| | | } |
| | | |
| | | |
| | | public ServiceSubtask boxedServiceSubtask(ServiceTask serviceTask, ServiceTaskdept serviceTaskdept, PatArchive patArchive) { |
| | | ServiceSubtask serviceSubtask = DtoConversionUtils.sourceToTarget(serviceTask, ServiceSubtask.class); |
| | | serviceSubtask.setTaskid(serviceTask.getTaskid()); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | public PhoneCallBackSHVO getFirstQues(PhoneCallReqYQVO phoneCallReqYQVO) { |
| | | //ç¨äºè¿å |
| | | PhoneCallBackSHVO phoneCallBackSHVO = new PhoneCallBackSHVO(); |
| | |
| | | } |
| | | return phoneCallBackSHVO; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 䏿±ASRç»æå¤ç |
| | |
| | | Object cacheObject = redisCache.getCacheObject(phoneCallResultYQVO.getSubId() + "-" + phoneCallResultYQVO.getScriptId()); |
| | | if (cacheObject == null || (Integer) cacheObject < ivrTaskTemplate.getMateNum()) { |
| | | |
| | | |
| | | // è·åé项éåä¸ç optiondesc ç¨äºå¼å¯¼æ£è
|
| | | List<IvrTaskTemplateTargetoption> optionList = ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList(); |
| | | String optionDescStr = ""; |
| | |
| | | } |
| | | return phoneCallBackSHVO; |
| | | } |
| | | |
| | | |
| | | public PhoneCallBackYQVO AiMatch(String url, PhoneCallReqYQVO phoneCallReqYQVO, PhoneCallBackYQVO phoneCallBackYQVO, IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO, ServiceSubtask serviceSubtask, IvrTaskTemplate ivrTaskTemplate, List<IvrTaskTemplateScript> ivrTaskTemplateScripts, String scriptId, Integer flag, String uuid) { |
| | | PhoneCallBackYQVO back = null; |
| | |
| | | return back; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * é®é¢ç»æå æ¯ |
| | | * |
| | | * @param sltdMydTotalVO |
| | | * @param serviceSubtaskRes |
| | | * @return |
| | | */ |
| | | public List<ServiceSubtaskDetailRatioExport> getDetailRatio(SltdMydTotalVO sltdMydTotalVO, List<ServiceSubtaskRes> serviceSubtaskRes) { |
| | | List<ServiceSubtaskDetailRatioExport> serviceSubtaskDetailRatioExports = null; |
| | | List<String> serviceTypeList = sltdMydTotalVO.getServiceTypeList(); |
| | | if (CollectionUtils.isEmpty(serviceTypeList)) { |
| | | log.warn("getDetailRatio æªä¼ serviceTypeListï¼æ æ³ç»è®¡é®é¢å æ¯"); |
| | | return serviceSubtaskDetailRatioExports; |
| | | } |
| | | // 夿å£å¾ï¼2=éè®¿ï¼æ taskid ç»è®¡ï¼ï¼6/14=满æåº¦ï¼æ subtask id ç»è®¡ï¼ |
| | | boolean hasFollowUp = serviceTypeList.contains("2"); |
| | | boolean hasSatisfaction = serviceTypeList.contains("6") || serviceTypeList.contains("14"); |
| | | if (hasFollowUp && hasSatisfaction) { |
| | | //serviceTypeï¼å³æéè®¿åææ»¡æåº¦ï¼ææ¶æ²¡æ³ç»è®¡ |
| | | log.warn("getDetailRatio æä¸æ¯æåæ¶ç»è®¡é访(2)䏿»¡æåº¦(6/14)ï¼serviceTypeList={}", serviceTypeList); |
| | | return serviceSubtaskDetailRatioExports; |
| | | } |
| | | if (hasFollowUp) { |
| | | //è·åserviceSubtaskListä¸çæætaskid |
| | | List<Long> taskIds = serviceSubtaskRes.stream().map(ServiceSubtaskRes::getTaskid).filter(ObjectUtils::isNotEmpty).distinct().collect(Collectors.toList()); |
| | | //忶另䏿¬æ¬¡å¯¼åºçåä»»å¡ idï¼è®©ãé®é¢è¯¦æ
å æ¯ãåªç»è®¡è¿æ¹æ£è
ï¼ä¸ãæ£è
é访信æ¯è¡¨åãå£å¾ä¸è´ |
| | | List<Long> subtaskIds = serviceSubtaskRes.stream().map(ServiceSubtaskRes::getId).filter(ObjectUtils::isNotEmpty).distinct().collect(Collectors.toList()); |
| | | serviceSubtaskDetailRatioExports = statQuestionOption(taskIds, sltdMydTotalVO.getStartFinishTime(), sltdMydTotalVO.getEndFinishTime(), sltdMydTotalVO.getStartOutHospTime(), sltdMydTotalVO.getEndOutHospTime(), sltdMydTotalVO.getQuestionContent(), sltdMydTotalVO.getStartScore(), sltdMydTotalVO.getEndScore(), sltdMydTotalVO.getValueType(), subtaskIds); |
| | | } else if (hasSatisfaction) { |
| | | //满æåº¦ç»è®¡ ï¼éè¿ subtask ç id å»ç»è®¡ï¼ |
| | | List<Long> subtaskIds = serviceSubtaskRes.stream().map(ServiceSubtaskRes::getId).collect(Collectors.toList()); |
| | | serviceSubtaskDetailRatioExports = statQuestionOptionBySubtaskIds(subtaskIds, sltdMydTotalVO.getStartOutHospTime(), sltdMydTotalVO.getEndOutHospTime(), sltdMydTotalVO.getStartFinishTime(), sltdMydTotalVO.getEndFinishTime(), sltdMydTotalVO.getQuestionContent(), sltdMydTotalVO.getStartScore(), sltdMydTotalVO.getEndScore(), sltdMydTotalVO.getValueType()); |
| | | } else { |
| | | log.warn("getDetailRatio æä¸æ¯æç serviceTypeList={}ï¼ä»
æ¯æ 2 æ 6/14ï¼", serviceTypeList); |
| | | } |
| | | return serviceSubtaskDetailRatioExports; |
| | | } |
| | | |
| | | //è·åä»»å¡ç»ä¿¡æ¯ |
| | | private void findServiceTaskScheduleVO(ServiceTaskVO serviceTaskVO) { |
| | | if (StringUtils.isNotEmpty(serviceTaskVO.getAppltype()) && serviceTaskVO.getAppltype().equals("5")) { |
| | |
| | | } |
| | | } |
| | | log.info("aiå¹é
æåï¼å¹é
ç»ææ¯:" + matchedText); |
| | | } |
| | | |
| | | private static String trimAll(String s) { |
| | | if (s == null) { |
| | | return ""; |
| | | } |
| | | int start = 0; |
| | | int end = s.length(); |
| | | while (start < end && isBlankChar(s.charAt(start))) { |
| | | start++; |
| | | } |
| | | while (end > start && isBlankChar(s.charAt(end - 1))) { |
| | | end--; |
| | | } |
| | | return s.substring(start, end); |
| | | } |
| | | |
| | | private static Boolean isBlankChar(char c) { |
| | | return c == '\u3000' // å
¨è§ç©ºæ ¼ |
| | | || c == ' ' // åè§ç©ºæ ¼ |
| | | || c == '\t' || c == '\n' || c == '\r' || c == '\f' || Character.isWhitespace(c); |
| | | } |
| | | |
| | | |
| | | private String buildKey(String groupName, String questionText, String option) { |
| | | return groupName + "\u0001" + questionText + "\u0001" + option; |
| | | } |
| | | |
| | | private static int parseCount(String s) { |
| | | if (StringUtils.isEmpty(s)) { |
| | | return 0; |
| | | } |
| | | try { |
| | | return Integer.parseInt(s.trim()); |
| | | } catch (NumberFormatException e) { |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | private List<MydTrendReqDTO> getWeekDate(MydTrendReqVO mydTrendReqVO, List<MydTrendReqDTO> list) { |
| | | // 1. è®¡ç®æ»å¨æ°ï¼å SQL éçå
¬å¼ä¿æä¸è´ï¼ |
| | | long days = (mydTrendReqVO.getEndFinishTime().getTime() - mydTrendReqVO.getStartFinishTime().getTime()) / (1000L * 60 * 60 * 24); |
| | | int totalWeeks = (int) (days / 7) + 1; |
| | | |
| | | // 2. å·²ææ°æ®ï¼period -> totalScore |
| | | Map<Integer, String> exist = new HashMap<>(); |
| | | for (MydTrendReqDTO row : list) { |
| | | // period æ¯æ°åï¼å¯è½æ¯ Integer / Long / BigDecimalï¼ç»ä¸è½¬ int |
| | | int p = Integer.parseInt(StringUtils.isNotEmpty(row.getPeriod()) ? row.getPeriod() : "0"); |
| | | exist.put(p, row.getTotalScore() != null ? row.getTotalScore() : "0"); |
| | | // ä¸é¢è¿è¡æä½ çåé»è¾ä¿çï¼è½ç¶çèµ·æ¥æç¹å¤ä½ï¼ |
| | | exist.put(p, String.valueOf(row.getTotalScore() != null ? row.getTotalScore() : 0)); |
| | | } |
| | | |
| | | // 3. è¡¥å
¨ 1..totalWeeks |
| | | List<MydTrendReqDTO> result = new ArrayList<>(totalWeeks); |
| | | |
| | | // è·åæ´ä½çå¼å§æ¶é´ |
| | | long startTimeMillis = mydTrendReqVO.getStartFinishTime().getTime(); |
| | | long endTimeMillis = mydTrendReqVO.getEndFinishTime().getTime(); |
| | | long oneWeekMillis = 7L * 24 * 60 * 60 * 1000; // ä¸å¨çæ¯«ç§æ° |
| | | |
| | | for (int i = 1; i <= totalWeeks; i++) { |
| | | MydTrendReqDTO row = new MydTrendReqDTO(); |
| | | row.setPeriod(String.valueOf(i)); |
| | | row.setTotalScore(exist.getOrDefault(i, "0")); |
| | | |
| | | // -------- æ°å¢ï¼è®¾ç½®æ¯å¨ç startDate å endDate -------- |
| | | // å½åå¨å¼å§æ¶é´ = æ´ä½å¼å§æ¶é´ + (i - 1) * 7天 |
| | | long currentStartMillis = startTimeMillis + (long) (i - 1) * oneWeekMillis; |
| | | |
| | | // å½åå¨ç»ææ¶é´ = å½åå¨å¼å§æ¶é´ + 7天 - 1毫ç§ï¼ä¿è¯æ¯è¿ä¸å¨çæåä¸å»ï¼ |
| | | long currentEndMillis = currentStartMillis + oneWeekMillis - 1; |
| | | |
| | | // å¦ææ¯æåä¸å¨ï¼ç»ææ¶é´ä¸è½è¶
è¿æ´ä½ç endTime |
| | | if (i == totalWeeks) { |
| | | currentEndMillis = endTimeMillis; |
| | | } |
| | | |
| | | row.setStartDate(new Date(currentStartMillis)); |
| | | row.setEndDate(new Date(currentEndMillis)); |
| | | // ---------------------------------------------------- |
| | | |
| | | result.add(row); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | private List<MydTrendReqDTO> getYearDate(MydTrendReqVO mydTrendReqVO, List<MydTrendReqDTO> list) { |
| | | // è·åæ´ä½å¼å§åç»ææ¶é´ |
| | | Date startTime = mydTrendReqVO.getStartFinishTime(); |
| | | Date endTime = mydTrendReqVO.getEndFinishTime(); |
| | | |
| | | // 1. 计ç®å¹´ä»½èå´ |
| | | // ä½¿ç¨ Calendar è·åèµ·å§å¹´ä»½åç»æå¹´ä»½ |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(startTime); |
| | | int startYear = cal.get(Calendar.YEAR); |
| | | |
| | | cal.setTime(endTime); |
| | | int endYear = cal.get(Calendar.YEAR); |
| | | |
| | | // æ»å¹´æ° (å
å«é¦å°¾) |
| | | int totalYears = endYear - startYear + 1; |
| | | |
| | | // 2. å·²ææ°æ®ï¼period -> totalScore (å设 period åçæ¯å¹´ä»½å符串ï¼å¦ "2024") |
| | | Map<String, String> exist = new HashMap<>(); |
| | | for (MydTrendReqDTO row : list) { |
| | | String period = row.getPeriod() != null ? row.getPeriod() : ""; |
| | | exist.put(period, row.getTotalScore() != null ? row.getTotalScore() : "0"); |
| | | } |
| | | |
| | | // 3. è¡¥å
¨ææå¹´ä»½ |
| | | List<MydTrendReqDTO> result = new ArrayList<>(totalYears); |
| | | |
| | | for (int i = 0; i < totalYears; i++) { |
| | | int currentYear = startYear + i; |
| | | String periodKey = String.valueOf(currentYear); |
| | | |
| | | MydTrendReqDTO row = new MydTrendReqDTO(); |
| | | row.setPeriod(periodKey); |
| | | // å¦ææ²¡æè¯¥å¹´ä»½çæ°æ®ï¼é»è®¤ç» "0" |
| | | row.setTotalScore(exist.getOrDefault(periodKey, "0")); |
| | | |
| | | // -------- 设置该年份ç startDate å endDate -------- |
| | | Calendar yearCal = Calendar.getInstance(); |
| | | // 设置为该年ç 1æ1æ¥ 00:00:00 |
| | | yearCal.set(currentYear, Calendar.JANUARY, 1, 0, 0, 0); |
| | | yearCal.set(Calendar.MILLISECOND, 0); |
| | | row.setStartDate(yearCal.getTime()); |
| | | |
| | | // 设置为该年ç 12æ31æ¥ 23:59:59 |
| | | yearCal.set(currentYear, Calendar.DECEMBER, 31, 23, 59, 59); |
| | | yearCal.set(Calendar.MILLISECOND, 999); |
| | | row.setEndDate(yearCal.getTime()); |
| | | // ---------------------------------------------------- |
| | | |
| | | result.add(row); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | private List<MydTrendReqDTO> getMonthDate(MydTrendReqVO mydTrendReqVO, List<MydTrendReqDTO> list) { |
| | | // è·åæ´ä½å¼å§åç»ææ¶é´ |
| | | Date startTime = mydTrendReqVO.getStartFinishTime(); |
| | | Date endTime = mydTrendReqVO.getEndFinishTime(); |
| | | |
| | | // 1. è®¡ç®æä»½èå´ |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(startTime); |
| | | int startYear = cal.get(Calendar.YEAR); |
| | | int startMonth = cal.get(Calendar.MONTH); // 注æï¼Calendar.MONTH ä» 0 å¼å§ |
| | | |
| | | cal.setTime(endTime); |
| | | int endYear = cal.get(Calendar.YEAR); |
| | | int endMonth = cal.get(Calendar.MONTH); |
| | | |
| | | // æ»ææ° = (ç»æå¹´ - å¼å§å¹´) * 12 + (ç»ææ - å¼å§æ) + 1 |
| | | int totalMonths = (endYear - startYear) * 12 + (endMonth - startMonth) + 1; |
| | | |
| | | // 2. å·²ææ°æ®ï¼period -> totalScore (period åçæ¯æä»½å符串ï¼å¦ "2024-06") |
| | | Map<String, String> exist = new HashMap<>(); |
| | | for (MydTrendReqDTO row : list) { |
| | | String period = row.getPeriod() != null ? row.getPeriod() : ""; |
| | | exist.put(period, row.getTotalScore() != null ? row.getTotalScore() : "0"); |
| | | } |
| | | |
| | | // 3. è¡¥å
¨æææä»½ |
| | | List<MydTrendReqDTO> result = new ArrayList<>(totalMonths); |
| | | |
| | | Calendar monthCal = Calendar.getInstance(); |
| | | monthCal.set(startYear, startMonth, 1, 0, 0, 0); |
| | | monthCal.set(Calendar.MILLISECOND, 0); |
| | | |
| | | for (int i = 0; i < totalMonths; i++) { |
| | | int currentYear = monthCal.get(Calendar.YEAR); |
| | | int currentMonth = monthCal.get(Calendar.MONTH) + 1; // 转æ 1-12 æ |
| | | |
| | | // æ¼æ¥ periodï¼æ ¼å¼ï¼yyyy-MMï¼æ¯å¦ "2024-06" |
| | | // å¦æä½ å¸ææ¯ "2024-6"ï¼å¯ä»¥æ String.format æ¹æ currentMonth |
| | | String periodKey = String.format("%04d-%02d", currentYear, currentMonth); |
| | | |
| | | MydTrendReqDTO row = new MydTrendReqDTO(); |
| | | row.setPeriod(periodKey); |
| | | row.setTotalScore(exist.getOrDefault(periodKey, "0")); |
| | | |
| | | // -------- 设置该æç startDate å endDate -------- |
| | | // 彿å¼å§æ¶é´ï¼1å· 00:00:00.000 |
| | | Calendar startCal = (Calendar) monthCal.clone(); |
| | | row.setStartDate(startCal.getTime()); |
| | | |
| | | // å½æç»ææ¶é´ï¼ä¸ä¸ªæ1å· 00:00:00.000 å 1 æ¯«ç§ |
| | | Calendar endCal = (Calendar) monthCal.clone(); |
| | | endCal.add(Calendar.MONTH, 1); |
| | | endCal.add(Calendar.MILLISECOND, -1); |
| | | row.setEndDate(endCal.getTime()); |
| | | // ---------------------------------------------------- |
| | | |
| | | result.add(row); |
| | | |
| | | // è¿å
¥ä¸ä¸ä¸ªæ |
| | | monthCal.add(Calendar.MONTH, 1); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | private List<MydTrendReqDTO> getDayDate(MydTrendReqVO mydTrendReqVO, List<MydTrendReqDTO> list) { |
| | | // è·åæ´ä½å¼å§åç»ææ¶é´ |
| | | Date startTime = mydTrendReqVO.getStartFinishTime(); |
| | | Date endTime = mydTrendReqVO.getEndFinishTime(); |
| | | |
| | | // 1. è®¡ç®æ»å¤©æ° |
| | | long oneDayMillis = 24L * 60 * 60 * 1000; |
| | | // 注æï¼è¿éåªç®æ¥æå·®ï¼ä¸èèæ¶åç§ï¼å¦åå¯è½å·®ä¸å¤© |
| | | Calendar startCal = Calendar.getInstance(); |
| | | startCal.setTime(startTime); |
| | | startCal.set(Calendar.HOUR_OF_DAY, 0); |
| | | startCal.set(Calendar.MINUTE, 0); |
| | | startCal.set(Calendar.SECOND, 0); |
| | | startCal.set(Calendar.MILLISECOND, 0); |
| | | |
| | | Calendar endCal = Calendar.getInstance(); |
| | | endCal.setTime(endTime); |
| | | endCal.set(Calendar.HOUR_OF_DAY, 0); |
| | | endCal.set(Calendar.MINUTE, 0); |
| | | endCal.set(Calendar.SECOND, 0); |
| | | endCal.set(Calendar.MILLISECOND, 0); |
| | | |
| | | long days = (endCal.getTimeInMillis() - startCal.getTimeInMillis()) / oneDayMillis; |
| | | int totalDays = (int) days + 1; |
| | | |
| | | // 2. å·²ææ°æ®ï¼period -> totalScore (period åçæ¯æ¥æå符串ï¼å¦ "2024-06-01") |
| | | Map<String, String> exist = new HashMap<>(); |
| | | for (MydTrendReqDTO row : list) { |
| | | String period = row.getPeriod() != null ? row.getPeriod() : ""; |
| | | exist.put(period, row.getTotalScore() != null ? row.getTotalScore() : "0"); |
| | | } |
| | | |
| | | // 3. è¡¥å
¨æææ¥æ |
| | | List<MydTrendReqDTO> result = new ArrayList<>(totalDays); |
| | | |
| | | Calendar dayCal = (Calendar) startCal.clone(); |
| | | for (int i = 0; i < totalDays; i++) { |
| | | // æ¼æ¥ periodï¼æ ¼å¼ï¼yyyy-MM-dd |
| | | String periodKey = String.format("%04d-%02d-%02d", dayCal.get(Calendar.YEAR), dayCal.get(Calendar.MONTH) + 1, dayCal.get(Calendar.DAY_OF_MONTH)); |
| | | |
| | | MydTrendReqDTO row = new MydTrendReqDTO(); |
| | | row.setPeriod(periodKey); |
| | | row.setTotalScore(exist.getOrDefault(periodKey, "0")); |
| | | |
| | | // -------- 设置该天ç startDate å endDate -------- |
| | | Calendar startOfDay = (Calendar) dayCal.clone(); |
| | | row.setStartDate(startOfDay.getTime()); |
| | | |
| | | Calendar endOfDay = (Calendar) dayCal.clone(); |
| | | endOfDay.set(Calendar.HOUR_OF_DAY, 23); |
| | | endOfDay.set(Calendar.MINUTE, 59); |
| | | endOfDay.set(Calendar.SECOND, 59); |
| | | endOfDay.set(Calendar.MILLISECOND, 999); |
| | | row.setEndDate(endOfDay.getTime()); |
| | | // ---------------------------------------------------- |
| | | |
| | | result.add(row); |
| | | |
| | | // è¿å
¥ä¸ä¸å¤© |
| | | dayCal.add(Calendar.DAY_OF_MONTH, 1); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * é¨è¯æ»¡æåº¦ç»¼åå¾åæåï¼æç§å®¤æç
åºï¼ |
| | | * <p> |
| | | * ç»¼åæ»¡æåº¦ = Σ(è¯åæç»æé) / è¯åæç»æ¡æ° à 100%ï¼ |
| | | * æéåªå 1ã0.8ã0.6ã0.4ã0.2 äºæ¡£ï¼å¾æ»¡æã满æãä¸è¬ã䏿»¡æãå¾ä¸æ»¡æï¼ã |
| | | * |
| | | * @param mzMydScoreRankVO æ¥è¯¢æ¡ä»¶ |
| | | * @return æåç»æï¼åæ¬¡ä» 1 å¼å§é¡ºåºç¼å· |
| | | */ |
| | | @Override |
| | | public List<MzMydScoreRankDTO> mzMydScoreRank(MzMydScoreRankVO mzMydScoreRankVO) { |
| | | if (StringUtils.isEmpty(mzMydScoreRankVO.getDimensionType())) { |
| | | mzMydScoreRankVO.setDimensionType("1"); |
| | | } |
| | | if (CollectionUtils.isEmpty(mzMydScoreRankVO.getServiceTypes())) { |
| | | List<String> list=new ArrayList<>(Arrays.asList("14")); |
| | | mzMydScoreRankVO.setServiceTypes(list); |
| | | } |
| | | List<MzMydScoreRankDTO> list = serviceSubtaskMapper.selectMzMydScoreRank(mzMydScoreRankVO); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | // 忬¡ï¼SQL å·²æç»¼åå¾åéåºè¿åï¼è¿é顺åºç¼å· |
| | | for (int i = 0; i < list.size(); i++) { |
| | | list.get(i).setRank(i + 1); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | // --------------------------------------------------------------------- |
| | |
| | | package com.smartor.service.impl; |
| | | |
| | | import com.ruoyi.common.core.service.IUserExtInfoService; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.smartor.domain.IvrLibaScriptAssort; |
| | | import com.smartor.domain.SvyLibScriptCategory; |
| | | import com.smartor.domain.SysUserOrg; |
| | | import com.smartor.mapper.IvrLibaScriptAssortMapper; |
| | | import com.smartor.mapper.SvyLibScriptCategoryMapper; |
| | | import com.smartor.mapper.SysUserOrgMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * ç¨æ·æ©å±ä¿¡æ¯æå¡å®ç°ï¼smartor 模åï¼ |
| | | * ä¾ ruoyi-system éè¿ SpringUtils è°ç¨ |
| | | * <p> |
| | | * è¿ç§»è¯´æï¼å {@code getSatisfactionCategories}ï¼å« Redis ç¼åãè¯é³/é®å·åç±»æ¥è¯¢ï¼ |
| | | * å±äºæ»¡æåº¦é»è¾ï¼å·²æ´æ®µæ¬å
¥ ruoyi-satisfaction 模åï¼ç± |
| | | * {@code com.ruoyi.satisfaction.api.SatisfactionFacade} å®ç° |
| | | * {@code com.ruoyi.common.core.service.ISatisfactionCategoryService}ã |
| | | * æ¬ç±»å æ¤ä¸åä¾èµ {@code IvrLibaScriptAssortMapper} / {@code SvyLibScriptCategoryMapper} / {@code RedisCache}ã |
| | | */ |
| | | @Service |
| | | public class UserExtInfoServiceImpl implements IUserExtInfoService { |
| | | |
| | | private static final String SATISFACTION_CACHE_KEY = "satisfaction:categories:"; |
| | | private static final int SATISFACTION_CACHE_TTL = 30; |
| | | |
| | | @Autowired |
| | | private SysUserOrgMapper sysUserOrgMapper; |
| | | |
| | | @Autowired |
| | | private IvrLibaScriptAssortMapper ivrLibaScriptAssortMapper; |
| | | |
| | | @Autowired |
| | | private SvyLibScriptCategoryMapper svyLibScriptCategoryMapper; |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | /** |
| | | * è·åç¨æ·æºæ/é¢åºä¿¡æ¯ |
| | |
| | | result.put("campusid", sysUserOrgs.get(0).getCampusid()); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * è·å满æåº¦é®é¢åç±»ï¼è¯é³ + é®å·ï¼ï¼å¸¦Redisç¼å |
| | | */ |
| | | @Override |
| | | @SuppressWarnings("unchecked") |
| | | public Map<String, Object> getSatisfactionCategories(String orgid) { |
| | | // å
æ¥ç¼å |
| | | String cacheKey = SATISFACTION_CACHE_KEY + orgid; |
| | | Map<String, Object> cached = redisCache.getCacheObject(cacheKey); |
| | | if (cached != null) { |
| | | return cached; |
| | | } |
| | | |
| | | Map<String, Object> satisfactionCategories = new HashMap<>(); |
| | | |
| | | // è·åè¯é³é®é¢åç±» |
| | | IvrLibaScriptAssort ivrLibaScriptAssort = new IvrLibaScriptAssort(); |
| | | ivrLibaScriptAssort.setOrgid(orgid); |
| | | ivrLibaScriptAssort.setType("myd"); |
| | | List<IvrLibaScriptAssort> ivrLibaScriptAssorts = ivrLibaScriptAssortMapper.selectIvrLibaScriptAssortList(ivrLibaScriptAssort); |
| | | List<Map<String, Object>> categoryList = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(ivrLibaScriptAssorts)) { |
| | | for (IvrLibaScriptAssort assort : ivrLibaScriptAssorts) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("categoryid", assort.getId()); |
| | | map.put("categoryName", assort.getIndexAssortName()); |
| | | categoryList.add(map); |
| | | } |
| | | } |
| | | satisfactionCategories.put("voiceCategories", categoryList); |
| | | |
| | | // è·åé®å·é®é¢åç±» |
| | | SvyLibScriptCategory svyLibScriptCategory = new SvyLibScriptCategory(); |
| | | svyLibScriptCategory.setOrgid(orgid); |
| | | svyLibScriptCategory.setType("myd"); |
| | | List<SvyLibScriptCategory> svyLibScriptCategories = svyLibScriptCategoryMapper.selectSvyLibScriptCategoryList(svyLibScriptCategory); |
| | | List<Map<String, Object>> questionnaireCategorys = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(svyLibScriptCategories)) { |
| | | for (SvyLibScriptCategory scriptCategory : svyLibScriptCategories) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("categoryid", scriptCategory.getId()); |
| | | map.put("categoryName", scriptCategory.getName()); |
| | | questionnaireCategorys.add(map); |
| | | } |
| | | } |
| | | satisfactionCategories.put("questionnaireCategorys", questionnaireCategorys); |
| | | |
| | | // åå
¥ç¼å |
| | | redisCache.setCacheObject(cacheKey, satisfactionCategories, SATISFACTION_CACHE_TTL, TimeUnit.MINUTES); |
| | | |
| | | return satisfactionCategories; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | /** |
| | | * ============================================================================ |
| | | * ä½é¢ç¶ææºéææå |
| | | * ============================================================================ |
| | | * |
| | | * ä¸ãç¶ææºæä»¶æ¸
å |
| | | * ============================================================================ |
| | | * |
| | | * 1. æ ¸å¿æä¸¾ |
| | | * ââ com.smartor.common.enums.InhospStateEnum |
| | | * å®ä¹ç¶æå转æ¢è§å |
| | | * |
| | | * 2. å¼å¸¸ç±» |
| | | * ââ com.smartor.common.exception.StateTransitionException |
| | | * å¤çéæ³ç¶æè½¬æ¢ |
| | | * |
| | | * 3. å¤ç卿¥å£ |
| | | * ââ com.smartor.statemachine.handler.InhospStateHandler |
| | | * ç¶æå¤ç卿¥å£ |
| | | * |
| | | * 4. å¤çå¨å®ç° |
| | | * ââ com.smartor.statemachine.handler.impl.PreAdmissionHandler |
| | | * â å¤çé¢å
¥é¢(state=3) |
| | | * ââ com.smartor.statemachine.handler.impl.InHospitalHandler |
| | | * â å¤çå
¥é¢(state=0) |
| | | * ââ com.smartor.statemachine.handler.impl.DischargeHandler |
| | | * å¤çåºé¢(state=1) |
| | | * |
| | | * 5. ç¶ææºç®¡çå¨ |
| | | * ââ com.smartor.statemachine.InhospStateMachine |
| | | * åè°ç¶æè½¬æ¢ã管çåå¸å¼é |
| | | * |
| | | * 6. é¨é¢æå¡ |
| | | * ââ com.smartor.statemachine.InhospStateMachineService |
| | | * 对å¤APIæ¥å£ |
| | | * |
| | | * 7. 使ç¨ç¤ºä¾ |
| | | * ââ com.smartor.statemachine.InhospStateMachineExample |
| | | * éæç¤ºä¾ä»£ç |
| | | * |
| | | * |
| | | * äºãå¦ä½å¨ç°æä»£ç ä¸éæ |
| | | * ============================================================================ |
| | | * |
| | | * å代ç ä½ç½®ï¼ |
| | | * ServiceSLTDHealthcareRecordServiceImpl.processPatientInhospInfo (L561-677) |
| | | * |
| | | * ãæ¹æ¡1ãå®å
¨æ¿æ¢ï¼æ¨èç¨äºæ°åè½ï¼ |
| | | * ----------------------------------------- |
| | | * |
| | | * @Autowired |
| | | * private InhospStateMachineService stateMachineService; |
| | | * |
| | | * private void processPatientInhospInfo(ServiceSLTDInhospResDTO dto, PatArchive patArchive, String cry) { |
| | | * PatMedInhosp patMedInhosp = buildPatientInhospInfo(dto, patArchive, cry); |
| | | * stateMachineService.processStateChange(patMedInhosp, cry); |
| | | * } |
| | | * |
| | | * |
| | | * ãæ¹æ¡2ãå忍¡å¼ï¼æ¨èç¨äºç产ç¯å¢éªè¯ï¼ |
| | | * ----------------------------------------- |
| | | * |
| | | * @Autowired |
| | | * private InhospStateMachineService stateMachineService; |
| | | * |
| | | * private void processPatientInhospInfo(ServiceSLTDInhospResDTO dto, PatArchive patArchive, String cry) { |
| | | * PatMedInhosp patMedInhosp = buildPatientInhospInfo(dto, patArchive, cry); |
| | | * |
| | | * // æ¹å¼Aï¼ä¿çåæé»è¾ |
| | | * // processPatientInhospInfoOld(dto, patArchive, cry); |
| | | * |
| | | * // æ¹å¼Bï¼ä½¿ç¨ç¶ææº |
| | | * try { |
| | | * boolean success = stateMachineService.processStateChange(patMedInhosp, cry); |
| | | * log.info("ãç¶ææºãå¤çç»æï¼{}, serialnum={}, cry={}", success, patMedInhosp.getSerialnum(), cry); |
| | | * } catch (Exception e) { |
| | | * log.error("ãç¶ææºãå¤çå¼å¸¸ï¼serialnum={}, cry={}, é误ï¼{}", patMedInhosp.getSerialnum(), cry, e.getMessage()); |
| | | * } |
| | | * } |
| | | * |
| | | * |
| | | * ãæ¹æ¡3ãå¼å
³æ§å¶ï¼æ¨èç¨äºç°åº¦åå¸ï¼ |
| | | * ----------------------------------------- |
| | | * |
| | | * @Value("${inhosp.statemachine.enabled:false}") |
| | | * private boolean stateMachineEnabled; |
| | | * |
| | | * @Autowired |
| | | * private InhospStateMachineService stateMachineService; |
| | | * |
| | | * private void processPatientInhospInfo(ServiceSLTDInhospResDTO dto, PatArchive patArchive, String cry) { |
| | | * PatMedInhosp patMedInhosp = buildPatientInhospInfo(dto, patArchive, cry); |
| | | * |
| | | * if (stateMachineEnabled) { |
| | | * // 使ç¨ç¶ææº |
| | | * stateMachineService.processStateChange(patMedInhosp, cry); |
| | | * } else { |
| | | * // 使ç¨åæé»è¾ |
| | | * processPatientInhospInfoOld(dto, patArchive, cry); |
| | | * } |
| | | * } |
| | | * |
| | | * é
ç½®æä»¶ application.ymlï¼ |
| | | * inhosp: |
| | | * statemachine: |
| | | * enabled: true # å¼å¯ç¶ææº |
| | | * |
| | | * |
| | | * ä¸ãæ°æ®åºç´¢å¼å»ºè®® |
| | | * ============================================================================ |
| | | * |
| | | * ãé项1ãå
许å¤ç¶æè®°å½ï¼æ¨èï¼ä¸ç°æé»è¾å
¼å®¹ï¼ |
| | | * ----------------------------------------- |
| | | * CREATE UNIQUE INDEX uk_serialnum_orgid_state |
| | | * ON pat_med_inhosp(serialnum, orgid, inhospstate); |
| | | * |
| | | * ä¼ç¹ï¼ |
| | | * - ä¸ç°ææ°æ®å
¼å®¹ |
| | | * - åªæ¦æªç¸åç¶æçé夿å
¥ |
| | | * - ç¶ææºå¤çå¨å¯ä»¥å³å®æ¯æ°å¢è¿æ¯æ´æ° |
| | | * |
| | | * |
| | | * ãé项2ã强å¶åè®°å½ï¼éæ°æ®è¿ç§»ï¼ |
| | | * ----------------------------------------- |
| | | * CREATE UNIQUE INDEX uk_serialnum_orgid |
| | | * ON pat_med_inhosp(serialnum, orgid); |
| | | * |
| | | * ä¼ç¹ï¼ |
| | | * - æ°æ®ä¸è´æ§æ´å¼º |
| | | * - é¿å
䏿£å¤è®°å½é®é¢ |
| | | * |
| | | * 缺ç¹ï¼ |
| | | * - éè¦æ¸
çå岿°æ® |
| | | * - ææç¶æåæ´å¿
é¡»èµ°æ´æ° |
| | | * |
| | | * æ°æ®æ¸
çèæ¬ï¼ |
| | | * -- ä¿çæ¯ä¸ªæ£è
ææ°ç¶æçè®°å½ï¼å é¤å
¶ä»è®°å½ |
| | | * DELETE t1 FROM pat_med_inhosp t1 |
| | | * INNER JOIN ( |
| | | * SELECT serialnum, orgid, MAX(inhospid) as max_id |
| | | * FROM pat_med_inhosp |
| | | * GROUP BY serialnum, orgid |
| | | * HAVING COUNT(*) > 1 |
| | | * ) t2 ON t1.serialnum = t2.serialnum |
| | | * AND t1.orgid = t2.orgid |
| | | * AND t1.inhospid < t2.max_id; |
| | | * |
| | | * |
| | | * åãç¶ææºæ ¸å¿ä¼å¿ |
| | | * ============================================================================ |
| | | * |
| | | * 1. å¹¶åå®å
¨ |
| | | * â
èªå¨å åå¸å¼éï¼Redisï¼ |
| | | * â
éç²åº¦ï¼serialnum + orgid |
| | | * â
è¶
æ¶æ¶é´ï¼10ç§ï¼å¯é
ç½®ï¼ |
| | | * â
Redisä¸å¯ç¨æ¶èªå¨é级 |
| | | * |
| | | * 2. ç¶ææ ¡éª |
| | | * â
强å¶ååæµè½¬ï¼3(é¢å
¥é¢) â 0(å
¥é¢) â 1(åºé¢) |
| | | * â
黿¢éæ³è½¬æ¢ï¼å¦ï¼é¢å
¥é¢âåºé¢ï¼ |
| | | * â
黿¢é夿ä½ï¼å¦ï¼éå¤å
¥é¢ï¼ |
| | | * |
| | | * 3. 代ç ç®å |
| | | * â
100+è¡if-else â 10è¡ç¶ææºè°ç¨ |
| | | * â
çç¥æ¨¡å¼ï¼ææ©å± |
| | | * â
éä¸å¼ç¶æç®¡ç |
| | | * |
| | | * 4. æ¥å¿å®å |
| | | * â
æ¯ä¸ªç¶æè½¬æ¢é½ææ¥å¿ |
| | | * â
å¼å¸¸ä¿¡æ¯è¯¦ç» |
| | | * â
便äºé®é¢ææ¥ |
| | | * |
| | | * |
| | | * äºãæµè¯éªè¯å»ºè®® |
| | | * ============================================================================ |
| | | * |
| | | * 1. åå
æµè¯ |
| | | * - æµè¯ç¶ææä¸¾ç转æ¢è§å |
| | | * - æµè¯æ¯ä¸ªHandlerçé»è¾ |
| | | * - æµè¯ç¶ææºçéæºå¶ |
| | | * |
| | | * 2. éææµè¯ |
| | | * - æ£å¸¸æµç¨ï¼é¢å
¥é¢âå
¥é¢âåºé¢ |
| | | * - è·³è¿é¢å
¥é¢ï¼ç´æ¥å
¥é¢âåºé¢ |
| | | * - å¼å¸¸æµç¨ï¼é夿ä½ãéæ³è½¬æ¢ |
| | | * |
| | | * 3. å¹¶åæµè¯ |
| | | * - 使ç¨JMeter模æå¹¶åè¯·æ± |
| | | * - éªè¯å䏿£è
100å¹¶åä¸ä¼é夿å
¥ |
| | | * - éªè¯Rediséçæææ§ |
| | | * |
| | | * 4. ç产éªè¯ |
| | | * - å
å¼å¯å忍¡å¼ |
| | | * - 对æ¯åé»è¾ä¸ç¶ææºç»æ |
| | | * - éªè¯1-2å¨åå®å
¨åæ¢ |
| | | * |
| | | * |
| | | * å
ãé
ç½®åæ°ï¼å¯éï¼ |
| | | * ============================================================================ |
| | | * |
| | | * application.yml 坿·»å 以ä¸é
ç½®ï¼ |
| | | * |
| | | * inhosp: |
| | | * statemachine: |
| | | * enabled: true # æ¯å¦å¯ç¨ç¶ææº |
| | | * lock-timeout: 10 # åå¸å¼éè¶
æ¶æ¶é´ï¼ç§ï¼ |
| | | * allow-direct-discharge: false # æ¯å¦å
许æ å
¥é¢è®°å½ç´æ¥åºé¢ |
| | | * |
| | | * |
| | | * ä¸ã常è§é®é¢ |
| | | * ============================================================================ |
| | | * |
| | | * Q1: ç¶ææºæ¯å¦ä¼å½±åæ§è½ï¼ |
| | | * A: ä¸ä¼ãç¶ææºå
é¨é»è¾ä¸å代ç ç¸ä¼¼ï¼åªæ¯ç»ææ´æ¸
æ°ãRediséçè·åèæ¶å¨æ¯«ç§çº§ã |
| | | * |
| | | * Q2: Redisä¸å¯ç¨æ¶ä¼ææ ·ï¼ |
| | | * A: ç¶ææºä¼èªå¨é级为æ 鿍¡å¼ï¼ä¾ç¶å¯ä»¥æ§è¡ï¼ä½å¹¶åå®å
¨ä¾èµæ°æ®åºå¯ä¸ç´¢å¼ã |
| | | * |
| | | * Q3: å¦ä½æ©å±æ°ç¶æï¼ |
| | | * A: |
| | | * 1. å¨InhospStateEnum䏿·»å æ°ç¶æ |
| | | * 2. å建对åºçHandlerå®ç° |
| | | * 3. ç¶ææºä¼èªå¨æ³¨åå¹¶è¯å« |
| | | * |
| | | * Q4: ç¶ææºæ¯å¦æ¯æäºå¡ï¼ |
| | | * A: æ¯æãç¶ææºè°ç¨æ¬èº«å¯ä»¥å¨@Transactionalæ¹æ³ä¸ä½¿ç¨ã |
| | | * |
| | | * Q5: åºé¢åè½å¦åå
¥é¢ï¼ |
| | | * A: ç®åé»è¾ä¸å
许ã妿éè¦æ¯æï¼å»ºè®®å¨æ°æ®æ¨¡åä¸å¢å "å°±è¯æ¹æ¬¡"åæ®µã |
| | | * |
| | | * |
| | | * å
«ãåç»ä¼åæ¹å |
| | | * ============================================================================ |
| | | * |
| | | * 1. ç¶æåæ´åå²è¡¨ |
| | | * - è®°å½æ¯æ¬¡ç¶æè½¬æ¢ |
| | | * - æ¯æç¶æåæº¯ |
| | | * - 便äºå®¡è®¡ |
| | | * |
| | | * 2. ç¶ææºå¯è§å |
| | | * - æä¾ç¶ææµè½¬å¾ |
| | | * - 宿¶çæ§ç¶æåå¸ |
| | | * |
| | | * 3. è¡¥å¿æºå¶ |
| | | * - æ¯æç¶æåæ» |
| | | * - å¼å¸¸ç¶æä¿®å¤ |
| | | * |
| | | * 4. é
ç½®åç¶æè§å |
| | | * - 仿°æ®åºè¯»åç¶æè½¬æ¢è§å |
| | | * - å¨æè°æ´ä¸éè¦éå¯ |
| | | * |
| | | * |
| | | * ============================================================================ |
| | | * è系人ï¼smartorå¼åå¢é |
| | | * åå»ºæ¥æï¼2026-01-29 |
| | | * ============================================================================ |
| | | */ |
| | | package com.smartor.statemachine; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.smartor.mapper.PatMedOuthospErrorMapper"> |
| | | |
| | | <resultMap type="com.smartor.domain.PatMedOuthospError" id="PatMedOuthospErrorResult"> |
| | | <result property="id" column="id"/> |
| | | <result property="serialnum" column="serialnum"/> |
| | | <result property="outhospno" column="outhospno"/> |
| | | <result property="patname" column="patname"/> |
| | | <result property="patno" column="patno"/> |
| | | <result property="campusid" column="campusid"/> |
| | | <result property="orgid" column="orgid"/> |
| | | <result property="admitdate" column="admitdate"/> |
| | | <result property="gatherDate" column="gather_date"/> |
| | | <result property="errorType" column="error_type"/> |
| | | <result property="errorMsg" column="error_msg"/> |
| | | <result property="rawData" column="raw_data"/> |
| | | <result property="failCount" column="fail_count"/> |
| | | <result property="handleStatus" column="handle_status"/> |
| | | <result property="handleRemark" column="handle_remark"/> |
| | | <result property="createTime" column="create_time"/> |
| | | <result property="updateTime" column="update_time"/> |
| | | </resultMap> |
| | | |
| | | <sql id="selectPatMedOuthospErrorVo"> |
| | | select id, serialnum, outhospno, patname, patno, campusid, orgid, admitdate, gather_date, |
| | | error_type, error_msg, raw_data, fail_count, handle_status, handle_remark, create_time, update_time |
| | | from pat_med_outhosp_error |
| | | </sql> |
| | | |
| | | <!-- |
| | | éé失败è½è¡¨ï¼serialnum ä¸ä¸ºç©ºæ¶é å¯ä¸ç´¢å¼ uk_serialnum_type(serialnum, error_type) å upsertï¼ |
| | | é¿å
æ¯åå°æ¶ä¸è½®æå䏿¡èæ°æ®éå¤åè¿æ¥ï¼fail_count ç´¯å å¯ä»¥çå°å®å°åºå¤±è´¥äºå¤å°è½®ã |
| | | 已被人工æ è®°"å·²å¤ç"çè®°å½å¦æå次失败ï¼ç¶æéæ°åå°"å¾
å¤ç"ï¼"已忽ç¥"çä¿æå¿½ç¥ä¸åææ°ã |
| | | --> |
| | | <insert id="insertPatMedOuthospError" parameterType="com.smartor.domain.PatMedOuthospError" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into pat_med_outhosp_error |
| | | (serialnum, outhospno, patname, patno, campusid, orgid, admitdate, gather_date, |
| | | error_type, error_msg, raw_data, fail_count, handle_status, handle_remark, create_time, update_time) |
| | | values |
| | | (#{serialnum}, #{outhospno}, #{patname}, #{patno}, #{campusid}, #{orgid}, #{admitdate}, #{gatherDate}, |
| | | #{errorType}, #{errorMsg}, #{rawData}, 1, #{handleStatus}, #{handleRemark}, now(), now()) |
| | | <if test="serialnum != null and serialnum != ''"> |
| | | on duplicate key update |
| | | error_msg = values(error_msg), |
| | | raw_data = values(raw_data), |
| | | admitdate = values(admitdate), |
| | | fail_count = fail_count + 1, |
| | | handle_status = case when handle_status = '1' then '0' else handle_status end, |
| | | update_time = now() |
| | | </if> |
| | | </insert> |
| | | |
| | | <select id="selectPatMedOuthospErrorList" parameterType="com.smartor.domain.PatMedOuthospError" |
| | | resultMap="PatMedOuthospErrorResult"> |
| | | <include refid="selectPatMedOuthospErrorVo"/> |
| | | <where> |
| | | <if test="serialnum != null and serialnum != ''">and serialnum = #{serialnum}</if> |
| | | <if test="errorType != null and errorType != ''">and error_type = #{errorType}</if> |
| | | <if test="gatherDate != null and gatherDate != ''">and gather_date = #{gatherDate}</if> |
| | | <if test="handleStatus != null and handleStatus != ''">and handle_status = #{handleStatus}</if> |
| | | </where> |
| | | order by id desc |
| | | </select> |
| | | |
| | | <update id="updateHandleStatus" parameterType="com.smartor.domain.PatMedOuthospError"> |
| | | update pat_med_outhosp_error |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="handleStatus != null and handleStatus != ''">handle_status = #{handleStatus},</if> |
| | | <if test="handleRemark != null">handle_remark = #{handleRemark},</if> |
| | | update_time = now(), |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | </mapper> |
| | |
| | | <if test="questiontext != null">and questiontext = #{questiontext}</if> |
| | | </select> |
| | | |
| | | <!-- |
| | | 满æåº¦æ±ç¶å¾ï¼ä¸æ¬¡æ§ç»è®¡æ¬æ¬¡è¯·æ±å
¨é¨æ¨¡æ¿çå¡«æ¥éã |
| | | çä»·äºå¯¹æ¯ä¸ªæ¨¡æ¿æ§è¡ queryFillCount(subids, questiontext)ï¼åºå«æ¯ï¼ |
| | | 1) ç¨ join service_subtask 代æ¿å
æå
¨é¨ sub_id æ¥å Java åæ¼ IN(...)ï¼ |
| | | 2) æ libtemplateid + questiontext + score åç»ï¼åªåä¼ åå¼ä¸æ¡æ°ï¼ |
| | | 3) visit_time æ¹æå¯èµ°ç´¢å¼çèå´æ¡ä»¶ã |
| | | 注æï¼è¿é廿ä¸å¨ SQL éè¿æ»¤ questiontextï¼ç± Java æå queryFillCount ç |
| | | ãquestiontext 为 null æ¶ä¸æ¼è¯¥æ¡ä»¶ãè¯ä¹åå¹é
ï¼ä¿è¯ç»æå£å¾å®å
¨ä¸è´ã |
| | | --> |
| | | <select id="selectSatisfactionFillStat" parameterType="com.smartor.domain.entity.SatisfactionStatQuery" |
| | | resultType="java.util.Map"> |
| | | select ss.libtemplateid as libtemplateid, |
| | | ssd.questiontext as questiontext, |
| | | ssd.score as score, |
| | | count(*) as cnt |
| | | from service_subtask_detail ssd |
| | | join service_subtask ss on ss.id = ssd.sub_id |
| | | where ssd.del_flag = 0 |
| | | and ss.del_flag = 0 |
| | | <if test="orgid != null and orgid != ''"> |
| | | and ss.orgid = #{orgid} |
| | | </if> |
| | | <if test="campusid != null and campusid != ''"> |
| | | and ss.campusid = #{campusid} |
| | | </if> |
| | | <if test="type != null and type != ''">and ss.type = #{type}</if> |
| | | <if test="startTime != null"> |
| | | and ss.visit_time >= #{startTime} |
| | | </if> |
| | | <if test="endTime != null"> |
| | | and ss.visit_time < date_add(#{endTime}, interval 1 day) |
| | | </if> |
| | | <if test="libTemplateIds != null and libTemplateIds.size() > 0"> |
| | | and ss.libtemplateid IN |
| | | <foreach collection="libTemplateIds" item="libTemplateId" open="(" separator="," close=")"> |
| | | #{libTemplateId} |
| | | </foreach> |
| | | </if> |
| | | <if test="(hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0) or (deptcodes != null and deptcodes.size() > 0)"> |
| | | AND ( |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0"> |
| | | ss.leavehospitaldistrictcode IN |
| | | <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="(" |
| | | separator="," |
| | | close=")"> |
| | | #{hospitaldistrictcode} |
| | | </foreach> |
| | | </if> |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0 and deptcodes != null and deptcodes.size() > 0"> |
| | | OR |
| | | </if> |
| | | <if test="deptcodes != null and deptcodes.size() > 0"> |
| | | ss.deptcode IN |
| | | <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | ) |
| | | </if> |
| | | group by ss.libtemplateid, ssd.questiontext, ssd.score |
| | | </select> |
| | | |
| | | <select id="selectSatisfactionFillPersonCount" parameterType="com.smartor.domain.entity.SatisfactionStatQuery" |
| | | resultType="java.util.Map"> |
| | | select ss.libtemplateid as libtemplateid, |
| | | count(distinct ssd.sub_id) as cnt |
| | | from service_subtask_detail ssd |
| | | join service_subtask ss on ss.id = ssd.sub_id |
| | | where ssd.del_flag = 0 |
| | | and ss.del_flag = 0 |
| | | <if test="orgid != null and orgid != ''"> |
| | | and ss.orgid = #{orgid} |
| | | </if> |
| | | <if test="campusid != null and campusid != ''"> |
| | | and ss.campusid = #{campusid} |
| | | </if> |
| | | <if test="type != null and type != ''">and ss.type = #{type}</if> |
| | | <if test="startTime != null"> |
| | | and ss.visit_time >= #{startTime} |
| | | </if> |
| | | <if test="endTime != null"> |
| | | and ss.visit_time < date_add(#{endTime}, interval 1 day) |
| | | </if> |
| | | <if test="libTemplateIds != null and libTemplateIds.size() > 0"> |
| | | and ss.libtemplateid IN |
| | | <foreach collection="libTemplateIds" item="libTemplateId" open="(" separator="," close=")"> |
| | | #{libTemplateId} |
| | | </foreach> |
| | | </if> |
| | | <if test="(hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0) or (deptcodes != null and deptcodes.size() > 0)"> |
| | | AND ( |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0"> |
| | | ss.leavehospitaldistrictcode IN |
| | | <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="(" |
| | | separator="," |
| | | close=")"> |
| | | #{hospitaldistrictcode} |
| | | </foreach> |
| | | </if> |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0 and deptcodes != null and deptcodes.size() > 0"> |
| | | OR |
| | | </if> |
| | | <if test="deptcodes != null and deptcodes.size() > 0"> |
| | | ss.deptcode IN |
| | | <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | ) |
| | | </if> |
| | | group by ss.libtemplateid |
| | | </select> |
| | | |
| | | <!-- |
| | | 满æåº¦ç»è®¡ï¼statistics / statisticsByDimensionï¼ï¼ä¸æ¬¡æ§ç»è®¡æ¬æ¬¡è¯·æ±å
¨é¨é®é¢çå¡«æ¥éã |
| | | çä»·äºå¯¹æ¯ä¸ªé®é¢æ§è¡ queryFillCount(subids, questiontext)ï¼åºå«æ¯ï¼ |
| | | 1) ç¨ join service_subtask 代æ¿å
æå
¨é¨ sub_id æ¥å Java åæ¼ IN(...)ï¼ |
| | | 2) æ æ¨¡æ¿+é®é¢+matchedtext+score åç»ï¼åªåä¼ é项/åå¼ä¸æ¡æ°ï¼ |
| | | 3) targetvalue ç¨ min() å该é®é¢çä¸ä¸ªé空é项串ï¼åä¸ä¸ªé®é¢è¯¥å¼ä¸è´ï¼ï¼ |
| | | 4) visit_time æ¹æå¯èµ°ç´¢å¼çèå´æ¡ä»¶ã |
| | | 注æï¼è¿é廿ä¸å¨ SQL éè¿æ»¤ questiontextï¼ç± Java æå queryFillCount ç |
| | | ãquestiontext 为 null æ¶ä¸æ¼è¯¥æ¡ä»¶ãè¯ä¹åå¹é
ï¼ä¿è¯ç»æå£å¾å®å
¨ä¸è´ã |
| | | --> |
| | | <select id="selectSatisfactionFillStatByMatchedtext" parameterType="com.smartor.domain.entity.SatisfactionStatQuery" |
| | | resultType="java.util.Map"> |
| | | select ss.libtemplateid as libtemplateid, |
| | | ssd.questiontext as questiontext, |
| | | ssd.matchedtext as matchedtext, |
| | | ssd.score as score, |
| | | count(*) as cnt, |
| | | min(ssd.targetvalue) as targetvalue |
| | | from service_subtask_detail ssd |
| | | join service_subtask ss on ss.id = ssd.sub_id |
| | | where ssd.del_flag = 0 |
| | | and ss.del_flag = 0 |
| | | <if test="orgid != null and orgid != ''"> |
| | | and ss.orgid = #{orgid} |
| | | </if> |
| | | <if test="campusid != null and campusid != ''"> |
| | | and ss.campusid = #{campusid} |
| | | </if> |
| | | <if test="type != null and type != ''">and ss.type = #{type}</if> |
| | | <if test="startTime != null"> |
| | | and ss.visit_time >= #{startTime} |
| | | </if> |
| | | <if test="endTime != null"> |
| | | and ss.visit_time < date_add(#{endTime}, interval 1 day) |
| | | </if> |
| | | <if test="libTemplateIds != null and libTemplateIds.size() > 0"> |
| | | and ss.libtemplateid IN |
| | | <foreach collection="libTemplateIds" item="libTemplateId" open="(" separator="," close=")"> |
| | | #{libTemplateId} |
| | | </foreach> |
| | | </if> |
| | | <if test="(hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0) or (deptcodes != null and deptcodes.size() > 0)"> |
| | | AND ( |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0"> |
| | | ss.leavehospitaldistrictcode IN |
| | | <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="(" |
| | | separator="," |
| | | close=")"> |
| | | #{hospitaldistrictcode} |
| | | </foreach> |
| | | </if> |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0 and deptcodes != null and deptcodes.size() > 0"> |
| | | OR |
| | | </if> |
| | | <if test="deptcodes != null and deptcodes.size() > 0"> |
| | | ss.deptcode IN |
| | | <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | ) |
| | | </if> |
| | | group by ss.libtemplateid, ssd.questiontext, ssd.matchedtext, ssd.score |
| | | </select> |
| | | |
| | | <select id="isExistServiceSubtaskDetail" resultType="com.smartor.domain.DTO.ServiceSubtaskDetailDTO"> |
| | | <select id="isExistServiceSubtaskDetail" resultType="com.smartor.domain.DTO.ServiceSubtaskDetailDTO"> |
| | | select id, questiontext, matchedtext, score |
| | | from service_subtask_detail |
| | | where del_flag = 0 |
| | |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | |
| | | <update id="updateSSDByCondition" parameterType="com.smartor.domain.ServiceSubtaskDetail"> |
| | | update service_subtask_detail |
| | | <trim prefix="SET" suffixOverrides=","> |
| | |
| | | service_subtask_detail.matchedtext |
| | | </select> |
| | | |
| | | <select id="selectRepeatDetailIds" resultType="Long"> |
| | | SELECT d1.id |
| | | FROM service_subtask_detail d1 |
| | | INNER JOIN ( |
| | | SELECT sub_id, questiontext, |
| | | MAX(create_time) AS max_create_time, |
| | | MAX(id) AS keep_id |
| | | FROM service_subtask_detail |
| | | WHERE del_flag = 0 |
| | | GROUP BY sub_id, questiontext |
| | | HAVING COUNT(*) > 1 |
| | | ) d2 ON d1.sub_id = d2.sub_id |
| | | AND d1.questiontext = d2.questiontext |
| | | AND ( |
| | | d1.create_time < d2.max_create_time |
| | | OR (d1.create_time = d2.max_create_time AND d1.id < d2.keep_id) |
| | | ) |
| | | WHERE d1.del_flag = 0 |
| | | </select> |
| | | |
| | | <update id="deleteRepeatDetailByIds"> |
| | | UPDATE service_subtask_detail |
| | | SET del_flag = 1 |
| | | WHERE del_flag = 0 |
| | | AND id IN |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </update> |
| | | </mapper> |
| | | </mapper> |
| | |
| | | <if test="continueTimeNext != null ">and continue_time_next = #{continueTimeNext}</if> |
| | | </select> |
| | | |
| | | |
| | | <select id="selectServiceSubtaskList" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity" |
| | | resultMap="ServiceSubtaskResult"> |
| | | <include refid="selectServiceSubtaskVo"/> |
| | |
| | | <if test="pageSize != null and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if> |
| | | </select> |
| | | |
| | | <select id="selectSatisfactionSubtaskList" parameterType="com.smartor.domain.VO.PatSatisfactionReqVO" |
| | | resultMap="ServiceSubtaskResult"> |
| | | <include refid="selectServiceSubtaskVo"/> |
| | | where 1=1 |
| | | and del_flag = 0 |
| | | <if test="questionType != null">and type = #{questionType}</if> |
| | | |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0"> |
| | | AND leavehospitaldistrictcode IN |
| | | <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="(" separator="," |
| | | close=")"> |
| | | #{hospitaldistrictcode} |
| | | </foreach> |
| | | </if> |
| | | <if test="deptcodes != null and deptcodes.size() > 0"> |
| | | AND deptcode IN |
| | | <foreach collection="deptcodes" item="deptcode" open="(" separator="," |
| | | close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | <if test="serviceTypes != null and serviceTypes.size() > 0"> |
| | | AND service_type IN |
| | | <foreach collection="serviceTypes" item="serviceType" open="(" separator="," |
| | | close=")"> |
| | | #{serviceType} |
| | | </foreach> |
| | | </if> |
| | | |
| | | <if test="startTime != null and endTime != null"> |
| | | AND date_format(visit_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d') |
| | | AND date_format(visit_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d') |
| | | </if> |
| | | </select> |
| | | <!-- |
| | | 满æåº¦ç»è®¡ï¼åªæ¥æ¬æ¬¡æ¡ä»¶ä¸å®é
åå¨åªäº typeã |
| | | è¿æ»¤æ¡ä»¶ä¸ selectSatisfactionSubtaskList å®å
¨ä¸è´ï¼åªæ¯ï¼ |
| | | 1) åª select distinct typeï¼åæ¥æ¯æä¸ç¾ä¸ªå段å
¨æ¥åæ¥ï¼ï¼ |
| | | 2) visit_time æ¹æå¯èµ°ç´¢å¼çèå´æ¡ä»¶ï¼åæ¥å¯¹åå¥ date_formatï¼ç´¢å¼ç¨ä¸ä¸ï¼ã |
| | | --> |
| | | <select id="selectSatisfactionSubtaskTypes" parameterType="com.smartor.domain.VO.PatSatisfactionReqVO" |
| | | resultType="java.lang.String"> |
| | | select distinct type |
| | | from service_subtask |
| | | where del_flag = 0 |
| | | <if test="questionType != null">and type = #{questionType}</if> |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0"> |
| | | AND leavehospitaldistrictcode IN |
| | | <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="(" separator="," |
| | | close=")"> |
| | | #{hospitaldistrictcode} |
| | | </foreach> |
| | | </if> |
| | | <if test="deptcodes != null and deptcodes.size() > 0"> |
| | | AND deptcode IN |
| | | <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | <if test="serviceTypes != null and serviceTypes.size() > 0"> |
| | | AND service_type IN |
| | | <foreach collection="serviceTypes" item="serviceType" open="(" separator="," close=")"> |
| | | #{serviceType} |
| | | </foreach> |
| | | </if> |
| | | <if test="startTime != null and endTime != null"> |
| | | AND visit_time >= #{startTime} |
| | | AND visit_time < date_add(#{endTime}, interval 1 day) |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="getCompensateServiceSubtaskList" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity" |
| | | <select id="getCompensateServiceSubtaskList" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity" |
| | | resultMap="ServiceSubtaskResult"> |
| | | <include refid="selectServiceSubtaskVo"/> |
| | | where del_flag = 0 |
| | |
| | | <if test="continueTimeNext != null ">and continue_time_next = #{continueTimeNext}</if> |
| | | |
| | | </select> |
| | | |
| | | |
| | | <select id="selectServiceSubtaskListAgain" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity" |
| | | resultMap="ServiceSubtaskResult"> |
| | |
| | | GROUP BY ss.${groupKey} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="selectTimelyRateDetail" parameterType="com.smartor.domain.ServiceSubtask" |
| | | resultMap="ServiceSubtaskResult"> |
| | |
| | | </trim> |
| | | where task_guid = #{taskGuid} and task_name = #{taskName} |
| | | </update> |
| | | |
| | | |
| | | <update id="deleteServiceSubtaskById" parameterType="Long"> |
| | | update service_subtask |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <select id="selectVisitCount" parameterType="com.smartor.domain.PatMedReq" |
| | | resultType="com.smartor.domain.PatMedRes"> |
| | | select |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="querySendCount" parameterType="com.smartor.domain.entity.ServiceSubtaskSatisfactionEntity" |
| | | resultType="Long"> |
| | | select distinct id from service_subtask |
| | | where del_flag = 0 |
| | | <if test="orgid != null and orgid != ''"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | <if test="campusid != null and campusid != ''"> |
| | | and campusid = #{campusid} |
| | | </if> |
| | | <if test="type != null ">and type = #{type}</if> |
| | | <if test="startTime != null"> |
| | | AND date_format(visit_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d') |
| | | </if> |
| | | <if test="endTime != null"> |
| | | AND date_format(visit_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d') |
| | | </if> |
| | | <if test=" libTemplateIds != null and libTemplateIds.size()>0"> |
| | | AND libtemplateid IN |
| | | <foreach collection="libTemplateIds" item="libTemplateId" open="(" separator="," |
| | | close=")"> |
| | | #{libTemplateId} |
| | | </foreach> |
| | | </if> |
| | | <if test="(hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0) or (deptcodes != null and deptcodes.size() > 0)"> |
| | | AND ( |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0"> |
| | | leavehospitaldistrictcode IN |
| | | <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="(" |
| | | separator="," |
| | | close=")"> |
| | | #{hospitaldistrictcode} |
| | | </foreach> |
| | | </if> |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0 and deptcodes != null and deptcodes.size() > 0"> |
| | | OR |
| | | </if> |
| | | <if test="deptcodes != null and deptcodes.size() > 0"> |
| | | deptcode IN |
| | | <foreach collection="deptcodes" item="deptcode" open="(" separator="," |
| | | close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | ) |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- |
| | | 满æåº¦æ±ç¶å¾ï¼ä¸æ¬¡æ§ç»è®¡æ¬æ¬¡è¯·æ±å
¨é¨æ¨¡æ¿çåééã |
| | | ä¸ querySendCount çè¿æ»¤æ¡ä»¶å®å
¨ä¸è´ï¼åºå«æ¯ï¼ |
| | | 1) æ libtemplateid åç»ï¼ä¸æ¬¡è¿åæææ¨¡æ¿ï¼æ¿ä»£éä¸ªæ¨¡æ¿æ¥è¯¢ï¼ï¼ |
| | | 2) visit_time æ¹æå¯èµ°ç´¢å¼çèå´æ¡ä»¶ï¼åæ¥å¯¹åå¥ date_formatï¼ç´¢å¼ç¨ä¸ä¸ï¼ã |
| | | --> |
| | | <select id="selectSatisfactionSendCount" parameterType="com.smartor.domain.entity.SatisfactionStatQuery" |
| | | resultType="java.util.Map"> |
| | | select libtemplateid as libtemplateid, count(distinct id) as cnt |
| | | from service_subtask |
| | | where del_flag = 0 |
| | | <if test="orgid != null and orgid != ''"> |
| | | and orgid = #{orgid} |
| | | </if> |
| | | <if test="campusid != null and campusid != ''"> |
| | | and campusid = #{campusid} |
| | | </if> |
| | | <if test="type != null and type != ''">and type = #{type}</if> |
| | | <if test="startTime != null"> |
| | | and visit_time >= #{startTime} |
| | | </if> |
| | | <if test="endTime != null"> |
| | | and visit_time < date_add(#{endTime}, interval 1 day) |
| | | </if> |
| | | <if test="libTemplateIds != null and libTemplateIds.size() > 0"> |
| | | and libtemplateid IN |
| | | <foreach collection="libTemplateIds" item="libTemplateId" open="(" separator="," close=")"> |
| | | #{libTemplateId} |
| | | </foreach> |
| | | </if> |
| | | <if test="(hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0) or (deptcodes != null and deptcodes.size() > 0)"> |
| | | AND ( |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0"> |
| | | leavehospitaldistrictcode IN |
| | | <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="(" |
| | | separator="," |
| | | close=")"> |
| | | #{hospitaldistrictcode} |
| | | </foreach> |
| | | </if> |
| | | <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size() > 0 and deptcodes != null and deptcodes.size() > 0"> |
| | | OR |
| | | </if> |
| | | <if test="deptcodes != null and deptcodes.size() > 0"> |
| | | deptcode IN |
| | | <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")"> |
| | | #{deptcode} |
| | | </foreach> |
| | | </if> |
| | | ) |
| | | </if> |
| | | group by libtemplateid |
| | | </select> |
| | | |
| | | <!-- |
| | | <!-- |
| | | æç
åºæç§å®¤åç»ç»è®¡ continue_flag æ°é |
| | | ä¼ äº leavehospitaldistrictcodes â æç
åºç»´åº¦ |
| | | ä¼ äº deptcodes â æç§å®¤ç»´åº¦ |
| | |
| | | and sendstate in (1, 2, 3) |
| | | </select> |
| | | |
| | | <select id="mydTrend" resultType="com.smartor.domain.DTO.MydTrendReqDTO"> |
| | | SELECT CASE #{type} |
| | | WHEN 'year' THEN DATE_FORMAT(d.create_time, '%Y') |
| | | WHEN 'quarter' THEN CONCAT(YEAR(d.create_time), '-Q', QUARTER(d.create_time)) |
| | | WHEN 'month' THEN DATE_FORMAT(d.create_time, '%Y-%m') |
| | | WHEN 'week' THEN FLOOR(DATEDIFF(d.create_time, #{startFinishTime}) / 7) + 1 |
| | | ELSE DATE_FORMAT(d.create_time, '%Y-%m-%d') |
| | | END AS period, |
| | | ROUND(avg(d.score), 2) AS totalScore |
| | | FROM service_subtask_detail d |
| | | JOIN service_task t ON d.taskid = t.taskid |
| | | WHERE t.service_type IN (14) |
| | | AND t.del_flag = 0 |
| | | AND d.del_flag = 0 |
| | | AND d.create_time >= #{startFinishTime} |
| | | AND d.create_time < DATE_ADD(#{endFinishTime}, INTERVAL 1 DAY) |
| | | GROUP BY period |
| | | ORDER BY period; |
| | | </select> |
| | | |
| | | <select id="sltdMydTotalByDimension" resultType="com.smartor.domain.DTO.MydTrendReqDTO"> |
| | | SELECT |
| | | p.period, |
| | | dim.dimension, |
| | | IFNULL(ROUND(SUM(d.score), 2), 0) AS totalScore |
| | | FROM ( |
| | | <!-- çææ¥è¯¢èå´å
å®é
åºç°è¿çæ¶é´æ®µ --> |
| | | SELECT DISTINCT |
| | | CASE #{type} |
| | | WHEN 'year' THEN DATE_FORMAT(d.create_time, '%Y') |
| | | WHEN 'quarter' THEN CONCAT(YEAR(d.create_time), '-Q', QUARTER(d.create_time)) |
| | | WHEN 'month' THEN DATE_FORMAT(d.create_time, '%Y-%m') |
| | | WHEN 'week' THEN FLOOR(DATEDIFF(d.create_time, #{startFinishTime}) / 7) + 1 |
| | | ELSE DATE_FORMAT(d.create_time, '%Y-%m-%d') |
| | | END AS period |
| | | FROM service_subtask_detail d |
| | | WHERE d.del_flag = 0 |
| | | AND d.create_time >= #{startFinishTime} |
| | | AND d.create_time < #{endFinishTime} |
| | | ) p |
| | | CROSS JOIN ( |
| | | <!-- ææéè¦å±ç¤ºç dimension --> |
| | | SELECT DISTINCT dimension |
| | | FROM service_subtask_detail |
| | | WHERE del_flag = 0 |
| | | AND dimension IS NOT NULL |
| | | ) dim |
| | | LEFT JOIN service_task t |
| | | ON t.service_type IN (6, 14) |
| | | AND t.del_flag = 0 |
| | | LEFT JOIN service_subtask_detail d |
| | | ON d.taskid = t.taskid |
| | | AND d.del_flag = 0 |
| | | AND d.dimension = dim.dimension |
| | | AND CASE #{type} |
| | | WHEN 'year' THEN DATE_FORMAT(d.create_time, '%Y') |
| | | WHEN 'quarter' THEN CONCAT(YEAR(d.create_time), '-Q', QUARTER(d.create_time)) |
| | | WHEN 'month' THEN DATE_FORMAT(d.create_time, '%Y-%m') |
| | | WHEN 'week' THEN FLOOR(DATEDIFF(d.create_time, #{startFinishTime}) / 7) + 1 |
| | | ELSE DATE_FORMAT(d.create_time, '%Y-%m-%d') |
| | | END = p.period |
| | | AND d.create_time >= #{startFinishTime} |
| | | AND d.create_time < #{endFinishTime} |
| | | GROUP BY p.period, dim.dimension |
| | | ORDER BY p.period, dim.dimension |
| | | </select> |
| | | |
| | | <select id="sltdMydTotalByYQ" resultType="com.smartor.domain.DTO.MydTrendReqDTO"> |
| | | SELECT p.period, |
| | | c.campusid, |
| | | IFNULL(ROUND(AVG(d.score), 2), 0) AS totalScore |
| | | FROM ( |
| | | -- çææ¥è¯¢èå´å
å®é
åºç°è¿çæ¶é´æ®µ |
| | | SELECT DISTINCT CASE #{type} |
| | | WHEN 'year' THEN DATE_FORMAT(d.create_time, '%Y') |
| | | WHEN 'quarter' THEN CONCAT(YEAR(d.create_time), '-Q', QUARTER(d.create_time)) |
| | | WHEN 'month' THEN DATE_FORMAT(d.create_time, '%Y-%m') |
| | | WHEN 'week' THEN FLOOR(DATEDIFF(d.create_time, #{startFinishTime}) / 7) + 1 |
| | | ELSE DATE_FORMAT(d.create_time, '%Y-%m-%d') |
| | | END AS period |
| | | FROM service_subtask_detail d |
| | | WHERE d.del_flag = 0 |
| | | AND d.create_time >= #{startFinishTime} |
| | | AND d.create_time < #{endFinishTime}) p |
| | | CROSS JOIN ( |
| | | -- ææéè¦å±ç¤ºçé¢åº |
| | | SELECT DISTINCT campusid |
| | | FROM service_task |
| | | WHERE service_type IN (6, 14) |
| | | AND del_flag = 0 |
| | | AND campusid IS NOT NULL) c |
| | | LEFT JOIN service_task t |
| | | ON t.campusid = c.campusid |
| | | AND t.service_type IN (6, 14) |
| | | AND t.del_flag = 0 |
| | | LEFT JOIN service_subtask_detail d |
| | | ON d.taskid = t.taskid |
| | | AND d.del_flag = 0 |
| | | AND CASE #{type} |
| | | WHEN 'year' THEN DATE_FORMAT(d.create_time, '%Y') |
| | | WHEN 'quarter' THEN CONCAT(YEAR(d.create_time), '-Q', QUARTER(d.create_time)) |
| | | WHEN 'month' THEN DATE_FORMAT(d.create_time, '%Y-%m') |
| | | WHEN 'week' THEN FLOOR(DATEDIFF(d.create_time, #{startFinishTime}) / 7) + 1 |
| | | ELSE DATE_FORMAT(d.create_time, '%Y-%m-%d') |
| | | END = p.period |
| | | AND d.create_time >= #{startFinishTime} |
| | | AND d.create_time < #{endFinishTime} |
| | | GROUP BY p.period, c.campusid |
| | | ORDER BY p.period, c.campusid; |
| | | </select> |
| | | |
| | | <!-- ä»»å¡ç»ï¼appltype=5ï¼æ»å¨è°åº¦ç¨ï¼ææ¬è½®å
¨é subtaskï¼ä½ä¸ºä¸ä¸è½®çå
鿍¡æ¿ --> |
| | | <!-- ä»»å¡ç»ï¼appltype=5ï¼æ»å¨è°åº¦ç¨ï¼ææ¬è½®å
¨é subtaskï¼ä½ä¸ºä¸ä¸è½®çå
鿍¡æ¿ --> |
| | | <select id="selectByScheduleIdAndLoop" resultMap="ServiceSubtaskResult"> |
| | | <include refid="selectServiceSubtaskVo"/> |
| | | where schedule_id = #{scheduleId} |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="statQuestionOption" resultType="com.smartor.domain.ServiceSubtaskDetailRatioExport"> |
| | | SELECT |
| | | d.questiontext AS questiontext, |
| | | t.taskid AS taskid, |
| | | t.task_name AS taskName, |
| | | d.asrtext AS optionresult, |
| | | d.score AS score, |
| | | d.targetvalue AS targetvalue, |
| | | d.value_type AS valueType, |
| | | COUNT(*) AS count, |
| | | CONCAT(ROUND(COUNT(*) * 100.0 / t2.total_count, 2), '%') AS ratio |
| | | FROM |
| | | service_task t |
| | | INNER JOIN service_subtask s ON s.taskid = t.taskid |
| | | INNER JOIN service_subtask_detail d ON d.sub_id = s.id |
| | | INNER JOIN ( |
| | | SELECT |
| | | t.taskid, |
| | | d.questiontext, |
| | | COUNT(*) AS total_count |
| | | FROM |
| | | service_task t |
| | | INNER JOIN service_subtask s ON s.taskid = t.taskid |
| | | INNER JOIN service_subtask_detail d ON d.sub_id = s.id |
| | | WHERE 1=1 |
| | | <if test="taskIds != null and taskIds.size() > 0"> |
| | | AND t.taskid IN |
| | | <foreach collection="taskIds" item="taskId" open="(" separator="," close=")"> |
| | | #{taskId} |
| | | </foreach> |
| | | </if> |
| | | <!-- ä¼ äº subtaskIds åªç»è®¡è¿æ¹åä»»å¡ï¼æ¬æ¬¡å¯¼åºçæ£è
ï¼ --> |
| | | <if test="subtaskIds != null and subtaskIds.size() > 0"> |
| | | AND s.id IN |
| | | <foreach collection="subtaskIds" item="subtaskId" open="(" separator="," close=")"> |
| | | #{subtaskId} |
| | | </foreach> |
| | | </if> |
| | | <if test="valueType != null">AND d.value_type = #{valueType}</if> |
| | | <if test="scoreStart != null">AND d.score >= #{scoreStart}</if> |
| | | <if test="scoreEnd != null">AND d.score <= #{scoreEnd}</if> |
| | | <if test="questiontext != null and questiontext != ''">and d.questiontext like concat('%', #{questiontext}, |
| | | '%') |
| | | </if> |
| | | and s.sendstate=6 |
| | | and d.del_flag=0 |
| | | <!-- 忝å¿
é¡»åæç»ç¨åä¸å¥æ¶é´æ¡ä»¶ï¼å¦åéäºæ¶é´èå´åæ¯ä¾ä¼æå
¨éåå²è¢«ç¨é --> |
| | | <if test="startOutHospTime != null"> |
| | | AND date_format(s.endtime,'%y%m%d') >= date_format(#{startOutHospTime},'%y%m%d') |
| | | </if> |
| | | <if test="endOutHospTime != null"> |
| | | AND date_format(s.endtime,'%y%m%d') <= date_format(#{endOutHospTime},'%y%m%d') |
| | | </if> |
| | | <if test="startFinishTime != null"> |
| | | AND date_format(s.finishtime,'%y%m%d') >= date_format(#{startFinishTime},'%y%m%d') |
| | | </if> |
| | | <if test="endFinishTime != null"> |
| | | AND date_format(s.finishtime,'%y%m%d') <= date_format(#{endFinishTime},'%y%m%d') |
| | | </if> |
| | | GROUP BY |
| | | t.taskid, |
| | | d.questiontext |
| | | ) t2 ON t2.taskid = t.taskid AND t2.questiontext = d.questiontext |
| | | WHERE 1=1 |
| | | <if test="taskIds != null and taskIds.size() > 0"> |
| | | AND t.taskid IN |
| | | <foreach collection="taskIds" item="taskId" open="(" separator="," close=")"> |
| | | #{taskId} |
| | | </foreach> |
| | | </if> |
| | | <if test="subtaskIds != null and subtaskIds.size() > 0"> |
| | | AND s.id IN |
| | | <foreach collection="subtaskIds" item="subtaskId" open="(" separator="," close=")"> |
| | | #{subtaskId} |
| | | </foreach> |
| | | </if> |
| | | <if test="valueType != null">AND d.value_type = #{valueType}</if> |
| | | <if test="scoreStart != null">AND d.score >= #{scoreStart}</if> |
| | | <if test="scoreEnd != null">AND d.score <= #{scoreEnd}</if> |
| | | <if test="questiontext != null and questiontext != ''">and d.questiontext like concat('%', #{questiontext}, |
| | | '%') |
| | | </if> |
| | | AND s.sendstate = 6 |
| | | and d.del_flag=0 |
| | | <if test="startOutHospTime != null"> |
| | | AND date_format(s.endtime,'%y%m%d') >= date_format(#{startOutHospTime},'%y%m%d') |
| | | </if> |
| | | <if test="endOutHospTime != null"> |
| | | AND date_format(s.endtime,'%y%m%d') <= date_format(#{endOutHospTime},'%y%m%d') |
| | | </if> |
| | | <if test="startFinishTime != null"> |
| | | AND date_format(s.finishtime,'%y%m%d') >= date_format(#{startFinishTime},'%y%m%d') |
| | | </if> |
| | | <if test="endFinishTime != null"> |
| | | AND date_format(s.finishtime,'%y%m%d') <= date_format(#{endFinishTime},'%y%m%d') |
| | | </if> |
| | | GROUP BY |
| | | t.taskid, |
| | | d.questiontext, |
| | | d.score, |
| | | d.targetvalue, |
| | | d.asrtext, |
| | | d.value_type |
| | | ORDER BY |
| | | d.questiontext, |
| | | t.taskid |
| | | </select> |
| | | |
| | | <!-- |
| | | 导åºãé®é¢è¯¦æ
å æ¯ãä¸ç¨ç»è®¡ï¼åªç»è®¡æ¬æ¬¡å¯¼åºçè¿æ¹æ£è
ï¼ |
| | | æ°é = éæ©è¯¥éé¡¹çæ£è
æ°ï¼COUNT(DISTINCT s.id)ï¼å¹¶ç¨ MAX(id) ä¿è¯å䏿£è
åä¸é¢åªç®ææ°ä¸æ¡ï¼ |
| | | åæ° = 该é项æç»ç score ä¹å |
| | | æ¯ä¾ = æ°é / 该é¢ä½çæ£è
æ°ï¼å¨ Java ä¾§ç»ä¸è®¡ç®ï¼å æ¤ãåé¢åé项æ°éä¹å = 该é¢ä½çæ£è
æ°ã |
| | | --> |
| | | <select id="statMydQuestionOptionForExport" resultType="com.smartor.domain.DTO.ServiceSubtaskOptionStatDTO"> |
| | | SELECT |
| | | t.taskid AS taskid, |
| | | t.task_name AS taskName, |
| | | d.questiontext AS questiontext, |
| | | d.asrtext AS optionresult, |
| | | d.targetvalue AS targetvalue, |
| | | d.value_type AS valueType, |
| | | COUNT(DISTINCT s.id) AS patientCount, |
| | | SUM(COALESCE(CAST(d.score AS DECIMAL(18,2)), 0)) AS scoreSum |
| | | FROM |
| | | service_task t |
| | | INNER JOIN service_subtask s ON s.taskid = t.taskid |
| | | INNER JOIN service_subtask_detail d ON d.sub_id = s.id |
| | | WHERE 1=1 |
| | | AND s.del_flag = '0' |
| | | AND d.del_flag = 0 |
| | | <if test="subtaskIds != null and subtaskIds.size() > 0"> |
| | | AND s.id IN |
| | | <foreach collection="subtaskIds" item="subtaskId" open="(" separator="," close=")"> |
| | | #{subtaskId} |
| | | </foreach> |
| | | </if> |
| | | <!-- ä¸ä¼ å任塿¶ç´æ¥æ¥ä¸å°æ°æ®ï¼é¿å
误ç»è®¡å
¨é --> |
| | | <if test="subtaskIds == null or subtaskIds.size() == 0"> |
| | | AND 1 = 0 |
| | | </if> |
| | | <if test="questiontext != null and questiontext != ''"> |
| | | AND d.questiontext LIKE CONCAT('%', #{questiontext}, '%') |
| | | </if> |
| | | <!-- å䏿£è
åä¸é¢ç®åªä¿çææ°ä¸æ¡ï¼éçä¸éå¤è®¡å
¥æ°é --> |
| | | AND d.id = ( |
| | | SELECT MAX(d2.id) |
| | | FROM service_subtask_detail d2 |
| | | WHERE d2.sub_id = d.sub_id |
| | | AND d2.questiontext <=> d.questiontext |
| | | AND d2.del_flag = '0' |
| | | ) |
| | | GROUP BY |
| | | t.taskid, |
| | | t.task_name, |
| | | d.questiontext, |
| | | d.asrtext, |
| | | d.targetvalue, |
| | | d.value_type |
| | | <!-- æä»»å¡åç§°åç»å±ç¤ºï¼å
ä»»å¡åç§°ãåä»»å¡ç¼å·ï¼åä¸ä»»å¡çé¢ç®/é项è¿ç»æå --> |
| | | ORDER BY |
| | | t.task_name, |
| | | t.taskid, |
| | | d.questiontext |
| | | </select> |
| | | |
| | | <!-- æ°æ¹æ³ï¼æ ¹æ®åä»»å¡ ID ç»è®¡é®é¢é项ç¾åæ¯ (ç¨äºæ»¡æåº¦ç»è®¡ serviceType=6) --> |
| | | <select id="statQuestionOptionBySubtaskIds" resultType="com.smartor.domain.ServiceSubtaskDetailRatioExport"> |
| | | SELECT |
| | | d.questiontext AS questiontext, |
| | | <!-- æç»å·²æãé¢ç® + éé¡¹ãæ±æ»ï¼ä»»å¡/ç§å®¤/ç
åºåªæ¯é带信æ¯ï¼å¿
é¡»ç¨èå彿°åå¼ï¼MySQL ONLY_FULL_GROUP_BYï¼ --> |
| | | MAX(t.taskid) AS taskid, |
| | | MAX(t.task_name) AS taskName, |
| | | d.asrtext AS optionresult, |
| | | d.score AS score, |
| | | MAX(s.deptcode) AS deptcode, |
| | | MAX(s.deptname) AS deptname, |
| | | MAX(s.leavehospitaldistrictcode) AS leavehospitaldistrictcode, |
| | | MAX(s.leavehospitaldistrictname) AS leavehospitaldistrictname, |
| | | d.targetvalue AS targetvalue, |
| | | d.value_type AS valueType, |
| | | COUNT(*) AS count, |
| | | CONCAT(ROUND(COUNT(*) * 100.0 / t2.total_count, 2), '%') AS ratio |
| | | FROM |
| | | service_task t |
| | | INNER JOIN service_subtask s ON s.taskid = t.taskid |
| | | INNER JOIN service_subtask_detail d ON d.sub_id = s.id |
| | | <!-- å»éï¼åä¸åä»»å¡åä¸é¢ç®åªä¿çææ°ä¸æ¡ï¼é¿å
éç/éå¤åè°æåä¸éé¢éå¤è®¡å
¥é¡¹æ°ï¼ä¸ mzMydScoreRank å£å¾ä¸è´ï¼ --> |
| | | AND d.id = ( |
| | | SELECT MAX(d2.id) |
| | | FROM service_subtask_detail d2 |
| | | WHERE d2.sub_id = d.sub_id |
| | | AND d2.questiontext <=> d.questiontext |
| | | AND d2.del_flag = '0' |
| | | ) |
| | | INNER JOIN ( |
| | | <!-- 忝 = 该é¢åé项项æ°ä¹åï¼æªä½çç空 asrtext ä¸è¿åæ¯ï¼ï¼è¿æ ·ä¸éé¢åé项æ¯ä¾åè®¡ææ¯ 100% --> |
| | | SELECT |
| | | x.questiontext AS questiontext, |
| | | SUM(x.option_count) AS total_count |
| | | FROM ( |
| | | SELECT |
| | | d.questiontext, |
| | | d.asrtext, |
| | | COUNT(*) AS option_count |
| | | FROM |
| | | service_task t |
| | | INNER JOIN service_subtask s ON s.taskid = t.taskid |
| | | INNER JOIN service_subtask_detail d ON d.sub_id = s.id |
| | | <!-- å»éï¼åæ¯ï¼è¯¥é¢ææçå·æ»æ°ï¼ä¸æç»å£å¾ä¿æä¸è´ï¼ä¿è¯åé项æ¯ä¾å计 100% --> |
| | | AND d.id = ( |
| | | SELECT MAX(d4.id) |
| | | FROM service_subtask_detail d4 |
| | | WHERE d4.sub_id = d.sub_id |
| | | AND d4.questiontext <=> d.questiontext |
| | | AND d4.del_flag = '0' |
| | | ) |
| | | WHERE 1=1 |
| | | <if test="subtaskIds != null and subtaskIds.size() > 0"> |
| | | AND s.id IN |
| | | <foreach collection="subtaskIds" item="subtaskId" open="(" separator="," close=")"> |
| | | #{subtaskId} |
| | | </foreach> |
| | | </if> |
| | | <if test="valueType != null">AND d.value_type >= #{valueType}</if> |
| | | <if test="scoreStart != null">AND d.score >= #{scoreStart}</if> |
| | | <if test="scoreEnd != null">AND d.score <= #{scoreEnd}</if> |
| | | <if test="questiontext != null and questiontext != ''">and d.questiontext like concat('%', #{questiontext}, |
| | | '%') |
| | | </if> |
| | | AND s.sendstate = 6 |
| | | AND d.del_flag=0 |
| | | <!-- 忝䏿ç»ç¨åä¸å¥æ¶é´æ¡ä»¶ï¼å¦åéäºæ¥æåºé´ååé项æ¯ä¾å计ä¸å° 100% --> |
| | | <if test="startOutHospTime != null"> |
| | | AND date_format(s.endtime,'%y%m%d') >= date_format(#{startOutHospTime},'%y%m%d') |
| | | </if> |
| | | <if test="endOutHospTime != null"> |
| | | AND date_format(s.endtime,'%y%m%d') <= date_format(#{endOutHospTime},'%y%m%d') |
| | | </if> |
| | | <if test="startFinishTime != null"> |
| | | AND date_format(s.finishtime,'%y%m%d') >= date_format(#{startFinishTime},'%y%m%d') |
| | | </if> |
| | | <if test="endFinishTime != null"> |
| | | AND date_format(s.finishtime,'%y%m%d') <= date_format(#{endFinishTime},'%y%m%d') |
| | | </if> |
| | | <!-- æªä½çï¼asrtext 为空ï¼çæç»ä¸è®¡å
¥åæ¯ --> |
| | | AND d.asrtext IS NOT NULL AND TRIM(d.asrtext) <> '' |
| | | GROUP BY d.questiontext, d.asrtext |
| | | ) x |
| | | GROUP BY x.questiontext |
| | | ) t2 ON t2.questiontext = d.questiontext |
| | | WHERE 1=1 |
| | | <!-- å»éï¼æç»è¡åä¸åä»»å¡åä¸é¢ç®åªä¿çææ°ä¸æ¡ï¼éçä¸éå¤è®¡å
¥é¡¹æ° --> |
| | | AND d.id = ( |
| | | SELECT MAX(d3.id) |
| | | FROM service_subtask_detail d3 |
| | | WHERE d3.sub_id = d.sub_id |
| | | AND d3.questiontext <=> d.questiontext |
| | | AND d3.del_flag = '0' |
| | | ) |
| | | <if test="subtaskIds != null and subtaskIds.size() > 0"> |
| | | AND s.id IN |
| | | <foreach collection="subtaskIds" item="subtaskId" open="(" separator="," close=")"> |
| | | #{subtaskId} |
| | | </foreach> |
| | | </if> |
| | | AND s.sendstate = 6 |
| | | AND d.del_flag=0 |
| | | <!-- æªä½çï¼asrtext 为空ï¼ä¸ç®ä»»ä½éé¡¹ï¼æç»éç´æ¥æé¤ï¼é¿å
åºç°ç©ºéé¡¹è¡ --> |
| | | AND d.asrtext IS NOT NULL AND TRIM(d.asrtext) <> '' |
| | | <if test="valueType != null">AND d.value_type >= #{valueType}</if> |
| | | <if test="scoreStart != null">AND d.score >= #{scoreStart}</if> |
| | | <if test="scoreEnd != null">AND d.score <= #{scoreEnd}</if> |
| | | <if test="questiontext != null and questiontext != ''">and d.questiontext like concat('%', #{questiontext}, |
| | | '%') |
| | | </if> |
| | | <if test="startOutHospTime != null"> |
| | | AND date_format(s.endtime,'%y%m%d') >= date_format(#{startOutHospTime},'%y%m%d') |
| | | </if> |
| | | <if test="endOutHospTime != null"> |
| | | AND date_format(s.endtime,'%y%m%d') <= date_format(#{endOutHospTime},'%y%m%d') |
| | | </if> |
| | | <if test="startFinishTime != null"> |
| | | AND date_format(s.finishtime,'%y%m%d') >= date_format(#{startFinishTime},'%y%m%d') |
| | | </if> |
| | | <if test="endFinishTime != null"> |
| | | AND date_format(s.finishtime,'%y%m%d') <= date_format(#{endFinishTime},'%y%m%d') |
| | | </if> |
| | | <!-- åªæãé¢ç® + éé¡¹ãæ±æ»ï¼åæ¥ GROUP BY å¸¦ä¸ taskid/ç§å®¤/ç
åºï¼åä¸ä¸ªé项被ææå¤è¡ãæ¯è¡æ°é齿¯ 1ï¼ |
| | | å端/å¯¼åºæ¿å°çãæ°éã就永è¿åä¸äºç´¯å --> |
| | | GROUP BY |
| | | d.questiontext, |
| | | d.asrtext, |
| | | d.score, |
| | | d.targetvalue, |
| | | d.value_type |
| | | ORDER BY |
| | | d.questiontext, |
| | | MIN(t.taskid) |
| | | </select> |
| | | |
| | | <select id="statQuestionOptionByKsOrBq" resultType="com.smartor.domain.DTO.QuestionCountKsOrBqDTO" |
| | | parameterType="com.smartor.domain.VO.QuestionCountKsOrBqVO"> |
| | | SELECT |
| | | s.deptname AS deptname, |
| | | s.leavehospitaldistrictname AS leavehospitaldistrictname, |
| | | d.questiontext AS questionText, |
| | | d.targetvalue AS targetvalue, -- ææéé¡¹æ¼æ¥ |
| | | d.asrtext AS asrtext, -- ç¨æ·å®é
éä¸çé项 |
| | | d.score AS singleScore -- åæ¡è®°å½çåæ° |
| | | FROM service_subtask_detail d |
| | | JOIN service_subtask s ON d.sub_id = s.id |
| | | WHERE s.del_flag = 0 |
| | | AND d.del_flag = 0 |
| | | AND s.service_type IN ('6', '14') |
| | | <if test="taskTemplateid != null"> |
| | | AND s.templateid = #{taskTemplateid} |
| | | </if> |
| | | <if test="endFinishTime != null"> |
| | | AND d.create_time < #{endFinishTime} |
| | | </if> |
| | | <if test="startFinishTime != null"> |
| | | AND d.create_time >= #{startFinishTime} |
| | | </if> |
| | | <if test="deptOrDistrict ==1"> |
| | | <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0"> |
| | | AND leavehospitaldistrictcode IN |
| | | <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" |
| | | separator="," |
| | | close=")"> |
| | | #{leavehospitaldistrictcode} |
| | | </foreach> |
| | | </if> |
| | | <if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0"> |
| | | AND deptcode IN |
| | | <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator="," |
| | | close=")"> |
| | | #{leaveldeptcode} |
| | | </foreach> |
| | | </if> |
| | | </if> |
| | | <if test="deptOrDistrict ==2"> |
| | | <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0"> |
| | | AND leavehospitaldistrictcode IN |
| | | <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" |
| | | separator="," |
| | | close=")"> |
| | | #{leavehospitaldistrictcode} |
| | | </foreach> |
| | | </if> |
| | | <if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0"> |
| | | OR deptcode IN |
| | | <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator="," |
| | | close=")"> |
| | | #{leaveldeptcode} |
| | | </foreach> |
| | | </if> |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectServiceSubtaskListDeadLine" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity" |
| | | <select id="selectServiceSubtaskListDeadLine" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity" |
| | | resultMap="ServiceSubtaskResult"> |
| | | <include refid="selectServiceSubtaskVo"/> |
| | | where 1=1 |
| | |
| | | </select> |
| | | |
| | | <!-- é¨è¯æ»¡æåº¦ç»¼åå¾åæåï¼æç§å®¤æç
åºï¼ --> |
| | | <!-- ç»¼åæ»¡æåº¦ = Σ(è¯åæç»æé) / è¯åæç»æ¡æ° à 100%ï¼æéåªå 1ã0.8ã0.6ã0.4ã0.2 äºæ¡£ --> |
| | | <select id="selectMzMydScoreRank" parameterType="com.smartor.domain.VO.MzMydScoreRankVO" |
| | | resultType="com.smartor.domain.DTO.MzMydScoreRankDTO"> |
| | | SELECT |
| | | t.code AS code, |
| | | t.name AS name, |
| | | ROUND(AVG(t.w) * 100, 2) AS score, |
| | | COUNT(*) AS itemCount |
| | | FROM ( |
| | | SELECT |
| | | <choose> |
| | | <when test='dimensionType == "2"'> |
| | | s.leavehospitaldistrictcode AS code, |
| | | s.leavehospitaldistrictname AS name, |
| | | </when> |
| | | <otherwise> |
| | | s.deptcode AS code, |
| | | s.deptname AS name, |
| | | </otherwise> |
| | | </choose> |
| | | CAST(d.score AS DECIMAL(10,4)) AS w |
| | | FROM service_subtask s |
| | | INNER JOIN service_subtask_detail d ON d.sub_id = s.id |
| | | WHERE s.del_flag = '0' |
| | | AND d.del_flag = '0' |
| | | AND s.sendstate = 6 |
| | | <if test="serviceTypes != null and serviceTypes.size() > 0"> |
| | | AND service_type IN |
| | | <foreach collection="serviceTypes" item="serviceType" open="(" separator="," |
| | | close=")"> |
| | | #{serviceType} |
| | | </foreach> |
| | | </if> |
| | | <!-- <!– åªåå
¬å¼éçäºæ¡£æéï¼ç©ºå¼/0/æªççæ¢ä¸è¿ååä¹ä¸è¿åæ¯ –>--> |
| | | <!-- AND CAST(d.score AS DECIMAL(10,4)) IN (1, 0.8, 0.6, 0.4, 0.2)--> |
| | | <!-- åä¸åä»»å¡åä¸é¢ç®åªä¿çææ°ä¸æ¡ï¼é¿å
éç被éå¤è®¡å
¥é¡¹æ° --> |
| | | AND d.id = ( |
| | | SELECT MAX(d2.id) |
| | | FROM service_subtask_detail d2 |
| | | WHERE d2.sub_id = d.sub_id |
| | | AND d2.questiontext <=> d.questiontext |
| | | AND d2.del_flag = '0' |
| | | ) |
| | | <if test="orgid != null and orgid != ''"> |
| | | AND s.orgid = #{orgid} |
| | | </if> |
| | | <if test="campusid != null and campusid != ''"> |
| | | AND s.campusid = #{campusid} |
| | | </if> |
| | | <if test="startFinishTime != null"> |
| | | AND s.finishtime >= #{startFinishTime} |
| | | </if> |
| | | <if test="endFinishTime != null"> |
| | | AND s.finishtime < DATE_ADD(#{endFinishTime}, INTERVAL 1 DAY) |
| | | </if> |
| | | <if test="questionText != null and questionText != ''">and d.questiontext like concat('%', #{questionText}, |
| | | '%') |
| | | </if> |
| | | <choose> |
| | | <when test='dimensionType == "2"'> |
| | | AND s.leavehospitaldistrictcode IS NOT NULL AND s.leavehospitaldistrictcode <> '' |
| | | AND s.leavehospitaldistrictname IS NOT NULL AND s.leavehospitaldistrictname <> '' |
| | | <if test="districtCodes != null and districtCodes.size() > 0"> |
| | | AND s.leavehospitaldistrictcode IN |
| | | <foreach collection="districtCodes" item="districtCode" open="(" separator="," close=")"> |
| | | #{districtCode} |
| | | </foreach> |
| | | </if> |
| | | </when> |
| | | <otherwise> |
| | | AND s.deptcode IS NOT NULL AND s.deptcode <> '' |
| | | AND s.deptname IS NOT NULL AND s.deptname <> '' |
| | | <if test="deptCodes != null and deptCodes.size() > 0"> |
| | | AND s.deptcode IN |
| | | <foreach collection="deptCodes" item="deptCode" open="(" separator="," close=")"> |
| | | #{deptCode} |
| | | </foreach> |
| | | </if> |
| | | </otherwise> |
| | | </choose> |
| | | ) t |
| | | GROUP BY t.code, t.name |
| | | ORDER BY AVG(t.w) DESC, COUNT(*) DESC |
| | | <if test="limit != null and limit > 0"> |
| | | LIMIT #{limit} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | |
| | | </mapper> |
| | | </mapper> |
| | | |