select registid,
               serialnum,
               patid,
               hospitalname,
               hospitalcode,
               deptcode,
               deptname,
               deptid,
               state,
               appointmenttime,
               appointmenttimetype,
               appointmentcode,
               appointmentbegintime,
               appointmentendtime,
               orgid,
               del_flag,
               update_by,
               update_time,
               create_by,
               create_time,
               isupload,
               upload_time,
               pid,
               guid
        from pat_med_registration
    
    
    
    
        insert into pat_med_registration
        
            registid,
            serialnum,
            patid,
            hospitalname,
            hospitalcode,
            deptcode,
            deptname,
            deptid,
            state,
            appointmenttime,
            appointmenttimetype,
            appointmentcode,
            appointmentbegintime,
            appointmentendtime,
            orgid,
            del_flag,
            update_by,
            update_time,
            create_by,
            create_time,
            isupload,
            upload_time,
            pid,
            guid,
        
        
            #{registid},
            #{serialnum},
            #{patid},
            #{hospitalname},
            #{hospitalcode},
            #{deptcode},
            #{deptname},
            #{deptid},
            #{state},
            #{appointmenttime},
            #{appointmenttimetype},
            #{appointmentcode},
            #{appointmentbegintime},
            #{appointmentendtime},
            #{orgid},
            #{delFlag},
            #{updateBy},
            #{updateTime},
            #{createBy},
            #{createTime},
            #{isupload},
            #{uploadTime},
            #{pid},
            #{guid},
        
    
    
        update pat_med_registration
        
            serialnum = #{serialnum},
            patid = #{patid},
            hospitalname = #{hospitalname},
            hospitalcode = #{hospitalcode},
            deptcode = #{deptcode},
            deptname = #{deptname},
            deptid = #{deptid},
            state = #{state},
            appointmenttime = #{appointmenttime},
            appointmenttimetype = #{appointmenttimetype},
            appointmentcode = #{appointmentcode},
            appointmentbegintime = #{appointmentbegintime},
            appointmentendtime = #{appointmentendtime},
            orgid = #{orgid},
            del_flag = #{delFlag},
            update_by = #{updateBy},
            update_time = #{updateTime},
            create_by = #{createBy},
            create_time = #{createTime},
            isupload = #{isupload},
            upload_time = #{uploadTime},
            pid = #{pid},
            guid = #{guid},
        
        where registid = #{registid}
    
    
        delete
        from pat_med_registration
        where registid = #{registid}
    
    
        update pat_med_registration
        
            del_flag =1
        
        where registid in
        
            #{registid}