<?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="org.example.mapper.HospitalOverviewMapper">
    
    <!-- 结果映射 -->
    <resultMap id="HospitalOverviewResultMap" type="HospitalOverview">
        <id property="id" column="id"/>
        <result property="dizhi" column="dizhi"/>
        <result property="dianhua" column="dianhua"/>
        <result property="jieshao" column="jieshao"/>
    </resultMap>
    
    <!-- 获取医院概况信息 -->
    <select id="getHospitalOverview" resultMap="HospitalOverviewResultMap">
        SELECT id, dizhi, dianhua, jieshao FROM yiyuangaikuang LIMIT 1
    </select>
    
    <!-- 更新医院概况信息 -->
    <update id="updateHospitalOverview" parameterType="HospitalOverview">
        UPDATE yiyuangaikuang 
        SET 
            dizhi = #{dizhi},
            dianhua = #{dianhua},
            jieshao = #{jieshao}
        WHERE id = #{id}
    </update>
    
    <!-- 插入医院概况信息 -->
    <insert id="insertHospitalOverview" parameterType="HospitalOverview">
        INSERT INTO yiyuangaikuang(dizhi, dianhua, jieshao)
        VALUES (#{dizhi}, #{dianhua}, #{jieshao})
    </insert>
    
</mapper>