From 418c8b665703987e30893285628fc4c7045e19d6 Mon Sep 17 00:00:00 2001 From: ryoeiken <754264374@qq.com> Date: Tue, 29 Dec 2020 16:18:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AA=97=E5=8F=A3=E6=94=B6=E8=B4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ClientPatientController.java | 35 ++++++++ .../controller/FtSettleDaoController.java | 39 ++++++--- .../system/fantang/entity/SettleEntity.java | 3 + .../fantang/mapper/FtPatientDaoMapper.java | 6 +- ruoyi-ui/src/views/fantang/settle/index.vue | 85 +++++++++++++------ 5 files changed, 131 insertions(+), 37 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientPatientController.java diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientPatientController.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientPatientController.java new file mode 100644 index 000000000..4278ed536 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/ClientPatientController.java @@ -0,0 +1,35 @@ +package com.ruoyi.system.fantang.controller; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.system.fantang.service.IFtPatientDaoService; +import com.ruoyi.system.fantang.vo.FtPatientVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + + +@RestController +@RequestMapping("/client_api/patient") +public class ClientPatientController extends BaseController { + + @Autowired + private IFtPatientDaoService iFtPatientDaoService; + + @GetMapping("/getReportMealsToday/{patientId}") + public AjaxResult getReportMealsToday(@PathVariable("patientId") Long patientId) { + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String createAt = sdf.format(new Date()); + + FtPatientVo reportMealsToday = iFtPatientDaoService.getReportMealsToday("2020-12-29", patientId); + + return AjaxResult.success(reportMealsToday); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtSettleDaoController.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtSettleDaoController.java index 34db7a6fd..093323f55 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtSettleDaoController.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtSettleDaoController.java @@ -108,17 +108,6 @@ public class FtSettleDaoController extends BaseController { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - // 根据病人 id 查询预付费记录 - QueryWrapper prepaymentWrapper = new QueryWrapper<>(); - prepaymentWrapper.eq("patient_id", patientId); - FtPrepaymentDao prepaymentDao = iFtPrepaymentDaoService.getOne(prepaymentWrapper); - - // 预付费扣费 -// BigDecimal prepaid = prepaymentDao.getPrepaid(); -// BigDecimal balance = prepaid.subtract(netPeceipt); -// prepaymentDao.setPrepaid(balance); -// iFtPrepaymentDaoService.updateById(prepaymentDao); - // 添加结算记录 FtSettleDao ftSettleDao = new FtSettleDao(); ftSettleDao.setReceipts(netPeceipt); @@ -128,6 +117,34 @@ public class FtSettleDaoController extends BaseController { ftSettleDao.setOpera(userName); ftSettleDao.setPayable(sumTotalPrice); ftSettleDao.setReceipts(netPeceipt); + + //支付方式 + switch (settlement.getPayType()) { + case 1: + ftSettleDao.setType("现金"); + break; + + case 2: + // 根据病人 id 查询预付费记录 + QueryWrapper prepaymentWrapper = new QueryWrapper<>(); + prepaymentWrapper.eq("patient_id", patientId); + FtPrepaymentDao prepaymentDao = iFtPrepaymentDaoService.getOne(prepaymentWrapper); + + // 预付费扣费 + BigDecimal prepaid = prepaymentDao.getPrepaid(); + BigDecimal balance = prepaid.subtract(netPeceipt); + prepaymentDao.setPrepaid(balance); + iFtPrepaymentDaoService.updateById(prepaymentDao); + + ftSettleDao.setType("预付款"); + break; + + case 3: + ftSettleDao.setType("在线支付"); + break; + } + + iFtSettleDaoService.save(ftSettleDao); // 修改报餐信息 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/entity/SettleEntity.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/entity/SettleEntity.java index 8a4d8bfae..ea1a52a39 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/entity/SettleEntity.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/entity/SettleEntity.java @@ -63,4 +63,7 @@ public class SettleEntity { // 正餐和营养餐总价 private BigDecimal sumTotalPrice; + // 付款方式 + private Integer payType; + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtPatientDaoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtPatientDaoMapper.java index e16124f08..a5f7314e8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtPatientDaoMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtPatientDaoMapper.java @@ -1,9 +1,11 @@ package com.ruoyi.system.fantang.mapper; -import com.ruoyi.system.fantang.domain.FtPatientDao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.system.fantang.domain.FtPatientDao; +import com.ruoyi.system.fantang.vo.FtPatientVo; import com.ruoyi.system.fantang.vo.ftSyncConflictVo; import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; import org.springframework.stereotype.Repository; @@ -48,4 +50,6 @@ public interface FtPatientDaoMapper extends BaseMapper { @Select("select a.hospital_id, a.name, a.depart_name, a.bed_id, b.depart_id, c.hospital_id as old_hospital_id, c.name as old_name, a.depart_name as old_depart_name, c.bed_id as old_bed_id, c.depart_id as old_depart_id, c.patient_id as patient_id from ft_sync a LEFT JOIN ft_depart b on a.depart_name = b.depart_name LEFT JOIN ft_patient c on a.hospital_id = c.hospital_id where b.depart_id = c.depart_id and a.bed_id = c.bed_id and a.name = c.name and c.hospital_id!=a.hospital_id") List syncConflictOtherAllEqual(); + + FtPatientVo getReportMealsToday(@Param("createAt") String createAt, @Param("patientId") Long patientId); } diff --git a/ruoyi-ui/src/views/fantang/settle/index.vue b/ruoyi-ui/src/views/fantang/settle/index.vue index 321b826da..1deb7e825 100644 --- a/ruoyi-ui/src/views/fantang/settle/index.vue +++ b/ruoyi-ui/src/views/fantang/settle/index.vue @@ -212,17 +212,34 @@ - - - - + + + + + + + + + + + + + + + + + @@ -303,6 +320,16 @@ export default { components: {}, data() { return { + payTypeOptions: [{ + value: 1, + label: '现金' + }, { + value: 2, + label: '预付款' + }, { + value: 3, + label: '在线支付' + }], sumTotalPrice: 0, dinnerTotalPrice: 0, nutritionTotalPrice: 0, @@ -354,7 +381,6 @@ export default { name: null, departName: null, bedId: null, - price: null, receivable: null, // 应收 @@ -372,6 +398,7 @@ export default { // 选择结算日期 selectBillingDate: null, opera: null, + payType: null, }, // 结算类型字典 @@ -438,7 +465,16 @@ export default { ], refund: [ {required: true, message: "退款总额不能为空", trigger: "blur"} - ] + ], + selectBillingDate: [{ + required: true, message: "结算日期不能为空", trigger: "blur" + }], + payType: [{ + required: true, message: "支付方式不能为空", trigger: "blur" + }], + netPeceipt: [{ + required: true, message: "实收不能为空", trigger: "blur" + }] } }; }, @@ -456,7 +492,7 @@ export default { var dateSpan, iDays; let sDate1 = Date.parse(this.formAddNewSettlement.lastBillingDate); let sDate2 = Date.parse(value); - console.log("selectBillingDate", this.formAddNewSettlement.selectBillingDate) + // console.log("selectBillingDate", this.formAddNewSettlement.selectBillingDate) dateSpan = sDate2 - sDate1; if (dateSpan < 0) { @@ -488,14 +524,14 @@ export default { this.userName = response.data.userName; this.roleGroup = response.roleGroup; this.postGroup = response.postGroup; - console.log(this.userName); + // console.log(this.userName); }); }, // 日常伙食费结算操作按钮 clickAddNewSettlement(row) { getLastSettlementDate(row.patientId).then(response => { - console.log("getLastBillingDateByPatientId-->", response); + // console.log("getLastBillingDateByPatientId-->", response); if (response.data.settlementAt === null) { this.lastBillFlag = false; this.formAddNewSettlement.lastBillingDate = response.data.lastCreateDate; @@ -508,7 +544,7 @@ export default { }); getPrepaymentByPatientId(row.patientId).then(response => { - console.log("row-->", response); + // console.log("row-->", response); this.flagAddNewSettlementOpen = true; this.flagAddPrepaymentShow = false; this.formAddNewSettlement.hospitalId = row.hospitalId; @@ -532,7 +568,7 @@ export default { // 处理筛选结算标志 selectSettlementFlag(value) { - console.log("value", value) + // console.log("value", value) if (value === null) { this.loading = true; listAll(this.queryParams).then(response => { @@ -624,8 +660,8 @@ export default { }, /** 提交按钮 */ submitForm() { - // this.$refs["formAddNewSettlement"].validate(valid => { - // if (valid) { + this.$refs["formAddNewSettlement"].validate(valid => { + if (valid) { // if (this.form.settleId != null) { // updateSettle(this.form).then(response => { // this.msgSuccess("修改成功"); @@ -633,7 +669,6 @@ export default { // this.getList(); // }); // } else { - console.log(this.formAddNewSettlement); this.formAddNewSettlement.opera = this.userName; this.formAddNewSettlement.dinnerTotalPrice = this.dinnerTotalPrice; this.formAddNewSettlement.nutritionTotalPrice = this.nutritionTotalPrice; @@ -645,12 +680,12 @@ export default { this.flagAddNewSettlementOpen = false; this.getList(); }); - }else { - this.msgError("预付费余额不足"); + } else { + this.msgError("预付费余额不足"); } // } - // } - // }); + } + }); }, /** 删除按钮操作 */ handleDelete(row) {