Merge remote-tracking branch 'origin/master' into master

This commit is contained in:
czx 2020-12-07 14:55:40 +08:00
commit 99abbdb015
10 changed files with 942 additions and 45 deletions

View File

@ -0,0 +1,110 @@
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.enums.BusinessType;
import com.ruoyi.system.fantang.domain.FtCateringDao;
import com.ruoyi.system.fantang.service.IFtCateringDaoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 配餐功能Controller
*
* @author ft
* @date 2020-12-07
*/
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/fantang/catering" )
public class FtCateringDaoController extends BaseController {
private final IFtCateringDaoService iFtCateringDaoService;
/**
* 查询配餐功能列表
*/
@PreAuthorize("@ss.hasPermi('fantang:catering:list')")
@GetMapping("/list")
public TableDataInfo list(FtCateringDao ftCateringDao)
{
startPage();
LambdaQueryWrapper<FtCateringDao> lqw = Wrappers.lambdaQuery(ftCateringDao);
if (ftCateringDao.getFlag() != null){
lqw.eq(FtCateringDao::getFlag ,ftCateringDao.getFlag());
}
List<FtCateringDao> list = iFtCateringDaoService.list(lqw);
return getDataTable(list);
}
/**
* 导出配餐功能列表
*/
@PreAuthorize("@ss.hasPermi('fantang:catering:export')" )
@Log(title = "配餐功能" , businessType = BusinessType.EXPORT)
@GetMapping("/export" )
public AjaxResult export(FtCateringDao ftCateringDao) {
LambdaQueryWrapper<FtCateringDao> lqw = new LambdaQueryWrapper<FtCateringDao>(ftCateringDao);
List<FtCateringDao> list = iFtCateringDaoService.list(lqw);
ExcelUtil<FtCateringDao> util = new ExcelUtil<FtCateringDao>(FtCateringDao. class);
return util.exportExcel(list, "catering" );
}
/**
* 获取配餐功能详细信息
*/
@PreAuthorize("@ss.hasPermi('fantang:catering:query')" )
@GetMapping(value = "/{id}" )
public AjaxResult getInfo(@PathVariable("id" ) Long id) {
return AjaxResult.success(iFtCateringDaoService.getById(id));
}
/**
* 新增配餐功能
*/
@PreAuthorize("@ss.hasPermi('fantang:catering:add')" )
@Log(title = "配餐功能" , businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody FtCateringDao ftCateringDao) {
return toAjax(iFtCateringDaoService.save(ftCateringDao) ? 1 : 0);
}
/**
* 修改配餐功能
*/
@PreAuthorize("@ss.hasPermi('fantang:catering:edit')" )
@Log(title = "配餐功能" , businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody FtCateringDao ftCateringDao) {
return toAjax(iFtCateringDaoService.updateById(ftCateringDao) ? 1 : 0);
}
/**
* 删除配餐功能
*/
@PreAuthorize("@ss.hasPermi('fantang:catering:remove')" )
@Log(title = "配餐功能" , businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}" )
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(iFtCateringDaoService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
}
}

View File

