完善病患营养配餐“暂停”功能

This commit is contained in:
czx 2021-01-18 17:58:30 +08:00
parent 7026d78c34
commit 5273d1d669
5 changed files with 86 additions and 10 deletions

View File

@ -127,7 +127,7 @@ public class FtCateringDaoController extends BaseController {
}
/**
* 作废营养配餐数据
* 暂停多个病患营养配餐配置并更新默认报餐配置
*/
@PutMapping("/cancel/{ids}")
@Transactional
@ -140,7 +140,25 @@ public class FtCateringDaoController extends BaseController {
// 根据病人 id 修改报餐配置表营养餐启用标志
iFtFoodDemandDaoService.cancelNutritionByPatientId(ids);
return AjaxResult.success("已作废");
return AjaxResult.success("已暂停");
}
/**
* 恢复多个病患营养配餐配置并更新默认报餐配置
*/
@PutMapping("/restoreCatering/{ids}")
@Transactional
public AjaxResult restoreCatering(@PathVariable Long[] ids) {
System.out.println(Arrays.toString(ids));
// 根据病人 id 修改营养配餐启用标志
iFtCateringDaoService.cancelByPatientId(ids);
// 根据病人 id 修改报餐配置表营养餐启用标志
iFtFoodDemandDaoService.cancelNutritionByPatientId(ids);
return AjaxResult.success("已暂停");
}
/**
@ -175,11 +193,6 @@ public class FtCateringDaoController extends BaseController {
for (Long patientId : patientIds) {
Integer ftCateringDaoList = iFtCateringDaoService.copyAndAdd(patientId, data);
}
return null;
return AjaxResult.success();
}
}

View File

@ -114,5 +114,5 @@ public class FtCateringDao extends FtCateringVo {
// 暂停标志
@Excel(name = "停餐")
private Integer suspendFlag;
private Boolean suspendFlag;
}

View File

@ -92,11 +92,18 @@ public class FtCateringDaoServiceImpl extends ServiceImpl<FtCateringDaoMapper, F
FtCateringDao ftCateringDao = new FtCateringDao();
ftCateringDao.setFlag(false);
ftCateringDao.setUpdateAt(new Date());
ftCateringDao.setSuspendFlag(false);
for (Long id : ids) {
UpdateWrapper<FtCateringDao> wrapper = new UpdateWrapper<>();
wrapper.eq("patient_id", id);
rows += this.baseMapper.update(ftCateringDao, wrapper);
// 更新该病患的报餐配置记录
FtFoodDemandDao foodDemandDao = new FtFoodDemandDao();
foodDemandDao.setNutritionFoodFlag(false);
QueryWrapper<FtFoodDemandDao> wrapper1 = new QueryWrapper<>();
foodDemandDaoService.update(foodDemandDao, wrapper1);
}
return rows;

View File

@ -60,6 +60,15 @@ export function cancelCatering(id) {
})
}
// 恢复指定病患的营养配餐
export function restoreCatering(id) {
return request({
url: '/fantang/catering/restoreCatering/' + id,
method: 'put'
})
}
// 导出配餐功能
export function exportCatering(query) {
return request({

View File

@ -182,6 +182,11 @@
@selection-change="handleSelectionChange">
<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="suspendFlag" width="80px">
<template slot-scope="scope">
<el-checkbox v-model="scope.row.suspendFlag" @change="changeSuspend(scope.row, $event)">暂停</el-checkbox>
</template>
</el-table-column>
<el-table-column label="科室" align="center" prop="departName"/>
<el-table-column label="姓名" align="center" prop="name"/>
<el-table-column label="床号" align="center" prop="bedId"/>
@ -710,6 +715,19 @@ export default {
colspan: 0
};
}
} else if (columnIndex === 5) {
if (rowIndex % 4 === 0) {
return {
rowspan: 4,
colspan: 1
};
} else {
return {
rowspan: 0,
colspan: 0
};
}
} else if (columnIndex === 0) {
if (rowIndex % 4 === 0) {
return {
@ -929,10 +947,39 @@ export default {
this.msgSuccess("删除成功");
})
},
//
changeSuspend(row, e) {
if (e){
this.$confirm('是否暂停 “' + row.name + '” 的营养配餐数据?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
return cancelCatering(row.patientId);
}).then(() => {
this.getList();
this.msgSuccess("已暂停");
})
} else {
this.$confirm('是否恢复 “' + row.name + '” 的营养配餐数据?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
return restoreCatering(row.patientId);
}).then(() => {
this.getList();
this.msgSuccess("已恢复");
})
}
},
//
handleCancel(row) {
const ids = row.patientId || this.ids;
console.log("ids-----", ids);
console.log("ids-----", row);
this.$confirm('是否作废 “' + this.names + '” 的营养配餐数据?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",