From 25329c6d6d581ffc4357502a6df6f2a6277fde52 Mon Sep 17 00:00:00 2001 From: ryoeiken <754264374@qq.com> Date: Fri, 29 Jan 2021 18:04:20 +0800 Subject: [PATCH] =?UTF-8?q?todo:pdf=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FtPrepaymentDaoController.java | 41 +- ruoyi-ui/src/api/fantang/prepayment.js | 8 + .../src/views/fantang/careStaffInfo/index.vue | 2 +- .../src/views/fantang/prepayment/index.vue | 653 +++++++++--------- 4 files changed, 377 insertions(+), 327 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtPrepaymentDaoController.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtPrepaymentDaoController.java index e77f9762f..9c9c54d94 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtPrepaymentDaoController.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtPrepaymentDaoController.java @@ -1,5 +1,6 @@ package com.ruoyi.system.fantang.controller; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -17,6 +18,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.net.URLEncoder; import java.util.Arrays; import java.util.Date; import java.util.List; @@ -59,7 +67,7 @@ public class FtPrepaymentDaoController extends BaseController { // return AjaxResult.error("无该记录"); // return AjaxResult.success("操作成功", dao); FtPrepaymentDao ftPrepaymentDao = iFtPrepaymentDaoService.getByPatientId(patientId); - if (ftPrepaymentDao == null){ + if (ftPrepaymentDao == null) { return AjaxResult.error("无该记录"); } return AjaxResult.success("操作成功", ftPrepaymentDao); @@ -76,7 +84,7 @@ public class FtPrepaymentDaoController extends BaseController { // 查询所有已缴费列表 @PreAuthorize("@ss.hasPermi('fantang:prepayment:list')") @GetMapping("/listPrepay") - public AjaxResult listPrepay(@RequestParam("pageNum")Integer pageNum, @RequestParam("pageSize")Integer pageSize) { + public AjaxResult listPrepay(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize) { return AjaxResult.success(iFtPrepaymentDaoService.listPrepay(pageNum, pageSize)); } @@ -177,4 +185,33 @@ public class FtPrepaymentDaoController extends BaseController { public AjaxResult remove(@PathVariable Long[] prepaymentIds) { return toAjax(iFtPrepaymentDaoService.removeByIds(Arrays.asList(prepaymentIds)) ? 1 : 0); } + + @GetMapping("/generateReceiptPdf") + public void generateReceiptPdf(HttpServletRequest request, HttpServletResponse response) throws IOException { + + //根据文件信息中文件名字 和 文件存储路径获取文件输入流 + String realpath = "E:\\Dev\\jmfx_1\\fantang\\ruoyi-ui\\src\\assets\\images\\login-background.jpg"; + //PDF文件地址 + File file = new File(realpath); + if (file.exists()) { + byte[] data = null; + FileInputStream input=null; + try { + input= new FileInputStream(file); + data = new byte[input.available()]; + input.read(data); + response.getOutputStream().write(data); + } catch (Exception e) { + System.out.println("pdf文件处理异常:" + e); + }finally{ + try { + if(input!=null){ + input.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } } diff --git a/ruoyi-ui/src/api/fantang/prepayment.js b/ruoyi-ui/src/api/fantang/prepayment.js index 5ad663580..ccc7f7a34 100644 --- a/ruoyi-ui/src/api/fantang/prepayment.js +++ b/ruoyi-ui/src/api/fantang/prepayment.js @@ -101,3 +101,11 @@ export function exportPrepayment(query) { params: query }) } + +export function generateReceiptPdf(data) { + return request({ + url: '/fantang/prepayment/generateReceiptPdf', + method: 'get', + data: data + }) +} diff --git a/ruoyi-ui/src/views/fantang/careStaffInfo/index.vue b/ruoyi-ui/src/views/fantang/careStaffInfo/index.vue index 72b7a5e1d..073155773 100644 --- a/ruoyi-ui/src/views/fantang/careStaffInfo/index.vue +++ b/ruoyi-ui/src/views/fantang/careStaffInfo/index.vue @@ -179,7 +179,7 @@ import { updateNursingInfo, } from "@/api/fantang/staffInfo"; import {listDepart} from "@/api/fantang/depart"; -import UploadImage from '@/components/UploadImage'; +import UploadImage from '../../../components/UploadImage'; export default { name: "StaffInfo", diff --git a/ruoyi-ui/src/views/fantang/prepayment/index.vue b/ruoyi-ui/src/views/fantang/prepayment/index.vue index 52c308750..c9f2cebde 100644 --- a/ruoyi-ui/src/views/fantang/prepayment/index.vue +++ b/ruoyi-ui/src/views/fantang/prepayment/index.vue @@ -43,30 +43,6 @@ - - - 预付收款 - - - - 导出 - - - - - @@ -76,23 +52,36 @@ - - - - - - + @@ -125,9 +114,9 @@ {{ item.departName }} - {{ item.bedId}} + {{ item.bedId }} - {{ item.value}} + {{ item.value }} @@ -139,7 +128,7 @@ + style="width: 250px"/> { + this.prepaymentList = response.data.records.map((item) => { + console.log(item); + item.noPrepayment = true; + return item; + }); + this.total = response.data.total; + this.loading = false; + }) + } else { + this.getDefaultNoPrepayment(); + } + + }, + + // 生产收据 pdf + handleGenerateReceiptPdf(row) { + console.log(row); + generateReceiptPdf(row).then(response => { + // window.open("http://47.106.12.11:8080/prod-api/" + response.msg) + }) + console.log(process.env); + }, + // 获取用户相关信息 + myGetUser() { + getUserProfile().then(response => { + this.user = response.data; + this.roleGroup = response.roleGroup; + this.postGroup = response.postGroup; + }); + }, + // 处理筛选结算标志 + selectSettlementFlag(value) { + this.getList(); + }, + + // 响应自动查询回显 + querySearch(queryString, cb) { + var restaurants = this.suggestionList; + console.log("restaurants-->", restaurants); + console.log("queryString", queryString) + console.log("cb-->", cb) + var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants; + // 调用 callback 返回建议列表的数据 + cb(results); + }, + + // 处理过滤器 + createFilter(queryString) { + return (restaurant) => { + return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0); }; }, - created() { - this.getList(); - this.buildSuggestionList(); - this.myGetUser(); - }, - mounted() { - }, - - methods: { - // 获取数据列表,跟进筛选条件不同获取不同类型的数据 - getList() { - if (this.queryParams.settlementFlag === 0) { - // 查询已交预付费信息 - listPrepay(this.queryParams).then(response => { - this.prepaymentList = response.data.records; - this.total = response.data.total; - this.loading = false; - }) - } else { - this.getDefaultNoPrepayment(); - } - - }, - - // 获取用户相关信息 - myGetUser() { - getUserProfile().then(response => { - this.user = response.data; - this.roleGroup = response.roleGroup; - this.postGroup = response.postGroup; - }); - }, - // 处理筛选结算标志 - selectSettlementFlag(value) { - this.getList(); - }, - - // 响应自动查询回显 - querySearch(queryString, cb) { - var restaurants = this.suggestionList; - console.log("restaurants-->", restaurants); - console.log("queryString", queryString) - console.log("cb-->", cb) - var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants; - // 调用 callback 返回建议列表的数据 - cb(results); - }, - - // 处理过滤器 - createFilter(queryString) { - return (restaurant) => { - return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0); - }; - }, - - buildSuggestionList() { - listNoPrepayment().then(response => { - console.log("aaaaaaaaaaaaa",response); - let prepaymentList = response.rows; - this.suggestionList = prepaymentList.map(item => { - return { - "value": item.hospitalId, - "departName": item.departName, - "name": item.name, - "bedId": item.bedId, - "patientId": item.patientId, - } - }); - }); - }, - - // 填充所有待缴预付伙食费的病人清单 - getDefaultNoPrepayment() { - this.loading = true; - listNoPrepayment(this.queryParams).then(response => { - this.prepaymentList = response.rows; - this.total = response.total; - this.suggestionList = this.prepaymentList.map(item => { - return { - "value": item.hospitalId, - "departName": item.departName, - "name": item.name, - "bedId": item.bedId, - "patientId": item.patientId, - } - }); - this.loading = false; - return response.rows; - }); - }, - - // 处理自动查询列表选择的事件 - handleSelect(item) { - this.formAddPrepayment.name = item.name; - this.formAddPrepayment.patientId = item.patientId; - this.formAddPrepayment.bedId = item.bedId; - this.formAddPrepayment.departName = item.departName; - this.formAddPrepayment["hospitalId"] = item.value ; - }, - - // 处理点击查询图标的事件 - handleIconClick(ev) { - console.log(ev); - }, - - // 取消按钮 - cancel() { - this.open = false; - this.reset(); - }, - // 表单重置 - reset() { - this.formAddPrepayment = { - prepaymentId: null, - patientId: null, - collectAt: null, - collectBy: null, - settlementAt: null, - settlementBy: null, - settlementId: null, - settlementFlag: null, - prepaid: 700, - prepaidAt: new Date(), - hospitalId: null, - name: null, - userName:null, - }; - this.resetForm("formAddPrepayment"); - }, - /** 搜索按钮操作 */ - handleQuery() { - this.queryParams.pageNum = 1; - this.getList(); - }, - /** 重置按钮操作 */ - resetQuery() { - this.resetForm("queryForm"); - this.handleQuery(); - }, - // 多选框选中数据 - handleSelectionChange(selection) { - this.ids = selection.map(item => item.prepaymentId) - this.single = selection.length !== 1 - this.multiple = !selection.length - }, - /** 新增按钮操作 */ - handleAdd() { - this.reset(); - this.open = true; - this.title = "添加收费管理"; - }, - /** 修改按钮操作 */ - handleUpdate(row) { - this.reset(); - const prepaymentId = row.prepaymentId || this.ids - getPrepayment(prepaymentId).then(response => { - this.formAddPrepayment = response.data; - console.log(response.data) - this.open = true; - this.title = "出院结清"; - }); - }, - /** 提交按钮 */ - submitformAddPrepayment() { - - // 1、检查该用户是否找推荐列表中,如果不在,认为该用户是已经缴费的用户 - let hospitalId = this.formAddPrepayment.hospitalId; - this.formAddPrepayment.collectBy = this.user.userName; - this.$refs["formAddPrepayment"].validate(valid => { - if (valid) { - if (!this.suggestionList.find(x=> { - return x.value === hospitalId; - })) { - this.msgError("未找到该住院号记录,请先添加!"); - return ; - } - - this.formAddPrepayment.prepaidAt = null; - console.log("form -->", this.formAddPrepayment) - addPrepayment(this.formAddPrepayment).then(response => { - this.msgSuccess("新增成功"); - this.open = false; - this.getList(); - this.buildSuggestionList(); - }); + buildSuggestionList() { + listNoPrepayment().then(response => { + console.log("aaaaaaaaaaaaa", response); + let prepaymentList = response.rows; + this.suggestionList = prepaymentList.map(item => { + return { + "value": item.hospitalId, + "departName": item.departName, + "name": item.name, + "bedId": item.bedId, + "patientId": item.patientId, } }); - }, - /** 删除按钮操作 */ - handleDelete(row) { - const prepaymentIds = row.prepaymentId || this.ids; - this.$confirm('是否确认删除收费管理编号为"' + prepaymentIds + '"的数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function () { - return delPrepayment(prepaymentIds); - }).then(() => { - this.getList(); - this.msgSuccess("删除成功"); - }) - }, - /** 导出按钮操作 */ - handleExport() { - const queryParams = this.queryParams; - this.$confirm('是否确认导出所有收费管理数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function () { - return exportPrepayment(queryParams); - }).then(response => { - this.download(response.msg); - }) - } + }); + }, + + // 填充所有待缴预付伙食费的病人清单 + getDefaultNoPrepayment() { + this.loading = true; + listNoPrepayment(this.queryParams).then(response => { + this.prepaymentList = response.rows.map(item => { + console.log(item); + item.noPrepayment = false; + return item; + }); + this.total = response.total; + this.suggestionList = this.prepaymentList.map(item => { + return { + "value": item.hospitalId, + "departName": item.departName, + "name": item.name, + "bedId": item.bedId, + "patientId": item.patientId, + } + }); + this.loading = false; + return response.rows; + }); + }, + + // 处理自动查询列表选择的事件 + handleSelect(item) { + this.formAddPrepayment.name = item.name; + this.formAddPrepayment.patientId = item.patientId; + this.formAddPrepayment.bedId = item.bedId; + this.formAddPrepayment.departName = item.departName; + this.formAddPrepayment["hospitalId"] = item.value; + }, + + // 处理点击查询图标的事件 + handleIconClick(ev) { + console.log(ev); + }, + + // 取消按钮 + cancel() { + this.open = false; + this.reset(); + }, + // 表单重置 + reset() { + this.formAddPrepayment = { + prepaymentId: null, + patientId: null, + collectAt: null, + collectBy: null, + settlementAt: null, + settlementBy: null, + settlementId: null, + settlementFlag: null, + prepaid: 700, + prepaidAt: new Date(), + hospitalId: null, + name: null, + userName: null, + }; + this.resetForm("formAddPrepayment"); + }, + /** 搜索按钮操作 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 重置按钮操作 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, + // 多选框选中数据 + handleSelectionChange(selection) { + this.ids = selection.map(item => item.prepaymentId) + this.single = selection.length !== 1 + this.multiple = !selection.length + }, + /** 新增按钮操作 */ + handleAdd() { + this.reset(); + this.open = true; + this.title = "添加收费管理"; + }, + /** 修改按钮操作 */ + handleUpdate(row) { + this.reset(); + const prepaymentId = row.prepaymentId || this.ids + getPrepayment(prepaymentId).then(response => { + this.formAddPrepayment = response.data; + console.log(response.data) + this.open = true; + this.title = "出院结清"; + }); + }, + /** 提交按钮 */ + submitformAddPrepayment() { + + // 1、检查该用户是否找推荐列表中,如果不在,认为该用户是已经缴费的用户 + let hospitalId = this.formAddPrepayment.hospitalId; + this.formAddPrepayment.collectBy = this.user.userName; + this.$refs["formAddPrepayment"].validate(valid => { + if (valid) { + if (!this.suggestionList.find(x => { + return x.value === hospitalId; + })) { + this.msgError("未找到该住院号记录,请先添加!"); + return; + } + + this.formAddPrepayment.prepaidAt = null; + console.log("form -->", this.formAddPrepayment) + addPrepayment(this.formAddPrepayment).then(response => { + this.msgSuccess("新增成功"); + this.open = false; + this.getList(); + this.buildSuggestionList(); + }); + } + }); + }, + /** 删除按钮操作 */ + handleDelete(row) { + const prepaymentIds = row.prepaymentId || this.ids; + this.$confirm('是否确认删除收费管理编号为"' + prepaymentIds + '"的数据项?', "警告", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning" + }).then(function () { + return delPrepayment(prepaymentIds); + }).then(() => { + this.getList(); + this.msgSuccess("删除成功"); + }) + }, + /** 导出按钮操作 */ + handleExport() { + const queryParams = this.queryParams; + this.$confirm('是否确认导出所有收费管理数据项?', "警告", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning" + }).then(function () { + return exportPrepayment(queryParams); + }).then(response => { + this.download(response.msg); + }) } - }; + } +};