窗口收费-收费

This commit is contained in:
ryoeiken 2021-01-21 15:32:06 +08:00
parent bd3d3e4e0f
commit 4a1a09e932
7 changed files with 157 additions and 137 deletions

View File

@ -10,8 +10,10 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.fantang.domain.FtPrepaymentDao;
import com.ruoyi.system.fantang.domain.FtReportMealsDao;
import com.ruoyi.system.fantang.entity.ReportMealsDayEntity;
import com.ruoyi.system.fantang.service.IFtPrepaymentDaoService;
import com.ruoyi.system.fantang.service.IFtReportMealsDaoService;
import com.ruoyi.system.fantang.vo.FtReportMealVo;
import lombok.RequiredArgsConstructor;
@ -23,6 +25,8 @@ import java.util.Arrays;
import java.util.Date;
import java.util.List;
import static com.ruoyi.common.core.domain.AjaxResult.success;
/**
* 报餐管理Controller
*
@ -36,31 +40,49 @@ public class FtReportMealsDaoController extends BaseController {
private final IFtReportMealsDaoService iFtReportMealsDaoService;
@Autowired
private IFtPrepaymentDaoService prepaymentDaoService;
/**
* 查询指定用户上一次结算的日期并通过这个日期计算未结算的天数
*/
@GetMapping("/getLastSettlementDate/{patientId}")
public AjaxResult getLastSettlementDate(@PathVariable("patientId") Long patientId) {
// 初始化一个返回对象
AjaxResult result = AjaxResult.success();
// 获取最近一次已结算的报餐记录如果首次结算则返回
// 获取该病患的预付费数据
FtPrepaymentDao prepaymentDao = prepaymentDaoService.getByPatientId(patientId);
result.put("prepayment", prepaymentDao);
// 获取最近一次已结算的报餐记录如果首次结算则返回第一条已用餐的记录
FtReportMealsDao reportMealsDao = iFtReportMealsDaoService.getLastReportMeals(patientId);
Date createAt = reportMealsDao.getCreateAt();
// 获取用餐日期
Date diningAt = reportMealsDao.getDiningAt();
// 获取结算日期
Date settlementAt = reportMealsDao.getSettlementAt();
ReportMealsDayEntity reportMealsDayEntity = new ReportMealsDayEntity();
if (settlementAt == null) {
long betweenDays = DateUtil.between(createAt, new Date(), DateUnit.DAY);
reportMealsDayEntity.setDays(betweenDays);
reportMealsDayEntity.setLastCreateDate(createAt);
return AjaxResult.success(reportMealsDayEntity);
}
long days = DateUtil.between(settlementAt, new Date(), DateUnit.DAY);
// 如果首次结算
if (settlementAt == null) {
// 计算第一条已用餐的用餐时间与现在相差多少天
long betweenDays = DateUtil.between(diningAt, new Date(), DateUnit.DAY);
reportMealsDayEntity.setDays(betweenDays);
reportMealsDayEntity.setLastCreateDate(diningAt);
result.put("reportMeals", reportMealsDayEntity);
return result;
}
//计算上次结算日期与现在相差多少天
long days = DateUtil.between(settlementAt, new Date(), DateUnit.DAY);
reportMealsDayEntity.setSettlementAt(settlementAt);
reportMealsDayEntity.setDays(days);
result.put("reportMeals", reportMealsDayEntity);
return AjaxResult.success(reportMealsDayEntity);
return result;
}
@ -161,7 +183,7 @@ public class FtReportMealsDaoController extends BaseController {
*/
@GetMapping("/countBillingBetween")
public AjaxResult countBillingBetween(ReportMealsDayEntity dao) {
return AjaxResult.success(iFtReportMealsDaoService.countBillingBetween(dao));
return success(iFtReportMealsDaoService.countBillingBetween(dao));
}
/**
@ -170,7 +192,7 @@ public class FtReportMealsDaoController extends BaseController {
@PreAuthorize("@ss.hasPermi('fantang:meals:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(iFtReportMealsDaoService.getById(id));
return success(iFtReportMealsDaoService.getById(id));
}
/**

View File

@ -69,8 +69,8 @@ public class FtSettleDaoController extends BaseController {
// 根据病人 id 上次结算日期选择日期查询病人非营养餐记录
QueryWrapper<FtReportMealsDao> reportMealsWrapper = new QueryWrapper<>();
reportMealsWrapper.eq("patient_id", patientId);
// reportMealsWrapper.eq("nutrition_food_flag", 0);
reportMealsWrapper.between("create_at", sdf.format(lastBillingDate), sdf.format(selectBillingDate));
reportMealsWrapper.eq("dining_flag",1);
reportMealsWrapper.between("dining_at", sdf.format(lastBillingDate), sdf.format(selectBillingDate));
List<FtReportMealsDao> reportMealsList = iFtReportMealsDaoService.list(reportMealsWrapper);
ReportMealsPriceEntity reportMealsPrice = iFtReportMealsDaoService.sumTotalPrice(patientId, lastBillingDate, selectBillingDate);

View File

@ -180,4 +180,9 @@ public class FtReportMealsDao implements Serializable {
*/
@TableField(exist = false)
private Date endOfDay;
/**
* 用餐标志
*/
private Integer diningFlag;
}

