<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.server.report.mapper.MaternalInfantRelationshipMapper">


    <insert id="saveOrUpdate">
        INSERT INTO `docus_medicalrecord`.`t_maternal_infant_relationship`
        (`baby_id`, `baby_his_id`, `mom_id`, `parent_times`, `parent_his_id`, `hosp_code`, `create_time`, `update_time`)
        VALUES (#{PO.babyId}, #{PO.babyHisId}, #{PO.momId}, #{PO.parentTimes}, #{PO.parentHisId}, #{PO.hospCode}, NOW(),
                NOW())
        ON DUPLICATE KEY
        UPDATE
            `baby_his_id`=#{PO.babyHisId},
            `mom_id`= #{PO.momId},
            `parent_times`=#{PO.parentTimes},
            `parent_his_id`=#{PO.parentHisId},
            `hosp_code`=#{PO.hospCode},
            `update_time`=NOW()
    </insert>
</mapper>
