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

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

import java.util.List;

public interface OutpatientOrderDetailRepository extends JpaRepository<OutpatientOrderDetail, Integer>, JpaSpecificationExecutor<OutpatientOrderDetail> {
    @Query(value = "select count(*) from outpatient_order_detail where his_order_no = ? and code = ? and deleted = 0", nativeQuery = true)
    int countByHisOrderNoAndCode(String hisOrderNo, String code);

    @Query(value = "select * from outpatient_order_detail where his_order_no = ? and deleted = 0", nativeQuery = true)
    List<OutpatientOrderDetail> getByHisOrderNo(String hisOrderNo);
}