搭建病患配餐页面

This commit is contained in:
ryoeiken 2020-12-03 18:11:09 +08:00
parent a8567345c9
commit e6e6a94784
3 changed files with 163 additions and 118 deletions

View File

@ -1,31 +1,23 @@
package com.ruoyi.system.fantang.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import java.util.List;
import java.util.Arrays;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.utils.StringUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
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.FtFoodDemandDao;
import com.ruoyi.system.fantang.service.IFtFoodDemandDaoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
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.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* 病人报餐Controller
@ -95,6 +87,7 @@ public class FtFoodDemandDaoController extends BaseController {
@Log(title = "病人报餐" , businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody FtFoodDemandDao ftFoodDemandDao) {
ftFoodDemandDao.setUpdateAt(new Date());
return toAjax(iFtFoodDemandDaoService.updateById(ftFoodDemandDao) ? 1 : 0);
}

View File

@ -1,23 +1,21 @@
package com.ruoyi.system.fantang.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import com.ruoyi.common.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 病人报餐对象 ft_food_demand
*
*
* @author ft
* @date 2020-12-03
*/
@ -29,61 +27,91 @@ import com.ruoyi.common.core.domain.BaseEntity;
@TableName("ft_food_demand")
public class FtFoodDemandDao implements Serializable {
private static final long serialVersionUID=1L;
private static final long serialVersionUID = 1L;
/** id */
/**
* id
*/
@TableId(value = "id")
private Long id;
/** 病人id */
/**
* 病人id
*/
private Long patientId;
/** 正餐清单 */
/**
* 正餐清单
*/
@Excel(name = "正餐清单")
private String foods;
/** 正餐类型 */
/**
* 正餐类型
*/
@Excel(name = "正餐类型")
private Long type;
/** 创建时间 */
/**
* 创建时间
*/
private Date createAt;
/** 创建人 */
/**
* 创建人
*/
private Long createBy;
/** 更新日期 */
@Excel(name = "更新日期" , width = 30, dateFormat = "yyyy-MM-dd")
/**
* 更新日期
*/
@Excel(name = "更新日期", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateAt;
/** 加菜 */
/**
* 加菜
*/
@Excel(name = "加菜")
private Integer vegetables;
/** 更新操作人 id */
/**
* 更新操作人 id
*/
private Long updateBy;
/** 加肉 */
/**
* 加肉
*/
@Excel(name = "加肉")
private Integer meat;
/** 更新来源 */
/**
* 更新来源
*/
private Integer updateFrom;
/** 加饭 */
/**
* 加饭
*/
@Excel(name = "加饭")
private Integer rice;
/** 加蛋 */
/**
* 加蛋
*/
@Excel(name = "加蛋")
private Integer egg;
/** 订单详情 */
/**
* 订单详情
*/
private String orderInfo;
/** 启用状态 */
/**
* 启用状态
*/
@Excel(name = "启用状态")
private Integer flag;
private Boolean flag;
}

View File

@ -1,15 +1,56 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="启用状态" prop="flag">
<el-form-item label="姓名" prop="patientName">
<el-input
v-model="queryParams.flag"
placeholder="请输入启用状态"
v-model="queryParams.name"
placeholder="请输入姓名"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="床号" prop="bedId">
<el-input
v-model="queryParams.bedId"
placeholder="请输入床号"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="科室" prop="departName">
<el-input
v-model="queryParams.departName"
placeholder="请输入科室"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="住院号" prop="hospitalId">
<el-input
v-model="queryParams.hospitalId"
placeholder="请输入住院号"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="启用状态" prop="flag">
<el-select v-model="queryParams.flag" placeholder="请选择启用状态"
clearable
size="small"
@keyup.enter.native="handleQuery">
<el-option
v-for="item in flagOptions"
: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>
@ -24,27 +65,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['fantang:foodDemand:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['fantang:foodDemand: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:foodDemand:remove']"
>删除</el-button>
>自动生成
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -53,26 +75,32 @@
size="mini"
@click="handleExport"
v-hasPermi="['fantang:foodDemand:export']"
>导出</el-button>
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="foodDemandList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table v-loading="loading" :data="foodDemandList" @selection-change="handleSelectionChange" border>
<!-- <el-table-column type="selection" width="55" align="center"/>-->
<el-table-column label="id" align="center" prop="id" v-if="false"/>
<el-table-column label="正餐类型" align="center" prop="type" :formatter="typeFormat" />
<el-table-column label="正餐清单" align="center" prop="foods" />
<el-table-column label="更新日期" align="center" prop="updateAt" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateAt, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="加菜" align="center" prop="vegetables" />
<el-table-column label="加肉" align="center" prop="meat" />
<el-table-column label="加饭" align="center" prop="rice" />
<el-table-column label="加蛋" align="center" prop="egg" />
<el-table-column label="启用状态" align="center" prop="flag" />
<!-- <el-table-column label="住院号" align="center" prop="hospitalId"/>-->
<el-table-column label="姓名" align="center" prop="name" width="100px"/>
<!-- <el-table-column label="科室" align="center" prop="departName"/>-->
<el-table-column label="床号" align="center" prop="bedId" width="100px"/>
<el-table-column label="正餐" align="center" prop="type" :formatter="typeFormat" width="100px"/>
<el-table-column label="正餐清单" align="center" prop="foods"/>
<el-table-column label="加菜" align="center" prop="vegetables" width="80px"/>
<el-table-column label="加肉" align="center" prop="meat" width="80px"/>
<el-table-column label="加饭" align="center" prop="rice" width="80px"/>
<el-table-column label="加蛋" align="center" prop="egg" width="80px"/>
<el-table-column label="营养配餐" align="center" prop="nutritionFood" width="120px"/>
<!-- <el-table-column label="更新日期" align="center" prop="updateAt" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.updateAt, '{y}-{m}-{d}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="启用状态" align="center" prop="flag" width="80px"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -81,14 +109,8 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['fantang:foodDemand:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['fantang:foodDemand:remove']"
>删除</el-button>
>修改
</el-button>
</template>
</el-table-column>
</el-table>
@ -104,6 +126,9 @@
<!-- 添加或修改病人报餐对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="姓名">
<el-input label="姓名"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@ -114,14 +139,27 @@
</template>
<script>
import { listFoodDemand, getFoodDemand, delFoodDemand, addFoodDemand, updateFoodDemand, exportFoodDemand } from "@/api/fantang/foodDemand";
import {
addFoodDemand,
delFoodDemand,
exportFoodDemand,
getFoodDemand,
listFoodDemand,
updateFoodDemand
} from "@/api/fantang/foodDemand";
export default {
name: "FoodDemand",
components: {
},
components: {},
data() {
return {
flagOptions: [{
value: 1,
label: '启用'
}, {
value: 2,
label: '禁用'
}],
//
loading: true,
//
@ -155,7 +193,7 @@ export default {
//
rules: {
type: [
{ required: true, message: "正餐类型不能为空", trigger: "change" }
{required: true, message: "正餐类型不能为空", trigger: "change"}
],
}
};
@ -226,7 +264,7 @@ export default {
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
@ -265,32 +303,18 @@ export default {
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除病人报餐编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delFoodDemand(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有病人报餐数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportFoodDemand(queryParams);
}).then(response => {
this.download(response.msg);
})
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
return exportFoodDemand(queryParams);
}).then(response => {
this.download(response.msg);
})
}
}
};