package thyyxxk.webserver.dao.his.technologyArchives;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import thyyxxk.webserver.entity.technologyArchives.TechnologyArchivesHL7;

import java.util.Map;

@Mapper
public interface TechnologyArchivesHL7Dao extends BaseMapper<TechnologyArchivesHL7> {

    @Select(" select * from technology_archives_hl7 where social_no = #{socialNo} and id = #{id} ")
    TechnologyArchivesHL7 selectTechnologyArchivesHL7ById(@Param("socialNo") String socialNo, @Param("id") Integer id);

    @Select(" select image  from  technology_archives_hl7 where social_no = #{socialNo} and id = #{id}")
    Map<String, Object> selectHL7Image(@Param("socialNo") String socialNo, @Param("id") Integer id);

    @Update(" update technology_archives_hl7 set image = #{url} where social_no = #{socialNo}  and approval_time = #{approvalTime} ")
    int updateHL7Image(@Param("socialNo") String socialNo, @Param("approvalTime") String approvalTime, String url);
    @Select(" select isnull(max(id), 0) as id from technology_archives_hl7 where social_no = #{socialNo} ")
    int selectTechnologyArchivesHL7MaxId(@Param("socialNo") String socialNo);

    @Update(" delete from technology_archives_hl7 where social_no = #{socialNo} and approval_time = #{approvalTime} ")
    int delTechnologyArchivesHL7ByCode(@Param("socialNo") String socialNo, @Param("approvalTime") String approvalTime);

}
