优化:新增病患的时候,创建明天的报餐数据。

This commit is contained in:
czx 2021-02-02 18:20:54 +08:00
parent 99af8998bb
commit 7a253f1628
5 changed files with 24 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.fantang.domain.FtPatientDao;
import com.ruoyi.system.fantang.service.IFtFoodDemandDaoService;
import com.ruoyi.system.fantang.service.IFtPatientDaoService;
import com.ruoyi.system.fantang.service.IFtReportMealsDaoService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@ -37,6 +38,9 @@ public class FtPatientDaoController extends BaseController {
private final IFtFoodDemandDaoService iFtFoodDemandDaoService;
@Autowired
private IFtReportMealsDaoService reportMealsDaoService;
/**
* 查询病人管理列表
*/
@ -124,6 +128,7 @@ public class FtPatientDaoController extends BaseController {
iFtPatientDaoService.save(ftPatientDao);
iFtFoodDemandDaoService.GenerateOrderByPatientId(ftPatientDao.getPatientId());
reportMealsDaoService.insertTomorrowReportMealByPatient(ftPatientDao.getPatientId());
return AjaxResult.success("已添加");
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.fantang.domain.FtReportMealsDao;
import com.ruoyi.system.fantang.vo.FtReportMealVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
@ -39,6 +40,16 @@ public interface FtReportMealVoMapper extends BaseMapper<FtReportMealVo> {
"LEFT JOIN ft_nutrition_food e ON e.id = d.nutrition_food_id")
public void insertTomorrowReportMeal();
// 为指定病患生成次日报餐记录并通过ft_food 菜品价格计算菜单总价
@Insert("INSERT INTO ft_report_meals (create_at,type,patient_id,foods,settlement_flag,price,open_flag,nutrition_food_flag,nutrition_food_id,nutrition_food_price) " +
"SELECT date_add(now(), INTERVAL 1 DAY), d.type, d.patient_id, d.foods,0," +
"(SELECT sum(price) FROM ft_food f WHERE FIND_IN_SET(f.food_id, d.foods)) AS price," +
"d.open_flag,0,d.nutrition_food_id, e.price as nutrition_food_price " +
"FROM ft_food_demand d where d.patient_id = #{patientId}" +
"LEFT JOIN ft_patient p ON p.patient_id = d.patient_id AND p.off_flag = 0 " +
"LEFT JOIN ft_nutrition_food e ON e.id = d.nutrition_food_id")
public void insertTomorrowReportMealByPatient(@Param("patientId") Long patientId);
@Update("UPDATE ft_report_meals set dining_flag = 1, dining_at = now() where type = 1 and create_at =CURDATE()")
Integer updateBreakfastDinnerFlag();

View File

@ -42,5 +42,7 @@ public interface IFtReportMealsDaoService extends IService<FtReportMealsDao> {
List<FtReportMealVo> getStatisticsFoods(Integer departId, Date day);
List<FtReportMealsDao> listPatientReportMeals(FtReportMealsDao ftReportMealsDao);
void insertTomorrowReportMealByPatient(Long patientId);
}

View File

@ -145,4 +145,9 @@ public class FtReportMealsDaoServiceImpl extends ServiceImpl<FtReportMealsDaoMap
public List<FtReportMealsDao> listPatientReportMeals(FtReportMealsDao ftReportMealsDao) {
return this.baseMapper.listPatientReportMeals(ftReportMealsDao);
}
@Override
public void insertTomorrowReportMealByPatient(Long patientId) {
ftReportMealVoMapper.insertTomorrowReportMealByPatient(patientId);
}
}

View File

@ -41,7 +41,7 @@
"clipboard": "2.0.6",
"core-js": "3.8.1",
"echarts": "4.9.0",
"element-ui": "2.14.1",
"element-ui": "2.15.0",
"file-saver": "2.0.4",
"fuse.js": "6.4.3",
"highlight.js": "10.4.1",