增加填充新病患的报餐默认配置数据

This commit is contained in:
czx 2020-11-27 17:13:41 +08:00
parent 7ab0d24e50
commit 0ef4ec268e
5 changed files with 24 additions and 3 deletions

View File

@ -16,6 +16,6 @@ public class FtGenerateOrderTask {
private FtFoodDemandDaoServiceImpl foodDemandDaoService; private FtFoodDemandDaoServiceImpl foodDemandDaoService;
public void GenerateOrderTask() { public void GenerateOrderTask() {
System.out.println("执行生成一条病患默认订餐配置记录"); System.out.println("执行生成一条病患默认订餐配置记录");
foodDemandDaoService.GenerateOrderByPatientId(4L); foodDemandDaoService.GenerateOrderForNewPatient();
} }
} }

View File

@ -15,7 +15,7 @@ import org.springframework.stereotype.Component;
*/ */
@DataSource(value = DataSourceType.SLAVE) @DataSource(value = DataSourceType.SLAVE)
@Component("SyncPatient") @Component("SyncPatient")
public class ftSyncPatient { public class ftSyncPatientTask {
@Autowired @Autowired
private FtRemotePatientDaoMapper ftRemotePatientDaoMapper; private FtRemotePatientDaoMapper ftRemotePatientDaoMapper;

View File

@ -4,6 +4,9 @@ import com.ruoyi.system.fantang.domain.FtFoodDemandDao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/** /**
* 病人报餐Mapper接口 * 病人报餐Mapper接口
@ -12,7 +15,9 @@ import org.apache.ibatis.annotations.Param;
* @date 2020-11-26 * @date 2020-11-26
*/ */
public interface FtFoodDemandDaoMapper extends BaseMapper<FtFoodDemandDao> { public interface FtFoodDemandDaoMapper extends BaseMapper<FtFoodDemandDao> {
@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) ; 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<Long> getNewPatientNotDemand();
} }

View File

@ -12,4 +12,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
public interface IFtFoodDemandDaoService extends IService<FtFoodDemandDao> { public interface IFtFoodDemandDaoService extends IService<FtFoodDemandDao> {
public Integer GenerateOrderByPatientId(Long patientId); public Integer GenerateOrderByPatientId(Long patientId);
public Integer GenerateOrderForNewPatient() ;
} }

View File

@ -6,6 +6,8 @@ import com.ruoyi.system.fantang.mapper.FtFoodDemandDaoMapper;
import com.ruoyi.system.fantang.domain.FtFoodDemandDao; import com.ruoyi.system.fantang.domain.FtFoodDemandDao;
import com.ruoyi.system.fantang.service.IFtFoodDemandDaoService; import com.ruoyi.system.fantang.service.IFtFoodDemandDaoService;
import java.util.List;
/** /**
* 病人报餐Service业务层处理 * 病人报餐Service业务层处理
* *
@ -19,4 +21,15 @@ public class FtFoodDemandDaoServiceImpl extends ServiceImpl<FtFoodDemandDaoMappe
public Integer GenerateOrderByPatientId(Long patientId) { public Integer GenerateOrderByPatientId(Long patientId) {
return this.baseMapper.GenerateOrderByPatientId(patientId); return this.baseMapper.GenerateOrderByPatientId(patientId);
} }
// 扫描所有未设置默认订餐信息的病人增加配置信息
@Override
public Integer GenerateOrderForNewPatient() {
// 获取所有未设置默认订餐需求病人
List<Long> newPatients = this.baseMapper.getNewPatientNotDemand();
for (Long patientId : newPatients) {
this.baseMapper.GenerateOrderByPatientId(patientId);
}
return newPatients.size();
}
} }