From 5273d1d6692744f283431910dfd5876f9720cbdf Mon Sep 17 00:00:00 2001 From: czx <28353131@qq.com> Date: Mon, 18 Jan 2021 17:58:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=97=85=E6=82=A3=E8=90=A5?= =?UTF-8?q?=E5=85=BB=E9=85=8D=E9=A4=90=E2=80=9C=E6=9A=82=E5=81=9C=E2=80=9D?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FtCateringDaoController.java | 29 ++++++++--- .../system/fantang/domain/FtCateringDao.java | 2 +- .../impl/FtCateringDaoServiceImpl.java | 7 +++ ruoyi-ui/src/api/fantang/catering.js | 9 ++++ ruoyi-ui/src/views/fantang/catering/index.vue | 49 ++++++++++++++++++- 5 files changed, 86 insertions(+), 10 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtCateringDaoController.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtCateringDaoController.java index 600931795..d0c0d0563 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtCateringDaoController.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtCateringDaoController.java @@ -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(); } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtCateringDao.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtCateringDao.java index 0e0e4654d..dcfdcbe7b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtCateringDao.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtCateringDao.java @@ -114,5 +114,5 @@ public class FtCateringDao extends FtCateringVo { // 暂停标志 @Excel(name = "停餐") - private Integer suspendFlag; + private Boolean suspendFlag; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtCateringDaoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtCateringDaoServiceImpl.java index 2addd0b9c..2e292e0c4 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtCateringDaoServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtCateringDaoServiceImpl.java @@ -92,11 +92,18 @@ public class FtCateringDaoServiceImpl extends ServiceImpl wrapper = new UpdateWrapper<>(); wrapper.eq("patient_id", id); rows += this.baseMapper.update(ftCateringDao, wrapper); + + // 更新该病患的报餐配置记录 + FtFoodDemandDao foodDemandDao = new FtFoodDemandDao(); + foodDemandDao.setNutritionFoodFlag(false); + QueryWrapper wrapper1 = new QueryWrapper<>(); + foodDemandDaoService.update(foodDemandDao, wrapper1); } return rows; diff --git a/ruoyi-ui/src/api/fantang/catering.js b/ruoyi-ui/src/api/fantang/catering.js index 744607088..0aba68f46 100644 --- a/ruoyi-ui/src/api/fantang/catering.js +++ b/ruoyi-ui/src/api/fantang/catering.js @@ -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({ diff --git a/ruoyi-ui/src/views/fantang/catering/index.vue b/ruoyi-ui/src/views/fantang/catering/index.vue index 5a02db7db..432fa9357 100644 --- a/ruoyi-ui/src/views/fantang/catering/index.vue +++ b/ruoyi-ui/src/views/fantang/catering/index.vue @@ -182,6 +182,11 @@ @selection-change="handleSelectionChange"> + + + @@ -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: "取消",