diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/FtGenerateOrderTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/FtGenerateOrderTask.java new file mode 100644 index 000000000..dd964650f --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/FtGenerateOrderTask.java @@ -0,0 +1,21 @@ +package com.ruoyi.quartz.task; + +import com.ruoyi.system.fantang.service.impl.FtFoodDemandDaoServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 定时任务调度测试 + * + * @author ruoyi + */ +@Component("OrderingTask") +public class FtGenerateOrderTask { + + @Autowired + private FtFoodDemandDaoServiceImpl foodDemandDaoService; + public void GenerateOrderTask() { + System.out.println("执行生成一条病患默认订餐配置记录"); + foodDemandDaoService.GenerateOrderByPatientId(4L); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtFoodDemandDaoController.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtFoodDemandDaoController.java new file mode 100644 index 000000000..783f4da88 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtFoodDemandDaoController.java @@ -0,0 +1,116 @@ +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.FtFoodDemandDao; +import com.ruoyi.system.fantang.service.IFtFoodDemandDaoService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 病人报餐Controller + * + * @author ft + * @date 2020-11-26 + */ +@RequiredArgsConstructor(onConstructor_ = @Autowired) +@RestController +@RequestMapping("/fantang/foodDemand" ) +public class FtFoodDemandDaoController extends BaseController { + + private final IFtFoodDemandDaoService iFtFoodDemandDaoService; + + /** + * 查询病人报餐列表 + */ + @PreAuthorize("@ss.hasPermi('fantang:foodDemand:list')") + @GetMapping("/list") + public TableDataInfo list(FtFoodDemandDao ftFoodDemandDao) + { + startPage(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(ftFoodDemandDao); + if (ftFoodDemandDao.getType() != null){ + lqw.eq(FtFoodDemandDao::getType ,ftFoodDemandDao.getType()); + } + if (ftFoodDemandDao.getUpdateAt() != null){ + lqw.eq(FtFoodDemandDao::getUpdateAt ,ftFoodDemandDao.getUpdateAt()); + } + if (ftFoodDemandDao.getUpdateFrom() != null){ + lqw.eq(FtFoodDemandDao::getUpdateFrom ,ftFoodDemandDao.getUpdateFrom()); + } + List list = iFtFoodDemandDaoService.list(lqw); + return getDataTable(list); + } + + /** + * 导出病人报餐列表 + */ + @PreAuthorize("@ss.hasPermi('fantang:foodDemand:export')" ) + @Log(title = "病人报餐" , businessType = BusinessType.EXPORT) + @GetMapping("/export" ) + public AjaxResult export(FtFoodDemandDao ftFoodDemandDao) { + LambdaQueryWrapper lqw = new LambdaQueryWrapper(ftFoodDemandDao); + List list = iFtFoodDemandDaoService.list(lqw); + ExcelUtil util = new ExcelUtil(FtFoodDemandDao. class); + return util.exportExcel(list, "foodDemand" ); + } + + /** + * 获取病人报餐详细信息 + */ + @PreAuthorize("@ss.hasPermi('fantang:foodDemand:query')" ) + @GetMapping(value = "/{id}" ) + public AjaxResult getInfo(@PathVariable("id" ) Long id) { + return AjaxResult.success(iFtFoodDemandDaoService.getById(id)); + } + + /** + * 新增病人报餐 + */ + @PreAuthorize("@ss.hasPermi('fantang:foodDemand:add')" ) + @Log(title = "病人报餐" , businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody FtFoodDemandDao ftFoodDemandDao) { + return toAjax(iFtFoodDemandDaoService.save(ftFoodDemandDao) ? 1 : 0); + } + + /** + * 修改病人报餐 + */ + @PreAuthorize("@ss.hasPermi('fantang:foodDemand:edit')" ) + @Log(title = "病人报餐" , businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody FtFoodDemandDao ftFoodDemandDao) { + return toAjax(iFtFoodDemandDaoService.updateById(ftFoodDemandDao) ? 1 : 0); + } + + /** + * 删除病人报餐 + */ + @PreAuthorize("@ss.hasPermi('fantang:foodDemand:remove')" ) + @Log(title = "病人报餐" , businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}" ) + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(iFtFoodDemandDaoService.removeByIds(Arrays.asList(ids)) ? 1 : 0); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtFoodDemandDao.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtFoodDemandDao.java new file mode 100644 index 000000000..9a13a0167 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtFoodDemandDao.java @@ -0,0 +1,73 @@ +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_food_demand + * + * @author ft + * @date 2020-11-26 + */ +@Data +@ToString +@EqualsAndHashCode +@NoArgsConstructor +@Accessors(chain = true) +@TableName("ft_food_demand") +public class FtFoodDemandDao implements Serializable { + +private static final long serialVersionUID=1L; + + + /** id */ + @TableId(value = "id") + private Long id; + + /** 病人id */ + private Long patientId; + + /** 订单详情 */ + private String foods; + + /** 用餐类型 */ + @Excel(name = "用餐类型") + private Long type; + + /** 创建时间 */ + private Date createAt; + + /** 创建人 */ + private Long createBy; + + /** 总价 */ + @Excel(name = "总价") + private BigDecimal price; + + /** 有效期 */ + private Long term; + + /** 更新日期 */ + @Excel(name = "更新日期" , width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateAt; + + /** 更新操作人 id */ + private Long updateBy; + + /** 更新来源 */ + @Excel(name = "更新来源") + private Integer updateFrom; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtFoodDemandDaoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtFoodDemandDaoMapper.java new file mode 100644 index 000000000..6f89a109a --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/mapper/FtFoodDemandDaoMapper.java @@ -0,0 +1,18 @@ +package com.ruoyi.system.fantang.mapper; + +import com.ruoyi.system.fantang.domain.FtFoodDemandDao; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.Param; + +/** + * 病人报餐Mapper接口 + * + * @author ft + * @date 2020-11-26 + */ +public interface FtFoodDemandDaoMapper extends BaseMapper { + @Insert("insert into ft_food_demand (patient_id, foods, type) select #{patient_id}, food_list, type FROM ft_food_default") + public Integer GenerateOrderByPatientId(@Param("patient_id") Long patientId) ; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtFoodDemandDaoService.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtFoodDemandDaoService.java new file mode 100644 index 000000000..1cb6a4c3a --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/IFtFoodDemandDaoService.java @@ -0,0 +1,15 @@ +package com.ruoyi.system.fantang.service; + +import com.ruoyi.system.fantang.domain.FtFoodDemandDao; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * 病人报餐Service接口 + * + * @author ft + * @date 2020-11-26 + */ +public interface IFtFoodDemandDaoService extends IService { + public Integer GenerateOrderByPatientId(Long patientId); + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtFoodDemandDaoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtFoodDemandDaoServiceImpl.java new file mode 100644 index 000000000..aac3a6177 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/service/impl/FtFoodDemandDaoServiceImpl.java @@ -0,0 +1,22 @@ +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.FtFoodDemandDaoMapper; +import com.ruoyi.system.fantang.domain.FtFoodDemandDao; +import com.ruoyi.system.fantang.service.IFtFoodDemandDaoService; + +/** + * 病人报餐Service业务层处理 + * + * @author ft + * @date 2020-11-26 + */ +@Service +public class FtFoodDemandDaoServiceImpl extends ServiceImpl implements IFtFoodDemandDaoService { + + @Override + public Integer GenerateOrderByPatientId(Long patientId) { + return this.baseMapper.GenerateOrderByPatientId(patientId); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/fantang/FtFoodDemandDaoMapper.xml b/ruoyi-system/src/main/resources/mapper/fantang/FtFoodDemandDaoMapper.xml new file mode 100644 index 000000000..e511c40f8 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/fantang/FtFoodDemandDaoMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-ui/src/api/fantang/foodDemand.js b/ruoyi-ui/src/api/fantang/foodDemand.js new file mode 100644 index 000000000..71dcc5de8 --- /dev/null +++ b/ruoyi-ui/src/api/fantang/foodDemand.js @@ -0,0 +1,53 @@ +import request from '@/utils/request' + +// 查询病人报餐列表 +export function listFoodDemand(query) { + return request({ + url: '/fantang/foodDemand/list', + method: 'get', + params: query + }) +} + +// 查询病人报餐详细 +export function getFoodDemand(id) { + return request({ + url: '/fantang/foodDemand/' + id, + method: 'get' + }) +} + +// 新增病人报餐 +export function addFoodDemand(data) { + return request({ + url: '/fantang/foodDemand', + method: 'post', + data: data + }) +} + +// 修改病人报餐 +export function updateFoodDemand(data) { + return request({ + url: '/fantang/foodDemand', + method: 'put', + data: data + }) +} + +// 删除病人报餐 +export function delFoodDemand(id) { + return request({ + url: '/fantang/foodDemand/' + id, + method: 'delete' + }) +} + +// 导出病人报餐 +export function exportFoodDemand(query) { + return request({ + url: '/fantang/foodDemand/export', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/views/fantang/foodDemand/index.vue b/ruoyi-ui/src/views/fantang/foodDemand/index.vue new file mode 100644 index 000000000..acf6599b9 --- /dev/null +++ b/ruoyi-ui/src/views/fantang/foodDemand/index.vue @@ -0,0 +1,320 @@ + + +