View File

@ -36,7 +36,7 @@ public interface FtReportMealsDaoMapper extends BaseMapper<FtReportMealsDao> {
* @param selectBillingDate
* @return
*/
@Select("SELECT a.patient_id,sum(a.price) as dinner_total_price , sum(a.nutrition_food_price ) as nutrition_total_price , sum(a.total_price) as sum_total_price FROM ft_report_meals a where a.patient_id = #{patientId} and a.create_at BETWEEN #{lastBillingDate} AND #{selectBillingDate}")
@Select("SELECT a.patient_id,sum(a.price) as dinner_total_price , sum(a.nutrition_food_price ) as nutrition_total_price , sum(a.total_price) as sum_total_price FROM ft_report_meals a where a.patient_id = #{patientId} and a.dining_at BETWEEN #{lastBillingDate} AND #{selectBillingDate}")
ReportMealsPriceEntity sumTotalPrice(@Param("patientId") Long patientId, @Param("lastBillingDate") Date lastBillingDate, @Param("selectBillingDate") Date selectBillingDate);
List<FtReportMealsDao> listNutrition(@Param("beginOfDay") DateTime beginOfDay, @Param("endOfDay") DateTime endOfDay, FtReportMealsDao ftReportMealsDao);

View File

@ -76,10 +76,11 @@ public class FtReportMealsDaoServiceImpl extends ServiceImpl<FtReportMealsDaoMap
@Override
public FtReportMealsDao getLastReportMeals(Long patientId) {
// 获取最近一条已结算的报餐记录
// 获取最近一条已用餐结算的报餐记录
QueryWrapper<FtReportMealsDao> flag1Wrapper = new QueryWrapper<>();
flag1Wrapper.eq("patient_id", patientId);
flag1Wrapper.eq("settlement_flag", 1);
flag1Wrapper.eq("dining_flag", 1);
flag1Wrapper.orderByDesc("settlement_at");
flag1Wrapper.last("limit 1");
FtReportMealsDao flag1ReportMealsDao = this.baseMapper.selectOne(flag1Wrapper);
@ -87,9 +88,10 @@ public class FtReportMealsDaoServiceImpl extends ServiceImpl<FtReportMealsDaoMap
// 如果是首次结算
if (flag1ReportMealsDao == null) {
// 获取第一条报餐数据
// 获取第一条 已用餐 报餐记录
QueryWrapper<FtReportMealsDao> flag0Wrapper = new QueryWrapper<>();
flag0Wrapper.eq("patient_id", patientId);
flag0Wrapper.eq("dining_flag", 1);
flag0Wrapper.orderByAsc("dining_at");
flag0Wrapper.last("limit 1");

View File

@ -27,14 +27,17 @@
<result property="egg" column="egg"/>
<result property="openFlag" column="open_flag"/>
<result property="diningAt" column="dining_at"/>
<result property="diningFlag" column="dining_flag"/>
</resultMap>
<select id="listMealsWithInSettle" resultType="com.ruoyi.system.fantang.domain.FtReportMealsDao">
select sum(a.price) as price, a.patient_id, b.hospital_id, b.bed_id, b.`name`, c.depart_name, c.depart_code
select sum(a.total_price ) as price, a.patient_id, b.hospital_id, b.bed_id, b.`name`, c.depart_name, c.depart_code
from ft_report_meals a
LEFT JOIN ft_patient b on a.patient_id = b.patient_id
LEFT JOIN ft_depart c on b.depart_id = c.depart_id
<where>
a.dining_flag = 1
AND b.off_flag = 0
<if test="hospitalId != null">and b.hospital_id = #{hospitalId}</if>
<if test="departId != null">and b.depart_id = #{departId}</if>
<if test="name != null and name !=''">and b.name = #{name}</if>

View File

@ -3,11 +3,11 @@
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="住院号" prop="hospitalId">
<el-input
v-model="queryParams.hospitalId"
placeholder="请输入住院号"
clearable
size="small"
@keyup.enter.native="handleQuery"
v-model="queryParams.hospitalId"
placeholder="请输入住院号"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
@ -17,36 +17,36 @@
size="small"
@keyup.enter.native="handleQuery">
<el-option
v-for="item in departOptions"
:key="item.departName"
:label="item.departName"
:value="item.departId">
v-for="item in departOptions"
:key="item.departName"
:label="item.departName"
:value="item.departId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="姓名" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入姓名"
clearable
size="small"
@keyup.enter.native="handleQuery"
v-model="queryParams.name"
placeholder="请输入姓名"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="结算标志" prop="settlementFlag">
<el-select v-model="queryParams.settlementFlag" placeholder="请选择"
clearable
size="small"
@keyup.enter.native="handleQuery">
<el-option
v-for="item in settlementFlagOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="结算标志" prop="settlementFlag">-->
<!-- <el-select v-model="queryParams.settlementFlag" placeholder="请选择"-->
<!-- clearable-->
<!-- size="small"-->
<!-- @keyup.enter.native="handleQuery">-->
<!-- <el-option-->
<!-- v-for="item in settlementFlagOptions"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value">-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -66,33 +66,33 @@
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['fantang:settle:edit']"
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['fantang:settle:edit']"
>出院结算
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['fantang:settle:remove']"
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['fantang:settle:remove']"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['fantang:settle:export']"
type="warning"
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['fantang:settle:export']"
>导出
</el-button>
</el-col>
@ -106,58 +106,35 @@
<el-table-column label="科室" align="center" prop="departName"/>
<el-table-column label="姓名" align="center" prop="name"/>
<el-table-column label="床号" align="center" prop="bedId"/>
<el-table-column label="结算总价" align="center" prop="price"/>
<el-table-column label="结算类型" align="center" prop="type"/>
<el-table-column label="结算日期" align="center" prop="settleAt" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.settleAt, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="退款总额" align="center" prop="refund"/>
<el-table-column label="累计总额" align="center" prop="price"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="clickAddNewSettlement(scope.row)"
v-hasPermi="['fantang:settle:AddNewSettlement']"
size="mini"
type="text"
icon="el-icon-edit"
@click="clickAddNewSettlement(scope.row)"
v-hasPermi="['fantang:settle:AddNewSettlement']"
>收费
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="clickAddLeaveSettlement(scope.row)"
v-hasPermi="['fantang:settle:AddLeaveSettlement']"
size="mini"
type="text"
icon="el-icon-edit"
@click="clickAddLeaveSettlement(scope.row)"
v-hasPermi="['fantang:settle:AddLeaveSettlement']"
>出院结算
</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['fantang:settle:edit']"-->
<!-- >修改-->
<!-- </el-button>-->
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['fantang:settle:remove']"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 日常收费弹出层对话框-->
@ -189,11 +166,11 @@
<el-form-item label="上次结算 / 用餐日期" prop="lastBillingDate">
<!-- <el-input v-model="formAddNewSettlement.lastBillingDate" :disabled="true"/>-->
<el-date-picker
v-model="formAddNewSettlement.lastBillingDate"
align="right"
type="date"
value-format="yyyy-MM-dd"
:disabled="true">
v-model="formAddNewSettlement.lastBillingDate"
align="right"
type="date"
value-format="yyyy-MM-dd"
:disabled="true">
</el-date-picker>
</el-form-item>
</el-col>
@ -216,13 +193,13 @@
<el-col :span="8">
<el-form-item label="结算日期" prop="selectBillingDate">
<el-date-picker
v-model="formAddNewSettlement.selectBillingDate"
align="right"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
@change="changeBillingDate"
:picker-options="pickerOptions">
v-model="formAddNewSettlement.selectBillingDate"
align="right"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
@change="changeBillingDate"
:picker-options="pickerOptions">
</el-date-picker>
</el-form-item>
</el-col>
@ -230,10 +207,10 @@
<el-form-item label="支付方式" prop="payType">
<el-select v-model="formAddNewSettlement.payType" placeholder="请选择支付方式">
<el-option
v-for="item in payTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
v-for="item in payTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
@ -241,7 +218,7 @@
</el-row>
<el-form-item label="实收" prop="netPeceipt">
<el-input v-model="formAddNewSettlement.netPeceipt" placeholder="请输入实收"/>
<el-input v-model="formAddNewSettlement.netPeceipt" placeholder="请输入实收" :disabled="true"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -310,9 +287,8 @@
<script>
import {addSettle, delSettle, exportSettle, getSettle, showMealsWithSelect} from "@/api/fantang/settle";
import {getLastSettlementDate, listAll, listMealsWithInSettle, listNoPay, listPayoff} from "@/api/fantang/meals";
import {getLastSettlementDate, listAll, listMealsWithInSettle, listNoPay, listPayoff} from "../../../api/fantang/meals";
import {getUserProfile} from "@/api/system/user";
import {getPrepaymentByPatientId} from "@/api/fantang/prepayment";
import {listDepart} from "@/api/fantang/depart";
export default {
@ -491,13 +467,14 @@ export default {
changeBillingDate(value) {
var dateSpan, iDays;
let sDate1 = Date.parse(this.formAddNewSettlement.lastBillingDate);
let sDate2 = Date.parse(value);
// console.log("selectBillingDate", this.formAddNewSettlement.selectBillingDate)
let sDate2 = Date.parse(value + ' 23:59:59');
console.log("lastBillingDate", this.formAddNewSettlement.lastBillingDate)
console.log("selectBillingDate", value);
dateSpan = sDate2 - sDate1;
console.log("sdate2-------", sDate2);
console.log("sdate1-------", sDate1);
console.log("当前选择时间-------", sDate2);
console.log("最后结算时间-------", sDate1);
if (dateSpan < 0) {
this.msgError("你现在的结算日期小于上一次上次结算 / 用餐日期");
@ -511,9 +488,19 @@ export default {
if (this.formAddNewSettlement.selectBillingDate != null) {
showMealsWithSelect(this.formAddNewSettlement).then(response => {
this.mealsList = response.data.reportMealsList;
this.dinnerTotalPrice = response.data.reportMealsPrice.dinnerTotalPrice;
this.nutritionTotalPrice = response.data.reportMealsPrice.nutritionTotalPrice;
this.sumTotalPrice = response.data.reportMealsPrice.sumTotalPrice;
if (response.data.reportMealsPrice == null) {
this.dinnerTotalPrice = 0;
this.nutritionTotalPrice = 0;
this.sumTotalPrice = 0;
}
if (response.data.reportMealsPrice != null) {
this.dinnerTotalPrice = response.data.reportMealsPrice.dinnerTotalPrice;
this.nutritionTotalPrice = response.data.reportMealsPrice.nutritionTotalPrice;
this.sumTotalPrice = response.data.reportMealsPrice.sumTotalPrice;
this.formAddNewSettlement.netPeceipt = this.sumTotalPrice;
}
})
} else {
this.mealsList = null;
@ -528,27 +515,29 @@ export default {
this.userName = response.data.userName;
this.roleGroup = response.roleGroup;
this.postGroup = response.postGroup;
// console.log(this.userName);
});
},
//
clickAddNewSettlement(row) {
getLastSettlementDate(row.patientId).then(response => {
// console.log("getLastBillingDateByPatientId-->", response);
if (response.data.settlementAt === null) {
console.log("getLastBillingDateByPatientId-->", response);
if (response.reportMeals.settlementAt === null) {
this.lastBillFlag = false;
this.formAddNewSettlement.lastBillingDate = response.data.lastCreateDate;
this.formAddNewSettlement.lastBillingDate = response.reportMeals.lastCreateDate;
this.msgInfo("该病人首次收费")
} else {
this.lastBillFlag = true;
this.formAddNewSettlement.lastBillingDate = response.data.settlementAt;
this.formAddNewSettlement.lastBillingDate = response.reportMeals.settlementAt;
}
this.formAddNewSettlement.settlementDays = response.data.days;
});
getPrepaymentByPatientId(row.patientId).then(response => {
// console.log("row-->", response);
if (response.prepayment === null) {
this.formAddNewSettlement.prepayment = 0;
} else {
this.formAddNewSettlement.prepayment = response.prepayment.prepaid;
}
this.formAddNewSettlement.settlementDays = response.reportMeals.days;
this.flagAddNewSettlementOpen = true;
this.flagAddPrepaymentShow = false;
this.formAddNewSettlement.hospitalId = row.hospitalId;
@ -557,7 +546,6 @@ export default {
this.formAddNewSettlement.bedId = row.bedId;
this.formAddNewSettlement.patientId = row.patientId;
this.formAddNewSettlement.price = row.price;
this.formAddNewSettlement.prepayment = response.data.prepaid;
this.formAddNewSettlement.netPeceipt = null;
this.formAddNewSettlement.userName = this.userName;
});