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 index dd964650f..da7e11db5 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/FtGenerateOrderTask.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/FtGenerateOrderTask.java @@ -16,6 +16,6 @@ public class FtGenerateOrderTask { private FtFoodDemandDaoServiceImpl foodDemandDaoService; public void GenerateOrderTask() { System.out.println("执行生成一条病患默认订餐配置记录"); - foodDemandDaoService.GenerateOrderByPatientId(4L); + foodDemandDaoService.GenerateOrderForNewPatient(); } } diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/ftSyncPatient.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/ftSyncPatientTask.java similarity index 96% rename from ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/ftSyncPatient.java rename to ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/ftSyncPatientTask.java index 8c6b978d3..1e3f19712 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/ftSyncPatient.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/ftSyncPatientTask.java @@ -15,7 +15,7 @@ import org.springframework.stereotype.Component; */ @DataSource(value = DataSourceType.SLAVE) @Component("SyncPatient") -public class ftSyncPatient { +public class ftSyncPatientTask { @Autowired private FtRemotePatientDaoMapper ftRemotePatientDaoMapper; 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 index 6f89a109a..cff14af12 100644 --- 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 @@ -4,6 +4,9 @@ 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; +import org.apache.ibatis.annotations.Select; + +import java.util.List; /** * 病人报餐Mapper接口 @@ -12,7 +15,9 @@ import org.apache.ibatis.annotations.Param; * @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") + @Insert("insert into ft_food_demand (patient_id, foods, type, price) select #{patient_id}, food_list, type, price FROM ft_food_default") public Integer GenerateOrderByPatientId(@Param("patient_id") Long patientId) ; + @Select("select a.patient_id from ft_patient a where a.patient_id not in (select patient_id from ft_food_demand c )") + public List getNewPatientNotDemand(); } 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 index 1cb6a4c3a..9269c2c7a 100644 --- 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 @@ -12,4 +12,7 @@ import com.baomidou.mybatisplus.extension.service.IService; public interface IFtFoodDemandDaoService extends IService { public Integer GenerateOrderByPatientId(Long patientId); + public Integer GenerateOrderForNewPatient() ; + + } 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 index aac3a6177..5b6faacaf 100644 --- 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 @@ -6,6 +6,8 @@ import com.ruoyi.system.fantang.mapper.FtFoodDemandDaoMapper; import com.ruoyi.system.fantang.domain.FtFoodDemandDao; import com.ruoyi.system.fantang.service.IFtFoodDemandDaoService; +import java.util.List; + /** * 病人报餐Service业务层处理 * @@ -19,4 +21,15 @@ public class FtFoodDemandDaoServiceImpl extends ServiceImpl newPatients = this.baseMapper.getNewPatientNotDemand(); + for (Long patientId : newPatients) { + this.baseMapper.GenerateOrderByPatientId(patientId); + } + return newPatients.size(); + } }