package com.ywt.outpatient.domain.entity.center;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface LaboratoryDetailRepository extends JpaRepository<LaboratoryDetail, Integer> {
    @Query(value = "select count(0) from laboratory_detail where inspection_id = ? and deleted = 0;", nativeQuery = true)
    int count(String inspectionId);

    @Query(value = "select * from laboratory_detail where inspection_id = ? and deleted = 0;", nativeQuery = true)
    List<LaboratoryDetail> getListByInspectionId(String inspectionId);

    @Query(value = "select * from laboratory_detail where inspection_id = ? and hospital_id = ? and deleted = 0;", nativeQuery = true)
    List<LaboratoryDetail> getListByInspectionIdAndHospitalId(String inspectionId, int hospitalId);

    @Query(value = "select count(0) from laboratory_detail where his_patient_id = ? and inspection_id = ? and hospital_id = ? and deleted = 0;", nativeQuery = true)
    int getCount(String hisPatientId, String inspectionId, int hospitalId);
}
