package com.ann.demo.repository;

import com.ann.demo.entity.interfaceEntity.ArchiveMaster;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.Date;

/**
 * @Author: LeiJiaXin
 * @Date: 2019/7/11 20:55
 */
public interface ArchiveMasterRepository extends JpaRepository<ArchiveMaster, String> {

    @Query(nativeQuery = true, value = " select  o.visit_id from archive_master o  " +
            "where ?1 between o.admission_date_time and  isnull(o.discharge_date_time,GETDATE()) and o.Is_Valid = 0 and o.inp_no = ?2 ")
    public String findVisitIdByTimeAndInpNo(Date admissionDateTime, String inpNo);
}
