@PostMapping("/oneUserDetectionDetail")public AjaxResult oneUserDetectionDetail(@RequestBody Map<String, Object> map) {Object userId = map.get("userId");long l = Long.valueOf(String.valueOf(userId));map.remove("pageNum");map.remove("pageSize");List<UserScoreRule> userScoreRules = userScoreRuleService.selectUserScoreRuleList(null);UserScoreRule userScoreRule = userScoreRules.get(0);ax = userScoreRule.getAX();ay = userScoreRule.getAY();ta = userScoreRule.getTA();tb = userScoreRule.getTB();xm = userScoreRule.getXM();xn = userScoreRule.getXN();ar = userScoreRule.getAR();ars = userScoreRule.getARS();tr = userScoreRule.getTR();trs = userScoreRule.getTRS();xr = userScoreRule.getXR();xrs = userScoreRule.getXRS();Map<String, Object> mapA = new HashMap<>();double a1 = 0; Integer o1 = 0; Integer o2 = 0; String nickName = "";String sex = "";String phoneNumber = "";String deptName = "";String jobNumber = "";String roleName = "";String downloadPath = "";double MIN_NORMAL = ta; double MAX_NORMAL = tb; double PENALTY_PER_01 = trs; double MAX_PASS_ALCOHOL = ax; double PENALTY_PER_MG = ars; List<Double> listAlcohol = new ArrayList<>();List<Integer> listSy = new ArrayList<>();List<Integer> listDia = new ArrayList<>();List<Integer> listHeartRate = new ArrayList<>();List<String> listUserInfo = new ArrayList<>();List<Integer> listBloodOx = new ArrayList<>();List<Double> listTemperature = new ArrayList<>();List<Double> bloodPressureScore = new ArrayList<>();List<Double> alcoholPressureScore = new ArrayList<>();List<Double> bloodOxPressureScore = new ArrayList<>();List<Double> temperatureScore = new ArrayList<>();List<SysUserExport> sysUserExports = sysUserInfoRecordService.oneUserDetectionDetail(map);for (SysUserExport sysUserExport : sysUserExports) {String alcoholDetectionResult = sysUserExport.getAlcoholDetectionResult();if (!alcoholDetectionResult.equals("0")) { alcoholDetectionResult = alcoholDetectionResult.replace("测酒结果:", "");String alcoholValue = alcoholDetectionResult.substring(0, alcoholDetectionResult.indexOf("mg"));double alcoholNumber = Double.parseDouble(alcoholValue);a1 = alcoholNumber;if (alcoholNumber < MAX_PASS_ALCOHOL) { double as1 = 100;alcoholPressureScore.add(as1);} else {double penalty = (alcoholNumber - MAX_PASS_ALCOHOL) * PENALTY_PER_MG; double as2 = 100 - penalty;alcoholPressureScore.add(as2);}}String bloodO = sysUserExport.getBloodOxygenDetectionResult();if (!bloodO.equals("0")) {String[] parts = bloodO.split("血氧饱和度:");if (parts.length > 1) {String saturation = parts[1].split("%")[0]; int bloodONum = Integer.parseInt(saturation);o1 = bloodONum;o2 = 0;if (bloodONum >= xm) {double os1 = 100;bloodOxPressureScore.add(os1);} else if (bloodONum < xn) {double os2 = 0;bloodOxPressureScore.add(os2);} else if (xn <= bloodONum && bloodONum < xm) {double os3 = 100 - (xm - bloodONum) * 10;bloodOxPressureScore.add(os3);}}}String blood = sysUserExport.getBloodPressureDetectionResult();if (blood.contains("Error")) {Integer high = 0;Integer low = 0;Integer heartRate = 0;listSy.add(high);listDia.add(low);listHeartRate.add(heartRate);} else {if (blood.equals("0")) {Integer high = 0;Integer low = 0;Integer heartRate = 0;listSy.add(high);listDia.add(low);listHeartRate.add(heartRate);} else {int systolicStart = blood.indexOf("收缩压:");int systolicEnd = blood.indexOf("mmhg", systolicStart);int diastolicStart = blood.indexOf("舒张压:");int diastolicEnd = blood.indexOf("mmhg", diastolicStart);int heartRateIndex = blood.indexOf("心率:");if (heartRateIndex != -1) {String heartRateStr = blood.substring(heartRateIndex + "心率:".length());int heartRate = Integer.parseInt(heartRateStr);listHeartRate.add(heartRate);}String systolicValue = blood.substring(systolicStart + "收缩压:".length(), systolicEnd);String diastolicValue = blood.substring(diastolicStart + "舒张压:".length(), diastolicEnd);Integer high = Integer.valueOf(systolicValue);Integer low = Integer.valueOf(diastolicValue);listSy.add(high);listDia.add(low);}}String booldScore = sysUserExport.getBloodPressureDetectionResult();if (booldScore.contains("Error")) {bloodPressureScore.add(0.0);} else {if (!booldScore.equals("0")) {int systolicStart = booldScore.indexOf("收缩压:");int systolicEnd = booldScore.indexOf("mmhg", systolicStart);int diastolicStart = booldScore.indexOf("舒张压:");int diastolicEnd = booldScore.indexOf("mmhg", diastolicStart);String systolicValue = booldScore.substring(systolicStart + "收缩压:".length(), systolicEnd);String diastolicValue = booldScore.substring(diastolicStart + "舒张压:".length(), diastolicEnd);Integer systolic = Integer.valueOf(systolicValue);Integer diastolic = Integer.valueOf(diastolicValue);if (systolic >= 140 || diastolic >= 90) {if (systolic >= 180 || diastolic >= 110) {double B1 = 0;bloodPressureScore.add(B1);} else if (systolic >= 160 || diastolic >= 100) {double B2 = 60;bloodPressureScore.add(B2);} else {double B3 = 80;bloodPressureScore.add(B3);}} else if (systolic >= 130 || diastolic >= 85) {double B4 = 90;bloodPressureScore.add(B4);} else if (systolic >= 90 || diastolic >= 60) {double B5 = 100;bloodPressureScore.add(B5);} else {double B6 = 0;bloodPressureScore.add(B6);}}}String temperature = sysUserExport.getTemperature();if (StringUtils.isEmpty(temperature)) {listTemperature.add(0.0);} else {double temperatureDouble = Double.parseDouble(temperature);listTemperature.add(temperatureDouble);if (temperatureDouble >= MIN_NORMAL && temperatureDouble <= MAX_NORMAL) {double deviation = Math.max(Math.abs(temperatureDouble - MIN_NORMAL), Math.abs(temperatureDouble - MAX_NORMAL));int penalty = (int) (deviation * 10 / PENALTY_PER_01); double t1 = 100 - penalty;temperatureScore.add(t1);} else {double t2 = 0;temperatureScore.add(t2);}}}UserIndex userIndex = userIndexService.selectUserIndexByUserIdAllInfo(l);if (userIndex != null) {nickName = userIndex.getNickName();jobNumber = userIndex.getJobNumber();deptName = userIndex.getDeptName();roleName = userIndex.getRoleName();phoneNumber = userIndex.getPhonenumber();downloadPath = userIndex.getDownloadPath();sex = userIndex.getSex();}listAlcohol.add(a1);listBloodOx.add(o1);listBloodOx.add(o2);listUserInfo.add(nickName);listUserInfo.add(jobNumber);listUserInfo.add(deptName);listUserInfo.add(roleName);listUserInfo.add(phoneNumber);listUserInfo.add(sex);listUserInfo.add(downloadPath);String formattedNumberBlood = "0";if (bloodPressureScore.size() != 0) {double sum = 0.0;for (double bps : bloodPressureScore) {sum += bps;}double bloodAverage = sum / bloodPressureScore.size();DecimalFormat decimalFormatBlood = new DecimalFormat("#.#");formattedNumberBlood = decimalFormatBlood.format(bloodAverage);} else {formattedNumberBlood = "0";}String formattedNumberAlcoho = "";if (alcoholPressureScore.size() != 0) {double sumA = 0.0;for (double bps : alcoholPressureScore) {sumA += bps;}double bloodAAverage = sumA / alcoholPressureScore.size();DecimalFormat decimalFormat = new DecimalFormat("#.#");formattedNumberAlcoho = decimalFormat.format(bloodAAverage);} else {formattedNumberAlcoho = "0";}String formattedNumberBO = "0";if (bloodOxPressureScore.size() != 0) {double sumBO = 0.0;for (double bps : bloodOxPressureScore) {sumBO += bps;}double bloodBOverage = sumBO / bloodOxPressureScore.size();DecimalFormat decimalFormatBO = new DecimalFormat("#.#");formattedNumberBO = decimalFormatBO.format(bloodBOverage);} else {formattedNumberBO = "0";}double sumT = 0.0;for (double bps : temperatureScore) {sumT += bps;}double Tempverage = sumT / temperatureScore.size();DecimalFormat decimalFormatTemp = new DecimalFormat("#.#");String formattedNumberTemp = decimalFormatTemp.format(Tempverage);mapA.put("listUserInfo", listUserInfo); mapA.put("alcohoMap", listAlcohol); mapA.put("bloodOxygenMap", listBloodOx); mapA.put("bloodPressureSyMap", listSy); mapA.put("bloodPressureDiaMap", listDia); mapA.put("bloodPressureHeartRateMap", listHeartRate); mapA.put("temperatureMap", listTemperature); mapA.put("bloodPressureScore", formattedNumberBlood); mapA.put("alcohoScore", formattedNumberAlcoho); mapA.put("bloodOXScore", formattedNumberBO); mapA.put("temperatureScore", formattedNumberTemp); formattedNumberBloodPDF = formattedNumberBlood;formattedNumberAlcohoPDF = formattedNumberAlcoho;formattedNumberBOPDF = formattedNumberBO;formattedNumberTempPDF = formattedNumberTemp;Map<String, Object> mapB = new HashMap<>();mapB.put("bloodPressureScore", formattedNumberBlood); mapB.put("alcohoScore", formattedNumberAlcoho); mapB.put("bloodOXScore", formattedNumberBO); mapB.put("temperatureScore", formattedNumberTemp); String overallScore = calculateOverallScore(mapB);mapA.put("overallScore", overallScore); LocalDate today = LocalDate.now();List<LocalDate> recentMonths = new ArrayList<>();for (int i = 0; i < 12; i++) {LocalDate firstDayOfCurrentMonth = today.with(TemporalAdjusters.firstDayOfMonth());recentMonths.add(firstDayOfCurrentMonth);today = today.minusMonths(1);}List<SysUserExport> sysUserExportAll = new ArrayList<>();for (LocalDate date : recentMonths) {map.put("year", date.getYear()); map.put("month", date.getMonthValue()); List<SysUserExport> monthlyData = sysUserInfoRecordService.selectUserIndexByUserIdAllInfo(map); sysUserExportAll.addAll(monthlyData); }List<Integer> overallYearScore = calculateYearlyScores(sysUserExportAll);mapA.put("overallYearScore", overallYearScore); return AjaxResult.success(mapA);}String calculateOverallScore(Map<String, Object> scores) {int sum = 0;int count = 0;for (Map.Entry<String, Object> entry : scores.entrySet()) {if (entry.getValue() instanceof String && !((String) entry.getValue()).isEmpty()) {try {String scoreStr = (String) entry.getValue();double score = Double.parseDouble(scoreStr);if (score != 0) {sum += score;count++;}} catch (NumberFormatException e) {System.err.println("评分值转换错误: " + entry.getValue());}}}String overallScoreAsString = "";if (count > 0) {int average = sum / count;scores.put("overallScore", average);Object overallScore = scores.get("overallScore");overallScoreAsString = overallScore.toString();} else {scores.put("overallScore", "0");Object overallScore = scores.get("overallScore");overallScoreAsString = overallScore.toString();}return overallScoreAsString;}@PostMapping("/weekUserDetectionDetail")public AjaxResult weekUserDetectionDetail(@RequestBody Map<String, Object> map) {Object userId = map.get("userId");long l = Long.valueOf(String.valueOf(userId));map.remove("pageNum");map.remove("pageSize");List<UserScoreRule> userScoreRules = userScoreRuleService.selectUserScoreRuleList(null);UserScoreRule userScoreRule = userScoreRules.get(0);ax = userScoreRule.getAX();ay = userScoreRule.getAY();ta = userScoreRule.getTA();tb = userScoreRule.getTB();xm = userScoreRule.getXM();xn = userScoreRule.getXN();ar = userScoreRule.getAR();ars = userScoreRule.getARS();tr = userScoreRule.getTR();trs = userScoreRule.getTRS();xr = userScoreRule.getXR();xrs = userScoreRule.getXRS();Map<String, Object> mapA = new HashMap<>();Integer a1 = 0; Integer a2 = 0; Integer a3 = 0; Integer a4 = 0; Integer o1 = 0; Integer o2 = 0; Integer o3 = 0; String nickName = "";String sex = "";String phoneNumber = "";String deptName = "";String jobNumber = "";String roleName = "";String downloadPath = "";double MIN_NORMAL = ta; double MAX_NORMAL = tb; double PENALTY_PER_01 = trs; double MAX_PASS_ALCOHOL = ax; double PENALTY_PER_MG = ars; List<Integer> listA = new ArrayList<>();List<Integer> listSy = new ArrayList<>();List<Integer> listDia = new ArrayList<>();List<Integer> listHeartRate = new ArrayList<>();List<String> listUserInfo = new ArrayList<>();List<Integer> listBloodOx = new ArrayList<>();List<Double> listTemperature = new ArrayList<>();List<Double> bloodPressureScore = new ArrayList<>();List<Double> alcoholPressureScore = new ArrayList<>();List<Double> bloodOxPressureScore = new ArrayList<>();List<Double> temperatureScore = new ArrayList<>();List<SysUserExport> sysUserExports = sysUserInfoRecordService.weekUserDetectionDetail(map);for (SysUserExport sysUserExport : sysUserExports) {String alcoholDetectionResult = sysUserExport.getAlcoholDetectionResult();if (!alcoholDetectionResult.equals("0")) { alcoholDetectionResult = alcoholDetectionResult.replace("测酒结果:", "");String alcoholValue = alcoholDetectionResult.substring(0, alcoholDetectionResult.indexOf("mg"));double alcoholNumber = Double.parseDouble(alcoholValue);if (alcoholNumber == 0) {a1 += 1;}if (alcoholNumber < 20 && alcoholNumber > 0) {a2 += 1;}if (alcoholNumber >= 20 && alcoholNumber < 80) {a3 += 1;}if (alcoholNumber >= 80) {a4 += 1;}if (alcoholNumber < MAX_PASS_ALCOHOL) { double as1 = 100;alcoholPressureScore.add(as1);} else {double penalty = (alcoholNumber - MAX_PASS_ALCOHOL) * PENALTY_PER_MG;double as2 = 100 - penalty;alcoholPressureScore.add(as2);}}String bloodO = sysUserExport.getBloodOxygenDetectionResult();if (!bloodO.equals("0")) {String[] parts = bloodO.split("血氧饱和度:");if (parts.length > 1) {String saturation = parts[1].split("%")[0]; int bloodONum = Integer.parseInt(saturation);if (bloodONum >= 95 && bloodONum < 100) {o1 += 1;} else if (bloodONum < 95) {o2 += 1;} else {o3 += 1;}if (bloodONum >= xm) {double os1 = 100;bloodOxPressureScore.add(os1);} else if (bloodONum < xn) {double os2 = 0;bloodOxPressureScore.add(os2);} else if (xn <= bloodONum && bloodONum < xm) {double os3 = 100 - (xm - bloodONum) / xr;bloodOxPressureScore.add(os3);}}}String blood = sysUserExport.getBloodPressureDetectionResult();if (blood.contains("Error")) {Integer high = 0;Integer low = 0;Integer heartRate = 0;listSy.add(high);listDia.add(low);listHeartRate.add(heartRate);} else {if (blood.equals("0")) {Integer high = 0;Integer low = 0;Integer heartRate = 0;listSy.add(high);listDia.add(low);listHeartRate.add(heartRate);} else {int systolicStart = blood.indexOf("收缩压:");int systolicEnd = blood.indexOf("mmhg", systolicStart);int diastolicStart = blood.indexOf("舒张压:");int diastolicEnd = blood.indexOf("mmhg", diastolicStart);int heartRateIndex = blood.indexOf("心率:");if (heartRateIndex != -1) {String heartRateStr = blood.substring(heartRateIndex + "心率:".length());int heartRate = Integer.parseInt(heartRateStr);listHeartRate.add(heartRate);}String systolicValue = blood.substring(systolicStart + "收缩压:".length(), systolicEnd);String diastolicValue = blood.substring(diastolicStart + "舒张压:".length(), diastolicEnd);Integer high = Integer.valueOf(systolicValue);Integer low = Integer.valueOf(diastolicValue);listSy.add(high);listDia.add(low);}}String temperature = sysUserExport.getTemperature();if (StringUtils.isEmpty(temperature)) {listTemperature.add(0.0);} else {double temperatureDouble = Double.parseDouble(temperature);listTemperature.add(temperatureDouble);if (temperatureDouble >= MIN_NORMAL && temperatureDouble <= MAX_NORMAL) {double t1 = 100;temperatureScore.add(t1);} else if (temperatureDouble < MIN_NORMAL) {double L = 100 - ((MIN_NORMAL - temperatureDouble) / PENALTY_PER_01);temperatureScore.add(L);} else {double U = 100 - ((temperatureDouble - MAX_NORMAL) / PENALTY_PER_01);temperatureScore.add(U);}}String booldScore = sysUserExport.getBloodPressureDetectionResult();if (booldScore.contains("Error")) {bloodPressureScore.add(0.0);} else {if (!booldScore.equals("0")) {int systolicStart = booldScore.indexOf("收缩压:");int systolicEnd = booldScore.indexOf("mmhg", systolicStart);int diastolicStart = booldScore.indexOf("舒张压:");int diastolicEnd = booldScore.indexOf("mmhg", diastolicStart);String systolicValue = booldScore.substring(systolicStart + "收缩压:".length(), systolicEnd);String diastolicValue = booldScore.substring(diastolicStart + "舒张压:".length(), diastolicEnd);Integer systolic = Integer.valueOf(systolicValue);Integer diastolic = Integer.valueOf(diastolicValue);if (systolic >= 140 || diastolic >= 90) {if (systolic >= 180 || diastolic >= 110) {double B1 = 0;bloodPressureScore.add(B1);} else if (systolic >= 160 || diastolic >= 100) {double B2 = 60;bloodPressureScore.add(B2);} else {double B3 = 80;bloodPressureScore.add(B3);}} else if (systolic >= 130 || diastolic >= 85) {double B4 = 90;bloodPressureScore.add(B4);} else if (systolic >= 90 || diastolic >= 60) {double B5 = 100;bloodPressureScore.add(B5);} else {double B6 = 0;bloodPressureScore.add(B6);}}}}UserIndex userIndex = userIndexService.selectUserIndexByUserIdAllInfo(l);if (userIndex != null) {nickName = userIndex.getNickName();jobNumber = userIndex.getJobNumber();deptName = userIndex.getDeptName();roleName = userIndex.getRoleName();phoneNumber = userIndex.getPhonenumber();downloadPath = userIndex.getDownloadPath();sex = userIndex.getSex();}listA.add(a1);listA.add(a2);listA.add(a3);listA.add(a4);listBloodOx.add(o1);listBloodOx.add(o2);listBloodOx.add(o3);listUserInfo.add(nickName);listUserInfo.add(jobNumber);listUserInfo.add(deptName);listUserInfo.add(roleName);listUserInfo.add(phoneNumber);listUserInfo.add(sex);listUserInfo.add(downloadPath);double sum = 0.0;for (double bps : bloodPressureScore) {sum += bps;}String formattedNumberBlood = "0";if (bloodPressureScore.size() > 0) {double bloodAverage = sum / bloodPressureScore.size();DecimalFormat decimalFormatBlood = new DecimalFormat("#.#");formattedNumberBlood = decimalFormatBlood.format(bloodAverage);}double sumA = 0.0;for (double bps : alcoholPressureScore) {sumA += bps;}String formattedNumberAlcoho = "0";if (alcoholPressureScore.size() > 0) {double bloodAAverage = sumA / alcoholPressureScore.size();DecimalFormat decimalFormat = new DecimalFormat("#.#");formattedNumberAlcoho = decimalFormat.format(bloodAAverage);}double sumBO = 0.0;for (double bps : bloodOxPressureScore) {sumBO += bps;}String formattedNumberBO = "0";if (bloodOxPressureScore.size() > 0) {double bloodBOverage = sumBO / bloodOxPressureScore.size();DecimalFormat decimalFormatBO = new DecimalFormat("#.#");formattedNumberBO = decimalFormatBO.format(bloodBOverage);}double sumT = 0.0;for (double bps : temperatureScore) {sumT += bps;}String formattedNumberTemp = "0";if (temperatureScore.size() > 0) {double Tempverage = sumT / temperatureScore.size();DecimalFormat decimalFormatTemp = new DecimalFormat("#.#");formattedNumberTemp = decimalFormatTemp.format(Tempverage);}mapA.put("alcohoMap", listA);mapA.put("bloodOxygenMap", listBloodOx);mapA.put("bloodPressureSyMap", listSy);mapA.put("bloodPressureDiaMap", listDia);mapA.put("bloodPressureHeartRateMap", listHeartRate);mapA.put("temperatureMap", listTemperature);mapA.put("listMap", sysUserExports);mapA.put("listUserInfo", listUserInfo);mapA.put("bloodPressureScore", formattedNumberBlood);mapA.put("alcohoScore", formattedNumberAlcoho);mapA.put("bloodOXScore", formattedNumberBO);mapA.put("temperatureScore", formattedNumberTemp);formattedNumberBloodPDF = formattedNumberBlood;formattedNumberAlcohoPDF = formattedNumberAlcoho;formattedNumberBOPDF = formattedNumberBO;formattedNumberTempPDF = formattedNumberTemp;Map<String, Object> mapB = new HashMap<>();mapB.put("bloodPressureScore", formattedNumberBlood); mapB.put("alcohoScore", formattedNumberAlcoho); mapB.put("bloodOXScore", formattedNumberBO); mapB.put("temperatureScore", formattedNumberTemp); String overallScore = calculateOverallScore(mapB);mapA.put("overallScore", overallScore); LocalDate today = LocalDate.now();List<LocalDate> recentMonths = new ArrayList<>();for (int i = 0; i < 12; i++) {LocalDate firstDayOfCurrentMonth = today.with(TemporalAdjusters.firstDayOfMonth());recentMonths.add(firstDayOfCurrentMonth);today = today.minusMonths(1);}List<SysUserExport> sysUserExportAll = new ArrayList<>();for (LocalDate date : recentMonths) {map.put("year", date.getYear()); map.put("month", date.getMonthValue()); List<SysUserExport> monthlyData = sysUserInfoRecordService.selectUserIndexByUserIdAllInfo(map); sysUserExportAll.addAll(monthlyData); }List<Integer> overallYearScore = calculateYearlyScores(sysUserExportAll);mapA.put("overallYearScore", overallYearScore); return AjaxResult.success(mapA);}@PostMapping("/monthUserDetectionDetail")public AjaxResult monthUserDetectionDetail(@RequestBody Map<String, Object> map) {Object userId = map.get("userId");long l = Long.valueOf(String.valueOf(userId));map.remove("pageNum");map.remove("pageSize");List<UserScoreRule> userScoreRules = userScoreRuleService.selectUserScoreRuleList(null);UserScoreRule userScoreRule = userScoreRules.get(0);ax = userScoreRule.getAX();ay = userScoreRule.getAY();ta = userScoreRule.getTA();tb = userScoreRule.getTB();xm = userScoreRule.getXM();xn = userScoreRule.getXN();ar = userScoreRule.getAR();ars = userScoreRule.getARS();tr = userScoreRule.getTR();trs = userScoreRule.getTRS();xr = userScoreRule.getXR();xrs = userScoreRule.getXRS();Map<String, Object> mapA = new HashMap<>();Integer a1 = 0; Integer a2 = 0; Integer a3 = 0; Integer a4 = 0; Integer o1 = 0; Integer o2 = 0; Integer o3 = 0; String nickName = "";String sex = "";String phoneNumber = "";String deptName = "";String jobNumber = "";String roleName = "";String downloadPath = "";double MIN_NORMAL = ta; double MAX_NORMAL = tb; double PENALTY_PER_01 = trs; double MAX_PASS_ALCOHOL = ax; double PENALTY_PER_MG = ars;List<Integer> listA = new ArrayList<>();List<Integer> listSy = new ArrayList<>();List<Integer> listDia = new ArrayList<>();List<Integer> listHeartRate = new ArrayList<>();List<String> listUserInfo = new ArrayList<>();List<Integer> listBloodOx = new ArrayList<>();List<Double> listTemperature = new ArrayList<>();List<Double> bloodPressureScore = new ArrayList<>();List<Double> alcoholPressureScore = new ArrayList<>();List<Double> bloodOxPressureScore = new ArrayList<>();List<Double> temperatureScore = new ArrayList<>();List<SysUserExport> sysUserExports = sysUserInfoRecordService.monthUserDetectionDetail(map);for (SysUserExport sysUserExport : sysUserExports) {String alcoholDetectionResult = sysUserExport.getAlcoholDetectionResult();if (!alcoholDetectionResult.equals("0")) { alcoholDetectionResult = alcoholDetectionResult.replace("测酒结果:", "");String alcoholValue = alcoholDetectionResult.substring(0, alcoholDetectionResult.indexOf("mg"));double alcoholNumber = Double.parseDouble(alcoholValue);if (alcoholNumber == 0) {a1 += 1;}if (alcoholNumber < 20 && alcoholNumber > 0) {a2 += 1;}if (alcoholNumber >= 20 && alcoholNumber < 80) {a3 += 1;}if (alcoholNumber >= 80) {a4 += 1;}if (alcoholNumber < MAX_PASS_ALCOHOL) { double as1 = 100;alcoholPressureScore.add(as1);} else {double penalty = (alcoholNumber - MAX_PASS_ALCOHOL) * PENALTY_PER_MG;double as2 = 100 - penalty;alcoholPressureScore.add(as2);}}String bloodO = sysUserExport.getBloodOxygenDetectionResult();if (!bloodO.equals("0")) {String[] parts = bloodO.split("血氧饱和度:");if (parts.length > 1) {String saturation = parts[1].split("%")[0]; int bloodONum = Integer.parseInt(saturation);if (bloodONum >= 95 && bloodONum < 100) {o1 += 1;} else if (bloodONum < 95) {o2 += 1;} else {o3 += 1;}if (bloodONum >= xm) {double os1 = 100;bloodOxPressureScore.add(os1);} else if (bloodONum < xn) {double os2 = 0;bloodOxPressureScore.add(os2);} else if (xn <= bloodONum && bloodONum < xm) {double os3 = 100 - (xm - bloodONum) * 10;bloodOxPressureScore.add(os3);}}}String blood = sysUserExport.getBloodPressureDetectionResult();if (blood.contains("Error")) {Integer high = 0;Integer low = 0;Integer heartRate = 0;listSy.add(high);listDia.add(low);listHeartRate.add(heartRate);} else {if (blood.equals("0")) {Integer high = 0;Integer low = 0;Integer heartRate = 0;listSy.add(high);listDia.add(low);listHeartRate.add(heartRate);} else {int systolicStart = blood.indexOf("收缩压:");int systolicEnd = blood.indexOf("mmhg", systolicStart);int diastolicStart = blood.indexOf("舒张压:");int diastolicEnd = blood.indexOf("mmhg", diastolicStart);int heartRateIndex = blood.indexOf("心率:");if (heartRateIndex != -1) {String heartRateStr = blood.substring(heartRateIndex + "心率:".length());int heartRate = Integer.parseInt(heartRateStr);listHeartRate.add(heartRate);}String systolicValue = blood.substring(systolicStart + "收缩压:".length(), systolicEnd);String diastolicValue = blood.substring(diastolicStart + "舒张压:".length(), diastolicEnd);Integer high = Integer.valueOf(systolicValue);Integer low = Integer.valueOf(diastolicValue);listSy.add(high);listDia.add(low);}}String temperature = sysUserExport.getTemperature();if (StringUtils.isEmpty(temperature)) {listTemperature.add(0.0);} else {double temperatureDouble = Double.parseDouble(temperature);listTemperature.add(temperatureDouble);if (temperatureDouble >= MIN_NORMAL && temperatureDouble <= MAX_NORMAL) {double deviation = Math.max(Math.abs(temperatureDouble - MIN_NORMAL), Math.abs(temperatureDouble - MAX_NORMAL));int penalty = (int) (deviation * 10 / PENALTY_PER_01); double t1 = 100 - penalty;temperatureScore.add(t1);} else {double t2 = 0;temperatureScore.add(t2);}}String booldScore = sysUserExport.getBloodPressureDetectionResult();if (booldScore.contains("Error")) {bloodPressureScore.add(0.0);} else {if (!booldScore.equals("0")) {int systolicStart = booldScore.indexOf("收缩压:");int systolicEnd = booldScore.indexOf("mmhg", systolicStart);int diastolicStart = booldScore.indexOf("舒张压:");int diastolicEnd = booldScore.indexOf("mmhg", diastolicStart);String systolicValue = booldScore.substring(systolicStart + "收缩压:".length(), systolicEnd);String diastolicValue = booldScore.substring(diastolicStart + "舒张压:".length(), diastolicEnd);Integer systolic = Integer.valueOf(systolicValue);Integer diastolic = Integer.valueOf(diastolicValue);if (systolic >= 140 || diastolic >= 90) {if (systolic >= 180 || diastolic >= 110) {double B1 = 0;bloodPressureScore.add(B1);} else if (systolic >= 160 || diastolic >= 100) {double B2 = 60;bloodPressureScore.add(B2);} else {double B3 = 80;bloodPressureScore.add(B3);}} else if (systolic >= 130 || diastolic >= 85) {double B4 = 90;bloodPressureScore.add(B4);} else if (systolic >= 90 || diastolic >= 60) {double B5 = 100;bloodPressureScore.add(B5);} else {double B6 = 0;bloodPressureScore.add(B6);}}}}UserIndex userIndex = userIndexService.selectUserIndexByUserIdAllInfo(l);if (userIndex != null) {nickName = userIndex.getNickName();jobNumber = userIndex.getJobNumber();deptName = userIndex.getDeptName();roleName = userIndex.getRoleName();phoneNumber = userIndex.getPhonenumber();downloadPath = userIndex.getDownloadPath();sex = userIndex.getSex();}listA.add(a1);listA.add(a2);listA.add(a3);listA.add(a4);listBloodOx.add(o1);listBloodOx.add(o2);listBloodOx.add(o3);listUserInfo.add(nickName);listUserInfo.add(jobNumber);listUserInfo.add(deptName);listUserInfo.add(roleName);listUserInfo.add(phoneNumber);listUserInfo.add(sex);listUserInfo.add(downloadPath);double sum = 0.0;for (double bps : bloodPressureScore) {sum += bps;}String formattedNumberBlood = "0";if (bloodPressureScore.size() > 0) {double bloodAverage = sum / bloodPressureScore.size();DecimalFormat decimalFormatBlood = new DecimalFormat("#.#");formattedNumberBlood = decimalFormatBlood.format(bloodAverage);}double sumA = 0.0;for (double bps : alcoholPressureScore) {sumA += bps;}String formattedNumberAlcoho = "0";if (alcoholPressureScore.size() > 0) {double bloodAAverage = sumA / alcoholPressureScore.size();DecimalFormat decimalFormat = new DecimalFormat("#.#");formattedNumberAlcoho = decimalFormat.format(bloodAAverage);}double sumBO = 0.0;for (double bps : bloodOxPressureScore) {sumBO += bps;}String formattedNumberBO = "0";if (bloodOxPressureScore.size() > 0) {double bloodBOverage = sumBO / bloodOxPressureScore.size();DecimalFormat decimalFormatBO = new DecimalFormat("#.#");formattedNumberBO = decimalFormatBO.format(bloodBOverage);}double sumT = 0.0;for (double bps : temperatureScore) {sumT += bps;}String formattedNumberTemp = "0";if (temperatureScore.size() > 0) {double Tempverage = sumT / temperatureScore.size();DecimalFormat decimalFormatTemp = new DecimalFormat("#.#");formattedNumberTemp = decimalFormatTemp.format(Tempverage);}mapA.put("alcohoMap", listA);mapA.put("bloodOxygenMap", listBloodOx);mapA.put("bloodPressureSyMap", listSy);mapA.put("bloodPressureDiaMap", listDia);mapA.put("bloodPressureHeartRateMap", listHeartRate);mapA.put("temperatureMap", listTemperature);mapA.put("listMap", sysUserExports);mapA.put("listUserInfo", listUserInfo);mapA.put("bloodPressureScore", formattedNumberBlood);mapA.put("alcohoScore", formattedNumberAlcoho);mapA.put("bloodOXScore", formattedNumberBO);mapA.put("temperatureScore", formattedNumberTemp);formattedNumberBloodPDF = formattedNumberBlood;formattedNumberAlcohoPDF = formattedNumberAlcoho;formattedNumberBOPDF = formattedNumberBO;formattedNumberTempPDF = formattedNumberTemp;Map<String, Object> mapB = new HashMap<>();mapB.put("bloodPressureScore", formattedNumberBlood); mapB.put("alcohoScore", formattedNumberAlcoho); mapB.put("bloodOXScore", formattedNumberBO); mapB.put("temperatureScore", formattedNumberTemp); String overallScore = calculateOverallScore(mapB);mapA.put("overallScore", overallScore); LocalDate today = LocalDate.now();List<LocalDate> recentMonths = new ArrayList<>();for (int i = 0; i < 12; i++) {LocalDate firstDayOfCurrentMonth = today.with(TemporalAdjusters.firstDayOfMonth());recentMonths.add(firstDayOfCurrentMonth);today = today.minusMonths(1);}List<SysUserExport> sysUserExportAll = new ArrayList<>();for (LocalDate date : recentMonths) {map.put("year", date.getYear()); map.put("month", date.getMonthValue()); List<SysUserExport> monthlyData = sysUserInfoRecordService.selectUserIndexByUserIdAllInfo(map); sysUserExportAll.addAll(monthlyData); }List<Integer> overallYearScore = calculateYearlyScores(sysUserExportAll);mapA.put("overallYearScore", overallYearScore); return AjaxResult.success(mapA);}private List<Integer> calculateYearlyScores(List<SysUserExport> sysUserExportAll) {List<Integer> overallYearScore = new ArrayList<>();for (int i = 0; i < 12; i++) {overallYearScore.add(0);}List<Double> bloodPressureScore = new ArrayList<>();List<Double> alcoholPressureScore = new ArrayList<>();List<Double> bloodOxPressureScore = new ArrayList<>();List<Double> temperatureScore = new ArrayList<>();double MIN_NORMAL = ta; double MAX_NORMAL = tb; double PENALTY_PER_01 = trs; double MAX_PASS_ALCOHOL = ax; double PENALTY_PER_MG = ars;Integer overallScoreInteger = 0;int currentMonthScore = 0;int currentMonth = -1;int month = 0;String formattedNumberTemp = "0";String formattedNumberBO = "0";String formattedNumberAlcoho = "0";String formattedNumberBlood = "0";if (sysUserExportAll.size() != 0) {for (SysUserExport sysUserExport : sysUserExportAll) {Date createTime = sysUserExport.getCreateTime(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");String monthYearStr = dateFormat.format(createTime);month = Integer.parseInt(monthYearStr.substring(5));if (month != currentMonth) {if (currentMonth != -1) {}currentMonth = month;String alcoholDetectionResult = sysUserExport.getAlcoholDetectionResult();if (alcoholDetectionResult != null) {alcoholDetectionResult = alcoholDetectionResult.replace("测酒结果:", "");String alcoholValue = alcoholDetectionResult.substring(0, alcoholDetectionResult.indexOf("mg"));double alcoholNumber = Double.parseDouble(alcoholValue);if (alcoholNumber < MAX_PASS_ALCOHOL) { double as1 = 100;alcoholPressureScore.add(as1);} else {double penalty = (alcoholNumber - MAX_PASS_ALCOHOL) * PENALTY_PER_MG;double as2 = 100 - penalty;alcoholPressureScore.add(as2);}}String booldScore = sysUserExport.getBloodPressureDetectionResult();if (StringUtils.isNotEmpty(booldScore)) {if (booldScore.contains("Error")) {bloodPressureScore.add(0.0);} else {int systolicStart = booldScore.indexOf("收缩压:");int systolicEnd = booldScore.indexOf("mmhg", systolicStart);int diastolicStart = booldScore.indexOf("舒张压:");int diastolicEnd = booldScore.indexOf("mmhg", diastolicStart);String systolicValue = booldScore.substring(systolicStart + "收缩压:".length(), systolicEnd);String diastolicValue = booldScore.substring(diastolicStart + "舒张压:".length(), diastolicEnd);Integer systolic = Integer.valueOf(systolicValue);Integer diastolic = Integer.valueOf(diastolicValue);if (systolic >= 140 || diastolic >= 90) {if (systolic >= 180 || diastolic >= 110) {double B1 = 0;bloodPressureScore.add(B1);} else if (systolic >= 160 || diastolic >= 100) {double B2 = 60;bloodPressureScore.add(B2);} else {double B3 = 80;bloodPressureScore.add(B3);}} else if (systolic >= 130 || diastolic >= 85) {double B4 = 90;bloodPressureScore.add(B4);} else if (systolic >= 90 || diastolic >= 60) {double B5 = 100;bloodPressureScore.add(B5);} else {double B6 = 0;bloodPressureScore.add(B6);}}}String temperature = sysUserExport.getTemperature();if (StringUtils.isNotEmpty(temperature)) {double temperatureDouble = Double.parseDouble(temperature);if (temperatureDouble >= MIN_NORMAL && temperatureDouble <= MAX_NORMAL) {double deviation = Math.max(Math.abs(temperatureDouble - MIN_NORMAL), Math.abs(temperatureDouble - MAX_NORMAL));int penalty = (int) (deviation * 10 / PENALTY_PER_01); double t1 = 100 - penalty;temperatureScore.add(t1);} else {double t2 = 0;temperatureScore.add(t2);}}String bloodO = sysUserExport.getBloodOxygenDetectionResult();if (StringUtils.isNotEmpty(bloodO)) {String[] parts = bloodO.split("血氧饱和度:");if (parts.length > 1) {String saturation = parts[1].split("%")[0]; int bloodONum = Integer.parseInt(saturation);Integer xm = this.xm;Integer xn = this.xn;if (bloodONum >= xm) {double os1 = 100;bloodOxPressureScore.add(os1);} else if (bloodONum < xn) {double os2 = 0;bloodOxPressureScore.add(os2);} else if (xn <= bloodONum && bloodONum < xm) {double os3 = 100 - (xm - bloodONum) * 10;bloodOxPressureScore.add(os3);}}}double sum = 0.0;for (double bps : bloodPressureScore) {sum += bps;}double bloodAverage = sum / bloodPressureScore.size();DecimalFormat decimalFormatBlood = new DecimalFormat("#.#");formattedNumberBlood = decimalFormatBlood.format(bloodAverage);double sumA = 0.0;for (double bps : alcoholPressureScore) {sumA += bps;}double bloodAAverage = sumA / alcoholPressureScore.size();DecimalFormat decimalFormat = new DecimalFormat("#.#");formattedNumberAlcoho = decimalFormat.format(bloodAAverage);double sumBO = 0.0;for (double bps : bloodOxPressureScore) {sumBO += bps;}if (bloodOxPressureScore.size() > 0) {double bloodBOverage = sumBO / bloodOxPressureScore.size();DecimalFormat decimalFormatBO = new DecimalFormat("#.#");formattedNumberBO = decimalFormatBO.format(bloodBOverage);}double sumT = 0.0;for (double bps : temperatureScore) {sumT += bps;}double Tempverage = sumT / temperatureScore.size();DecimalFormat decimalFormatTemp = new DecimalFormat("#.#");formattedNumberTemp = decimalFormatTemp.format(Tempverage);Map<String, Object> mapB = new HashMap<>();mapB.put("bloodPressureScore", formattedNumberBlood); mapB.put("alcohoScore", formattedNumberAlcoho); mapB.put("bloodOXScore", formattedNumberBO); mapB.put("temperatureScore", formattedNumberTemp); String overallScore = calculateOverallScore(mapB);overallScoreInteger = Integer.valueOf(overallScore);overallYearScore.set(month, overallScoreInteger);} else {
}}if (currentMonth != -1) {overallYearScore.set(month, overallScoreInteger);}}return overallYearScore;}
<select id="oneUserDetectionDetail" parameterType="Map"resultType="com.ruoyi.system.domain.export.SysUserExport">select a.click_date createTime,b.nickName,b.jobNumber,b.sex,b.phonenumber,b.roleName,b.deptName,b.downloadPath,ifnull(b.bloodOxygenDetectionResult,0) as bloodOxygenDetectionResult,ifnull(b.alcoholDetectionResult,0) as alcoholDetectionResult,ifnull(b.bloodPressureDetectionResult,0) as bloodPressureDetectionResult,ifnull(b.temperature,0) as temperaturefrom (SELECT curdate() as click_dateunion allSELECT date_sub(curdate(), interval 1 day) as click_dateunion allSELECT date_sub(curdate(), interval 2 day) as click_dateunion allSELECT date_sub(curdate(), interval 3 day) as click_dateunion allSELECT date_sub(curdate(), interval 4 day) as click_dateunion allSELECT date_sub(curdate(), interval 5 day) as click_dateunion allSELECT date_sub(curdate(), interval 6 day) as click_date) a left join (SELECTu.nick_name nickName, u.job_number jobNumber, u.cardkey,u.sex ,u.user_id userId,DATE_FORMAT(u.create_time,"%Y-%m-%d") as createtimes,u.alcohol_detection_result alcoholDetectionResult,u.phonenumber phonenumber,u.blood_pressure_detection_result bloodPressureDetectionResult,u.blood_oxygen_detection_result bloodOxygenDetectionResult,u.temperature,d.dept_name deptName, r.role_name roleName,p.download_path downloadPathfrom sys_user_index uleft join sys_dept d on u.dept_id = d.dept_idleft join sys_user_role ur on u.user_id = ur.user_idleft join sys_role r on r.role_id = ur.role_idLEFT JOIN sys_user_photo p ON u.job_number=p.job_numberwhere DATE(NOW()) = date(u.create_time) and u.user_id =) b on a.click_date = b.createtimesORDER BY a.click_date desc</select><select id="selectUserIndexByUserIdAllInfo" parameterType="Map" resultType="com.ruoyi.system.domain.export.SysUserExport">SELECTu.nick_name, u.job_number,u.sex ,u.user_id userId,u.create_time createTime,u.alcohol_detection_result alcoholDetectionResult,u.phonenumber,u.blood_pressure_detection_result bloodPressureDetectionResult,u.blood_oxygen_detection_result bloodOxygenDetectionResult,u.temperature,d.dept_name deptName, r.role_name roleName,p.download_path downloadPathfrom sys_user_index uleft join sys_dept d on u.dept_id = d.dept_idleft join sys_user_role ur on u.user_id = ur.user_idleft join sys_role r on r.role_id = ur.role_idLEFT JOIN sys_user_photo p ON u.job_number=p.job_numberwhere u.user_id =AND YEAR(u.create_time) = AND MONTH(u.create_time) = </select><select id="weekUserDetectionDetail" parameterType="Map"resultType="com.ruoyi.system.domain.export.SysUserExport">select a.click_date createTime,b.nickName,b.jobNumber,b.sex,b.phonenumber,b.roleName,b.deptName,b.downloadPath,ifnull(b.bloodOxygenDetectionResult,0) as bloodOxygenDetectionResult,ifnull(b.alcoholDetectionResult,0) as alcoholDetectionResult,ifnull(b.bloodPressureDetectionResult,0) as bloodPressureDetectionResult,ifnull(b.temperature,0) as temperaturefrom (SELECT curdate() as click_dateunion allSELECT date_sub(curdate(), interval 1 day) as click_dateunion allSELECT date_sub(curdate(), interval 2 day) as click_dateunion allSELECT date_sub(curdate(), interval 3 day) as click_dateunion allSELECT date_sub(curdate(), interval 4 day) as click_dateunion allSELECT date_sub(curdate(), interval 5 day) as click_dateunion allSELECT date_sub(curdate(), interval 6 day) as click_date) a left join (SELECTu.nick_name nickName, u.job_number jobNumber, u.cardkey,u.sex ,u.user_id userId,DATE_FORMAT(u.create_time,"%Y-%m-%d") as createtimes,u.alcohol_detection_result alcoholDetectionResult,u.phonenumber phonenumber,u.blood_pressure_detection_result bloodPressureDetectionResult,u.blood_oxygen_detection_result bloodOxygenDetectionResult,u.temperature,d.dept_name deptName, r.role_name roleName,p.download_path downloadPathfrom sys_user_index uleft join sys_dept d on u.dept_id = d.dept_idleft join sys_user_role ur on u.user_id = ur.user_idleft join sys_role r on r.role_id = ur.role_idLEFT JOIN sys_user_photo p ON u.job_number=p.job_numberwhere DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(u.create_time) and u.user_id =) b on a.click_date = b.createtimesORDER BY a.click_date desc</select><select id="monthUserDetectionDetail" parameterType="Map"resultType="com.ruoyi.system.domain.export.SysUserExport">SELECTa.click_date AS createTime,b.nickName,b.jobNumber,b.sex,b.phonenumber,b.roleName,b.deptName,b.downloadPath,IFNULL(b.bloodOxygenDetectionResult, 0) AS bloodOxygenDetectionResult,IFNULL(b.alcoholDetectionResult, 0) AS alcoholDetectionResult,IFNULL(b.bloodPressureDetectionResult, 0) AS bloodPressureDetectionResult,IFNULL(b.temperature, 0) AS temperatureFROM (SELECT curdate() as click_dateUNION ALL SELECT date_sub(curdate(), interval 1 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 2 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 3 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 4 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 5 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 6 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 7 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 8 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 9 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 10 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 11 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 12 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 13 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 14 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 15 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 16 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 17 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 18 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 19 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 20 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 21 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 22 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 23 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 24 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 25 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 26 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 27 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 28 day) as click_dateUNION ALL SELECT date_sub(curdate(), interval 29 day) as click_date) aLEFT JOIN (SELECTu.nick_name AS nickName,u.job_number AS jobNumber,u.cardkey,u.sex AS sex,u.user_id AS userId,DATE_FORMAT(u.create_time,"%Y-%m-%d") AS createtimes,u.alcohol_detection_result AS alcoholDetectionResult,u.phonenumber AS phonenumber,u.blood_pressure_detection_result AS bloodPressureDetectionResult,u.blood_oxygen_detection_result AS bloodOxygenDetectionResult,u.temperature,d.dept_name AS deptName,r.role_name AS roleName,p.download_path AS downloadPathFROM sys_user_index uLEFT JOIN sys_dept d ON u.dept_id = d.dept_idLEFT JOIN sys_user_role ur ON u.user_id = ur.user_idLEFT JOIN sys_role r ON r.role_id = ur.role_idLEFT JOIN sys_user_photo p ON u.job_number=p.job_numberWHERE DATE_SUB(CURDATE(), INTERVAL 29 DAY) <= DATE(u.create_time)AND u.user_id =AND u.del_flag = '0') b ON a.click_date = b.createtimesORDER BY a.click_date DESC</select>
<template><div class="dashboard-editor-container"><div class="block"><div class="block-son"><el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"label-width="98px"><el-form-item label="驾驶员名称" prop="nickName"><el-input v-model="queryParams.nickName" placeholder="请输入驾驶员名称" clearable@keyup.enter.native="handleQuery" /></el-form-item><el-form-item class="button1"><!-- 今日按钮 --><el-button plain type="primary" size="mini" :class="{ 'selected': selectedPeriod === 'today' }" @click="handleJump('today')">今日</el-button><!-- 近一周按钮 --><el-button plain type="primary" size="mini" :class="{ 'selected': selectedPeriod === 'week' }" @click="handleJump('week')">近一周</el-button><!-- 近一个月按钮 --><el-button plain type="primary" size="mini" :class="{ 'selected': selectedPeriod === 'month' }" @click="handleJump('month')">近一个月</el-button></el-form-item><el-form-item label="检测时间"><el-date-pickerv-model="queryParams.date"type="date"placeholder="选择日期"></el-date-picker></el-form-item><!-- <el-form-item label="检测时间"><el-date-picker v-model="value3" type="daterange" align="right" unlink-panels range-separator="至"start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions"></el-date-picker></el-form-item> --><el-form-item><el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button><el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button></el-form-item><el-form-item class="container"><div class="but"><el-button type="primary" size="mini" @click="dialogVisible = true">评分规则</el-button><!-- <el-button type="primary" size="mini" @click="printpage" >导出PDF1</el-button> --><el-button type="primary" size="mini" @click="exportPDF"> 导出PDF </el-button></div></el-form-item></el-form></div></div><el-row :gutter="12"><el-col :xs="24" :sm="24" :lg="8"><div class="chart-wrapper1"><div class="chart-img"><el-popover placement="top-start" trigger="hover"><div class="row_reserve"><img class="big-img" :src="baseurl + `/system/` + src" style="width: 250px; height: 250px; margin-bottom: -4px" :onerror="defaultAct" /></div><div slot="reference"><img class="td-img" :src="baseurl + `/system/` + src"style="width: 150px; height: 150px; margin-bottom: -4px" :onerror="defaultAct" /></div></el-popover></div><div><div class="info-item"><strong>姓名:</strong><span style="color:#54a0ff;margin-left:10px">{{ userData.nickName }}</span></div><div class="info-item"><strong>性别:</strong><span style="color:#54a0ff;margin-left:10px">{{ userData.sex === '0' ? '男' : '女' }}</span></div><div class="info-item"><strong >手机号:</strong><span style="color:#54a0ff;margin-left:10px">{{ userData.phonenumber }}</span></div><div class="info-item"><strong>所属部门:</strong><span style="color:#54a0ff;margin-left:10px">{{ userData.deptName }}</span></div><div class="info-item"><strong>员工工号:</strong><span style="color:#54a0ff;margin-left:10px">{{ userData.jobNumber }}</span></div><div class="info-item"><strong>用户角色:</strong><span style="color:#54a0ff;margin-left:10px">{{ userData.roleName }}</span></div></div></div></el-col><el-col :xs="24" :sm="24" :lg="8"><div class="chart-wrapper2"><div class="score-section1"><div style="font-weight:bold; padding:20px 20px 10px">综合评分:{{overallScore}}</div></div><div style="display:flex"><div style="display:flex"><div class="score-section"><div>血压检测:{{bloodPressureScore}}</div></div><div class="score-section"><div>酒精检测:{{alcohoScore}}</div></div></div><div style="display:flex"><div class="score-section"><div>体温检测:{{temperatureScore}}</div></div><div class="score-section"><div>血氧检测:{{bloodOXScore}}</div></div></div></div><div class="health-status"><div style="font-weight:bold;margin:20px 20px 0px">健康状况</div><div style="display:flex"><div class="status-item"><div>血压</div><!-- <div class="stars">★★★★★</div> --><div class="score"><!--循序生成五星,原理是通过给span绑定类名设置星星背景图--><span class="star-item" v-for="star in starScore1" :class="star"></span><span>{{tempBlood.toFixed(1)}}</span></div></div><div class="status-item"><div>酒精</div><div class="score"><!--循序生成五星,原理是通过给span绑定类名设置星星背景图--><span class="star-item" v-for="star in starScore2" :class="star"></span><span>{{tempAlcoho.toFixed(1)}}</span></div></div></div><div style="display:flex"><div class="status-item"><div>血氧</div><div class="score"><!--循序生成五星,原理是通过给span绑定类名设置星星背景图--><span class="star-item" v-for="star in starScore3" :class="star"></span><span>{{tempBloodOX.toFixed(1)}}</span></div></div><div class="status-item"><div>体温</div><div class="score"><!--循序生成五星,原理是通过给span绑定类名设置星星背景图--><span class="star-item" v-for="star in starScore4" :class="star"></span><span>{{tempTempture.toFixed(1)}}</span></div></div></div></div></div></el-col><el-col :xs="24" :sm="24" :lg="8"><div class="chart-wrapper-z"><div style="font-weight:bold">历史趋势</div><div style="font-size:15px;color:#48dbfb;margin-bottom:-22px;margin-left:10px">评分</div><line-chart-x :chart-data="lineChartDataX"/></div></el-col></el-row><el-row :gutter="12"><el-col :xs="24" :sm="24" :lg="12"><div class="chart-wrapper"><div style="font-weight:bold">血压检测图表(mm/hg)</div><line-chart-o :chart-data="lineChartDataO" /></div></el-col><el-col :xs="24" :sm="24" :lg="12"><div class="chart-wrapper"><div style="font-weight:bold">酒精检测图表(mg/100ml)</div><bar-chart-o :chart-data="alcohoData"/></div></el-col></el-row><el-row :gutter="12"><el-col :xs="24" :sm="24" :lg="8"><div class="chart-wrapper"><div style="font-weight:bold">血氧饱和检测图表(%)</div><line-chart-ox :chart-data="bloodOXData"/></div></el-col><el-col :xs="24" :sm="24" :lg="8"><div class="chart-wrapper"><div style="font-weight:bold">体温检测图表(°C)</div><bar-chart :chart-data="tempertureData"/></div></el-col><el-col :xs="24" :sm="24" :lg="8"><div class="chart-wrapper"><div style="font-weight:bold">心率检测图表(bpm)</div><line-chart-or :chart-data="rateData"/></div></el-col></el-row><el-dialog title="" :visible.sync="dialogVisible" width="60%" height="80%" ><div class="rule-title-p"><div class="rule-title-all"> 综合评分规则:</div><span class="rule-description">每个检测项目满分100分,60分及格。</span><spanclass="rule-description">每日综合评分为所有项目的总和/项目数。注:只计算驾驶员做的项目,例如:如果驾驶员只做了体温检测和酒精检测,没有做血氧检测和血压检测,那么总和评分就是(体温得分+酒测得分)/2每周综合评分为该周每日的综合评分相加/日数。注:只计算驾驶员做了检测的日数。每月综合评分为该月每日的总和评分相加/日数。注:只计算驾驶员做了检测的日数。</span></div><div class="rule-title-p"><span class="rule-title">体温评分规则:</span><span class="rule-description">体温在a°-b°范围内,得100分,(a、b由客户设定)</span><span class="rule-description">体温每升高或降低c°,扣1分,(c由客户设定)</span><span class="rule-description">如果司机体温在a°-b°之间,得分=100分</span><span class="rule-description">如果司机体温低于a°,得分=100-[(a°-司机体温)/c°]</span><span class="rule-description">如果司机体温高于b°,得分=100-[(司机体温-b°)/c°]</span></div><div class="rule-title-p"><span class="rule-title"> 测酒评分规则:</span> <span class="rule-description">酒精检测值低于x mg/100ml时,得100分,(x由客户设定)</span><span class="rule-description"> 酒精检测值每提高y mg/100ml,测酒评分减1分,(y由客户设定)</span><span class="rule-description"> 司机测酒精评分=100-[(司机酒精检测值-x)/y]</span></div><div class="rule-title-p"><span class="rule-title"> 血氧饱和度评分规则:</span><span class="rule-description">血氧饱和度在m%以上时,得100分,(m由客户设定)</span><span class="rule-description">血氧饱和度每下降n%,血氧评分减1分,(n由客户设定)</span><span class="rule-description">血氧饱和度评分=100-[(m-司机血氧饱和度)/n]</span></div><div class="rule-title-p"><span class="rule-title"> 血压评分规则:</span><span class="rule-description">100分:收缩压<139和舒张压<89 </span><span class="rule-description">80分:140<收缩压<159或90<舒张压<99(一级轻度高血压) </span><span class="rule-description">60分:160<收缩压<179或100<舒张压<109(二级中度高血压) </span><span class="rule-description">60分以下:收缩压>=180或舒张压>=110(三级重度高血压)</span></div><span slot="footer" class="dialog-footer"><el-button @click="dialogVisible = false">关闭</el-button></span></el-dialog></div>
</template>
<script>
import pdf from 'vue-pdf'
import LineChart from './dashboard/LineChart'
import LineChartX from './dashboard/LineChartX'
import LineChartY from './dashboard/LineChartY'
import LineChartO from './dashboard/LineChartO'
import LineChartOr from './dashboard/LineChartOr'
import LineChartOx from './dashboard/LineChartOx'
import RaddarChart from './dashboard/RaddarChart'
import PieChart from './dashboard/PieChart'
import PieChartX from './dashboard/PieChartX'
import BarChart from './dashboard/BarChart'
import BarChartO from './dashboard/BarChartO'
import { oneUserDetectionDetail, exportUserIndexPDF } from "@/api/userIndex/userIndex";
import profile from "../assets/images/profile.jpg";
export default {name: 'Index',components: {pdf,LineChartX,LineChartY,LineChart,LineChartO,RaddarChart,PieChart,PieChartX,BarChart,LineChartOr,LineChartOx,BarChartO},data() {return {defaultAct: 'this.src="' + profile + '"',baseurl: process.env.VUE_APP_BASE_API,tempBlood:null,tempAlcoho:null,tempBloodOX:null,tempTempture:null,selectedPeriod: '', bloodPressureScore:"",alcohoScore:"",bloodOXScore:"",temperatureScore:'',overallScore:"",RChartData:{a1:1,a2:3,a3:2,a4:0,},XChartData:{a1:4,a2:2,a3:1,},tempertureData:{temperture:[]},alcohoData:{temperture:[]},rateData:{heartRate:[]},bloodOXData:{systolicData: [],},lineChartDataX: {yearlyRateData: [], },lineChartDataO: {systolicData: [],diastolicData: []},dialogVisible: false,value3: '',pickerOptions: {shortcuts: [{text: '最近一周',onClick(picker) {const end = new Date();const start = new Date();start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);picker.$emit('pick', [start, end]);}}, {text: '最近一个月',onClick(picker) {const end = new Date();const start = new Date();start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);picker.$emit('pick', [start, end]);}}]},userData: {phonenumber:'',sex:'',nickName:'',deptName:'',roleName:''}, dateRange: [],src: 'https://cube.elemecdn.com/9/c2/f0ee8a3c7c9638a54940382568c9dpng.png',userList: {},showSearch: true,queryParams: {pageNum: 1,pageSize: 10,nickName: null,userId: null},}},created() {this.queryParams.userId = this.$route.params.userIdthis.getNowTime();this.getOneDayList();},computed:{starScore1(){let stars = []; let score = Math.floor(this.tempBlood * 2)/2; let decimalScore = score%1 !== 0; let integerScore = Math.floor(score); for (let i=0; i<integerScore; i++){stars.push('on') }if (decimalScore){stars.push('half') }while(stars.length<5){stars.push('off') }return stars},starScore2(){let stars = []; let score = Math.floor(this.tempAlcoho * 2)/2; let decimalScore = score%1 !== 0; let integerScore = Math.floor(score); for (let i=0; i<integerScore; i++){stars.push('on') }if (decimalScore){stars.push('half') }while(stars.length<5){stars.push('off') }return stars},starScore3(){let stars = []; let score = Math.floor(this.tempBloodOX * 2)/2; let decimalScore = score%1 !== 0; let integerScore = Math.floor(score); for (let i=0; i<integerScore; i++){stars.push('on') }if (decimalScore){stars.push('half') }while(stars.length<5){stars.push('off') }return stars},starScore4(){let stars = []; let score = Math.floor(this.tempTempture * 2)/2; let decimalScore = score%1 !== 0; let integerScore = Math.floor(score); for (let i=0; i<integerScore; i++){stars.push('on') }if (decimalScore){stars.push('half') }while(stars.length<5){stars.push('off') }return stars}},methods: {handleJump(timePeriod) {this.selectedPeriod = timePeriod;switch (timePeriod) {case 'today':this.$router.push({ name: 'today'})break;case 'week':this.$router.push({ name: 'week'})break;case 'month':this.$router.push({ name: 'month'})break;default:console.error('未知的时间段');break;}},exportPDF() {exportUserIndexPDF(this.queryParams).then((res) => {var filename = new Date().getTime();let url = window.URL.createObjectURL(res)let link = document.createElement('a')link.style.display = 'none'link.href = urllink.setAttribute('download', filename + '.pdf')document.body.appendChild(link)link.click();URL.revokeObjectURL(link.href);document.body.removeChild(link);});},printpage() {const printContent = document.querySelector('.dashboard-editor-container').innerHTML;const iframe = document.createElement('iframe');iframe.setAttribute('style', 'position: absolute; width: 0; height: 0;');document.body.appendChild(iframe);const iframeDoc = iframe.contentWindow.document;iframeDoc.write('<style media="print">@page {size: landscape;}</style>');iframeDoc.write('<div>' + printContent + '</div>');setTimeout(function () {iframe.contentWindow?.print();document.body.removeChild(iframe);}, 50);},handleClose(done) {this.$confirm('确认关闭?').then(_ => {done();}).catch(_ => { });},getOneDayList() {this.loading = true;oneUserDetectionDetail(this.queryParams,).then((response) => {this.userWeekList = response.data;this.loading = false;console.log("userListWeek:");console.log(this.userWeekList);this.bloodOXData.systolicData = this.userWeekList.bloodOxygenMap,this.lineChartDataO.diastolicData = this.userWeekList.bloodPressureDiaMap;this.lineChartDataO.systolicData = this.userWeekList.bloodPressureSyMap;this.tempertureData.temperture = this.userWeekList.temperatureMap;this.userData.nickName = this.userWeekList.listUserInfo[0];this.userData.jobNumber = this.userWeekList.listUserInfo[1];this.userData.deptName = this.userWeekList.listUserInfo[2];this.userData.roleName = this.userWeekList.listUserInfo[3];this.userData.phonenumber = this.userWeekList.listUserInfo[4];this.userData.sex = this.userWeekList.listUserInfo[5];this.src = this.userWeekList.listUserInfo[6]; this.bloodPressureScore =this.userWeekList.bloodPressureScore;console.log(this.userWeekList.bloodPressureScore);this.alcohoScore =this.userWeekList.alcohoScore;console.log(this.userWeekList.alcohoScore);this.bloodOXScore =this.userWeekList.bloodOXScore;this.temperatureScore =this.userWeekList.temperatureScore;this.overallScore = this.userWeekList.overallScore;this.tempBlood = this.userWeekList.bloodPressureScore/100*5;this.tempAlcoho =this.userWeekList.alcohoScore/100*5;this.tempBloodOX =this.userWeekList.bloodOXScore/100*5;this.tempTempture = this.userWeekList.temperatureScore / 100.0 * 5;this.rateData.heartRate = this.userWeekList.bloodPressureHeartRateMap;this.lineChartDataX.yearlyRateData = this.userWeekList.overallYearScore;});},handleQuery() {this.queryParams.pageNum = 1;this.getList();},resetQuery() {this.dateRange = [];this.resetForm("queryForm");this.handleQuery();},getNowTime() {var now = new Date();var year = now.getFullYear(); var month = now.getMonth(); var date = now.getDate(); month = month + 1;month = month.toString().padStart(2, "0");date = date.toString().padStart(2, "0");var defaultDate = `${year}-${month}-${date}`;this.queryParams.date = defaultDate;},}
}
</script><style lang="scss" scoped>
.status-item {display: flex;margin-left: 50px;margin-top: 10px;
}.stars {color: #10ac84;font-size: 18px;margin-left: 15px;
}.score-section {display: flex;margin-left: 40px;color: #00a8ff;font-size: 15px;
}.info-item {margin-left: 50px;font-size: 15px;margin-bottom: 3px;
}.chart-img {height: 180px;width: 150px;
}.dashboard-editor-container {padding: 12px;background-color: rgb(240, 242, 245);position: relative;.chart-wrapper {background: #fff;padding: 16px 16px 0;margin-bottom: 12px;}.chart-wrapper-z {margin-top: 20px;background: #fff;padding: 16px 16px 0;margin-bottom: 12px;height: 198px;}.chart-wrapper1 {margin-top: 20px;background: #fff;padding: 16px 16px 0;margin-bottom: 12px;height: 198px;display: flex;}.chart-wrapper2 {margin-top: 20px;background: #fff;margin-bottom: 12px;height: 198px;}}@media (max-width:1024px) {.chart-wrapper {padding: 8px;}
}.block {display: flex;background: #fff;height: 60px;align-items: center;}.block-son {margin-top: 20px;
}.container {
}.but {margin-left: 200px;
}.rule-title-all {font-weight: bold;margin-top: 20px;font-size: 25px;
}
.rule-title {font-weight: bold;margin-top: 20px;font-size: 20px;
}
.rule-description {margin-left: 20px;font-size: 20px;
}.rule-title-p {margin-bottom: 10px;
}
.selected {background-color: #409EFF; color: white;
}
.score{display: flex;align-items: center;justify-content: center;.star-item{width: 20px;height: 20px;display: inline-block;margin: 0 5px;background: no-repeat;}.star-item.on{background: url("../assets/images/星实.png"); background-size: contain;}.star-item.half{background: url("../assets/images/星半.png"); background-size: contain;}.star-item.off{background: url("../assets/images/星空.png"); background-size: contain;}
}
</style>
<template><div class="dashboard-editor-container"><div class="block"><div class="block-son"><el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"label-width="98px"><el-form-item label="驾驶员名称" prop="nickName"><el-input v-model="queryParams.nickName" placeholder="请输入驾驶员名称" clearable@keyup.enter.native="handleQuery" /></el-form-item><el-form-item class="button1"><!-- 今日按钮 --><el-button plain type="primary" size="mini" :class="{ 'selected': selectedPeriod === 'today' }" @click="handleJump('today')">今日</el-button><!-- 近一周按钮 --><el-button plain type="primary" size="mini" :class="{ 'selected': selectedPeriod === 'week' }" @click="handleJump('week')">近一周</el-button><!-- 近一个月按钮 --><el-button plain type="primary" size="mini" :class="{ 'selected': selectedPeriod === 'month' }" @click="handleJump('month')">近一个月</el-button></el-form-item><!-- <el-form-item label="检测时间"><el-date-pickerv-model="dateRange"type="daterange"range-separator="至"start-placeholder="开始日期"end-placeholder="结束日期"></el-date-picker></el-form-item> --><el-form-item label="检测时间"><el-date-picker v-model="dateRange" type="daterange" align="right" unlink-panels range-separator="至"start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions"></el-date-picker></el-form-item><el-form-item><el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button><el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button></el-form-item><el-form-item class="container"><div class="but"><el-button type="primary" size="mini" @click="dialogVisible = true">评分规则</el-button><!-- <el-button type="primary" size="mini" @click="printpage" >导出PDF1</el-button> --><el-button type="primary" size="mini" @click="exportPDF"> 导出PDF </el-button></div></el-form-item></el-form></div></div><el-row :gutter="12"><el-col :xs="24" :sm="24" :lg="8"><div class="chart-wrapper1"><div class="chart-img"><el-popover placement="top-start" trigger="hover"><div class="row_reserve"><img class="big-img" :src="baseurl + `/system/` + src" style="width: 250px; height: 250px; margin-bottom: -4px" :onerror="defaultAct" /></div><div slot="reference"><img class="td-img" :src="baseurl + `/system/` + src"style="width: 150px; height: 150px; margin-bottom: -4px" :onerror="defaultAct" /></div></el-popover></div><div><div class="info-item"><strong>姓名:</strong><span style="color:#54a0ff;margin-left:10px">{{ userData.nickName }}</span></div><div class="info-item"><strong>性别:</strong><span style="color:#54a0ff;margin-left:10px">{{ userData.sex === '0' ? '男' : '女' }}</span></div><div class="info-item"><strong >手机号:</strong><span style="color:#54a0ff;margin-left:10px">{{ userData.phonenumber }}</span></div><div class="info-item"><strong>所属部门:</strong><span style="color:#54a0ff;margin-left:10px">{{ userData.deptName }}</span></div><div class="info-item"><strong>员工工号:</strong><span style="color:#54a0ff;margin-left:10px">{{ userData.jobNumber }}</span></div><div class="info-item"><strong>用户角色:</strong><span style="color:#54a0ff;margin-left:10px">{{ userData.roleName }}</span></div></div></div></el-col><el-col :xs="24" :sm="24" :lg="8"><div class="chart-wrapper2"><div class="score-section1"><div style="font-weight:bold; padding:20px 20px 10px">综合评分:{{overallScore}}</div></div><div style="display:flex"><div style="display:flex"><div class="score-section"><div>血压检测:{{bloodPressureScore}}</div></div><div class="score-section"><div>酒精检测:{{alcohoScore}}</div></div></div><div style="display:flex"><div class="score-section"><div>体温检测:{{temperatureScore}}</div></div><div class="score-section"><div>血氧检测:{{bloodOXScore}}</div></div></div></div><div class="health-status"><div style="font-weight:bold;margin:20px 20px 0px">健康状况</div><div style="display:flex"><div class="status-item"><div>血压</div><!-- <div class="stars">★★★★★</div> --><div class="score"><!--循序生成五星,原理是通过给span绑定类名设置星星背景图--><span class="star-item" v-for="star in starScore1" :class="star"></span><span>{{tempBlood.toFixed(1)}}</span></div></div><div class="status-item"><div>酒精</div><div class="score"><!--循序生成五星,原理是通过给span绑定类名设置星星背景图--><span class="star-item" v-for="star in starScore2" :class="star"></span><span>{{tempAlcoho.toFixed(1)}}</span></div></div></div><div style="display:flex"><div class="status-item"><div>血氧</div><div class="score"><!--循序生成五星,原理是通过给span绑定类名设置星星背景图--><span class="star-item" v-for="star in starScore3" :class="star"></span><span>{{tempBloodOX.toFixed(1)}}</span></div></div><div class="status-item"><div>体温</div><div class="score"><!--循序生成五星,原理是通过给span绑定类名设置星星背景图--><span class="star-item" v-for="star in starScore4" :class="star"></span><span>{{tempTempture.toFixed(1)}}</span></div></div></div></div></div></el-col><el-col :xs="24" :sm="24" :lg="8"><div class="chart-wrapper-z"><div style="font-weight:bold">历史趋势</div><div style="font-size:15px;color:#48dbfb;margin-bottom:-22px;margin-left:10px">评分</div><line-chart-x :chart-data="lineChartDataX"/></div></el-col></el-row><el-row :gutter="12"><el-col :xs="24" :sm="24" :lg="12"><div class="chart-wrapper"><div style="font-weight:bold">血压检测图表(mm/hg)</div><line-chart :chart-data="lineChartData" /></div></el-col><el-col :xs="24" :sm="24" :lg="12"><div class="chart-wrapper"><div style="font-weight:bold">酒精检测图表(mg/100ml)</div><pie-chart :chart-data="RChartData"/></div></el-col></el-row><el-row :gutter="12"><el-col :xs="24" :sm="24" :lg="8"><div class="chart-wrapper"><div style="font-weight:bold">心率检测图表(bpm)</div><line-chart-y :chart-data="rateData"/></div></el-col><el-col :xs="24" :sm="24" :lg="8"><div class="chart-wrapper"><div style="font-weight:bold">血氧饱和检测图表(%)</div><pie-chart-x :chart-data="XChartData"/></div></el-col><el-col :xs="24" :sm="24" :lg="8"><div class="chart-wrapper"><div style="font-weight:bold">体温检测图表(°C)</div><bar-chart :chart-data="tempertureData"/></div></el-col></el-row><el-dialog title="" :visible.sync="dialogVisible" width="60%" height="80%" ><div class="rule-title-p"><div class="rule-title-all"> 综合评分规则:</div><span class="rule-description">每个检测项目满分100分,60分及格。</span><spanclass="rule-description">每日综合评分为所有项目的总和/项目数。注:只计算驾驶员做的项目,例如:如果驾驶员只做了体温检测和酒精检测,没有做血氧检测和血压检测,那么总和评分就是(体温得分+酒测得分)/2每周综合评分为该周每日的综合评分相加/日数。注:只计算驾驶员做了检测的日数。每月综合评分为该月每日的总和评分相加/日数。注:只计算驾驶员做了检测的日数。</span></div><div class="rule-title-p"><span class="rule-title">体温评分规则:</span><span class="rule-description">体温在a°-b°范围内,得100分,(a、b由客户设定)</span><span class="rule-description">体温每升高或降低c°,扣1分,(c由客户设定)</span><span class="rule-description">如果司机体温在a°-b°之间,得分=100分</span><span class="rule-description">如果司机体温低于a°,得分=100-[(a°-司机体温)/c°]</span><span class="rule-description">如果司机体温高于b°,得分=100-[(司机体温-b°)/c°]</span></div><div class="rule-title-p"><span class="rule-title"> 测酒评分规则:</span> <span class="rule-description">酒精检测值低于x mg/100ml时,得100分,(x由客户设定)</span><span class="rule-description"> 酒精检测值每提高y mg/100ml,测酒评分减1分,(y由客户设定)</span><span class="rule-description"> 司机测酒精评分=100-[(司机酒精检测值-x)/y]</span></div><div class="rule-title-p"><span class="rule-title"> 血氧饱和度评分规则:</span><span class="rule-description">血氧饱和度在m%以上时,得100分,(m由客户设定)</span><span class="rule-description">血氧饱和度每下降n%,血氧评分减1分,(n由客户设定)</span><span class="rule-description">血氧饱和度评分=100-[(m-司机血氧饱和度)/n]</span></div><div class="rule-title-p"><span class="rule-title"> 血压评分规则:</span><span class="rule-description">100分:收缩压<139和舒张压<89 </span><span class="rule-description">80分:140<收缩压<159或90<舒张压<99(一级轻度高血压) </span><span class="rule-description">60分:160<收缩压<179或100<舒张压<109(二级中度高血压) </span><span class="rule-description">60分以下:收缩压>=180或舒张压>=110(三级重度高血压)</span></div><span slot="footer" class="dialog-footer"><el-button @click="dialogVisible = false">关闭</el-button></span></el-dialog></div>
</template>
<script>
import pdf from 'vue-pdf'
import LineChart from './dashboard/LineChart'
import LineChartX from './dashboard/LineChartX'
import LineChartY from './dashboard/LineChartY'
import RaddarChart from './dashboard/RaddarChart'
import PieChart from './dashboard/PieChart'
import PieChartX from './dashboard/PieChartX'
import BarChart from './dashboard/BarChart'
import { weekUserDetectionDetail, exportUserIndexPDF } from "@/api/userIndex/userIndex";
import profile from "../assets/images/profile.jpg";
export default {name: 'Index',components: {pdf,LineChartX,LineChartY,LineChart,RaddarChart,PieChart,PieChartX,BarChart,},data() {return {defaultAct: 'this.src="' + profile + '"',baseurl: process.env.VUE_APP_BASE_API,tempBlood:null,tempAlcoho:null,tempBloodOX:null,tempTempture:null,selectedPeriod: '', bloodPressureScore:"",alcohoScore:"",bloodOXScore:"",temperatureScore:"",overallScore:"",RChartData:{a1:1,a2:3,a3:2,a4:0,},XChartData:{a1:4,a2:2,a3:1,},rateData:{heartRate:[]},tempertureData:{temperture:[]},lineChartDataX: {yearlyRateData: [], },lineChartData: {systolicData: [],diastolicData: []},bloodPressureHeartRate:{temperture:[]},dialogVisible: false,value3: '',pickerOptions: {shortcuts: [{text: '最近一周',onClick(picker) {const end = new Date();const start = new Date();start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);picker.$emit('pick', [start, end]);}}, {text: '最近一个月',onClick(picker) {const end = new Date();const start = new Date();start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);picker.$emit('pick', [start, end]);}}]},userData: {phonenumber:'',sex:'',nickName:'',deptName:'',roleName:''}, dateRange: [],src: '',userList: {},showSearch: true,queryParams: {pageNum: 1,pageSize: 10,nickName: null,userId: null},}},created() {this.queryParams.userId = this.$route.params.userIdthis.getNowTime();this.getWeekList();},computed:{starScore1(){let stars = []; let score = Math.floor(this.tempBlood * 2)/2; let decimalScore = score%1 !== 0; let integerScore = Math.floor(score); for (let i=0; i<integerScore; i++){stars.push('on') }if (decimalScore){stars.push('half') }while(stars.length<5){stars.push('off') }return stars},starScore2(){let stars = []; let score = Math.floor(this.tempAlcoho * 2)/2; let decimalScore = score%1 !== 0; let integerScore = Math.floor(score); for (let i=0; i<integerScore; i++){stars.push('on') }if (decimalScore){stars.push('half') }while(stars.length<5){stars.push('off') }return stars},starScore3(){let stars = []; let score = Math.floor(this.tempBloodOX * 2)/2; let decimalScore = score%1 !== 0; let integerScore = Math.floor(score); for (let i=0; i<integerScore; i++){stars.push('on') }if (decimalScore){stars.push('half') }while(stars.length<5){stars.push('off') }return stars},starScore4(){let stars = []; let score = Math.floor(this.tempTempture * 2)/2; let decimalScore = score%1 !== 0; let integerScore = Math.floor(score); for (let i=0; i<integerScore; i++){stars.push('on') }if (decimalScore){stars.push('half') }while(stars.length<5){stars.push('off') }return stars}},methods: {handleJump(timePeriod) {this.selectedPeriod = timePeriod;console.log(timePeriod);switch (timePeriod) {case 'today':this.$router.push({ name: 'today'})break;case 'week':this.$router.push({ name: 'week'})break;case 'month':this.$router.push({ name: 'month'})break;default:console.error('未知的时间段');break;}},exportPDF() {exportUserIndexPDF( this.addDateRange(this.queryParams, this.dateRange)).then((res) => {var filename = new Date().getTime();let url = window.URL.createObjectURL(res)let link = document.createElement('a')link.style.display = 'none'link.href = urllink.setAttribute('download', filename + '.pdf')document.body.appendChild(link)link.click();URL.revokeObjectURL(link.href);document.body.removeChild(link);});},printpage() {const printContent = document.querySelector('.dashboard-editor-container').innerHTML;const iframe = document.createElement('iframe');iframe.setAttribute('style', 'position: absolute; width: 0; height: 0;');document.body.appendChild(iframe);const iframeDoc = iframe.contentWindow.document;iframeDoc.write('<style media="print">@page {size: landscape;}</style>');iframeDoc.write('<div>' + printContent + '</div>');setTimeout(function () {iframe.contentWindow?.print();document.body.removeChild(iframe);}, 50);},handleClose(done) {this.$confirm('确认关闭?').then(_ => {done();}).catch(_ => { });},getWeekList() {this.loading = true;weekUserDetectionDetail(this.queryParams,).then((response) => {this.userWeekList = response.data;this.loading = false;console.log("userListWeek:");console.log(this.userWeekList);this.RChartData.a1 = this.userWeekList.alcohoMap[0];this.RChartData.a2 = this.userWeekList.alcohoMap[1];this.RChartData.a3 = this.userWeekList.alcohoMap[2];this.RChartData.a4 = this.userWeekList.alcohoMap[3];this.XChartData.a1 = this.userWeekList.bloodOxygenMap[0],this.XChartData.a2 = this.userWeekList.bloodOxygenMap[1],this.XChartData.a3 = this.userWeekList.bloodOxygenMap[2],this.lineChartData.diastolicData = this.userWeekList.bloodPressureDiaMap;this.lineChartData.systolicData = this.userWeekList.bloodPressureSyMap;this.tempertureData.temperture = this.userWeekList.temperatureMap;this.userData.nickName = this.userWeekList.listUserInfo[0];this.userData.jobNumber = this.userWeekList.listUserInfo[1];this.userData.deptName = this.userWeekList.listUserInfo[2];this.userData.roleName = this.userWeekList.listUserInfo[3];this.userData.phonenumber = this.userWeekList.listUserInfo[4];this.userData.sex = this.userWeekList.listUserInfo[5];this.src = this.userWeekList.listUserInfo[6]; this.bloodPressureScore =this.userWeekList.bloodPressureScore;this.alcohoScore =this.userWeekList.alcohoScore;this.bloodOXScore =this.userWeekList.bloodOXScore;this.temperatureScore =this.userWeekList.temperatureScore;this.overallScore = this.userWeekList.overallScore;this.tempBlood = this.userWeekList.bloodPressureScore/100*5;this.tempAlcoho =this.userWeekList.alcohoScore/100*5;this.tempBloodOX =this.userWeekList.bloodOXScore/100*5;this.tempTempture = this.userWeekList.temperatureScore / 100.0 * 5;this.bloodPressureHeartRate = this.userWeekList.bloodPressureHeartRateMap;this.rateData.heartRate = this.userWeekList.bloodPressureHeartRateMap;this.lineChartDataX.yearlyRateData = this.userWeekList.overallYearScore;});},handleQuery() {this.queryParams.pageNum = 1;this.getList();},resetQuery() {this.dateRange = [];this.resetForm("queryForm");this.handleQuery();},getNowTime() {var now = new Date();var year = now.getFullYear(); var month = now.getMonth(); var date = now.getDate(); month = month + 1;month = month.toString().padStart(2, "0");date = date.toString().padStart(2, "0");var defaultDate = `${year}-${month}-${date}`;var oneWeekAgo = new Date(now);oneWeekAgo.setDate(now.getDate() - 7); var yearAgo = oneWeekAgo.getFullYear();var monthAgo = (oneWeekAgo.getMonth() + 1).toString().padStart(2, "0");var dateAgo = oneWeekAgo.getDate().toString().padStart(2, "0");var sevenDaysAgo = `${yearAgo}-${monthAgo}-${dateAgo}`;this.dateRange = [sevenDaysAgo, defaultDate];},}
}
</script><style lang="scss" scoped>
.status-item {display: flex;margin-left: 50px;margin-top: 10px;
}.stars {color: #10ac84;font-size: 18px;margin-left: 15px;
}.score-section {display: flex;margin-left: 40px;color: #00a8ff;font-size: 15px;
}.info-item {margin-left: 50px;font-size: 15px;margin-bottom: 3px;
}.chart-img {height: 180px;width: 150px;
}.dashboard-editor-container {padding: 12px;background-color: rgb(240, 242, 245);position: relative;.chart-wrapper {background: #fff;padding: 16px 16px 0;margin-bottom: 12px;}.chart-wrapper-z {margin-top: 20px;background: #fff;padding: 16px 16px 0;margin-bottom: 12px;height: 198px;}.chart-wrapper1 {margin-top: 20px;background: #fff;padding: 16px 16px 0;margin-bottom: 12px;height: 198px;display: flex;}.chart-wrapper2 {margin-top: 20px;background: #fff;margin-bottom: 12px;height: 198px;}}@media (max-width:1024px) {.chart-wrapper {padding: 8px;}
}.block {display: flex;background: #fff;height: 60px;align-items: center;}.block-son {margin-top: 20px;
}.container {
}.but {margin-left: 200px;
}.rule-title-all {font-weight: bold;margin-top: 20px;font-size: 25px;
}
.rule-title {font-weight: bold;margin-top: 20px;font-size: 20px;
}
.rule-description {margin-left: 20px;font-size: 20px;
}.rule-title-p {margin-bottom: 10px;
}
.selected {background-color: #409EFF; color: white;
}.score{display: flex;align-items: center;justify-content: center;.star-item{width: 20px;height: 20px;display: inline-block;margin: 0 5px;background: no-repeat;}.star-item.on{background: url("../assets/images/星实.png"); background-size: contain;}.star-item.half{background: url("../assets/images/星半.png"); background-size: contain;}.star-item.off{background: url("../assets/images/星空.png"); background-size: contain;}
}</style>
<template><div class="dashboard-editor-container"><div class="block"><div class="block-son"><el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"label-width="98px"><el-form-item label="驾驶员名称" prop="nickName"><el-input v-model="queryParams.nickName" placeholder="请输入驾驶员名称" clearable@keyup.enter.native="handleQuery" /></el-form-item><el-form-item class="button1"><!-- 今日按钮 --><el-button plain type="primary" size="mini" :class="{ 'selected': selectedPeriod === 'today' }" @click="handleJump('today')">今日</el-button><!-- 近一周按钮 --><el-button plain type="primary" size="mini" :class="{ 'selected': selectedPeriod === 'week' }" @click="handleJump('week')">近一周</el-button><!-- 近一个月按钮 --><el-button plain type="primary" size="mini" :class="{ 'selected': selectedPeriod === 'month' }" @click="handleJump('month')">近一个月</el-button></el-form-item><!-- <el-form-item label="检测时间"><el-date-pickerv-model="dateRange"type="daterange"range-separator="至"start-placeholder="开始日期"end-placeholder="结束日期"></el-date-picker></el-form-item> --><el-form-item label="检测时间"><el-date-picker v-model="dateRange" type="daterange" align="right" unlink-panels range-separator="至"start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions"></el-date-picker></el-form-item><el-form-item><el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button><el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button></el-form-item><el-form-item class="container"><div class="but"><el-button type="primary" size="mini" @click="dialogVisible = true">评分规则</el-button><!-- <el-button type="primary" size="mini" @click="printpage" >导出PDF</el-button> --><el-button type="primary" size="mini" @click="exportPDF"> 导出PDF </el-button></div></el-form-item></el-form></div></div><el-row :gutter="12"><el-col :xs="24" :sm="24" :lg="8"><div class="chart-wrapper1"><div class="chart-img"><el-popover placement="top-start" trigger="hover"><div class="row_reserve"><img class="big-img" :src="baseurl + `/system/` + src" style="width: 250px; height: 250px; margin-bottom: -4px" :onerror="defaultAct" /></div><div slot="reference"><img class="td-img" :src="baseurl + `/system/` + src"style="width: 150px; height: 150px; margin-bottom: -4px" :onerror="defaultAct" /></div></el-popover></div><div><div class="info-item"><strong>姓名:</strong><span style="color:#54a0ff;margin-left:10px">{{ userData.nickName }}</span></div><div class="info-item"><strong>性别:</strong><span style="color:#54a0ff;margin-left:10px">{{ userData.sex === '0' ? '男' : '女' }}</span></div><div class="info-item"><strong >手机号:</strong><span style="color:#54a0ff;margin-left:10px">{{ userData.phonenumber }}</span></div><div class="info-item"><strong>所属部门:</strong><span style="color:#54a0ff;margin-left:10px">{{ userData.deptName }}</span></div><div class="info-item"><strong>员工工号:</strong><span style="color:#54a0ff;margin-left:10px">{{ userData.jobNumber }}</span></div><div class="info-item"><strong>用户角色:</strong><span style="color:#54a0ff;margin-left:10px">{{ userData.roleName }}</span></div></div></div></el-col><el-col :xs="24" :sm="24" :lg="8"><div class="chart-wrapper2"><div class="score-section1"><div style="font-weight:bold; padding:20px 20px 10px">综合评分:{{overallScore}}</div></div><div style="display:flex"><div style="display:flex"><div class="score-section"><div>血压检测:{{bloodPressureScore}}</div></div><div class="score-section"><div>酒精检测:{{alcohoScore}}</div></div></div><div style="display:flex"><div class="score-section"><div>体温检测:{{temperatureScore}}</div></div><div class="score-section"><div>血氧检测:{{bloodOXScore}}</div></div></div></div><div class="health-status"><div style="font-weight:bold;margin:20px 20px 0px">健康状况</div><div style="display:flex"><div class="status-item"><div>血压</div><!-- <div class="stars">★★★★★</div> --><div class="score"><!--循序生成五星,原理是通过给span绑定类名设置星星背景图--><span class="star-item" v-for="star in starScore1" :class="star"></span><span>{{tempBlood.toFixed(1)}}</span></div></div><div class="status-item"><div>酒精</div><div class="score"><!--循序生成五星,原理是通过给span绑定类名设置星星背景图--><span class="star-item" v-for="star in starScore2" :class="star"></span><span>{{tempAlcoho.toFixed(1)}}</span></div></div></div><div style="display:flex"><div class="status-item"><div>血氧</div><div class="score"><!--循序生成五星,原理是通过给span绑定类名设置星星背景图--><span class="star-item" v-for="star in starScore3" :class="star"></span><span>{{tempBloodOX.toFixed(1)}}</span></div></div><div class="status-item"><div>体温</div><div class="score"><!--循序生成五星,原理是通过给span绑定类名设置星星背景图--><span class="star-item" v-for="star in starScore4" :class="star"></span><span>{{tempTempture.toFixed(1)}}</span></div></div></div></div></div></el-col><el-col :xs="24" :sm="24" :lg="8"><div class="chart-wrapper-z"><div style="font-weight:bold">历史趋势</div><div style="font-size:15px;color:#48dbfb;margin-bottom:-22px;margin-left:10px">评分</div><line-chart-x :chart-data="lineChartDataX"/></div></el-col></el-row><el-row :gutter="12"><el-col :xs="24" :sm="24" :lg="12"><div class="chart-wrapper"><div style="font-weight:bold">血压检测图表(mm/hg)</div><line-chart-m :chart-data="lineChartDataM" /></div></el-col><el-col :xs="24" :sm="24" :lg="12"><div class="chart-wrapper"><div style="font-weight:bold">酒精检测图表(mg/100ml)</div><pie-chart :chart-data="RChartData"/></div></el-col></el-row><el-row :gutter="12"><el-col :xs="24" :sm="24" :lg="8"><div class="chart-wrapper"><div style="font-weight:bold">心率检测图表(bpm)</div><line-chart-n :chart-data="rateData"/></div></el-col><el-col :xs="24" :sm="24" :lg="8"><div class="chart-wrapper"><div style="font-weight:bold">血氧饱和检测图表(%)</div><pie-chart-x :chart-data="XChartData"/></div></el-col><el-col :xs="24" :sm="24" :lg="8"><div class="chart-wrapper"><div style="font-weight:bold">体温检测图表(°C)</div><bar-chart-m :chart-data="tempertureDataM"/></div></el-col></el-row><el-dialog title="" :visible.sync="dialogVisible" width="60%" height="80%" ><div class="rule-title-p"><div class="rule-title-all"> 综合评分规则:</div><span class="rule-description">每个检测项目满分100分,60分及格。</span><spanclass="rule-description">每日综合评分为所有项目的总和/项目数。注:只计算驾驶员做的项目,例如:如果驾驶员只做了体温检测和酒精检测,没有做血氧检测和血压检测,那么总和评分就是(体温得分+酒测得分)/2每周综合评分为该周每日的综合评分相加/日数。注:只计算驾驶员做了检测的日数。每月综合评分为该月每日的总和评分相加/日数。注:只计算驾驶员做了检测的日数。</span></div><div class="rule-title-p"><span class="rule-title">体温评分规则:</span><span class="rule-description">体温在a°-b°范围内,得100分,(a、b由客户设定)</span><span class="rule-description">体温每升高或降低c°,扣1分,(c由客户设定)</span><span class="rule-description">如果司机体温在a°-b°之间,得分=100分</span><span class="rule-description">如果司机体温低于a°,得分=100-[(a°-司机体温)/c°]</span><span class="rule-description">如果司机体温高于b°,得分=100-[(司机体温-b°)/c°]</span></div><div class="rule-title-p"><span class="rule-title"> 测酒评分规则:</span> <span class="rule-description">酒精检测值低于x mg/100ml时,得100分,(x由客户设定)</span><span class="rule-description"> 酒精检测值每提高y mg/100ml,测酒评分减1分,(y由客户设定)</span><span class="rule-description"> 司机测酒精评分=100-[(司机酒精检测值-x)/y]</span></div><div class="rule-title-p"><span class="rule-title"> 血氧饱和度评分规则:</span><span class="rule-description">血氧饱和度在m%以上时,得100分,(m由客户设定)</span><span class="rule-description">血氧饱和度每下降n%,血氧评分减1分,(n由客户设定)</span><span class="rule-description">血氧饱和度评分=100-[(m-司机血氧饱和度)/n]</span></div><div class="rule-title-p"><span class="rule-title"> 血压评分规则:</span><span class="rule-description">100分:收缩压<139和舒张压<89 </span><span class="rule-description">80分:140<收缩压<159或90<舒张压<99(一级轻度高血压) </span><span class="rule-description">60分:160<收缩压<179或100<舒张压<109(二级中度高血压) </span><span class="rule-description">60分以下:收缩压>=180或舒张压>=110(三级重度高血压)</span></div><span slot="footer" class="dialog-footer"><el-button @click="dialogVisible = false">关闭</el-button></span></el-dialog></div>
</template>
<script>
import pdf from 'vue-pdf'
import LineChart from './dashboard/LineChart'
import LineChartX from './dashboard/LineChartX'
import LineChartY from './dashboard/LineChartY'
import LineChartM from './dashboard/LineChartM'
import LineChartN from './dashboard/LineChartN'
import RaddarChart from './dashboard/RaddarChart'
import PieChart from './dashboard/PieChart'
import PieChartX from './dashboard/PieChartX'
import BarChart from './dashboard/BarChart'
import BarChartM from './dashboard/BarChartM'
import { exportUserIndexPDF,monthUserDetectionDetail } from "@/api/userIndex/userIndex";
import profile from "../assets/images/profile.jpg";
export default {name: 'Index',components: {pdf,LineChartX,LineChartY,LineChartM,LineChartN,LineChart,LineChart,RaddarChart,PieChart,PieChartX,BarChart,BarChartM},data() {return {defaultAct: 'this.src="' + profile + '"',baseurl: process.env.VUE_APP_BASE_API,tempBlood:null,tempAlcoho:null,tempBloodOX:null,tempTempture:null,selectedPeriod: '', bloodPressureScore:"",alcohoScore:"",bloodOXScore:"",temperatureScore:"",overallScore:"",RChartData:{ a1:1,a2:3,a3:2,a4:0,},XChartData:{ a1:4,a2:2,a3:1,},tempertureData:{temperture:[]},tempertureDataM:{temperture:[]},rateData:{heartRate:[]},lineChartDataM: {systolicData: [],diastolicData: []},lineChartDataX: {yearlyRateData: [], },dialogVisible: false,value3: '',pickerOptions: {shortcuts: [{text: '最近一周',onClick(picker) {const end = new Date();const start = new Date();start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);picker.$emit('pick', [start, end]);}}, {text: '最近一个月',onClick(picker) {const end = new Date();const start = new Date();start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);picker.$emit('pick', [start, end]);}}]},userData: {phonenumber:'',sex:'',nickName:'',deptName:'',roleName:''}, dateRange: [],src: 'https://cube.elemecdn.com/9/c2/f0ee8a3c7c9638a54940382568c9dpng.png',userList: {},showSearch: true,queryParams: {pageNum: 1,pageSize: 10,nickName: null,userId: null},}},created() {this.queryParams.userId = this.$route.params.userIdthis.getNowTime();this.getMonthList();},computed:{starScore1(){let stars = []; let score = Math.floor(this.tempBlood * 2)/2; let decimalScore = score%1 !== 0; let integerScore = Math.floor(score); for (let i=0; i<integerScore; i++){stars.push('on') }if (decimalScore){stars.push('half') }while(stars.length<5){stars.push('off') }return stars},starScore2(){let stars = []; let score = Math.floor(this.tempAlcoho * 2)/2; let decimalScore = score%1 !== 0; let integerScore = Math.floor(score); for (let i=0; i<integerScore; i++){stars.push('on') }if (decimalScore){stars.push('half') }while(stars.length<5){stars.push('off') }return stars},starScore3(){let stars = []; let score = Math.floor(this.tempBloodOX * 2)/2; let decimalScore = score%1 !== 0; let integerScore = Math.floor(score); for (let i=0; i<integerScore; i++){stars.push('on') }if (decimalScore){stars.push('half') }while(stars.length<5){stars.push('off') }return stars},starScore4(){let stars = []; let score = Math.floor(this.tempTempture * 2)/2; let decimalScore = score%1 !== 0; let integerScore = Math.floor(score); for (let i=0; i<integerScore; i++){stars.push('on') }if (decimalScore){stars.push('half') }while(stars.length<5){stars.push('off') }return stars}},methods: {handleJump(timePeriod) {this.selectedPeriod = timePeriod;switch (timePeriod) {case 'today':this.$router.push({ name: 'today'})break;case 'week':this.$router.push({ name: 'week'})break;case 'month':this.$router.push({ name: 'month'})break;default:console.error('未知的时间段');break;}},exportPDF() {exportUserIndexPDF( this.addDateRange(this.queryParams, this.dateRange)).then((res) => {var filename = new Date().getTime();let url = window.URL.createObjectURL(res)let link = document.createElement('a')link.style.display = 'none'link.href = urllink.setAttribute('download', filename + '.pdf')document.body.appendChild(link)link.click();URL.revokeObjectURL(link.href);document.body.removeChild(link);});},printpage() {const printContent = document.querySelector('.dashboard-editor-container').innerHTML;const iframe = document.createElement('iframe');iframe.setAttribute('style', 'position: absolute; width: 0; height: 0;');document.body.appendChild(iframe);const iframeDoc = iframe.contentWindow.document;iframeDoc.write('<style media="print">@page {size: landscape;}</style>');iframeDoc.write('<div>' + printContent + '</div>');setTimeout(function () {iframe.contentWindow?.print();document.body.removeChild(iframe);}, 50);},handleClose(done) {this.$confirm('确认关闭?').then(_ => {done();}).catch(_ => { });},getMonthList() {this.loading = true;monthUserDetectionDetail(this.queryParams,).then((response) => {this.userWeekList = response.data;this.loading = false;console.log("userListWeek:");console.log(this.userWeekList);this.RChartData.a1 = this.userWeekList.alcohoMap[0];this.RChartData.a2 = this.userWeekList.alcohoMap[1];this.RChartData.a3 = this.userWeekList.alcohoMap[2];this.RChartData.a4 = this.userWeekList.alcohoMap[3];this.XChartData.a1 = this.userWeekList.bloodOxygenMap[0],this.XChartData.a2 = this.userWeekList.bloodOxygenMap[1],this.XChartData.a3 = this.userWeekList.bloodOxygenMap[2],this.lineChartDataM.diastolicData = this.userWeekList.bloodPressureDiaMap;this.lineChartDataM.systolicData = this.userWeekList.bloodPressureSyMap;this.tempertureData.temperture = this.userWeekList.temperatureMap;this.tempertureDataM.temperture = this.userWeekList.temperatureMap;this.userData.nickName = this.userWeekList.listUserInfo[0];this.userData.jobNumber = this.userWeekList.listUserInfo[1];this.userData.deptName = this.userWeekList.listUserInfo[2];this.userData.roleName = this.userWeekList.listUserInfo[3];this.userData.phonenumber = this.userWeekList.listUserInfo[4];this.userData.sex = this.userWeekList.listUserInfo[5];this.src = this.userWeekList.listUserInfo[6]; this.bloodPressureScore =this.userWeekList.bloodPressureScore;this.alcohoScore =this.userWeekList.alcohoScore;this.bloodOXScore =this.userWeekList.bloodOXScore;this.temperatureScore =this.userWeekList.temperatureScore;this.overallScore = this.userWeekList.overallScore;this.tempBlood = this.userWeekList.bloodPressureScore/100*5;this.tempAlcoho =this.userWeekList.alcohoScore/100*5;this.tempBloodOX =this.userWeekList.bloodOXScore/100*5;this.tempTempture = this.userWeekList.temperatureScore / 100.0 * 5;this.rateData.heartRate = this.userWeekList.bloodPressureHeartRateMap;this.lineChartDataX.yearlyRateData = this.userWeekList.overallYearScore;});},handleQuery() {this.queryParams.pageNum = 1;this.getList();},resetQuery() {this.dateRange = [];this.resetForm("queryForm");this.handleQuery();},getNowTime() {var now = new Date();var year = now.getFullYear(); var month = now.getMonth(); var date = now.getDate(); month = month + 1;month = month.toString().padStart(2, "0");date = date.toString().padStart(2, "0");var defaultDate = `${year}-${month}-${date}`;var oneWeekAgo = new Date(now);oneWeekAgo.setDate(now.getDate() - 30); var yearAgo = oneWeekAgo.getFullYear();var monthAgo = (oneWeekAgo.getMonth() + 1).toString().padStart(2, "0");var dateAgo = oneWeekAgo.getDate().toString().padStart(2, "0");var sevenDaysAgo = `${yearAgo}-${monthAgo}-${dateAgo}`;this.dateRange = [sevenDaysAgo, defaultDate];},}
}
</script><style lang="scss" scoped>
.status-item {display: flex;margin-left: 50px;margin-top: 10px;
}
.stars {color: #10ac84;font-size: 18px;margin-left: 15px;
}.score-section {display: flex;margin-left: 40px;color: #00a8ff;font-size: 15px;
}.info-item {margin-left: 50px;font-size: 15px;margin-bottom: 3px;
}.chart-img {height: 180px;width: 150px;
}.dashboard-editor-container {padding: 12px;background-color: rgb(240, 242, 245);position: relative;.chart-wrapper {background: #fff;padding: 16px 16px 0;margin-bottom: 12px;}.chart-wrapper-z {margin-top: 20px;background: #fff;padding: 16px 16px 0;margin-bottom: 12px;height: 198px;}.chart-wrapper1 {margin-top: 20px;background: #fff;padding: 16px 16px 0;margin-bottom: 12px;height: 198px;display: flex;}.chart-wrapper2 {margin-top: 20px;background: #fff;margin-bottom: 12px;height: 198px;}}@media (max-width:1024px) {.chart-wrapper {padding: 8px;}
}.block {display: flex;background: #fff;height: 60px;align-items: center;}.block-son {margin-top: 20px;
}.container {
}.but {margin-left: 200px;
}.rule-title-all {font-weight: bold;margin-top: 20px;font-size: 25px;
}
.rule-title {font-weight: bold;margin-top: 20px;font-size: 20px;
}
.rule-description {margin-left: 20px;font-size: 20px;
}.rule-title-p {margin-bottom: 10px;
}
.selected {background-color: #409EFF; color: white;
}
.score{display: flex;align-items: center;justify-content: center;.star-item{width: 20px;height: 20px;display: inline-block;margin: 0 5px;background: no-repeat;}.star-item.on{background: url("../assets/images/星实.png"); background-size: contain;}.star-item.half{background: url("../assets/images/星半.png"); background-size: contain;}.star-item.off{background: url("../assets/images/星空.png"); background-size: contain;}
}
</style>