优化:初始化病患数据时,默认将加餐状态设置为禁用

This commit is contained in:
czx 2021-01-15 10:52:32 +08:00
parent 7fa65bfe15
commit a8a1b53794
2 changed files with 7 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import com.ruoyi.system.fantang.domain.FtReportMealsDao;
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 java.util.List;
@ -58,4 +59,7 @@ public interface FtFoodDemandDaoMapper extends BaseMapper<FtFoodDemandDao> {
"\ta.type,\n" +
"\tc.depart_name")
List<FtReportMealsDao> getStatisticsFoodDemand();
@Update("UPDATE ft_food_demand set flag = 0 where patient_id = #{patientId} and type = 4 ")
void updateExtraByPatientId(@Param("patientId") Long patientId);
}

View File

@ -32,7 +32,10 @@ public class FtFoodDemandDaoServiceImpl extends ServiceImpl<FtFoodDemandDaoMappe
// 获取所有未设置默认订餐需求病人
List<Long> newPatients = this.baseMapper.getNewPatientNotDemand();
for (Long patientId : newPatients) {
// 先创建四个用餐信息
this.baseMapper.GenerateOrderByPatientId(patientId);
// 更新加餐信息为禁用状态
this.baseMapper.updateExtraByPatientId(patientId);
}
return newPatients.size();
}