@ -1,42 +1,35 @@
package com.ruoyi.system.fantang.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import java.util.Date;
import java.util.List;
import java.util.Arrays;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.fantang.domain.FtPatientDao;
import com.ruoyi.system.fantang.service.IFtPatientDaoService;
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
*
*
* @author ft
* @date 2020-11-24
*/
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/fantang/patient" )
@RequestMapping("/fantang/patient")
public class FtPatientDaoController extends BaseController {
private final IFtPatientDaoService iFtPatientDaoService;
@ -46,50 +39,69 @@ public class FtPatientDaoController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('fantang:patient:list')")
@GetMapping("/list")
public TableDataInfo list(FtPatientDao ftPatientDao)
{
public TableDataInfo list(FtPatientDao ftPatientDao) {
startPage();
LambdaQueryWrapper<FtPatientDao> lqw = Wrappers.lambdaQuery(ftPatientDao);
if (StringUtils.isNotBlank(ftPatientDao.getName())){
lqw.like(FtPatientDao::getName ,ftPatientDao.getName());
if (StringUtils.isNotBlank(ftPatientDao.getName())) {
lqw.like(FtPatientDao::getName, ftPatientDao.getName());
}
if (StringUtils.isNotBlank(ftPatientDao.getBedId())){
lqw.eq(FtPatientDao::getBedId ,ftPatientDao.getBedId());
if (StringUtils.isNotBlank(ftPatientDao.getBedId())) {
lqw.eq(FtPatientDao::getBedId, ftPatientDao.getBedId());
}
if (StringUtils.isNotBlank(ftPatientDao.getHospitalId())){
lqw.eq(FtPatientDao::getHospitalId ,ftPatientDao.getHospitalId());
if (StringUtils.isNotBlank(ftPatientDao.getHospitalId())) {
lqw.eq(FtPatientDao::getHospitalId, ftPatientDao.getHospitalId());
}
List<FtPatientDao> list = iFtPatientDaoService.list(lqw);
return getDataTable(list);
}
/**
* 根据 departId 查询病人列表
*/
@GetMapping("/selectPatientByDepartId/{departId}")
public AjaxResult selectPatientByDepartId(@PathVariable("departId") Long departId) {
QueryWrapper<FtPatientDao> wrapper = new QueryWrapper<>();
wrapper.eq("depart_id", departId);
List<FtPatientDao> list = iFtPatientDaoService.list(wrapper);
return AjaxResult.success(list);
}
/**
* 根据 patientId 查询病人床号
*/
@GetMapping("/getBedIdById/{patientId}")
public AjaxResult getBedIdById(@PathVariable("patientId") Long patientId) {
String bedId = iFtPatientDaoService.getById(patientId).getBedId();
return AjaxResult.success(bedId);
}
/**
* 导出病人管理列表
*/
@PreAuthorize("@ss.hasPermi('fantang:patient:export')" )
@Log(title = "病人管理" , businessType = BusinessType.EXPORT)
@GetMapping("/export" )
@PreAuthorize("@ss.hasPermi('fantang:patient:export')")
@Log(title = "病人管理", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(FtPatientDao ftPatientDao) {
LambdaQueryWrapper<FtPatientDao> lqw = new LambdaQueryWrapper<FtPatientDao>(ftPatientDao);
List<FtPatientDao> list = iFtPatientDaoService.list(lqw);
ExcelUtil<FtPatientDao> util = new ExcelUtil<FtPatientDao>(FtPatientDao. class);
return util.exportExcel(list, "patient" );
ExcelUtil<FtPatientDao> util = new ExcelUtil<FtPatientDao>(FtPatientDao.class);
return util.exportExcel(list, "patient");
}
/**
* 获取病人管理详细信息
*/
@PreAuthorize("@ss.hasPermi('fantang:patient:query')" )
@GetMapping(value = "/{patientId}" )
public AjaxResult getInfo(@PathVariable("patientId" ) Long patientId) {
@PreAuthorize("@ss.hasPermi('fantang:patient:query')")
@GetMapping(value = "/{patientId}")
public AjaxResult getInfo(@PathVariable("patientId") Long patientId) {
return AjaxResult.success(iFtPatientDaoService.getById(patientId));
}
/**
* 新增病人管理
*/
@PreAuthorize("@ss.hasPermi('fantang:patient:add')" )
@Log(title = "病人管理" , businessType = BusinessType.INSERT)
@PreAuthorize("@ss.hasPermi('fantang:patient:add')")
@Log(title = "病人管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody FtPatientDao ftPatientDao) {
@ -101,8 +113,8 @@ public class FtPatientDaoController extends BaseController {
/**
* 修改病人管理
*/
@PreAuthorize("@ss.hasPermi('fantang:patient:edit')" )
@Log(title = "病人管理" , businessType = BusinessType.UPDATE)
@PreAuthorize("@ss.hasPermi('fantang:patient:edit')")
@Log(title = "病人管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody FtPatientDao ftPatientDao) {
return toAjax(iFtPatientDaoService.updateById(ftPatientDao) ? 1 : 0);
@ -111,9 +123,9 @@ public class FtPatientDaoController extends BaseController {
/**
* 删除病人管理
*/
@PreAuthorize("@ss.hasPermi('fantang:patient:remove')" )
@Log(title = "病人管理" , businessType = BusinessType.DELETE)
@DeleteMapping("/{patientIds}" )
@PreAuthorize("@ss.hasPermi('fantang:patient:remove')")
@Log(title = "病人管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{patientIds}")
public AjaxResult remove(@PathVariable Long[] patientIds) {
return toAjax(iFtPatientDaoService.removeByIds(Arrays.asList(patientIds)) ? 1 : 0);
}

View File

@ -0,0 +1,82 @@
package com.ruoyi.system.fantang.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
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_catering
*
* @author ft
* @date 2020-12-07
*/
@Data
@ToString
@EqualsAndHashCode
@NoArgsConstructor
@Accessors(chain = true)
@TableName("ft_catering")
public class FtCateringDao implements Serializable {
private static final long serialVersionUID=1L;
/** id */
@TableId(value = "id")
private Long id;
/** 病人 id */
private Long patientId;
/** 正餐类型 */
@Excel(name = "正餐类型")
private Integer type;
/** 配餐号 */
@Excel(name = "配餐号")
private Long number;
/** 配餐频次 */
@Excel(name = "配餐频次")
private String frequency;
/** 用法 */
@Excel(name = "用法")
private Integer usage;
/** 是否代替正餐 */
private Integer isReplace;
/** 作废标志 */
private Integer flag;
/** 更新日期 */
private Date updateAt;
/** 更新人 */
@Excel(name = "更新人")
private String updateBy;
/** 创建时间 */
@Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createAt;
/** 创建人 */
private String createBy;
/** 描述 */
@Excel(name = "描述")
private String describe;
}

View File

@ -0,0 +1,14 @@
package com.ruoyi.system.fantang.mapper;
import com.ruoyi.system.fantang.domain.FtCateringDao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 配餐功能Mapper接口
*
* @author ft
* @date 2020-12-07
*/
public interface FtCateringDaoMapper extends BaseMapper<FtCateringDao> {
}

View File

@ -0,0 +1,14 @@
package com.ruoyi.system.fantang.service;
import com.ruoyi.system.fantang.domain.FtCateringDao;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 配餐功能Service接口
*
* @author ft
* @date 2020-12-07
*/
public interface IFtCateringDaoService extends IService<FtCateringDao> {
}

View File

@ -0,0 +1,18 @@
package com.ruoyi.system.fantang.service.impl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.fantang.mapper.FtCateringDaoMapper;
import com.ruoyi.system.fantang.domain.FtCateringDao;
import com.ruoyi.system.fantang.service.IFtCateringDaoService;
/**
* 配餐功能Service业务层处理
*
* @author ft
* @date 2020-12-07
*/
@Service
public class FtCateringDaoServiceImpl extends ServiceImpl<FtCateringDaoMapper, FtCateringDao> implements IFtCateringDaoService {
}

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.fantang.mapper.FtCateringDaoMapper">
<resultMap type="FtCateringDao" id="FtCateringDaoResult">
<result property="id" column="id" />
<result property="patientId" column="patient_id" />
<result property="type" column="type" />
<result property="number" column="number" />
<result property="frequency" column="frequency" />
<result property="usage" column="usage" />
<result property="isReplace" column="is_replace" />
<result property="flag" column="flag" />
<result property="updateAt" column="update_at" />
<result property="updateBy" column="update_by" />
<result property="createAt" column="create_at" />
<result property="createBy" column="create_by" />
<result property="describe" column="describe" />
</resultMap>
</mapper>

View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询配餐功能列表
export function listCatering(query) {
return request({
url: '/fantang/catering/list',
method: 'get',
params: query
})
}
// 查询配餐功能详细
export function getCatering(id) {
return request({
url: '/fantang/catering/' + id,
method: 'get'
})
}
// 新增配餐功能
export function addCatering(data) {
return request({
url: '/fantang/catering',
method: 'post',
data: data
})
}
// 修改配餐功能
export function updateCatering(data) {
return request({
url: '/fantang/catering',
method: 'put',
data: data
})
}
// 删除配餐功能
export function delCatering(id) {
return request({
url: '/fantang/catering/' + id,
method: 'delete'
})
}
// 导出配餐功能
export function exportCatering(query) {
return request({
url: '/fantang/catering/export',
method: 'get',
params: query
})
}

View File

@ -9,6 +9,22 @@ export function listPatient(query) {
})
}
// 根据 departId 查询病人列表
export function selectPatientByDepartId(departId) {
return request({
url: '/fantang/patient/selectPatientByDepartId/' + departId,
method: 'get',
})
}
// 根据 patientId 查询病人床号
export function getBedIdById(patientId) {
return request({
url: '/fantang/patient/getBedIdById/' + patientId,
method: 'get',
})
}
// 查询病人管理详细
export function getPatient(patientId) {
return request({
@ -50,4 +66,4 @@ export function exportPatient(query) {
method: 'get',
params: query
})
}
}

View File

@ -0,0 +1,554 @@
<template>
<div class="app-container">
<!-- 搜索栏-->
<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"
/>
</el-form-item>
<el-form-item label="姓名" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入姓名"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="科室" prop="departId">
<el-select v-model="queryParams.departId"
size="small"
@keyup.enter.native="handleQuery"
placeholder="请选择科室">
<el-option
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="bedId">
<el-input
v-model="queryParams.bedId"
placeholder="请输入床号"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否启用" prop="flag">
<el-select v-model="queryParams.flag"
size="small"
@keyup.enter.native="handleQuery"
placeholder="请选是否启用">
<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>
</el-form-item>
</el-form>
<!-- 功能按钮栏-->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['fantang:catering:add']"
>新增
</el-button>
</el-col>
<el-col :span="1.5" v-if="false">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['fantang:catering: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:catering:remove']"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click=""
v-hasPermi="['fantang:catering:remove']"
>作废
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click=""
v-hasPermi="['fantang:catering:remove']"
>每日简报
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click=""
v-hasPermi="['fantang:catering:remove']"
>记录表
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click=""
v-hasPermi="['fantang:catering:remove']"
>拷贝并新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click=""
v-hasPermi="['fantang:catering:remove']"
>拷贝
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click=""
v-hasPermi="['fantang:catering:remove']"
>粘贴
</el-button>
</el-col>
<el-col :span="1.5" v-if="false">
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['fantang:catering:export']"
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 数据列表栏-->
<el-table v-loading="loading" :data="cateringList" @selection-change="handleSelectionChange" broder>
<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="departName"/>
<el-table-column label="姓名" align="center" prop="name"/>
<el-table-column label="床号" align="center" prop="bedId"/>
<el-table-column label="正餐类型" align="center" prop="type" :formatter="typeFormat" v-if="false"/>
<el-table-column label="配餐号" align="center" prop="number"/>
<el-table-column label="配餐频次" align="center" prop="frequency"/>
<el-table-column label="用法" align="center" prop="usage"/>
<el-table-column label="描述" align="center" prop="describe"/>
<el-table-column label="启用标示" align="center" prop="flag"/>
<el-table-column label="创建时间" align="center" prop="createAt" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createAt, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="更新人" align="center" prop="updateBy"/>
<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="handleUpdate(scope.row)"
v-hasPermi="['fantang:catering:edit']"
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['fantang:catering: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"
/>
<!-- 添加或修改配餐功能对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="科室" prop="departId">
<el-select v-model="form.departId"
placeholder="请选择科室"
@change="changeDepart">
<el-option
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="patientId">
<el-select v-model="form.patientId" placeholder="请选择病人" @change="changePatient">
<el-option
v-for="item in patientOptions"
:key="item.name"
:label="item.name"
:value="item.patientId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="床号" prop="bedId">
<el-input v-model="form.bedId" placeholder="床号" :disabled="true"/>
</el-form-item>
<el-row :gutter="10">
<el-col :span="12">
<el-form-item label="配餐号" prop="number">
<el-input v-model="form.number" placeholder="请输入配餐号"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="用法" prop="usage">
<el-select v-model="form.usage" placeholder="请选择用法">
<el-option
v-for="item in usageOptions"
:key="item.label"
:label="item.label"
:value="item.label"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="12">
<el-form-item label="正餐类型" prop="type">
<el-select v-model="form.type"
multiple
@change="changeDinnerType"
placeholder="请选择正餐类型">
<el-option
v-for="dict in typeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="配餐频次" prop="frequency">
<el-select v-model="form.frequency" placeholder="请选择频次">
<el-option
v-for="item in frequencyOptions"
:key="item.label"
:label="item.label"
:value="item.label"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
addCatering,
delCatering,
exportCatering,
getCatering,
listCatering,
updateCatering
} from "@/api/fantang/catering";
import {listDepart} from "@/api/fantang/depart";
import {getBedIdById, selectPatientByDepartId} from "@/api/fantang/patient";
export default {
name: "Catering",
components: {},
data() {
return {
//
frequencyOptions:[{
value: 'qd',
label: 'qd'
}, {
value: 'bid',
label: 'bid'
}, {
value: 'tid',
label: 'tid'
}, {
value: 'qn',
label: 'qn'
}
],
//
usageOptions: [{
value: 1,
label: '鼻饲'
}, {
value: 2,
label: '口服'
}],
//
flagOptions: [{
value: 1,
label: '是'
}, {
value: 0,
label: '否'
}],
//
departOptions: [],
//
patientOptions: [],
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
cateringList: [],
//
title: "",
//
open: false,
//
typeOptions: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
flag: null,
hospitalId: null,
name: null,
departId: null,
bedId: null,
},
//
form: {},
//
rules: {}
};
},
created() {
this.getList();
this.getDicts("ft_book_type").then(response => {
this.typeOptions = response.data;
});
listDepart().then(response => {
this.departOptions = response.rows;
})
},
methods: {
//
changeDinnerType(value) {
console.log(value)
if (value.length === 1)
this.form.frequency = 'qd';
else if (value.length === 2)
this.form.frequency = 'bid';
else if (value.length === 3)
this.form.frequency = 'tid';
else
this.form.frequency = 'qn';
},
//
changeDepart(value) {
selectPatientByDepartId(value).then(response => {
this.patientOptions = response.data;
});
},
//
changePatient(value) {
const _this = this;
getBedIdById(value).then(response => {
console.log("aaaaaaa", response);
_this.form.bedId = response.msg;
console.log(_this.form.bedId);
})
},
/** 查询配餐功能列表 */
getList() {
this.loading = true;
listCatering(this.queryParams).then(response => {
this.cateringList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
typeFormat(row, column) {
return this.selectDictLabel(this.typeOptions, row.type);
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
patientId: null,
type: null,
number: null,
frequency: null,
usage: null,
isReplace: null,
flag: null,
updateAt: null,
updateBy: null,
createAt: null,
createBy: null,
describe: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加配餐功能";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getCatering(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改配餐功能";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateCatering(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addCatering(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除配餐功能编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
return delCatering(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有配餐功能数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
return exportCatering(queryParams);
}).then(response => {
this.download(response.msg);
})
}
}
};
</script>