From fa110601b4f8ceba9cded55e3656a5302271fdee Mon Sep 17 00:00:00 2001 From: haown <454902499@qq.com> Date: Tue, 10 Oct 2023 11:09:01 +0800 Subject: [PATCH] =?UTF-8?q?update=3D=3D=3D>:=E4=BF=AE=E6=94=B9=E7=AD=9B?= =?UTF-8?q?=E6=9F=A5=E7=9B=B8=E5=85=B3=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 10 + xinelu-common/pom.xml | 6 + .../xinelu/common/config/XinELuConfig.java | 64 +++++ .../com/xinelu/common/constant/Constants.java | 24 ++ .../com/xinelu/common/utils/QrCodeUtils.java | 222 ++++++++++++++++++ .../xinelu/common/utils/file/FileUtils.java | 20 ++ .../AppletScreeningRecordController.java | 22 +- .../impl/ScreeningRecordServiceImpl.java | 74 +++--- .../vo/screeningrecord/ScreeningRecordVo.java | 8 +- .../screeningrecord/ScreeningRecordMapper.xml | 16 +- 10 files changed, 405 insertions(+), 61 deletions(-) create mode 100644 xinelu-common/src/main/java/com/xinelu/common/utils/QrCodeUtils.java diff --git a/xinelu-admin/src/main/resources/application.yml b/xinelu-admin/src/main/resources/application.yml index 5ebc93d..0a2c711 100644 --- a/xinelu-admin/src/main/resources/application.yml +++ b/xinelu-admin/src/main/resources/application.yml @@ -72,6 +72,16 @@ xinelu: consultation-file-url: /consultationFileUrl #聊天图片地址 chat-record-file-url: /chatRecordFileUrl + #筛查预约条码图片地址 + apply-barcode-piture-url: /applyBarcodePitureUrl + #筛查预约条码图片地址 + register-barcode-piture-url: /registerBarcodePictureUrl + #血小板筛查图片地址 + platelet-piture-url: /plateletPitureUrl + #眼底病变筛查左眼图片地址 + left-eye-piture-url: /leftEyePitureUrl + #眼底病变筛查右眼图片地址 + right-eye-piture-url: /rightEyePitureUrl # 开发环境配置 server: diff --git a/xinelu-common/pom.xml b/xinelu-common/pom.xml index 8a9c64e..6527690 100644 --- a/xinelu-common/pom.xml +++ b/xinelu-common/pom.xml @@ -185,6 +185,12 @@ org.springframework.integration spring-integration-redis + + + com.google.zxing + core + 3.4.0 + diff --git a/xinelu-common/src/main/java/com/xinelu/common/config/XinELuConfig.java b/xinelu-common/src/main/java/com/xinelu/common/config/XinELuConfig.java index 0d8883c..3c14cfa 100644 --- a/xinelu-common/src/main/java/com/xinelu/common/config/XinELuConfig.java +++ b/xinelu-common/src/main/java/com/xinelu/common/config/XinELuConfig.java @@ -77,6 +77,30 @@ public class XinELuConfig { */ private String attributePitureUrl; + /** + * 筛查预约条码图片地址 + */ + public String applyBarcodePitureUrl; + + /** + * 筛查预约条码图片地址 + */ + public String registerBarcodePitureUrl; + + /** + * 血小板筛查图片地址 + */ + public String plateletPitureUrl; + + /** + * 眼底病变筛查左眼图片地址 + */ + public String leftEyePitureUrl; + /** + * 眼底病变筛查右眼图片地址 + */ + public String rightEyePitureUrl; + /** * 修改会员App用户头像上传 */ @@ -576,4 +600,44 @@ public class XinELuConfig { public void setItemDirectoryUrl(String itemDirectoryUrl) { this.itemDirectoryUrl = itemDirectoryUrl; } + + public String getApplyBarcodePitureUrl() { + return applyBarcodePitureUrl; + } + + public void setApplyBarcodePitureUrl(String applyBarcodePitureUrl) { + this.applyBarcodePitureUrl = applyBarcodePitureUrl; + } + + public String getRegisterBarcodePitureUrl() { + return registerBarcodePitureUrl; + } + + public void setRegisterBarcodePitureUrl(String registerBarcodePitureUrl) { + this.registerBarcodePitureUrl = registerBarcodePitureUrl; + } + + public String getPlateletPitureUrl() { + return plateletPitureUrl; + } + + public void setPlateletPitureUrl(String plateletPitureUrl) { + this.plateletPitureUrl = plateletPitureUrl; + } + + public String getLeftEyePitureUrl() { + return leftEyePitureUrl; + } + + public void setLeftEyePitureUrl(String leftEyePitureUrl) { + this.leftEyePitureUrl = leftEyePitureUrl; + } + + public String getRightEyePitureUrl() { + return rightEyePitureUrl; + } + + public void setRightEyePitureUrl(String rightEyePitureUrl) { + this.rightEyePitureUrl = rightEyePitureUrl; + } } diff --git a/xinelu-common/src/main/java/com/xinelu/common/constant/Constants.java b/xinelu-common/src/main/java/com/xinelu/common/constant/Constants.java index 5e1cca5..a15b82e 100644 --- a/xinelu-common/src/main/java/com/xinelu/common/constant/Constants.java +++ b/xinelu-common/src/main/java/com/xinelu/common/constant/Constants.java @@ -259,6 +259,30 @@ public class Constants { */ public static final String ATTRIBUTE_PICTURE_URL = "attributePitureUrl"; + /** + * 筛查预约条码图片地址 + */ + public static final String APPLY_BARCODE_PICTURE_URL = "applyBarcodePitureUrl"; + + /** + * 筛查预约条码图片地址 + */ + public static final String REGISTER_BARCODE_PICTURE_URL = "registerBarcodePitureUrl"; + + /** + * 血小板筛查图片地址 + */ + public static final String PLATELET_PICTURE_URL = "plateletPitureUrl"; + + /** + * 眼底病变筛查左眼图片地址 + */ + public static final String LEFT_EYE_PICTURE_URL = "leftEyePitureUrl"; + /** + * 眼底病变筛查右眼图片地址 + */ + public static final String RIGHT_EYE_PICTURE_URL = "rightEyePitureUrl"; + /** * 护理站模板信息下载 */ diff --git a/xinelu-common/src/main/java/com/xinelu/common/utils/QrCodeUtils.java b/xinelu-common/src/main/java/com/xinelu/common/utils/QrCodeUtils.java new file mode 100644 index 0000000..e6633a8 --- /dev/null +++ b/xinelu-common/src/main/java/com/xinelu/common/utils/QrCodeUtils.java @@ -0,0 +1,222 @@ +package com.xinelu.common.utils; + +import cn.hutool.core.io.FileUtil; +import cn.hutool.extra.qrcode.BufferedImageLuminanceSource; +import cn.hutool.extra.qrcode.QrCodeUtil; +import cn.hutool.extra.qrcode.QrConfig; +import com.google.zxing.BarcodeFormat; +import com.google.zxing.BinaryBitmap; +import com.google.zxing.DecodeHintType; +import com.google.zxing.EncodeHintType; +import com.google.zxing.MultiFormatReader; +import com.google.zxing.MultiFormatWriter; +import com.google.zxing.Result; +import com.google.zxing.common.BitMatrix; +import com.google.zxing.common.HybridBinarizer; +import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; +import com.xinelu.common.utils.uuid.IdUtils; +import java.awt.BasicStroke; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Shape; +import java.awt.geom.RoundRectangle2D; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.util.Hashtable; +import java.util.concurrent.atomic.AtomicInteger; +import javax.imageio.ImageIO; +import org.apache.commons.lang3.StringUtils; + +/** + * 二维码生成类 + * + * @author haown + * @date 2023-01-31 + */ +public class QrCodeUtils { + + private static final String CHARSET = "UTF-8"; + private static final String FORMAT = "JPG"; + // 二维码尺寸 + private static final int QRCODE_SIZE = 300; + // LOGO宽度 + private static final int LOGO_WIDTH = 60; + // LOGO高度 + private static final int LOGO_HEIGHT = 60; + + /** + * 创建二维码图片 + * + * @param content 二维码内容 + * @param width 生成二维码长度 + * @param height 生成二维码高度 + * @param filePath 二维码存放路径 + */ + public static void createEwm(String content, Integer width, Integer height, String filePath) { + // 二维码生成 + QrConfig config = new QrConfig(width, height); + // 设置边距,既二维码和背景之间的边距 + config.setMargin(0); + QrCodeUtil.generate(content, config, FileUtil.file(filePath)); + } + + /** + * @return java.lang.Boolean + * @Author mengkuiliang + * @Description 生成二维码 + * @Date 2023-01-04 19:58 + * @Param [ ontent:二维码内容 + * logoPath:logo图片路径 + * savePath:二维码保存地址 + * fileName:二维码文件名 + * bCompress:是否压缩logo + * ] + **/ + public static Boolean generate(String content, String logoPath, String savePath, String fileName, boolean bCompress) { + try { + // 生成图片 + BufferedImage image = createImage(content, logoPath, bCompress); + // 创建输出目录 + mkdirs(savePath); + // 生成文件名 文件名为空时自动生成 + if (StringUtils.isBlank(fileName)) { + fileName = IdUtils.fastSimpleUUID() + "." + FORMAT.toLowerCase(); + } else { + fileName = fileName.substring(0, fileName.lastIndexOf(".") > 0 ? fileName.lastIndexOf(".") : fileName.length()) + "." + FORMAT.toLowerCase(); + } + // 写文件 + ImageIO.write(image, FORMAT, new File(savePath + "/" + fileName)); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + return true; + } + + /** + * @return java.lang.String + * @Author mengkuiliang + * @Description 解析二维码 + * @Date 2023-01-04 19:58 + * @Param [filePath:图片路径] + **/ + public static String analysis(String filePath) throws Exception { + if (StringUtils.isBlank(filePath)) { + return null; + } + BufferedImage image; + image = ImageIO.read(new File(filePath)); + if (image == null) { + return null; + } + BufferedImageLuminanceSource source = new BufferedImageLuminanceSource(image); + BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source)); + Hashtable hints = new Hashtable(); + hints.put(DecodeHintType.CHARACTER_SET, CHARSET); + Result result = new MultiFormatReader().decode(bitmap, hints); + return result.getText(); + } + + /** + * 生成图片 + */ + private static BufferedImage createImage(String content, String logoPath, boolean bCompress) throws Exception { + Hashtable hints = new Hashtable(); + hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); + hints.put(EncodeHintType.CHARACTER_SET, CHARSET); + hints.put(EncodeHintType.MARGIN, 1); + BitMatrix bitMatrix = new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, QRCODE_SIZE, QRCODE_SIZE, hints); + int width = bitMatrix.getWidth(); + int height = bitMatrix.getHeight(); + BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + for (int x = 0; x < width; x++) { + for (int y = 0; y < height; y++) { + image.setRGB(x, y, bitMatrix.get(x, y) ? 0xFF000000 : 0xFFFFFFFF); + } + } + // 插入logo + if (!StringUtils.isBlank(logoPath)) { + insertLogo(image, logoPath, bCompress); + } + return image; + } + + /*** + * @Author mengkuiliang + * @Description 插入LOGO + * @Date 2023-01-04 19:58 + * @Param [source:源图片, logoPath:logo文件地址, bCompress:是否压缩] + * @return void + **/ + private static void insertLogo(BufferedImage source, String logoPath, boolean bCompress) throws Exception { + if (!StringUtils.isBlank(logoPath)) { + File file = new File(logoPath); + if (file.exists()) { + Image src = ImageIO.read(file); + int width = src.getWidth(null); + int height = src.getHeight(null); + // 压缩LOGO + if (bCompress) { + if (width > LOGO_WIDTH) { + width = LOGO_WIDTH; + } + if (height > LOGO_HEIGHT) { + height = LOGO_HEIGHT; + } + Image image = src.getScaledInstance(width, height, Image.SCALE_SMOOTH); + BufferedImage tag = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + Graphics g = tag.getGraphics(); + g.drawImage(image, 0, 0, null); // 绘制缩小后的图 + g.dispose(); + src = image; + } + // 生成LOGO + Graphics2D graph = source.createGraphics(); + int x = (QRCODE_SIZE - width) / 2; + int y = (QRCODE_SIZE - height) / 2; + graph.drawImage(src, x, y, width, height, null); + Shape shape = new RoundRectangle2D.Float(x, y, width, width, 6, 6); + graph.setStroke(new BasicStroke(3f)); + graph.draw(shape); + graph.dispose(); + } + } + } + + public static void createTxm(String content, String filePath, String fileName) { + // 条形码生成 + BarcodeFormat barcodeFormat = BarcodeFormat.CODE_128; + AtomicInteger codeWidth = new AtomicInteger(3 + // start guard + (7 * 6) + // left bars + 5 + // middle guard + (7 * 6) + // right bars + 3); // end guard + codeWidth.set(Math.max(codeWidth.get(), 180)); + try { + BufferedImage txmImg = QrCodeUtil.generate(content, barcodeFormat, codeWidth.get(), 50); + + File imgFilePath = new File(filePath + fileName); + if (!imgFilePath.exists()) { + imgFilePath.getParentFile().mkdir(); + imgFilePath.createNewFile(); + } + + File outputfile = new File(filePath + fileName); + ImageIO.write(txmImg, "png", outputfile); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * 当文件夹不存在时,自动创建多层目录 + */ + public static void mkdirs(String path) { + File file = new File(path); + if (!file.exists() && !file.isDirectory()) { + file.mkdirs(); + } + } +} diff --git a/xinelu-common/src/main/java/com/xinelu/common/utils/file/FileUtils.java b/xinelu-common/src/main/java/com/xinelu/common/utils/file/FileUtils.java index e9f5dc9..aac2210 100644 --- a/xinelu-common/src/main/java/com/xinelu/common/utils/file/FileUtils.java +++ b/xinelu-common/src/main/java/com/xinelu/common/utils/file/FileUtils.java @@ -6,6 +6,7 @@ import com.xinelu.common.exception.ServiceException; import com.xinelu.common.utils.DateUtils; import com.xinelu.common.utils.StringUtils; import com.xinelu.common.utils.uuid.IdUtils; +import java.util.Base64; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.compress.utils.Lists; import org.apache.commons.io.IOUtils; @@ -356,6 +357,25 @@ public class FileUtils { return ajax; } + //将图片转换成Base64格式的数据集 + public static String PicToBase64(String filePath) { + Base64.Encoder encoder = Base64.getEncoder(); + byte[] ImgContainer = null; + FileInputStream fileInputStream = null; + try { + fileInputStream = new FileInputStream(filePath); + ImgContainer = new byte[fileInputStream.available()]; + fileInputStream.read(ImgContainer); + String Base64ImgData = encoder.encodeToString(ImgContainer); + fileInputStream.close(); + return "data:image/png" + ";base64," + Base64ImgData; + } catch (FileNotFoundException e) { + return "找不到指定文件!"; + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } /** * 视频上传接口 * diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/appletscreeningrecord/AppletScreeningRecordController.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/appletscreeningrecord/AppletScreeningRecordController.java index f6b98f6..f6ee977 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/appletscreeningrecord/AppletScreeningRecordController.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/appletscreeningrecord/AppletScreeningRecordController.java @@ -8,6 +8,7 @@ import com.xinelu.common.core.domain.R; import com.xinelu.common.core.page.TableDataInfo; import com.xinelu.common.utils.DateUtils; import com.xinelu.common.utils.StringUtils; +import com.xinelu.common.utils.file.FileUtils; import com.xinelu.manage.dto.screeningrecord.ScreeningApplyDTO; import com.xinelu.manage.dto.screeningrecord.ScreeningRecordDTO; import com.xinelu.manage.service.patientinfo.IPatientInfoService; @@ -15,6 +16,7 @@ import com.xinelu.manage.service.screeningrecord.IScreeningRecordService; import com.xinelu.manage.vo.screeningrecord.ScreeningRecordVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import java.io.File; import java.util.List; import javax.annotation.Resource; import org.springframework.web.bind.annotation.GetMapping; @@ -59,9 +61,12 @@ public class AppletScreeningRecordController extends BaseController { List list = screeningRecordService.list(query); // 二维码返回 list.forEach(record -> { - StringUtils.isNotEmpty(record.getApplyBarcode()); - // TODO 居民申请条码 - //record.setApplyBarcode(patientService.getPicToBase64(record.getApplyBarcode())); + if (StringUtils.isNotEmpty(record.getApplyBarcode())) { + File file = new File(record.getApplyBarcode()); + if (file.exists() && file.isFile()) { + record.setApplyBarcode(FileUtils.PicToBase64(record.getApplyBarcode())); + } + } }); return getDataTable(list); } @@ -97,11 +102,12 @@ public class AppletScreeningRecordController extends BaseController { public R detail(@PathVariable String screeningId) { ScreeningRecordVo screeningRecordVo = screeningRecordService.detail(screeningId); if (screeningRecordVo != null) { - // TODO 设置文件类型 - //File fileInfo = sysFileService.getFile(screeningRecordVo.getAttachment()); - //if (fileInfo != null) { - // screeningRecordVo.setFileType(fileInfo.getSuffix()); - //} + File file = new File(screeningRecordVo.getAttachment()); + if (file.exists() && file.isFile()) { + String fileName = file.getName(); + screeningRecordVo.setFileType(fileName.substring(fileName.lastIndexOf(".") + 1)); + } + if (!StringUtils.contains(screeningRecordVo.getProjectName(), ScreeningProjectConstants.ALZHEIMER)) { screeningRecordService.getRecordDetail(screeningRecordVo); } diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/screeningrecord/impl/ScreeningRecordServiceImpl.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/screeningrecord/impl/ScreeningRecordServiceImpl.java index 88e5817..5b2cb40 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/screeningrecord/impl/ScreeningRecordServiceImpl.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/screeningrecord/impl/ScreeningRecordServiceImpl.java @@ -1,14 +1,16 @@ package com.xinelu.manage.service.screeningrecord.impl; import com.alibaba.fastjson2.JSONObject; +import com.xinelu.common.config.XinELuConfig; import com.xinelu.common.constant.ScreeningProjectConstants; import com.xinelu.common.core.domain.SelectVo; import com.xinelu.common.core.domain.TimelineVo; import com.xinelu.common.core.domain.model.LoginUser; -import com.xinelu.common.enums.UploadType; import com.xinelu.common.utils.DateUtils; +import com.xinelu.common.utils.QrCodeUtils; import com.xinelu.common.utils.SecurityUtils; import com.xinelu.common.utils.bean.BeanUtils; +import com.xinelu.common.utils.file.FileUtils; import com.xinelu.common.utils.uuid.IdUtils; import com.xinelu.manage.domain.hospitalinfo.HospitalInfo; import com.xinelu.manage.domain.hospitalpersoninfo.HospitalPersonInfo; @@ -25,6 +27,7 @@ import com.xinelu.manage.service.patientinfo.IPatientInfoService; import com.xinelu.manage.service.screeningrecord.IScreeningRecordService; import com.xinelu.manage.vo.patientinfo.PatientInfoVO; import com.xinelu.manage.vo.screeningrecord.ScreeningRecordVo; +import java.io.File; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; @@ -53,6 +56,8 @@ public class ScreeningRecordServiceImpl implements IScreeningRecordService { private HospitalPersonInfoMapper hospitalPersonInfoMapper; @Resource private HospitalInfoMapper hospitalInfoMapper; + @Resource + private XinELuConfig xinELuConfig; @Override public List screeningList(ScreeningRecordDTO query) throws Exception { @@ -123,7 +128,7 @@ public class ScreeningRecordServiceImpl implements IScreeningRecordService { recordBody.setApplyCode(generateCode()); recordBody.setScreeningType("1"); // 预约条码 - recordBody.setApplyBarcode(generateBarcode(UploadType.SCREENING_BARCODE.getCode(), recordBody.getScreeningId(), recordBody.getApplyCode())); + recordBody.setApplyBarcode(generateBarcode(xinELuConfig.getApplyBarcodePitureUrl(), recordBody.getScreeningId(), recordBody.getApplyCode())); int flag = screeningRecordMapper.insert(recordBody); if(flag > 0) { // 推送消息 @@ -216,7 +221,7 @@ public class ScreeningRecordServiceImpl implements IScreeningRecordService { screeningRecord.setScreeningStatus("3"); // 生成登记条码 screeningRecord.setRegistrationCode(generateCode()); - screeningRecord.setRegistrationBarcode(generateBarcode(UploadType.REGISTRATION_BARCODE.getCode(), screeningRecord.getScreeningId(), screeningRecord.getRegistrationCode())); + screeningRecord.setRegistrationBarcode(generateBarcode(xinELuConfig.getRegisterBarcodePitureUrl(), screeningRecord.getScreeningId(), screeningRecord.getRegistrationCode())); int flag = screeningRecordMapper.update(screeningRecord); return screeningRecord.getRegistrationCode(); @@ -280,12 +285,11 @@ public class ScreeningRecordServiceImpl implements IScreeningRecordService { if(recordVo == null) { return null; } - // TODO 获取文件类型 - //File fileInfo = sysFileService.getFile(recordVo.getAttachment()); - //if (fileInfo != null) { - // recordVo.setFileType(fileInfo.getSuffix()); - //} - + File file = new File(recordVo.getAttachment()); + if (file.exists() && file.isFile()) { + String fileName = file.getName(); + recordVo.setFileType(fileName.substring(fileName.lastIndexOf(".") + 1)); + } if (!StringUtils.contains(recordVo.getProjectName(), ScreeningProjectConstants.ALZHEIMER)) { getRecordDetail(recordVo); } @@ -384,9 +388,8 @@ public class ScreeningRecordServiceImpl implements IScreeningRecordService { List projectName = screeningRecordVoList.stream().map(ScreeningRecordVo::getProjectName).collect(Collectors.toList()); retObject.fluentPut("projectName", String.join("," , projectName)) .fluentPut("doctorName", screeningRecordVoList.get(0).getDoctorName()); - // TODO 居民信息 - //PatientInfoVO patientInfoVO = patientService.selectPatientInfoById(screeningRecordVoList.get(0).getPatientId()); - //retObject.fluentPut("name", patientInfoVO.getPatientName()); + PatientInfoVO patientInfoVO = patientService.selectPatientInfoById(screeningRecordVoList.get(0).getPatientId()); + retObject.fluentPut("name", patientInfoVO.getPatientName()); } // 根据评估记录业务主键查询评估记录 @@ -428,19 +431,18 @@ public class ScreeningRecordServiceImpl implements IScreeningRecordService { /** 获取图片附件转base64 */ private void setAttachment(ScreeningRecordVo record) { - // TODO 文件转换为base64 - //if(!StringUtils.isBlank(record.getAttachment())) { - // File fileInfo = sysFileService.getFile(record.getAttachment()); - // if(fileInfo != null) { - // record.setAttachment(FileUtils.PicToBase64(fileInfo.getFilePath())); - // } - //} - //if(!StringUtils.isBlank(record.getAttachmentTwo())) { - // File fileInfo = sysFileService.getFile(record.getAttachmentTwo()); - // if(fileInfo != null) { - // record.setAttachmentTwo(FileUtils.PicToBase64(fileInfo.getFilePath())); - // } - //} + if(!StringUtils.isBlank(record.getAttachment())) { + File file = new File(record.getAttachment()); + if(file.exists()) { + record.setAttachment(FileUtils.PicToBase64(record.getAttachment())); + } + } + if(!StringUtils.isBlank(record.getAttachmentTwo())) { + File file = new File(record.getAttachmentTwo()); + if (file.exists()) { + record.setAttachmentTwo(FileUtils.PicToBase64(record.getAttachmentTwo())); + } + } } /** @@ -453,25 +455,15 @@ public class ScreeningRecordServiceImpl implements IScreeningRecordService { /** * 生成条码 - * @param code + * @param url * @param screeningId * @param content */ - private String generateBarcode(String code, String screeningId, String content) { - // TODO 文件保存 - //String fileDir = UploadType.getUploadType(code).getPath() + DateUtils.formatDate(new Date(), "yyyy-MM-dd") + "/"; - //String fileName = screeningId + ".jpg"; - //QrCodeUtils.createTxm(content, fileDir, fileName); - //File sysFile = new File(); - //sysFile.setFileId(IdUtils.fastSimpleUUID()); - //sysFile.setOriginalFilename(screeningId + ".jpg"); - //sysFile.setFilePath(fileDir); - //sysFile.setContentType("image/jpeg"); - //sysFile.setSuffix("jpg"); - //sysFile.setUploadType(code); - //fileService.insert(sysFile); - //return sysFile.getFileId(); - return null; + private String generateBarcode(String url, String screeningId, String content) { + String uploadPathUrl = XinELuConfig.getProfile() + url + "/"; + String fileName = screeningId + ".jpg"; + QrCodeUtils.createTxm(content, uploadPathUrl, fileName); + return uploadPathUrl + "/" + fileName; } } diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/vo/screeningrecord/ScreeningRecordVo.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/vo/screeningrecord/ScreeningRecordVo.java index 879aa21..0139d9b 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/vo/screeningrecord/ScreeningRecordVo.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/vo/screeningrecord/ScreeningRecordVo.java @@ -32,7 +32,7 @@ public class ScreeningRecordVo { * 居民业务主键 */ @ApiModelProperty("居民业务主键") - private String patientId; + private Long patientId; /** * 居民姓名 @@ -97,19 +97,19 @@ public class ScreeningRecordVo { * 医院编号 */ @ApiModelProperty("医院编号") - private String deptId; + private Long hospitalId; /** * 医院名称 */ @ApiModelProperty("医院名称") - private String deptName; + private String hospitalName; /** * 医生编号 */ @ApiModelProperty("医生编号") - private String doctorId; + private Long doctorId; /** * 医生名称 diff --git a/xinelu-nurse-manage/src/main/resources/mapper/manage/screeningrecord/ScreeningRecordMapper.xml b/xinelu-nurse-manage/src/main/resources/mapper/manage/screeningrecord/ScreeningRecordMapper.xml index b306b8d..111a3cf 100644 --- a/xinelu-nurse-manage/src/main/resources/mapper/manage/screeningrecord/ScreeningRecordMapper.xml +++ b/xinelu-nurse-manage/src/main/resources/mapper/manage/screeningrecord/ScreeningRecordMapper.xml @@ -11,7 +11,7 @@ - + @@ -36,7 +36,7 @@ id,screening_id,patient_id,screening_status, - disease,hospital_id,IFNULL(hospita_name, '') as hospita_name, + disease,hospital_id,IFNULL(hospital_name, '') as hospital_name, project_id, project_name, apply_start_time,apply_end_time, screening_date, content,diagnostic_result,attachment,attachment_two, @@ -46,7 +46,7 @@ screening_id,patient_id,screening_status, - disease,hospital_id,hospita_name, + disease,hospital_id,hospital_name, project_id, project_name, apply_start_time, apply_end_time, screening_date, content,diagnostic_result,attachment,attachment_two, @@ -78,7 +78,7 @@ hospital_id = #{hospitalId}, - hospita_name = #{hospitalName}, + hospital_name = #{hospitalName}, project_id = #{projectId}, @@ -183,7 +183,7 @@ and hospital_id = #{hospitalId} - and hospita_name = #{hospitalName} + and hospital_name = #{hospitalName} and project_id = #{projectId} @@ -216,7 +216,7 @@ select ssr.id,ssr.screening_id,ssr.patient_id,ssr.screening_status, - ssr.disease,ssr.hospital_id,IFNULL(ssr.hospita_name, '') as hospita_name,ssr.project_id, ssr.project_name, + ssr.disease,ssr.hospital_id,IFNULL(ssr.hospital_name, '') as hospital_name,ssr.project_id, ssr.project_name, ssr.apply_start_time,ssr.apply_end_time, ssr.screening_date,ssr.content,ssr.diagnostic_result,ssr.attachment,ssr.attachment_two, ssr.doctor_id,IFNULL(ssr.doctor_name,'') as doctor_name,ssr.apply_barcode,ssr.registration_date,ssr.screening_type,ssr.push_date,ssr.assess_record_id, ssr.remark,sf.suffix as fileType