Merge branch '0418_小程序开发' of http://182.92.166.109:3000/zhuangyuanke/PostDischargePatientManage into 0418_小程序开发
This commit is contained in:
commit
632309393b
@ -0,0 +1,41 @@
|
||||
package com.xinelu.common.utils.file;
|
||||
|
||||
import com.xinelu.common.config.SystemBusinessConfig;
|
||||
import com.xinelu.common.constant.Constants;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* 图片裁剪
|
||||
*
|
||||
* @author: zh
|
||||
* @create: 2024-08-22
|
||||
**/
|
||||
public class ImageResize {
|
||||
|
||||
public static void scaledDown(String pictureName) {
|
||||
try {
|
||||
pictureName = pictureName.replaceAll(Constants.RESOURCE_PREFIX, SystemBusinessConfig.getProfile());
|
||||
File inputFile = new File(pictureName);
|
||||
BufferedImage inputImage = ImageIO.read(inputFile);
|
||||
if (inputImage.getWidth() < 1080) {
|
||||
return;
|
||||
}
|
||||
// 新的宽度
|
||||
int newWidth = 1080;
|
||||
int newHeight = (int) ((double) inputImage.getHeight() / inputImage.getWidth() * newWidth);
|
||||
// 计算新的高度
|
||||
BufferedImage outputImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_RGB);
|
||||
Graphics2D g2d = outputImage.createGraphics();
|
||||
g2d.drawImage(inputImage, 0, 0, newWidth, newHeight, null);
|
||||
g2d.dispose();
|
||||
File outputFile = new File(pictureName);
|
||||
ImageIO.write(outputImage, "jpg", outputFile);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -96,7 +96,12 @@ public class SystemHomePageServiceImpl implements SystemHomePageService {
|
||||
signPatientCount.setTime(localDate);
|
||||
signPatientCount.setPatientCount(createPatientCount + patientPreHospitalizationCount);
|
||||
signPatientCount.setSignPatientCount(signPatient);
|
||||
signPatientCount.setProportion(new BigDecimal(i).divide(new BigDecimal(createPatientCount), 2, RoundingMode.HALF_UP));
|
||||
//除法运算
|
||||
if (createPatientCount != 0) {
|
||||
signPatientCount.setProportion(new BigDecimal(i).divide(new BigDecimal(createPatientCount), 2, RoundingMode.HALF_UP));
|
||||
} else {
|
||||
signPatientCount.setProportion(BigDecimal.ZERO);
|
||||
}
|
||||
signPatientCounts.add(signPatientCount);
|
||||
}
|
||||
return signPatientCounts;
|
||||
@ -120,10 +125,18 @@ public class SystemHomePageServiceImpl implements SystemHomePageService {
|
||||
BigDecimal appletPushSign = signPatientManageRouteNodeMapper.selectNodeCount(null, null, 0L);
|
||||
//全部
|
||||
BigDecimal all = common.add(AI).add(messagePushSign).add(appletPushSign);
|
||||
serviceModeStatisticsList.add(new ServiceModeStatistics("AI", AI.divide(all, 2, RoundingMode.HALF_UP), AI));
|
||||
serviceModeStatisticsList.add(new ServiceModeStatistics("短信", messagePushSign.divide(all, 2, RoundingMode.HALF_UP), messagePushSign));
|
||||
serviceModeStatisticsList.add(new ServiceModeStatistics("微信", appletPushSign.divide(all, 2, RoundingMode.HALF_UP), appletPushSign));
|
||||
serviceModeStatisticsList.add(new ServiceModeStatistics("人工随访", common.divide(all, 2, RoundingMode.HALF_UP), common));
|
||||
//除法运算
|
||||
if (all.equals(BigDecimal.ZERO)) {
|
||||
serviceModeStatisticsList.add(new ServiceModeStatistics("AI", BigDecimal.ZERO, AI));
|
||||
serviceModeStatisticsList.add(new ServiceModeStatistics("短信", BigDecimal.ZERO, messagePushSign));
|
||||
serviceModeStatisticsList.add(new ServiceModeStatistics("微信", BigDecimal.ZERO, appletPushSign));
|
||||
serviceModeStatisticsList.add(new ServiceModeStatistics("人工随访", BigDecimal.ZERO, common));
|
||||
} else {
|
||||
serviceModeStatisticsList.add(new ServiceModeStatistics("AI", AI.divide(all, 2, RoundingMode.HALF_UP), AI));
|
||||
serviceModeStatisticsList.add(new ServiceModeStatistics("短信", messagePushSign.divide(all, 2, RoundingMode.HALF_UP), messagePushSign));
|
||||
serviceModeStatisticsList.add(new ServiceModeStatistics("微信", appletPushSign.divide(all, 2, RoundingMode.HALF_UP), appletPushSign));
|
||||
serviceModeStatisticsList.add(new ServiceModeStatistics("人工随访", common.divide(all, 2, RoundingMode.HALF_UP), common));
|
||||
}
|
||||
return serviceModeStatisticsList;
|
||||
}
|
||||
|
||||
|
||||
@ -5,13 +5,15 @@ import com.xinelu.common.constant.FileUploadPathConstants;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.exception.ServiceException;
|
||||
import com.xinelu.common.utils.file.FileUploadUtils;
|
||||
import com.xinelu.common.utils.file.ImageResize;
|
||||
import com.xinelu.common.utils.file.MimeTypeUtils;
|
||||
import com.xinelu.manage.service.signpatientinformed.IFileUploadService;
|
||||
import javax.annotation.Resource;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @description: 文件上传Service业务层处理
|
||||
* @author: haown
|
||||
@ -63,6 +65,10 @@ public class FileUplooadServiceImpl implements IFileUploadService {
|
||||
if (StringUtils.isBlank(pictureName)) {
|
||||
throw new ServiceException("文件上传失败,请联系管理员!");
|
||||
}
|
||||
if (type.equals(FileUploadPathConstants.MATERIALS_COVER_TYPE)){
|
||||
//裁剪图片
|
||||
ImageResize.scaledDown(pictureName);
|
||||
}
|
||||
AjaxResult ajax = AjaxResult.success("上传成功!");
|
||||
ajax.put("imgUrl", pictureName);
|
||||
return ajax;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user