package com.bonus.canteen.core.nutrition.common.service;

import cn.hutool.core.collection.CollectionUtil;
import com.bonus.canteen.core.nutrition.common.mapper.HealthMedicalReportTmplMapper;
import com.bonus.canteen.core.nutrition.common.vo.HealthMedicalReportDetailVO;
import com.bonus.canteen.core.nutrition.common.vo.HealthMedicalReportProjectVO;
import com.bonus.canteen.core.nutrition.common.vo.HealthMedicalReportTmplVO;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.lang.invoke.SerializedLambda;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;

@Service
public class HealthMedicalReportTmplService {
   @Resource
   private HealthMedicalReportTmplMapper healthMedicalReportTmplMapper;

   public List<HealthMedicalReportTmplVO> listTemplate() {
      return this.healthMedicalReportTmplMapper.listTemplate();
   }

   public List<HealthMedicalReportProjectVO> getTemplateInfoByTmplId(Long medicalTemplateId) {
      List<HealthMedicalReportProjectVO> healthMedicalReportProjectVOS = this.healthMedicalReportTmplMapper.listReportProject(medicalTemplateId);
      if (CollectionUtil.isEmpty(healthMedicalReportProjectVOS)) {
         return healthMedicalReportProjectVOS;
      } else {
         Iterator var3 = healthMedicalReportProjectVOS.iterator();

         while(var3.hasNext()) {
            HealthMedicalReportProjectVO project = (HealthMedicalReportProjectVO)var3.next();
            List<HealthMedicalReportDetailVO> medicalReportDetailVOList = this.healthMedicalReportTmplMapper.listReportDetail(project.getMedicalProjectId());
            project.setMedicalReportDetailVOList(medicalReportDetailVOList);
         }

         return healthMedicalReportProjectVOS;
      }
   }

}
