fix code get jadwal dokter

This commit is contained in:
2024-10-07 08:55:22 +07:00
parent 6a4c99b062
commit cff6639073
7 changed files with 185 additions and 41 deletions

No files matched your search

@@ -9,6 +9,45 @@ import (
"github.com/google/uuid"
)
func GetJadwalDokterByDPJP(dpjp string) (string, error) {
var id string
errSelect := config.SatuDataDB.Debug().Raw(`select "id" from "data_pegawai" where "Code_dpjp" = ?`, dpjp).First(&id).Error
if errSelect != nil {
log.Printf("Failed get data : %v", errSelect)
return "", errSelect
}
return id, nil
}
func GetJadwalSpesialisDokterByID(id string) (string, error) {
var spesialis string
errSelect := config.SatuDataDB.Debug().Raw(`select "Spesialis" from "daftar_jadwal_dokter" where "Dokter" = ? order by "Spesialis"`, id).First(&spesialis).Error
if errSelect != nil {
log.Printf("Failed get data : %v", errSelect)
return "", errSelect
}
return spesialis, nil
}
func GetJadwalHariDokterBySpesialis(id string) ([]jadwal_dokter.ListHari, error) {
var hari []jadwal_dokter.ListHari
errSelect := config.SatuDataDB.Debug().Raw(`select distinct "id", "Spesialis", "Nama_hari" from "daftar_jadwal_dokter" where "Spesialis" = ? order by "id"`, id).Scan(&hari).Error
if errSelect != nil {
log.Printf("Failed get data : %v", errSelect)
return nil, errSelect
}
return hari, nil
}
func GetJadwalDokterByIDDokter(hari string) ([]string, error) {
var spesialis []string
errSelect := config.SatuDataDB.Debug().Raw(`select distinct "Spesialis" from "daftar_jadwal_dokter" where "Nama_hari" = ? order by "Spesialis"`, hari).Scan(&spesialis).Error
if errSelect != nil {
log.Printf("Failed get data : %v", errSelect)
return nil, errSelect
}
return spesialis, nil
}
func GetJadwalDokterByDate(hari string) ([]string, error) {
var spesialis []string
errSelect := config.SatuDataDB.Debug().Raw(`select distinct "Spesialis" from "daftar_jadwal_dokter" where "Nama_hari" = ? order by "Spesialis"`, hari).Scan(&spesialis).Error