From 56aa0ed6306f8ea95aac3bba46aea04ca67bdf91 Mon Sep 17 00:00:00 2001 From: ryoeiken <754264374@qq.com> Date: Wed, 9 Dec 2020 17:34:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=20=E6=97=A5=E5=B8=B8?= =?UTF-8?q?=E6=94=B6=E8=B4=B9-=E6=94=B6=E8=B4=B9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FtReportMealsDaoController.java | 8 + .../controller/FtSettleDaoController.java | 16 +- .../fantang/domain/FtReportMealsDao.java | 17 ++ .../system/fantang/domain/FtSettleDao.java | 8 + .../fantang/entity/ReportMealsDayEntity.java | 7 +- .../mapper/FtReportMealsDaoMapper.java | 9 +- .../fantang/mapper/FtSettleDaoMapper.java | 6 +- .../service/IFtReportMealsDaoService.java | 6 +- .../fantang/service/IFtSettleDaoService.java | 1 + .../impl/FtReportMealsDaoServiceImpl.java | 12 +- .../service/impl/FtSettleDaoServiceImpl.java | 4 + .../mapper/fantang/FtReportMealsDaoMapper.xml | 13 ++ .../mapper/fantang/FtSettleDaoMapper.xml | 28 +-- ruoyi-ui/src/api/fantang/meals.js | 113 +++++----- ruoyi-ui/src/views/fantang/settle/index.vue | 213 +++++++++--------- 15 files changed, 282 insertions(+), 179 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtReportMealsDaoController.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtReportMealsDaoController.java index e8056cd4d..0a544365c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtReportMealsDaoController.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtReportMealsDaoController.java @@ -126,6 +126,14 @@ public class FtReportMealsDaoController extends BaseController { return getDataTable(list); } + @PreAuthorize("@ss.hasPermi('fantang:meals:list')") + @GetMapping("/listMealsWithInSettle") + public TableDataInfo listMealsWithInSettle(FtReportMealsDao ftReportMealsDao) { + startPage(); + List list = iFtReportMealsDaoService.listMealsWithInSettle(ftReportMealsDao); + return getDataTable(list); + } + /** * 导出报餐管理列表 */ 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 5cef32e7a..07d743d77 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 @@ -10,12 +10,14 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.fantang.domain.FtSettleDao; +import com.ruoyi.system.fantang.service.IFtReportMealsDaoService; import com.ruoyi.system.fantang.service.IFtSettleDaoService; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; +import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Date; import java.util.List; @@ -33,6 +35,8 @@ public class FtSettleDaoController extends BaseController { private final IFtSettleDaoService iFtSettleDaoService; + private final IFtReportMealsDaoService iFtReportMealsDaoService; + /** * 查询结算报列表 @@ -95,7 +99,17 @@ public class FtSettleDaoController extends BaseController { public AjaxResult add(@RequestBody FtSettleDao ftSettleDao) { ftSettleDao.setSettleAt(new Date()); ftSettleDao.setReceipts(ftSettleDao.getNetPeceipt()); - return toAjax(iFtSettleDaoService.save(ftSettleDao) ? 1 : 0); + + Long patientId = ftSettleDao.getPatientId(); + Date lastBillingDate = ftSettleDao.getLastBillingDate(); + Date selectBillingDate = ftSettleDao.getSelectBillingDate(); + iFtSettleDaoService.save(ftSettleDao); + Long settlementId = ftSettleDao.getSettleId(); + SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + iFtReportMealsDaoService.settleMeals(settlementId, patientId, ft.format(lastBillingDate), ft.format(selectBillingDate)); + iFtSettleDaoService.updateList(settlementId, patientId, ft.format(lastBillingDate), ft.format(selectBillingDate)); + + return AjaxResult.success("结算成功"); } /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtReportMealsDao.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtReportMealsDao.java index 978148687..5e3f971f0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtReportMealsDao.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtReportMealsDao.java @@ -1,5 +1,6 @@ package com.ruoyi.system.fantang.domain; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; @@ -82,4 +83,20 @@ public class FtReportMealsDao implements Serializable { private Date settlementAt; private String settlementBy; + + @TableField(exist = false) + private String hospitalId; + + @TableField(exist = false) + private String departId; + + @TableField(exist = false) + private String departName; + + @TableField(exist = false) + private String bedId; + + + @TableField(exist = false) + private String name; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtSettleDao.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtSettleDao.java index 4125b440f..e6cdce086 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtSettleDao.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtSettleDao.java @@ -98,4 +98,12 @@ public class FtSettleDao implements Serializable { @TableField(exist = false) private BigDecimal netPeceipt; + + @TableField(exist = false) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date lastBillingDate; + + @TableField(exist = false) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date selectBillingDate; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/entity/ReportMealsDayEntity.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/entity/ReportMealsDayEntity.java index 0a75ca02d..a11817649 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/entity/ReportMealsDayEntity.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/entity/ReportMealsDayEntity.java @@ -1,20 +1,25 @@ package com.ruoyi.system.fantang.entity; +import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.system.fantang.domain.FtReportMealsDao; import lombok.AllArgsConstructor; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import java.util.Date; +@EqualsAndHashCode(callSuper = true) @Data @NoArgsConstructor @AllArgsConstructor -public class ReportMealsDayEntity extends FtReportMealsDao { +public class ReportMealsDayEntity extends FtReportMealsDao { // 用户自定义结算日期 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date selectBillingDate; // 自上一次结算累计未结算天数 private Long days; // 上次缴费日期 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date lastCreateDate; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtReportMealsDaoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtReportMealsDaoMapper.java index 55bd099c8..b3d4aded9 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtReportMealsDaoMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtReportMealsDaoMapper.java @@ -2,10 +2,12 @@ package com.ruoyi.system.fantang.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.system.fantang.domain.FtReportMealsDao; -import com.ruoyi.system.fantang.entity.ReportMealsDayEntity; +import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; import java.util.Date; +import java.util.List; /** * 报餐管理Mapper接口 @@ -17,4 +19,9 @@ public interface FtReportMealsDaoMapper extends BaseMapper { @Select("SELECT sum(price) as price from ft_report_meals where patient_id = #{patientId} and settlement_flag = 0 and create_at BETWEEN #{createAt} and #{selectBillingDate}") Long countBillingBetween(Long patientId, Date createAt, Date selectBillingDate); + + List listMealsWithInSettle(FtReportMealsDao ftReportMealsDao); + + @Update("UPDATE ft_report_meals set settlement_flag = 1 , settlement_at = now() , settlement_id = #{settlementId} where patient_id = #{patientId} and create_at BETWEEN #{lastBillingDate} and #{selectBillingDate}") + Integer settleMeals(@Param("settlementId") Long settlementId, @Param("patientId") Long patientId, @Param("lastBillingDate") String lastBillingDate, @Param("selectBillingDate") String selectBillingDate); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtSettleDaoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtSettleDaoMapper.java index 32c4ba589..fd1524ca2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtSettleDaoMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtSettleDaoMapper.java @@ -2,7 +2,8 @@ package com.ruoyi.system.fantang.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.system.fantang.domain.FtSettleDao; -import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Update; /** * 结算报Mapper接口 @@ -11,4 +12,7 @@ import org.apache.ibatis.annotations.Select; * @date 2020-11-19 */ public interface FtSettleDaoMapper extends BaseMapper { + + @Update("UPDATE ft_settle a set list = (select GROUP_CONCAT(b.id) from ft_report_meals b where b.patient_id = #{patientId} and b.create_at BETWEEN #{lastBillingDate} and #{selectBillingDate}) where a.settle_id = #{settlementId} ") + Integer updateList(@Param("settlementId") Long settlementId, @Param("patientId") Long patientId, @Param("lastBillingDate") String lastBillingDate, @Param("selectBillingDate") String selectBillingDate); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtReportMealsDaoService.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtReportMealsDaoService.java index 422cf76a0..8fa102ed9 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtReportMealsDaoService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtReportMealsDaoService.java @@ -2,10 +2,10 @@ package com.ruoyi.system.fantang.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.system.fantang.domain.FtReportMealsDao; -import com.ruoyi.system.fantang.domain.FtSettleDao; import com.ruoyi.system.fantang.entity.ReportMealsDayEntity; import com.ruoyi.system.fantang.vo.FtReportMealVo; +import java.util.Date; import java.util.List; /** @@ -23,4 +23,8 @@ public interface IFtReportMealsDaoService extends IService { List listPayoff(); Long countBillingBetween(ReportMealsDayEntity dao); + + List listMealsWithInSettle(FtReportMealsDao ftReportMealsDao); + + Integer settleMeals(Long settlementId, Long patientId, String lastBillingDate, String selectBillingDate); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtSettleDaoService.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtSettleDaoService.java index 703684fb3..8aae6cb14 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtSettleDaoService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtSettleDaoService.java @@ -11,4 +11,5 @@ import com.ruoyi.system.fantang.domain.FtSettleDao; */ public interface IFtSettleDaoService extends IService { + Integer updateList(Long settlementId, Long patientId, String lastBillingDate, String selectBillingDate); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtReportMealsDaoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtReportMealsDaoServiceImpl.java index 498790714..5d2dfa14e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtReportMealsDaoServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtReportMealsDaoServiceImpl.java @@ -1,6 +1,5 @@ package com.ruoyi.system.fantang.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.system.fantang.domain.FtReportMealsDao; import com.ruoyi.system.fantang.entity.ReportMealsDayEntity; @@ -11,6 +10,7 @@ import com.ruoyi.system.fantang.vo.FtReportMealVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Date; import java.util.List; /** @@ -53,4 +53,14 @@ public class FtReportMealsDaoServiceImpl extends ServiceImpl listMealsWithInSettle(FtReportMealsDao ftReportMealsDao) { + return this.baseMapper.listMealsWithInSettle(ftReportMealsDao); + } + + @Override + public Integer settleMeals(Long settlementId, Long patientId, String lastBillingDate, String selectBillingDate) { + return this.baseMapper.settleMeals(settlementId, patientId, lastBillingDate, selectBillingDate); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtSettleDaoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtSettleDaoServiceImpl.java index 892cbb6cf..d138c6887 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtSettleDaoServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtSettleDaoServiceImpl.java @@ -15,4 +15,8 @@ import org.springframework.stereotype.Service; @Service public class FtSettleDaoServiceImpl extends ServiceImpl implements IFtSettleDaoService { + @Override + public Integer updateList(Long settlementId, Long patientId, String lastBillingDate, String selectBillingDate) { + return this.baseMapper.updateList(settlementId, patientId, lastBillingDate, selectBillingDate); + } } diff --git a/ruoyi-system/src/main/resources/mapper/fantang/FtReportMealsDaoMapper.xml b/ruoyi-system/src/main/resources/mapper/fantang/FtReportMealsDaoMapper.xml index c2da2e96c..6e67dc662 100644 --- a/ruoyi-system/src/main/resources/mapper/fantang/FtReportMealsDaoMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/fantang/FtReportMealsDaoMapper.xml @@ -17,5 +17,18 @@ + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/fantang/FtSettleDaoMapper.xml b/ruoyi-system/src/main/resources/mapper/fantang/FtSettleDaoMapper.xml index bd734805e..a4e72692c 100644 --- a/ruoyi-system/src/main/resources/mapper/fantang/FtSettleDaoMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/fantang/FtSettleDaoMapper.xml @@ -1,21 +1,21 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + - - - - - - - - - - - + + + + + + + + + + + diff --git a/ruoyi-ui/src/api/fantang/meals.js b/ruoyi-ui/src/api/fantang/meals.js index 901f8ae84..8069f62da 100644 --- a/ruoyi-ui/src/api/fantang/meals.js +++ b/ruoyi-ui/src/api/fantang/meals.js @@ -2,98 +2,107 @@ import request from '@/utils/request' // 查询所有报餐管理列表 export function listAll(query) { - return request({ - url: '/fantang/meals/listAll', - method: 'get', - params: query - }) + return request({ + url: '/fantang/meals/listAll', + method: 'get', + params: query + }) } + // 查询未结算报餐记录 export function listNoPay(query) { - return request({ - url: '/fantang/meals/listNoPay', - method: 'get', - params: query - }) + return request({ + url: '/fantang/meals/listNoPay', + method: 'get', + params: query + }) } // 查询已结算报餐记录 export function listPayoff(query) { - return request({ - url: '/fantang/meals/listPayoff', - method: 'get', - params: query - }) + return request({ + url: '/fantang/meals/listPayoff', + method: 'get', + params: query + }) } // 查询报餐管理列表 export function listMeals(query) { - return request({ - url: '/fantang/meals/list', - method: 'get', - params: query - }) + return request({ + url: '/fantang/meals/list', + method: 'get', + params: query + }) +} + +export function listMealsWithInSettle(query) { + return request({ + url: '/fantang/meals/listMealsWithInSettle', + method: 'get', + params: query + }) } // 查询报餐管理详细 export function getMeals(id) { - return request({ - url: '/fantang/meals/' + id, - method: 'get' - }) + return request({ + url: '/fantang/meals/' + id, + method: 'get' + }) } // 新增报餐管理 export function addMeals(data) { - return request({ - url: '/fantang/meals', - method: 'post', - data: data - }) + return request({ + url: '/fantang/meals', + method: 'post', + data: data + }) } // 修改报餐管理 export function updateMeals(data) { - return request({ - url: '/fantang/meals', - method: 'put', - data: data - }) + return request({ + url: '/fantang/meals', + method: 'put', + data: data + }) } // 删除报餐管理 export function delMeals(id) { - return request({ - url: '/fantang/meals/' + id, - method: 'delete' - }) + return request({ + url: '/fantang/meals/' + id, + method: 'delete' + }) } // 导出报餐管理 export function exportMeals(query) { - return request({ - url: '/fantang/meals/export', - method: 'get', - params: query - }) + return request({ + url: '/fantang/meals/export', + method: 'get', + params: query + }) } // 获取最后结算日期 export function getLastSettlementDate(patientId) { - return request({ - url: '/fantang/meals/getLastSettlementDate/' + patientId, - method: 'get', - }) + return request({ + url: '/fantang/meals/getLastSettlementDate/' + patientId, + method: 'get', + }) } // 计算两个日期之间的结算数据 export function countBillingBetween(query) { - return request({ - url: '/fantang/meals/countBillingBetween', - method: 'get', - params: query - }) + return request({ + url: '/fantang/meals/countBillingBetween', + method: 'get', + params: query + }) } diff --git a/ruoyi-ui/src/views/fantang/settle/index.vue b/ruoyi-ui/src/views/fantang/settle/index.vue index 8c76e77b3..54d1ab698 100644 --- a/ruoyi-ui/src/views/fantang/settle/index.vue +++ b/ruoyi-ui/src/views/fantang/settle/index.vue @@ -3,46 +3,47 @@ + + + + + + + + - - - - - - - - + + v-for="item in settlementFlagOptions" + :key="item.value" + :label="item.label" + :value="item.value"> @@ -65,33 +66,33 @@ 出院结算 删除 导出 @@ -102,33 +103,33 @@ - + + + - - @@ -152,11 +153,11 @@ @@ -187,10 +188,11 @@ + v-model="formAddNewSettlement.lastBillingDate" + align="right" + type="date" + value-format="yyyy-MM-dd" + :disabled="true"> @@ -210,12 +212,13 @@ + v-model="formAddNewSettlement.selectBillingDate" + align="right" + type="date" + placeholder="选择日期" + value-format="yyyy-MM-dd mm:hh:ss" + @change="changeBillingDate" + :picker-options="pickerOptions"> @@ -261,16 +264,18 @@