<?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">
<!--
  namespace绑定了与之对应的接口,值是该接口的全限定名;这个参数有且只有一个
-->
<mapper namespace="com.joju.datamanager.mapper.OrderMapper">

    <select id="getOrderByDateAndDist" resultType="com.joju.datamanager.model.order.OrderVo">

        SELECT DISTINCT p.true_name,
                        o.cardno,
                        o.patient_id,
                        o.ksmc,
                        o.yyrq,
                        p.id_card
        FROM `order` o
                 INNER JOIN patient p ON o.cardno = p.medical_card
        WHERE o.`status` = '0'
          AND o.yyrq = #{yyrq}

    </select>


    <insert id="insertMissedAppoints" parameterType="java.util.List">


        insert into missed_appointment_record ( cardno
        , patient_id
        , ksmc
        , yyrq
        , true_name
        , id_card
        )
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (#{item.cardno},#{item.patientId},#{item.ksmc},#{item.yyrq},#{item.trueName},#{item.idCard})
        </foreach>

    </insert>

</mapper>