package com.jasamedika.medifirst2000.dao; import java.util.List; import java.util.Map; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import com.jasamedika.medifirst2000.entities.DiagnosaKeperawatan; @Repository("DiagnosaKeperawatanDao") public interface DiagnosaKeperawatanDao extends PagingAndSortingRepository{ @Query("select NEW Map (" + "a.id as id, " + "a.namaDiagnosaKep as namaDiagnosaKep) " + "from DiagnosaKeperawatan a ") List> getAllDiagnosaKeperawatan(); @Query("select NEW Map (" + "a.id as id, " + "a.namaDiagnosaKep as namaDiagnosaKep) " + "from DiagnosaKeperawatan a where a.id=:id") Map getOneDiagnosaKeperawatan(@Param("id") Integer id); @Query("select NEW Map (" + "a.id as id, " + "a.name as name) " + "from Intervensi a " + "left join a.diagnosaKeperawatan b " + "where b.id=:id") List> getIntervensiDetailByDiagnosa(@Param("id") Integer id); @Query("select NEW Map (" + "a.id as id, " + "a.name as name) " + "from Implementasi a " + "left join a.diagnosaKeperawatan b " + "where b.id=:id") List> getImplementasiDetailByDiagnosa(@Param("id") Integer id); @Query("select NEW Map (" + "a.id as id, " + "a.name as name) " + "from Evaluasi a " + "left join a.diagnosaKeperawatan b " + "where b.id=:id") List> getEvaluasiDetailByDiagnosa(@Param("id") Integer id); // @Query("select distinct NEW Map (" // + "a.tglDitemukan as tglDitemukan," // + "a.tglTeratasi as tglTeratasi," // + "a.tglInput as tglInput," // + "f.namaDiagnosaKep as namaDiagnosaKep," // + "f.id as diagnosaKepId," // + "g.namaLengkap as namaPegawai," // + "g.id as pegawaiId," // + "h.namaRuangan as namaRuangan," // + "h.id as ruanganId) " // + "from DiagnosaKeperawatanTransaksi a " // + "left join a.pasienDaftar b " // + "left join a.diagnosaKeperawatan f " // + "left join a.pegawai g " // + "left join a.ruangan h " // + "where b.noRec=:noRec and a.tglTeratasi is null") // Map getDetailDiagnosaKeperawatanTransaction(@Param("noRec") String noRec); @Query("select NEW Map (" + "a.tglDitemukan as tglDitemukan," + "a.tglTeratasi as tglTeratasi," + "a.tglInput as tglInput," + "g.namaLengkap as namaPegawai," + "g.id as pegawaiId," + "h.namaRuangan as namaRuangan," + "h.id as ruanganId) " + "from DiagnosaKeperawatanTransaksi a " + "left join a.pasienDaftar b " + "left join a.pegawai g " + "left join a.ruangan h " + "where b.noRec=:noRec and a.tglTeratasi is null") Map header(@Param("noRec") String noRec); @Query("select NEW Map (" + "f.namaDiagnosaKep as namaDiagnosaKep," + "f.id as diagnosaKepId," + "a.noRec as noRec," + "c.id as id," + "c.name as name) " + "from DiagnosaKeperawatanTransaksi a " + "left join a.pasienDaftar b " + "left join a.implementasi c " + "left join a.diagnosaKeperawatan f " + "where b.noRec=:noRec and a.tglTeratasi is null") List> getDetailDiagnosaKeperawatanTransactionImplementasi(@Param("noRec") String noRec); @Query("select NEW Map (" + "f.namaDiagnosaKep as namaDiagnosaKep," + "f.id as diagnosaKepId," + "a.noRec as noRec," + "d.id as id," + "d.name as name) " + "from DiagnosaKeperawatanTransaksi a " + "left join a.pasienDaftar b " + "left join a.intervensi d " + "left join a.diagnosaKeperawatan f " + "where b.noRec=:noRec and a.tglTeratasi is null") List> getDetailDiagnosaKeperawatanTransactionIntervensi(@Param("noRec") String noRec); @Query("select NEW Map (" + "f.namaDiagnosaKep as namaDiagnosaKep," + "f.id as diagnosaKepId," + "a.noRec as noRec," + "e.id as id," + "e.name as name) " + "from DiagnosaKeperawatanTransaksi a " + "left join a.pasienDaftar b " + "left join a.evaluasi e " + "left join a.diagnosaKeperawatan f " + "where b.noRec=:noRec and a.tglTeratasi is null") List> getDetailDiagnosaKeperawatanTransactionEvaluasi(@Param("noRec") String noRec); }