package digital.laboratory.platform.imr.convert;
import cn.hutool.core.collection.CollUtil;
import com.google.common.collect.Lists;

import digital.laboratory.platform.imr.entity.DrugHandingOverApply;
import digital.laboratory.platform.imr.enums.DrugHandingOverApplyStatus;
import digital.laboratory.platform.imr.vo.DrugHandingOverApplyVO;

import java.util.List;

/**
 * 送缴申请转换类
 */
public class DrugHandingOverApplyConvert {

    public static DrugHandingOverApplyVO entityToVO(DrugHandingOverApply entity) {
        if (entity == null) return null;
        DrugHandingOverApplyVO drugHandingOverApplyVO = new DrugHandingOverApplyVO();
        drugHandingOverApplyVO.setId(entity.getId());
        drugHandingOverApplyVO.setHandingOverUser(entity.getHandingOverUser());
        drugHandingOverApplyVO.setHandingOverOrg(entity.getHandingOverOrg());
        drugHandingOverApplyVO.setHandingOverDate(entity.getHandingOverDate());
        drugHandingOverApplyVO.setApplyDate(entity.getApplyDate());
        drugHandingOverApplyVO.setStatus(entity.getStatus());
        drugHandingOverApplyVO.setStatusName(DrugHandingOverApplyStatus.fromStatus(entity.getStatus()).getDesc());
        drugHandingOverApplyVO.setReviewer(entity.getReviewer());
        drugHandingOverApplyVO.setReason(entity.getReason());
        return drugHandingOverApplyVO;
    }

    public static List<DrugHandingOverApplyVO> entityToVOList(List<DrugHandingOverApply> entityList) {
        List<DrugHandingOverApplyVO> drugHandingOverApplyVOlist = CollUtil.newArrayList();
        for (DrugHandingOverApply drugHandingOverApply :entityList) {
        	drugHandingOverApplyVOlist.add(entityToVO(drugHandingOverApply));
        }
        return drugHandingOverApplyVOlist;
    }
}
