package com.diagbot.facade;

import com.diagbot.entity.BuriedSomeStatistical;
import com.diagbot.service.impl.BuriedSomeStatisticalServiceImpl;
import com.diagbot.util.DateUtil;
import com.diagbot.vo.BuriedSomeStatisticalVO;
import com.diagbot.vo.Taggeds;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @author wangfeng
 * @Description: TODO
 * @date 2018年12月3日 上午9:24:35
 */
@Component
public class BuriedSomeStatisticalFacade extends BuriedSomeStatisticalServiceImpl {

    /**
     * 批量保存
     *
     * @param buriedSomeStatisticalVO
     * @return
     */
    public boolean saveBuriedSomeStatistical(BuriedSomeStatisticalVO buriedSomeStatisticalVO) {
        List<BuriedSomeStatistical> buriedList = new ArrayList<BuriedSomeStatistical>();
        List<Taggeds> taggeds = buriedSomeStatisticalVO.getTaggeds();
        for (Taggeds taggedsNew : taggeds) {
            BuriedSomeStatistical buriedData = new BuriedSomeStatistical();
            buriedData.setCreator(buriedSomeStatisticalVO.getDoctorId().toString());
            buriedData.setDoctorId(buriedSomeStatisticalVO.getDoctorId());
            buriedData.setGmtCreate(DateUtil.now());
            buriedData.setHospitalDeptId(buriedSomeStatisticalVO.getHospitalDeptId());
            buriedData.setHospitalId(buriedSomeStatisticalVO.getHospitalId());
            buriedData.setInquiryCode(buriedSomeStatisticalVO.getInquiryCode());
            buriedData.setPatientId(buriedSomeStatisticalVO.getPatientId());
            buriedData.setLabelId(taggedsNew.getLabelId());
            buriedData.setLabelName(taggedsNew.getLabelName());
            buriedData.setOperationNum(taggedsNew.getOperationNum());
            buriedData.setOperationType(taggedsNew.getOperationType());
            buriedData.setStatus(taggedsNew.getStatus());
            buriedList.add(buriedData);
        }

        boolean res = insertCodeBatch(buriedList);
        return res;
    }


}
