diff --git a/xinelu-admin/src/main/resources/application.yml b/xinelu-admin/src/main/resources/application.yml index 08c9f45..b226acc 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: @@ -219,7 +229,7 @@ swagger: # 是否开启swagger enabled: true # 请求前缀 - pathMapping: /dev-api + pathMapping: swagger-ui: base-url: com.xinelu 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/core/domain/entity/SysUser.java b/xinelu-common/src/main/java/com/xinelu/common/core/domain/entity/SysUser.java index 6619c30..277d2ce 100644 --- a/xinelu-common/src/main/java/com/xinelu/common/core/domain/entity/SysUser.java +++ b/xinelu-common/src/main/java/com/xinelu/common/core/domain/entity/SysUser.java @@ -113,6 +113,11 @@ public class SysUser extends BaseEntity { */ private String stationPersonPassword; + /** + * 医生主键 + */ + private Long hospitalPersonId; + /** * 部门对象 */ @@ -334,7 +339,15 @@ public class SysUser extends BaseEntity { this.roleId = roleId; } - @Override + public Long getHospitalPersonId() { + return hospitalPersonId; + } + + public void setHospitalPersonId(Long hospitalPersonId) { + this.hospitalPersonId = hospitalPersonId; + } + + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) .append("userId", getUserId()) 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/appletSchedulePlan/AppletSchedulePlanController.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/appletSchedulePlan/AppletSchedulePlanController.java deleted file mode 100644 index bfd2b25..0000000 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/appletSchedulePlan/AppletSchedulePlanController.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.xinelu.applet.controller.appletSchedulePlan; - -import io.swagger.annotations.Api; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - * @description: 小程序医生排班计划控制器 - * @author: haown - * @create: 2023-09-22 10:28 - **/ -@Api(tags = "小程序医生排班计划控制器") -@RestController -@RequestMapping("/nurseApplet/schedule/plan") -public class AppletSchedulePlanController { -} diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/applethospitalinfo/AppletHospitalInfoController.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/applethospitalinfo/AppletHospitalInfoController.java new file mode 100644 index 0000000..676f190 --- /dev/null +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/applethospitalinfo/AppletHospitalInfoController.java @@ -0,0 +1,36 @@ +package com.xinelu.applet.controller.applethospitalinfo; + +import com.xinelu.common.core.controller.BaseController; +import com.xinelu.common.core.domain.AjaxResult; +import com.xinelu.manage.domain.hospitalinfo.HospitalInfo; +import com.xinelu.manage.service.hospitalinfo.IHospitalInfoService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import javax.annotation.Resource; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @description: 小程序医院信息管理控制器 + * @author: haown + * @create: 2023-10-09 11:06 + **/ +@Api(tags = "小程序医院信息管理控制器") +@RestController +@RequestMapping("/nurseApplet/hospital") +public class AppletHospitalInfoController extends BaseController { + @Resource + private IHospitalInfoService hospitalInfoService; + + /** + * 查询医院信息管理列表 + */ + @ApiOperation("查询医院信息管理列表") + @GetMapping("/getList") + public AjaxResult getList(HospitalInfo hospitalInfo) { + List list = hospitalInfoService.selectHospitalInfoList(hospitalInfo); + return AjaxResult.success(list); + } +} diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/appletscheduleplandetail/AppletSchedulePlanController.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/appletscheduleplandetail/AppletSchedulePlanController.java new file mode 100644 index 0000000..6454333 --- /dev/null +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/appletscheduleplandetail/AppletSchedulePlanController.java @@ -0,0 +1,35 @@ +package com.xinelu.applet.controller.appletscheduleplandetail; + +import com.xinelu.common.core.controller.BaseController; +import com.xinelu.common.core.domain.R; +import com.xinelu.manage.domain.scheduleplandetail.SchedulePlanDetail; +import com.xinelu.manage.service.scheduleplandetail.ISchedulePlanDetailService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import javax.annotation.Resource; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @description: 小程序医生排班计划控制器 + * @author: haown + * @create: 2023-09-22 10:28 + **/ +@Api(tags = "小程序医生排班计划控制器") +@RestController +@RequestMapping("/nurseApplet/schedule/plandetail") +public class AppletSchedulePlanController extends BaseController { + + @Resource + private ISchedulePlanDetailService planDetailService; + + @ApiOperation("通过排班计划查询明细") + @GetMapping("/getList") + public R> getList(SchedulePlanDetail planDetail) { + List list = planDetailService.getList(planDetail); + return R.ok(list); + } + +} 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/controller/patientinfo/PatientArchivesInfoController.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/patientinfo/PatientArchivesInfoController.java new file mode 100644 index 0000000..8f11448 --- /dev/null +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/patientinfo/PatientArchivesInfoController.java @@ -0,0 +1,130 @@ +package com.xinelu.manage.controller.patientinfo; + +import com.xinelu.common.annotation.Log; +import com.xinelu.common.core.controller.BaseController; +import com.xinelu.common.core.domain.AjaxResult; +import com.xinelu.common.core.page.TableDataInfo; +import com.xinelu.common.enums.BusinessType; +import com.xinelu.common.utils.poi.ExcelUtil; +import com.xinelu.manage.domain.patientinfo.PatientInfo; +import com.xinelu.manage.dto.cancelpicture.CancelPictureDTO; +import com.xinelu.manage.service.patientinfo.IPatientInfoService; +import com.xinelu.manage.vo.patientinfo.PatientInfoVO; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Objects; + +/** + * 被护理人基本信息Controller + * + * @author xinyilu + * @date 2022-09-02 + */ +@RestController +@RequestMapping("/system/patientArchives") +public class PatientArchivesInfoController extends BaseController { + + @Resource + private IPatientInfoService patientInfoService; + + /** + * 查询被护理人基本信息列表 + */ + @PreAuthorize("@ss.hasPermi('system:patientArchives:list')") + @GetMapping("/list") + public TableDataInfo list(PatientInfoVO patientInfo) { + startPage(); + List list = patientInfoService.selectPatientInfoList(patientInfo); + return getDataTable(list); + } + + /** + * 导出被护理人基本信息列表 + */ + @PreAuthorize("@ss.hasPermi('system:patientArchives:export')") + @Log(title = "被护理人基本信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, PatientInfoVO patientInfo) { + List list = patientInfoService.selectPatientInfoList(patientInfo); + ExcelUtil util = new ExcelUtil<>(PatientInfoVO.class); + util.exportExcel(response, list, "被护理人基本信息数据"); + } + + /** + * 获取被护理人基本信息详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:patientArchives:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return AjaxResult.success(patientInfoService.selectPatientInfoById(id)); + } + + /** + * 新增被护理人基本信息 + */ + @PreAuthorize("@ss.hasPermi('system:patientArchives:add')") + @Log(title = "被护理人基本信息", businessType = BusinessType.INSERT) + @PostMapping("/add") + public AjaxResult add(@RequestBody PatientInfo patientInfo) { + return toAjax(patientInfoService.insertPatientInfo(patientInfo)); + } + + /** + * 修改被护理人基本信息 + */ + @PreAuthorize("@ss.hasPermi('system:patientArchives:edit')") + @Log(title = "被护理人基本信息", businessType = BusinessType.UPDATE) + @PostMapping(value = "edit") + public AjaxResult edit(@RequestBody PatientInfo patientInfo) { + return patientInfoService.updatePatientInfo(patientInfo); + } + + /** + * 删除被护理人基本信息 + */ + @PreAuthorize("@ss.hasPermi('system:patientArchives:remove')") + @Log(title = "被护理人基本信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(patientInfoService.deletePatientInfoByIds(ids)); + } + + /** + * 删除旧图片 + * + * @param cancelPictureDTO 路径参数 + * @return 结果 + */ + @PostMapping("/updatePicture") + public AjaxResult updatePicture(@RequestBody CancelPictureDTO cancelPictureDTO) { + if (CollectionUtils.isEmpty(cancelPictureDTO.getPictureUrlList())) { + return AjaxResult.success(); + } + return patientInfoService.updatePicture(cancelPictureDTO.getPictureUrlList()); + } + + /** + * PC端重置密码 + * + * @param id 会员id + * @param password 密码 + * @return AjaxResult + */ + @PostMapping("/updatePassword") + public AjaxResult updatePassword(Long id, String password) { + if (Objects.isNull(id)) { + return AjaxResult.error("用户信息有误,请联系管理员!"); + } + if (StringUtils.isBlank(password)) { + return AjaxResult.error("请输入密码!"); + } + return patientInfoService.updatePasswordById(id, password); + } +} + diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/screeningproject/ScreeningProjectController.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/screeningproject/ScreeningProjectController.java index 5f873f2..281fe82 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/screeningproject/ScreeningProjectController.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/screeningproject/ScreeningProjectController.java @@ -3,8 +3,11 @@ package com.xinelu.manage.controller.screeningproject; import com.xinelu.common.core.controller.BaseController; import com.xinelu.common.core.domain.R; import com.xinelu.common.core.page.TableDataInfo; +import com.xinelu.common.utils.SecurityUtils; import com.xinelu.common.utils.uuid.IdUtils; +import com.xinelu.manage.domain.hospitalpersoninfo.HospitalPersonInfo; import com.xinelu.manage.domain.screeningproject.ScreeningProject; +import com.xinelu.manage.service.hospitalpersoninfo.IHospitalPersonInfoService; import com.xinelu.manage.service.screeningproject.IScreeningProjectService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -35,6 +38,9 @@ public class ScreeningProjectController extends BaseController { @Resource private IScreeningProjectService projectService; + @Resource + private IHospitalPersonInfoService personInfoService; + @ApiOperation("服务项目分页列表") @GetMapping("list") public TableDataInfo list(ScreeningProject project) { @@ -53,7 +59,11 @@ public class ScreeningProjectController extends BaseController { @ApiOperation("新增服务项目") @PostMapping("add") public R add(@RequestBody ScreeningProject project) { - if (projectService.checkSameProjectName(project.getProjectName(), project.getHospitalId(), null)) { + // 根据当前登录用户获取医生主键 + HospitalPersonInfo hospitalPersonInfo = personInfoService.selectHospitalPersonInfoById(SecurityUtils.getLoginUser().getUser().getHospitalPersonId()); + project.setHospitalId(hospitalPersonInfo.getHospitalId()); + project.setHospitalName(hospitalPersonInfo.getPersonName()); + if (projectService.checkSameProjectName(project.getProjectName(), project.getHospitalId(), null)) { return R.fail("【" + project.getHospitalName() + "】已存在服务项目【" + project.getProjectName() + "】,不能重复添加"); } //价格校验 @@ -72,7 +82,7 @@ public class ScreeningProjectController extends BaseController { if (StringUtils.isBlank(project.getStatus())) { project.setStatus("1"); } - project.setDiscountPrice(project.getPrice().multiply(new BigDecimal(project.getDiscount())).multiply(new BigDecimal("0.1")).setScale(2, BigDecimal.ROUND_HALF_UP)); + project.setDiscountPrice(project.getPrice().multiply(new BigDecimal(project.getDiscount())).multiply(new BigDecimal("0.1"))); project.setProjectId(IdUtils.fastSimpleUUID()); project.setCreateBy(getUsername()); project.setCreateTime(new Date()); @@ -102,7 +112,7 @@ public class ScreeningProjectController extends BaseController { if (StringUtils.isBlank(project.getStatus())) { project.setStatus("1"); } - project.setDiscountPrice(project.getPrice().multiply(new BigDecimal(project.getDiscount())).multiply(new BigDecimal("0.1")).setScale(2, BigDecimal.ROUND_HALF_UP)); + project.setDiscountPrice(project.getPrice().multiply(new BigDecimal(project.getDiscount())).multiply(new BigDecimal("0.1"))); project.setUpdateBy(getUsername()); project.setUpdateTime(new Date()); projectService.update(project); diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/screeningrecord/ScreeningRecordController.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/screeningrecord/ScreeningRecordController.java index 9f557d8..b2998e3 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/screeningrecord/ScreeningRecordController.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/screeningrecord/ScreeningRecordController.java @@ -44,7 +44,11 @@ public class ScreeningRecordController extends BaseController { @ApiOperation(value = "居民预约筛查列表") public TableDataInfo screeningList(ScreeningRecordDTO query) { startPage(); - return getDataTable(screeningRecordService.screeningList(query)); + try { + return getDataTable(screeningRecordService.screeningList(query)); + } catch (Exception e) { + throw new RuntimeException(e); + } } @GetMapping("/list") diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/hospitalpersoninfo/HospitalPersonInfo.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/hospitalpersoninfo/HospitalPersonInfo.java index 4464765..10058c9 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/hospitalpersoninfo/HospitalPersonInfo.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/hospitalpersoninfo/HospitalPersonInfo.java @@ -128,6 +128,16 @@ public class HospitalPersonInfo extends BaseDomain implements Serializable { */ private String personPictureUrl; + /** + * 科室人员账号 + */ + private String personAccount; + + /** + * 科室人员密码 + */ + private String personPassword; + @Override public String toString() { diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/screeningproject/ScreeningProject.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/screeningproject/ScreeningProject.java index b905545..4aa2fe8 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/screeningproject/ScreeningProject.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/screeningproject/ScreeningProject.java @@ -60,7 +60,7 @@ public class ScreeningProject extends BaseEntity { * 医院编号 */ @ApiModelProperty("医院编号") - private String hospitalId; + private Long hospitalId; /** * 医院名称 diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/screeningrecord/ScreeningRecord.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/screeningrecord/ScreeningRecord.java index d1e9a1f..f15bc77 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/screeningrecord/ScreeningRecord.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/domain/screeningrecord/ScreeningRecord.java @@ -49,12 +49,12 @@ public class ScreeningRecord implements Serializable { /** * 医院编号 */ - private String deptId; + private Long hospitalId; /** * 医院名称 */ - private String deptName; + private String hospitalName; /** * 预约项目业务主键 @@ -108,7 +108,7 @@ public class ScreeningRecord implements Serializable { * 医生编号 */ @ApiModelProperty("医生编号") - private String doctorId; + private Long doctorId; /** * 医生名称 diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/cancelpicture/CancelPictureDTO.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/cancelpicture/CancelPictureDTO.java new file mode 100644 index 0000000..9803cfe --- /dev/null +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/cancelpicture/CancelPictureDTO.java @@ -0,0 +1,21 @@ +package com.xinelu.manage.dto.cancelpicture; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 取消图片参数实体类 + * @Author 纪寒 + * @Date 2022-11-09 14:26:28 + * @Version 1.0 + */ +@Data +public class CancelPictureDTO implements Serializable { + private static final long serialVersionUID = 3470954431511861546L; + /** + * 图片集合 + */ + private List pictureUrlList; +} \ No newline at end of file diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/screeningrecord/ScreeningApplyDTO.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/screeningrecord/ScreeningApplyDTO.java index 2da296b..96a4cbe 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/screeningrecord/ScreeningApplyDTO.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/screeningrecord/ScreeningApplyDTO.java @@ -43,10 +43,10 @@ public class ScreeningApplyDTO implements Serializable { private Date applyEndTime; @ApiModelProperty(value = "预约机构业务主键", required = true) - private String deptId; + private Long hospitalId; @ApiModelProperty(value = "预约机构名称", required = true) - private String deptName; + private String hospitalName; @ApiModelProperty(value = "预约项目业务主键", required = true) private String projectId; diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/screeningrecord/ScreeningRecordApplyDTO.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/screeningrecord/ScreeningRecordApplyDTO.java index 9cd1d32..863c4ab 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/screeningrecord/ScreeningRecordApplyDTO.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/screeningrecord/ScreeningRecordApplyDTO.java @@ -52,13 +52,13 @@ public class ScreeningRecordApplyDTO implements Serializable { * 医院编号 */ @ApiModelProperty("医院编号") - private String deptId; + private Long hospitalId; /** * 医院名称 */ @ApiModelProperty("医院名称") - private String deptName; + private String hospitalName; @ApiModelProperty("项目业务主键") private String projectId; @@ -87,7 +87,7 @@ public class ScreeningRecordApplyDTO implements Serializable { * 医生编号 */ @ApiModelProperty("医生编号") - private String doctorId; + private Long doctorId; /** * 医生名称 diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/screeningrecord/ScreeningRecordDTO.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/screeningrecord/ScreeningRecordDTO.java index 0bb08eb..e863494 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/screeningrecord/ScreeningRecordDTO.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/dto/screeningrecord/ScreeningRecordDTO.java @@ -52,13 +52,13 @@ public class ScreeningRecordDTO extends BaseEntity { * 医院编号 */ @ApiModelProperty("医院编号") - private String deptId; + private Long hospitalId; /** * 医院名称 */ @ApiModelProperty("医院名称") - private String deptName; + private String hospitalName; @ApiModelProperty("预约项目业务主键") private String projectId; diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/mapper/screeningproject/ScreeningProjectMapper.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/mapper/screeningproject/ScreeningProjectMapper.java index 10f655f..d751d01 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/mapper/screeningproject/ScreeningProjectMapper.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/mapper/screeningproject/ScreeningProjectMapper.java @@ -26,6 +26,6 @@ public interface ScreeningProjectMapper { int updateByPrimaryKey(ScreeningProject record); - Integer checkSameName(@Param("projectName") String projectName, @Param("hospitalId") String hospitalId, @Param("projectId") String projectId); + Integer checkSameName(@Param("projectName") String projectName, @Param("deptId") Long deptId, @Param("projectId") String projectId); } diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/hospitalpersoninfo/impl/HospitalPersonInfoServiceImpl.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/hospitalpersoninfo/impl/HospitalPersonInfoServiceImpl.java index 61937c4..c55a4fe 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/hospitalpersoninfo/impl/HospitalPersonInfoServiceImpl.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/hospitalpersoninfo/impl/HospitalPersonInfoServiceImpl.java @@ -3,6 +3,7 @@ package com.xinelu.manage.service.hospitalpersoninfo.impl; import com.xinelu.common.config.XinELuConfig; import com.xinelu.common.constant.Constants; import com.xinelu.common.core.domain.AjaxResult; +import com.xinelu.common.core.domain.entity.SysUser; import com.xinelu.common.exception.ServiceException; import com.xinelu.common.utils.SecurityUtils; import com.xinelu.common.utils.codes.GenerateSystemCodeUtil; @@ -14,6 +15,7 @@ import com.xinelu.manage.mapper.hospitalpersoncertificate.HospitalPersonCertific import com.xinelu.manage.mapper.hospitalpersoninfo.HospitalPersonInfoMapper; import com.xinelu.manage.service.hospitalpersoninfo.IHospitalPersonInfoService; import com.xinelu.manage.vo.hospitalpersoninfo.HospitalPersonInfoVO; +import com.xinelu.system.mapper.SysUserMapper; import java.io.File; import java.math.BigDecimal; import java.time.LocalDateTime; @@ -48,6 +50,9 @@ public class HospitalPersonInfoServiceImpl implements IHospitalPersonInfoService @Resource private HospitalPersonCertificateMapper hospitalPersonCertificateMapper; + @Resource + private SysUserMapper userMapper; + /** * 查询健康咨询-科室人员信息 * @@ -126,6 +131,15 @@ public class HospitalPersonInfoServiceImpl implements IHospitalPersonInfoService throw new ServiceException("新增科室人员资质证书信息失败,请联系管理员!"); } } + // 保存到sys_user表 + SysUser sysUser = new SysUser(); + sysUser.setUserName(hospitalPersonInfo.getPersonAccount()); + sysUser.setPassword(SecurityUtils.encryptPassword(hospitalPersonInfo.getPersonPassword())); + sysUser.setNickName(hospitalPersonInfo.getPersonName()); + sysUser.setHospitalPersonId(hospitalPersonInfo.getId()); + sysUser.setStatus("0"); + sysUser.setDelFlag("0"); + userMapper.insertUser(sysUser); return AjaxResult.success(); } diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/screeningproject/IScreeningProjectService.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/screeningproject/IScreeningProjectService.java index 74f2491..67d0106 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/screeningproject/IScreeningProjectService.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/screeningproject/IScreeningProjectService.java @@ -27,5 +27,5 @@ public interface IScreeningProjectService { * @author gaoyu * @date 2022-11-23 10:20 */ - boolean checkSameProjectName(String projectName, String deptId, String projectId); + boolean checkSameProjectName(String projectName, Long deptId, String projectId); } diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/screeningproject/impl/ScreeningProjectServiceImpl.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/screeningproject/impl/ScreeningProjectServiceImpl.java index 9f8488c..7920898 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/screeningproject/impl/ScreeningProjectServiceImpl.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/screeningproject/impl/ScreeningProjectServiceImpl.java @@ -1,9 +1,13 @@ package com.xinelu.manage.service.screeningproject.impl; +import com.xinelu.common.utils.SecurityUtils; +import com.xinelu.manage.domain.hospitalinfo.HospitalInfo; +import com.xinelu.manage.domain.hospitalpersoninfo.HospitalPersonInfo; import com.xinelu.manage.domain.screeningproject.ScreeningProject; +import com.xinelu.manage.mapper.hospitalinfo.HospitalInfoMapper; +import com.xinelu.manage.mapper.hospitalpersoninfo.HospitalPersonInfoMapper; import com.xinelu.manage.mapper.screeningproject.ScreeningProjectMapper; import com.xinelu.manage.service.screeningproject.IScreeningProjectService; -import com.xinelu.system.mapper.SysDeptMapper; import java.util.List; import javax.annotation.Resource; import org.springframework.stereotype.Service; @@ -19,22 +23,36 @@ public class ScreeningProjectServiceImpl implements IScreeningProjectService { @Resource private ScreeningProjectMapper projectMapper; @Resource - private SysDeptMapper deptMapper; + private HospitalPersonInfoMapper hospitalPersonInfoMapper; + @Resource + private HospitalInfoMapper hospitalInfoMapper; @Override public List findList(ScreeningProject project) { return projectMapper.findList(project); } @Override public int insert(ScreeningProject project) { - // TODO 设置机构 - // project.setDeptName(deptMapper.selectDeptById(project.getDeptId()).getDeptName()); + HospitalPersonInfo hospitalPersonInfo = hospitalPersonInfoMapper.selectHospitalPersonInfoById(SecurityUtils.getLoginUser().getUser().getHospitalPersonId()); + if (hospitalPersonInfo != null) { + project.setHospitalId(hospitalPersonInfo.getHospitalId()); + HospitalInfo hospital = hospitalInfoMapper.selectHospitalInfoById(hospitalPersonInfo.getHospitalId()); + if (hospital != null) { + project.setHospitalName(hospital.getHospitalName()); + } + } return projectMapper.insertSelective(project); } @Override public int update(ScreeningProject project) { - // TODO 设置机构 - // project.setDeptName(deptMapper.selectDeptById(project.getDeptId()).getDeptName()); + HospitalPersonInfo hospitalPersonInfo = hospitalPersonInfoMapper.selectHospitalPersonInfoById(SecurityUtils.getLoginUser().getUser().getHospitalPersonId()); + if (hospitalPersonInfo != null) { + project.setHospitalId(hospitalPersonInfo.getHospitalId()); + HospitalInfo hospital = hospitalInfoMapper.selectHospitalInfoById(hospitalPersonInfo.getHospitalId()); + if (hospital != null) { + project.setHospitalName(hospital.getHospitalName()); + } + } return projectMapper.updateByPrimaryKey(project); } @@ -42,7 +60,7 @@ public class ScreeningProjectServiceImpl implements IScreeningProjectService { projectMapper.updateByPrimaryKeySelective(project); } - @Override public boolean checkSameProjectName(String projectName, String hospitalId, String projectId) { - return projectMapper.checkSameName(projectName, hospitalId, projectId) != null; + @Override public boolean checkSameProjectName(String projectName, Long deptId, String projectId) { + return projectMapper.checkSameName(projectName, deptId, projectId) != null; } } diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/screeningrecord/IScreeningRecordService.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/screeningrecord/IScreeningRecordService.java index 1af4a80..a5184ec 100644 --- a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/screeningrecord/IScreeningRecordService.java +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/service/screeningrecord/IScreeningRecordService.java @@ -16,7 +16,7 @@ import java.util.List; */ public interface IScreeningRecordService { - List screeningList(ScreeningRecordDTO query); + List screeningList(ScreeningRecordDTO query) throws Exception; /** * @Author mengkuiliang 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 9d47249..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,26 +1,33 @@ 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; import com.xinelu.manage.domain.screeningproject.ScreeningProject; import com.xinelu.manage.domain.screeningrecord.ScreeningRecord; import com.xinelu.manage.dto.screeningrecord.ScreeningApplyDTO; import com.xinelu.manage.dto.screeningrecord.ScreeningRecordApplyDTO; import com.xinelu.manage.dto.screeningrecord.ScreeningRecordDTO; import com.xinelu.manage.dto.screeningrecord.ScreeningRecordSaveDTO; +import com.xinelu.manage.mapper.hospitalinfo.HospitalInfoMapper; +import com.xinelu.manage.mapper.hospitalpersoninfo.HospitalPersonInfoMapper; import com.xinelu.manage.mapper.screeningrecord.ScreeningRecordMapper; 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; @@ -45,13 +52,21 @@ public class ScreeningRecordServiceImpl implements IScreeningRecordService { private ScreeningRecordMapper screeningRecordMapper; @Resource private IPatientInfoService patientService; - //@Resource - //private IScreeningProjectRecordService projectRecordService; + @Resource + private HospitalPersonInfoMapper hospitalPersonInfoMapper; + @Resource + private HospitalInfoMapper hospitalInfoMapper; + @Resource + private XinELuConfig xinELuConfig; @Override - public List screeningList(ScreeningRecordDTO query) { - // TODO 通过机构查询 - // query.setDeptId(SecurityUtils.getDeptId()); + public List screeningList(ScreeningRecordDTO query) throws Exception { + HospitalPersonInfo hospitalPersonInfo = hospitalPersonInfoMapper.selectHospitalPersonInfoById(SecurityUtils.getLoginUser().getUser().getHospitalPersonId()); + if (hospitalPersonInfo != null) { + query.setHospitalId(hospitalPersonInfo.getHospitalId()); + } else { + throw new Exception("该账号未关联医生"); + } return screeningRecordMapper.screeningList(query); } @@ -97,7 +112,7 @@ public class ScreeningRecordServiceImpl implements IScreeningRecordService { // 查询 同一机构的同一筛查项目在同一天是否有预约 ScreeningRecordDTO query = new ScreeningRecordDTO(); query.setPatientId(body.getPatientId()); - query.setDeptId(body.getDeptId()); + query.setHospitalId(body.getHospitalId()); query.setProjectId(body.getProjectId()); query.setApplyStartDate(body.getApplyStartTime()); query.setApplyEndDate(body.getApplyEndTime()); @@ -113,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) { // 推送消息 @@ -136,9 +151,17 @@ public class ScreeningRecordServiceImpl implements IScreeningRecordService { @Override public Integer update(ScreeningRecord body) { - // TODO 用户id - //body.setDoctorId(SecurityUtils.getUserId()); - body.setDeptName(SecurityUtils.getLoginUser().getUser().getDept().getDeptName()); + HospitalPersonInfo hospitalPersonInfo = hospitalPersonInfoMapper.selectHospitalPersonInfoById(SecurityUtils.getLoginUser().getUser().getHospitalPersonId()); + if (hospitalPersonInfo != null) { + body.setDoctorId(hospitalPersonInfo.getId()); + body.setDoctorName(hospitalPersonInfo.getPersonName()); + HospitalInfo hospitalInfo = hospitalInfoMapper.selectHospitalInfoById(hospitalPersonInfo.getHospitalId()); + if (hospitalInfo != null) { + body.setHospitalId(hospitalInfo.getId()); + body.setHospitalName(hospitalInfo.getHospitalName()); + } + } + body.setScreeningStatus("4"); body.setScreeningDate(new Date()); int flag = screeningRecordMapper.update(body); @@ -192,14 +215,13 @@ public class ScreeningRecordServiceImpl implements IScreeningRecordService { if (StringUtils.equals("3", screeningRecord.getScreeningStatus()) || StringUtils.equals("4", screeningRecord.getScreeningStatus())) { throw new Exception("该预约已登记,请勿重复登记。"); } - // TODO 当前登录用户id - //screeningRecord.setDoctorId(loginUser.getUserId()); + screeningRecord.setDoctorId(loginUser.getUser().getHospitalPersonId()); screeningRecord.setDoctorName(loginUser.getUser().getNickName()); screeningRecord.setRegistrationDate(new Date()); 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(); @@ -263,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); } @@ -320,12 +341,18 @@ public class ScreeningRecordServiceImpl implements IScreeningRecordService { screeningRecord.setProjectId(project.getProjectId()); screeningRecord.setProjectName(project.getProjectName()); screeningRecord.setPatientId(body.getPatientId()); - // TODO 用户id - //screeningRecord.setDoctorId(SecurityUtils.getUserId()); + screeningRecord.setDoctorId(SecurityUtils.getLoginUser().getUser().getHospitalPersonId()); screeningRecord.setDoctorName(SecurityUtils.getLoginUser().getUser().getNickName()); - // TODO 机构id - //screeningRecord.setDeptId(SecurityUtils.getDeptId()); - screeningRecord.setDeptName(SecurityUtils.getLoginUser().getUser().getDept().getDeptName()); + HospitalPersonInfo hospitalPersonInfo = hospitalPersonInfoMapper.selectHospitalPersonInfoById(SecurityUtils.getLoginUser().getUser().getHospitalPersonId()); + if (hospitalPersonInfo == null) { + throw new Exception("当前用户未绑定医生账号"); + } else { + HospitalInfo hospitalInfo = hospitalInfoMapper.selectHospitalInfoById(hospitalPersonInfo.getHospitalId()); + if (hospitalInfo != null) { + screeningRecord.setHospitalId(hospitalInfo.getId()); + screeningRecord.setHospitalName(hospitalInfo.getHospitalName()); + } + } screeningRecord.setScreeningStatus("1"); screeningRecord.setScreeningType("2"); screeningRecord.setApplyStartTime(new Date()); @@ -361,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()); } // 根据评估记录业务主键查询评估记录 @@ -405,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())); + } + } } /** @@ -430,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/screeningproject/ScreeningProjectMapper.xml b/xinelu-nurse-manage/src/main/resources/mapper/manage/screeningproject/ScreeningProjectMapper.xml index 37f097d..ea8b668 100644 --- a/xinelu-nurse-manage/src/main/resources/mapper/manage/screeningproject/ScreeningProjectMapper.xml +++ b/xinelu-nurse-manage/src/main/resources/mapper/manage/screeningproject/ScreeningProjectMapper.xml @@ -13,7 +13,7 @@ - + @@ -75,7 +75,7 @@ ,remark) values (#{id,jdbcType=BIGINT},#{projectId,jdbcType=VARCHAR},#{projectName,jdbcType=VARCHAR} ,#{projectType,jdbcType=CHAR},#{price,jdbcType=DECIMAL},#{discount,jdbcType=INTEGER} - ,#{discountPrice,jdbcType=VARCHAR},#{status,jdbcType=CHAR},#{hospitalId,jdbcType=VARCHAR} + ,#{discountPrice,jdbcType=VARCHAR},#{status,jdbcType=CHAR},#{hospitalId,jdbcType=BIGINT} ,#{hospitalName,jdbcType=VARCHAR},#{createBy,jdbcType=VARCHAR},#{createTime,jdbcType=DATE} ,#{updateBy,jdbcType=VARCHAR},#{updateTime,jdbcType=DATE},#{delFlag,jdbcType=CHAR} ,#{remark,jdbcType=VARCHAR}) @@ -109,7 +109,7 @@ #{discount,jdbcType=INTEGER}, #{discountPrice,jdbcType=DECIMAL}, #{status,jdbcType=CHAR}, - #{hospitalId,jdbcType=VARCHAR}, + #{hospitalId,jdbcType=BIGINT}, #{hospitalName,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=DATE}, @@ -141,7 +141,7 @@ status = #{status,jdbcType=CHAR}, - hospital_id = #{hospitalId,jdbcType=VARCHAR}, + hospital_id = #{hospitalId,jdbcType=BIGINT}, hospital_name = #{hospitalName,jdbcType=VARCHAR}, @@ -176,7 +176,7 @@ discount = #{discount,jdbcType=INTEGER}, discount_price = #{discountPrice,jdbcType=VARCHAR}, status = #{status,jdbcType=CHAR}, - hospital_id = #{hospitalId,jdbcType=VARCHAR}, + hospital_id = #{hospitalId,jdbcType=BIGINT}, hospital_name = #{hospitalName,jdbcType=VARCHAR}, create_by = #{createBy,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=DATE}, 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 cd0816c..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 @@ -10,8 +10,8 @@ - - + + @@ -21,7 +21,7 @@ - + @@ -36,7 +36,7 @@ id,screening_id,patient_id,screening_status, - disease,dept_id,IFNULL(dept_name, '') as dept_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,dept_id,dept_name, + disease,hospital_id,hospital_name, project_id, project_name, apply_start_time, apply_end_time, screening_date, content,diagnostic_result,attachment,attachment_two, @@ -57,7 +57,7 @@ insert into screening_record () values (#{screeningId}, #{patientId}, #{screeningStatus}, - #{disease}, #{deptId}, #{deptName}, + #{disease}, #{hospitalId}, #{hospitalName}, #{projectId},#{projectName}, #{applyStartTime}, #{applyEndTime},#{screeningDate}, #{content}, #{diagnosticResult},#{attachment},#{attachmentTwo}, @@ -74,11 +74,11 @@ screening_status = #{screeningStatus}, - - dept_id = #{deptId}, + + hospital_id = #{hospitalId}, - - dept_name = #{deptName}, + + hospital_name = #{hospitalName}, project_id = #{projectId}, @@ -179,11 +179,11 @@ and address like concat('%', #{address}, '%') - - and dept_id = #{deptId} + + and hospital_id = #{hospitalId} - - and dept_name = #{deptName} + + 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.dept_id,IFNULL(ssr.dept_name, '') as dept_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 diff --git a/xinelu-system/src/main/resources/mapper/system/SysUserMapper.xml b/xinelu-system/src/main/resources/mapper/system/SysUserMapper.xml index 73b26c6..b0f0664 100644 --- a/xinelu-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/xinelu-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -23,6 +23,7 @@ + @@ -47,7 +48,8 @@ - select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, + select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, + u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.hospital_person_id, d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status from sys_user u @@ -160,6 +162,7 @@ status, create_by, remark, + hospital_person_id, create_time )values( #{userId}, @@ -174,6 +177,7 @@ #{status}, #{createBy}, #{remark}, + #{hospitalPersonId}, sysdate() )