package com.docus.server.report.converter;

import com.docus.server.report.dto.MaternalInfantRelationshipDTO;
import com.docus.server.report.entity.MaternalInfantRelationship;

import java.util.Objects;

/**
 * 关于 MaternalInfantRelationship 转换的类
 * @author wyb
 */
public class MaternalInfantRelationshipConverter {
    private final MaternalInfantRelationshipDTO dto;

    public MaternalInfantRelationshipConverter(MaternalInfantRelationshipDTO dto) {
        this.dto = dto;
    }

    /**
     * 传输对象转数据库映射对象
     * @return 数据库映射对象
     */
    public MaternalInfantRelationship dto2po() {
        Objects.requireNonNull(this.dto);
        MaternalInfantRelationshipDTO relationshipDTO = this.dto;
        MaternalInfantRelationship relationship = new MaternalInfantRelationship();
        relationship.setBabyId(relationshipDTO.getBabyId());
        relationship.setBabyHisId(relationshipDTO.getBabyHisId());
        relationship.setMomId(relationshipDTO.getMomId());
        relationship.setParentTimes(relationshipDTO.getParentTimes());
        relationship.setParentHisId(relationshipDTO.getParentHisId());
        relationship.setHospCode(relationshipDTO.getHospCode());
        return relationship;
    }
}
