2026-07-26 14:39:10 +02:00
/ *
* To change this license header , choose License Headers in Project Properties .
* To change this template file , choose Tools | Templates
* and open the template in the editor .
* /
package com.triz.trizservice.service.impl ;
2026-09-04 11:45:31 +02:00
import com.triz.trizservice.modeles.AlertesMedicales ;
2026-07-30 10:37:16 +02:00
import com.triz.trizservice.modeles.Centre ;
2026-08-10 14:05:33 +02:00
import com.triz.trizservice.modeles.Consultation ;
2026-09-04 11:45:31 +02:00
import com.triz.trizservice.modeles.Examen ;
2026-08-13 16:57:29 +02:00
import com.triz.trizservice.modeles.Machine ;
2026-08-10 14:05:33 +02:00
import com.triz.trizservice.modeles.Medecin ;
import com.triz.trizservice.modeles.MedecinSpecialiste ;
2026-09-04 11:45:31 +02:00
import com.triz.trizservice.modeles.Patient ;
import com.triz.trizservice.modeles.Queue ;
2026-08-13 16:57:29 +02:00
import com.triz.trizservice.modeles.SalleDeSoin ;
2026-07-26 14:39:10 +02:00
import com.triz.trizservice.service.DaoService ;
import com.triz.trizservice.modeles.ServiceFonctiongroupe ;
import com.triz.trizservice.modeles.ServiceFonctionnaliter ;
import com.triz.trizservice.modeles.ServiceGroupe ;
import com.triz.trizservice.modeles.ServiceIncrementation ;
import com.triz.trizservice.modeles.ServiceMember ;
import com.triz.trizservice.modeles.ServiceUser ;
import com.triz.trizservice.modeles.ServicehistoriqueConnection ;
import com.triz.trizservice.modeles.ServiceHistoriqueManipulation ;
2026-07-30 10:37:16 +02:00
import com.triz.trizservice.modeles.ServiceUserCentre ;
2026-08-10 14:05:33 +02:00
import com.triz.trizservice.modeles.SpecialiteMedicale ;
2026-08-13 16:57:29 +02:00
import com.triz.trizservice.modeles.TypeAlerteMedical ;
import com.triz.trizservice.modeles.TypeExamen ;
import com.triz.trizservice.modeles.TypealerteTypeexamen ;
2026-07-30 10:37:16 +02:00
import com.triz.trizservice.modeles.Wilaya ;
2026-08-05 14:35:11 +02:00
import java.io.Serializable ;
2026-07-26 14:39:10 +02:00
import java.util.Date ;
import java.util.List ;
2026-08-03 14:29:20 +02:00
import java.util.UUID ;
2026-07-26 14:39:10 +02:00
import javax.annotation.Resource ;
import javax.persistence.NoResultException ;
import javax.persistence.criteria.CriteriaBuilder ;
import javax.persistence.criteria.CriteriaQuery ;
import javax.persistence.criteria.Root ;
import org.hibernate.Session ;
import org.hibernate.SessionFactory ;
import org.hibernate.criterion.Order ;
import org.hibernate.criterion.Restrictions ;
import org.springframework.stereotype.Repository ;
/ * *
*
* @author abder_000
* /
@Repository ( )
public class DaoServiceImpl implements DaoService {
@Resource ( name = " sessionFactory " )
SessionFactory sessionFactory ;
private Session getCurrentSession ( ) {
if ( sessionFactory . getCurrentSession ( ) = = null ) {
return sessionFactory . openSession ( ) ;
}
sessionFactory . getCurrentSession ( ) . clear ( ) ;
return sessionFactory . getCurrentSession ( ) ;
}
@Override
public List < ServiceUser > getAllUsers ( ) {
return getCurrentSession ( ) . createCriteria ( ServiceUser . class ) . list ( ) ;
}
@Override
public List < ServiceFonctionnaliter > getAllFonctionalite ( ) {
return getCurrentSession ( ) . createCriteria ( ServiceFonctionnaliter . class ) . list ( ) ;
}
@Override
public boolean isItTimeToChangePass ( ) {
return true ;
}
@Override
public ServiceUser getUserById ( String userId ) {
return ( ServiceUser ) getCurrentSession ( )
. createQuery ( " SELECT user FROM ServiceUser user WHERE user.userid = :userid " )
. setParameter ( " userid " , userId )
. setMaxResults ( 1 )
. uniqueResult ( ) ;
}
@Override
public List < ServiceMember > getGroupsByUser ( ServiceUser user ) {
return getCurrentSession ( )
. createQuery ( " SELECT membre FROM ServiceMember membre WHERE membre.fkUser = :user " , ServiceMember . class )
. setParameter ( " user " , user )
. getResultList ( ) ;
}
@Override
public ServiceMember getGroupByUser ( ServiceUser user ) {
return getCurrentSession ( )
. createQuery ( " SELECT membre FROM ServiceMember membre WHERE membre.fkUser = :user " , ServiceMember . class )
. setParameter ( " user " , user )
. setMaxResults ( 1 )
. uniqueResult ( ) ;
}
@Override
public void saveUser ( ServiceUser object ) {
getCurrentSession ( ) . saveOrUpdate ( object ) ;
}
@Override
2026-08-03 14:29:20 +02:00
public ServiceGroupe getGroupsById ( UUID id ) {
2026-07-26 14:39:10 +02:00
return ( ServiceGroupe ) getCurrentSession ( ) . createCriteria ( ServiceGroupe . class ) . add ( Restrictions . eq ( " id " , id ) ) . setMaxResults ( 1 ) . uniqueResult ( ) ;
}
@Override
public void saveGroup ( ServiceGroupe object ) {
getCurrentSession ( ) . saveOrUpdate ( object ) ;
}
@Override
public void saveMembership ( ServiceMember object ) {
getCurrentSession ( ) . saveOrUpdate ( object ) ;
}
@Override
public void saveFonctionsGroupes ( ServiceFonctiongroupe object ) {
getCurrentSession ( ) . saveOrUpdate ( object ) ;
}
@Override
public ServicehistoriqueConnection getLastHistoriqueConnectionByUsers ( ServiceUser user ) {
return ( ServicehistoriqueConnection ) getCurrentSession ( ) . createCriteria ( ServicehistoriqueConnection . class ) . add ( Restrictions . eq ( " fkUser " , user ) ) . addOrder ( Order . desc ( " id " ) ) . setMaxResults ( 1 ) . uniqueResult ( ) ;
}
@Override
public ServicehistoriqueConnection getLastHistoriqueConnectionById ( Long id ) {
return ( ServicehistoriqueConnection ) getCurrentSession ( ) . createCriteria ( ServicehistoriqueConnection . class ) . add ( Restrictions . eq ( " id " , id ) ) . setMaxResults ( 1 ) . uniqueResult ( ) ;
}
@Override
public void save ( ServicehistoriqueConnection historique ) {
getCurrentSession ( ) . saveOrUpdate ( historique ) ;
}
@Override
public List < ServiceGroupe > getAllGroups ( ) {
return getCurrentSession ( ) . createCriteria ( ServiceGroupe . class ) . add ( Restrictions . eq ( " actif " , " true " ) ) . list ( ) ;
}
@Override
public List < ServiceMember > getAllMembershipByUser ( ServiceUser user ) {
return getCurrentSession ( ) . createCriteria ( ServiceMember . class ) . add ( Restrictions . eq ( " fkUser " , user ) ) . list ( ) ;
}
@Override
public List < ServiceFonctiongroupe > getAllFonctionsGroupesByGroupe ( ServiceGroupe group ) {
return getCurrentSession ( ) . createCriteria ( ServiceFonctiongroupe . class ) . add ( Restrictions . eq ( " fkGroupe " , group ) ) . list ( ) ;
}
@Override
public List < ServiceMember > getAllMembership ( ) {
return getCurrentSession ( ) . createCriteria ( ServiceMember . class ) . addOrder ( Order . desc ( " date " ) ) . list ( ) ;
}
@Override
public ServiceFonctionnaliter getFonctionnaliteById ( String id ) {
return ( ServiceFonctionnaliter ) getCurrentSession ( ) . createCriteria ( ServiceFonctionnaliter . class ) . add ( Restrictions . eq ( " id " , id ) ) . setMaxResults ( 1 ) . uniqueResult ( ) ;
}
@Override
public List < ServiceFonctionnaliter > getAllFonctionnaliteServer ( ) {
return getCurrentSession ( ) . createCriteria ( ServiceFonctionnaliter . class ) . list ( ) ;
}
@Override
public void save ( ServiceFonctionnaliter object ) {
getCurrentSession ( ) . saveOrUpdate ( object ) ;
}
@Override
public void save ( ServiceHistoriqueManipulation object ) {
getCurrentSession ( ) . saveOrUpdate ( object ) ;
}
@Override
public List < ServiceFonctiongroupe > getAllFonctionsGroups ( ) {
return getCurrentSession ( ) . createCriteria ( ServiceFonctiongroupe . class ) . list ( ) ;
}
@Override
public List < ServiceFonctionnaliter > getFonctionServerByGroups ( ServiceGroupe groupe ) {
2026-07-30 10:37:16 +02:00
return getCurrentSession ( ) . createQuery ( " select sf from ServiceFonctionnaliter sf,ServiceFonctiongroupe sfg where sf.nom=sfg.fkFonctionnalite.nom and sfg.fkGroupe =:groupeS " ) . setParameter ( " groupeS " , groupe ) . list ( ) ;
2026-07-26 14:39:10 +02:00
}
@Override
public List < ServiceFonctionnaliter > getFonctionServerByUsers ( ServiceUser user ) {
2026-07-30 10:37:16 +02:00
return getCurrentSession ( ) . createQuery ( " select sf from ServiceFonctionnaliter sf,ServiceFonctiongroupe sfg, ServiceMember mem where sf.id=sfg.fkFonctionnalite.id and sfg.fkGroupe = mem.fkGroupe and mem.fkUser= :user " ) . setParameter ( " user " , user ) . list ( ) ;
2026-07-26 14:39:10 +02:00
}
@Override
public ServiceFonctionnaliter getFonctionnaliteServerByFonction ( String fonction ) {
return ( ServiceFonctionnaliter ) getCurrentSession ( ) . createCriteria ( ServiceFonctionnaliter . class ) . add ( Restrictions . eq ( " fonction " , fonction ) ) . setMaxResults ( 1 ) . uniqueResult ( ) ;
}
@Override
public int genererBDD ( String chemain , String nomSql ) {
return getCurrentSession ( ) . createSQLQuery ( " BACKUP DATABASE " + nomSql + " TO DISK = ' " + chemain + " ' WITH FORMAT, MEDIANAME = 'SQLServerBackups', NAME = 'Full Backup of " + nomSql + " ' " ) . executeUpdate ( ) ;
}
@Override
public List < ServiceMember > getAllMemberShipByUser ( ServiceUser user ) {
return getCurrentSession ( ) . createQuery ( " select m from ServiceMember m where m.fkUser =:idUser " ) . setParameter ( " idUser " , user ) . list ( ) ;
}
@Override
public ServiceFonctiongroupe getFonctionGroupByFonctionIdAndGoupe ( String id , ServiceGroupe group ) {
2026-07-30 10:37:16 +02:00
return ( ServiceFonctiongroupe ) getCurrentSession ( ) . createQuery ( " select fg from ServiceFonctiongroupe fg where fg.fkFonctionnalite.id =:fonction and fg.fkGroupe.id =:group " ) . setParameter ( " fonction " , id ) . setParameter ( " group " , group . getId ( ) ) . setMaxResults ( 1 ) . uniqueResult ( ) ;
2026-07-26 14:39:10 +02:00
}
@Override
public void save ( ServiceIncrementation object ) {
getCurrentSession ( ) . saveOrUpdate ( object ) ;
}
@Override
public ServiceIncrementation getIncrementation ( ) {
return ( ServiceIncrementation ) getCurrentSession ( ) . createQuery ( " select increm from ServiceIncrementation increm " ) . setMaxResults ( 1 ) . uniqueResult ( ) ;
}
@Override
public ServiceIncrementation getFirstIncrementation ( ) {
return getCurrentSession ( ) . createQuery ( " SELECT s FROM ServiceIncrementation s ORDER BY s.id ASC " , ServiceIncrementation . class ) . setMaxResults ( 1 ) . getSingleResult ( ) ;
}
@Override
public void save ( ServiceGroupe object ) {
getCurrentSession ( ) . saveOrUpdate ( object ) ;
}
@Override
public void removeFonctionsGroupes ( ServiceFonctiongroupe fonctionGroupe ) {
getCurrentSession ( ) . delete ( fonctionGroupe ) ;
}
@Override
public List < ServicehistoriqueConnection > getListHistoriqueConnectionByUsers ( ServiceUser user ) {
return getCurrentSession ( )
. createQuery ( " select e from ServicehistoriqueConnection e where e.fkUser = :user " , ServicehistoriqueConnection . class )
. setParameter ( " user " , user )
. list ( ) ;
}
@Override
public List < ServiceHistoriqueManipulation > getListHistoriqueManipulationByUsersByEntreprise ( ServiceUser user ) {
return getCurrentSession ( )
2026-08-05 14:35:11 +02:00
. createQuery ( " select e from ServiceHistoriqueManipulation e where e.fkUser = :user " , ServiceHistoriqueManipulation . class )
2026-07-26 14:39:10 +02:00
. setParameter ( " user " , user )
. list ( ) ;
}
@Override
2026-07-30 10:37:16 +02:00
public Centre getEtablissementById ( Object id ) {
return ( Centre ) getCurrentSession ( ) . createQuery ( " select ca from Centre ca where ca.id = :id " ) . setParameter ( " id " , id ) . setMaxResults ( 1 ) . uniqueResult ( ) ;
2026-07-26 14:39:10 +02:00
}
@Override
2026-07-30 10:37:16 +02:00
public List < Centre > getAllStockEtablissementFromUsersEtablissementByUser ( ServiceUser user ) {
2026-07-26 14:39:10 +02:00
CriteriaBuilder cb = getCurrentSession ( ) . getCriteriaBuilder ( ) ;
2026-07-30 10:37:16 +02:00
CriteriaQuery < Centre > cq = cb . createQuery ( Centre . class ) ;
Root < ServiceUserCentre > root = cq . from ( ServiceUserCentre . class ) ;
2026-07-26 14:39:10 +02:00
2026-07-30 10:37:16 +02:00
cq . select ( root . get ( " fkCentre " ) ) // sélectionne la relation
2026-07-26 14:39:10 +02:00
. where (
cb . and (
cb . equal ( root . get ( " fkUser " ) , user ) ,
2026-07-30 10:37:16 +02:00
cb . equal ( root . get ( " fkCentre " ) . get ( " actif " ) , " true " )
2026-07-26 14:39:10 +02:00
)
) ;
return getCurrentSession ( ) . createQuery ( cq ) . getResultList ( ) ;
}
@Override
2026-08-03 14:29:20 +02:00
public ServiceUserCentre getAllUserCentreByCentreByUser ( Centre etablissement , ServiceUser user ) {
2026-07-30 10:37:16 +02:00
return ( ServiceUserCentre ) getCurrentSession ( ) . createCriteria ( ServiceUserCentre . class ) . add ( Restrictions . eq ( " fkCentre " , etablissement ) ) . add ( Restrictions . eq ( " fkUser " , user ) ) . setMaxResults ( 1 ) . uniqueResult ( ) ;
2026-08-03 14:29:20 +02:00
}
2026-07-26 14:39:10 +02:00
@Override
2026-07-30 10:37:16 +02:00
public List < ServiceFonctionnaliter > getFonctionServerByUsersByEtablissement ( ServiceUser user , Centre etablissement ) {
2026-08-03 14:29:20 +02:00
return getCurrentSession ( ) . createQuery ( " select sf from ServiceFonctionnaliter sf,ServiceFonctiongroupe sfg, ServiceMember mem where sf.id=sfg.fkFonctionnalite and sfg.fkGroupe= mem.fkGroupe and mem.fkUser=:user and mem.fkGroupe.fkCentre=:etab " ) . setParameter ( " etab " , etablissement ) . setParameter ( " user " , user ) . list ( ) ;
2026-07-26 14:39:10 +02:00
}
@Override
public ServicehistoriqueConnection getLastStockHistoriqueConnectionByUsers ( ServiceUser user ) {
return ( ServicehistoriqueConnection ) getCurrentSession ( ) . createCriteria ( ServicehistoriqueConnection . class ) . add ( Restrictions . eq ( " fkUser " , user ) ) . addOrder ( Order . desc ( " id " ) ) . setMaxResults ( 1 ) . uniqueResult ( ) ;
2026-08-03 14:29:20 +02:00
}
2026-07-26 14:39:10 +02:00
@Override
2026-07-30 10:37:16 +02:00
public List < Wilaya > getAllWilaya ( ) {
2026-08-03 14:29:20 +02:00
return getCurrentSession ( ) . createQuery ( " select m from Wilaya m " ) . list ( ) ;
}
@Override
public int getNbrUtilisateurParGroupe ( ServiceGroupe groupe ) {
Long count = ( Long ) getCurrentSession ( ) . createQuery ( " select count(m) from ServiceGroupe m, ServiceMember f where m.id=f.fkGroupe.id and m.id=:groupe " ) . setParameter ( " groupe " , groupe . getId ( ) ) . uniqueResult ( ) ;
return count . intValue ( ) ;
}
@Override
public int getNbrFonctionnaliteParGroupe ( ServiceGroupe groupe ) {
2026-08-05 14:35:11 +02:00
Long count = ( Long ) getCurrentSession ( ) . createQuery ( " select count(m) from ServiceGroupe m, ServiceFonctiongroupe f where m.id=f.fkGroupe.id and m.id=:groupe " ) . setParameter ( " groupe " , groupe . getId ( ) ) . uniqueResult ( ) ;
2026-08-03 14:29:20 +02:00
return count . intValue ( ) ;
}
@Override
public ServiceFonctiongroupe getFonctiongroupeById ( UUID id ) {
2026-08-05 14:35:11 +02:00
return ( ServiceFonctiongroupe ) getCurrentSession ( ) . createQuery ( " select m from ServiceFonctiongroupe m where m.id=:id " ) . setParameter ( " id " , id ) . setMaxResults ( 1 ) . uniqueResult ( ) ;
}
@Override
public < T extends Serializable > void save ( final T object ) {
getCurrentSession ( ) . saveOrUpdate ( object ) ;
}
@Override
public < T extends Serializable > void delete ( final T object ) {
System . out . println ( " delete " ) ;
getCurrentSession ( ) . delete ( object ) ;
2026-07-26 14:39:10 +02:00
}
2026-08-10 14:05:33 +02:00
@Override
public List < Medecin > getAllMedecinByCenter ( Centre centre ) {
return getCurrentSession ( ) . createQuery ( " select s from Medecin s where s.fkCentre=:centre " ) . setParameter ( " centre " , centre ) . list ( ) ;
}
@Override
public < T extends Serializable , ID extends Serializable > T findById ( Class < T > clazz , ID id ) {
return getCurrentSession ( ) . get ( clazz , id ) ;
}
@Override
public List < SpecialiteMedicale > getAllSpecialitiesByMedecin ( Medecin medecin ) {
return getCurrentSession ( ) . createQuery ( " select s.fkSpecialite from MedecinSpecialiste s where s.fkMedecin =:medecin " ) . setParameter ( " medecin " , medecin ) . list ( ) ;
}
@Override
public List < Consultation > getAllConsultationByMedecin ( Medecin medecin ) {
return getCurrentSession ( ) . createQuery ( " select s from Consultation s where s.fkMedecin =:medecin " ) . setParameter ( " medecin " , medecin ) . list ( ) ;
}
@Override
public < T extends Serializable > List < T > findAll ( Class < T > clazz ) {
return getCurrentSession ( ) . createCriteria ( clazz ) . list ( ) ;
}
@Override
2026-08-13 16:57:29 +02:00
public List < ServiceUser > getAllUserByCentreNotInMedecinByUser ( Centre centre , Medecin medecin ) {
2026-08-10 14:05:33 +02:00
return getCurrentSession ( ) . createQuery ( " select s.fkUser from ServiceUserCentre s where s.fkCentre =:centre and (s.fkUser=:user or s.fkUser not in "
+ " (select m.fkUser from Medecin m)) " ) . setParameter ( " centre " , centre ) . setParameter ( " user " , medecin . getFkUser ( ) ) . list ( ) ;
}
@Override
public MedecinSpecialiste getMedecinSpecialisteByMedcinBySpecialiste ( Medecin medecin , SpecialiteMedicale spc ) {
2026-08-13 16:57:29 +02:00
return ( MedecinSpecialiste ) getCurrentSession ( ) . createQuery ( " select s from MedecinSpecialiste s where s.fkMedecin =:medecin and s.fkSpecialite=:spc " ) . setParameter ( " spc " , spc ) . setParameter ( " medecin " , medecin ) . setMaxResults ( 1 ) . uniqueResult ( ) ;
2026-08-10 14:05:33 +02:00
}
2026-08-13 16:57:29 +02:00
2026-08-10 14:05:33 +02:00
@Override
public List < ServiceUser > getAllUserByCentreNotInMedecin ( Centre centre ) {
return getCurrentSession ( ) . createQuery ( " select s.fkUser from ServiceUserCentre s where s.fkCentre =:centre and ( s.fkUser not in "
+ " (select m.fkUser from Medecin m)) " ) . setParameter ( " centre " , centre ) . list ( ) ;
}
2026-08-13 16:57:29 +02:00
@Override
public < T > List < T > getAllByCentre ( Class < T > clazz , Centre centre ) {
CriteriaBuilder cb = getCurrentSession ( ) . getCriteriaBuilder ( ) ;
CriteriaQuery < T > cq = cb . createQuery ( clazz ) ;
Root < T > root = cq . from ( clazz ) ;
cq . select ( root )
. where ( cb . equal ( root . get ( " fkCentre " ) , centre ) ) ;
return getCurrentSession ( )
. createQuery ( cq )
. getResultList ( ) ;
}
@Override
public < T > T getByCentre ( Class < T > clazz , Centre centre ) {
String hql
= " select e from "
+ clazz . getSimpleName ( )
+ " e where e.fkCentre = :centre " ;
System . out . println ( " CLASS = " + clazz ) ;
System . out . println ( " ENTITY = " + clazz . getSimpleName ( ) ) ;
System . out . println ( " HQL = " + hql ) ;
return getCurrentSession ( )
. createQuery ( hql , clazz )
. setParameter ( " centre " , centre )
. setMaxResults ( 1 )
. uniqueResult ( ) ;
}
@Override
public List < Machine > getMachineBySalle ( SalleDeSoin salle ) {
2026-09-04 11:45:31 +02:00
return getCurrentSession ( ) . createQuery ( " select s from Machine s where s.fkSalle =:salle " ) . setParameter ( " salle " , salle ) . list ( ) ;
}
2026-08-13 16:57:29 +02:00
@Override
public List < TypeExamen > getTypeExamenByTypeAlerte ( TypeAlerteMedical type ) {
return getCurrentSession ( ) . createQuery ( " select s from TypeExamen s,TypealerteTypeexamen m where s.id = m.fkExamen.id and m.fkAlerte=:alerte " ) . setParameter ( " alerte " , type ) . list ( ) ;
}
@Override
public List < MedecinSpecialiste > getMedecinSpecialisteBySpecialite ( SpecialiteMedicale type ) {
2026-09-04 11:45:31 +02:00
return getCurrentSession ( ) . createQuery ( " select s from MedecinSpecialiste s where s.fkSpecialite=:type " ) . setParameter ( " type " , type ) . list ( ) ;
2026-08-13 16:57:29 +02:00
}
@Override
public List < TypealerteTypeexamen > getTypeAlerteExamenByTypeAlerte ( TypeAlerteMedical type ) {
return getCurrentSession ( ) . createQuery ( " select s from TypealerteTypeexamen s where s.fkAlerte=:type " ) . setParameter ( " type " , type ) . list ( ) ;
}
2026-09-04 11:45:31 +02:00
@Override
public List < Machine > getMachineMotOrtahnc ( ) {
String hql = " SELECT m "
+ " FROM Machine m "
+ " LEFT JOIN m.fkTypeMachine tm "
+ " WHERE m.actif = true "
+ " AND (tm IS NULL OR LOWER(tm.type) NOT LIKE :type) " ;
List < Machine > machines = getCurrentSession ( ) . createQuery ( hql , Machine . class )
. setParameter ( " type " , " %orthanc% " )
. getResultList ( ) ;
return machines ;
}
@Override
public List < Examen > getExamenByQueue ( Queue queue ) {
return getCurrentSession ( ) . createQuery ( " select s from Examen s where s.fkQueue=:type " ) . setParameter ( " type " , queue ) . list ( ) ;
}
@Override
public List < TypeExamen > getTypeExamenByPatient ( Patient patient ) {
return getCurrentSession ( ) . createQuery (
" select distinct tte.fkExamen "
+ " from AlertesMedicales am "
+ " join am.fkTypeAlerteMedical tam, "
+ " TypealerteTypeexamen tte "
+ " where am.fkPatient = :patient "
+ " and tte.fkAlerte = tam " ,
TypeExamen . class
)
. setParameter ( " patient " , patient )
. getResultList ( ) ;
}
@Override
public List < Queue > getQueueByCentre ( Centre centre , Date date ) {
return getCurrentSession ( ) . createQuery ( " select s from Queue s where s.fkPatient.fkCentre=:centre and s.date=:date " ) . setParameter ( " centre " , centre ) . setParameter ( " date " , date ) . list ( ) ;
}
@Override
public Medecin getMedecinByUser ( ServiceUser user ) {
return ( Medecin ) getCurrentSession ( ) . createQuery ( " select s from Medecin s where s.fkUser=:user " ) . setParameter ( " user " , user ) . setMaxResults ( 1 ) . uniqueResult ( ) ;
}
@Override
public Consultation getConsultationByExamen ( Examen examen ) {
return ( Consultation ) getCurrentSession ( ) . createQuery ( " select s from Consultation s where s.fkExamen=:examen and s.sessionAnnule=false " ) . setParameter ( " examen " , examen ) . setMaxResults ( 1 ) . uniqueResult ( ) ;
}
@Override
public List < Queue > getQueueByCentreByRequete ( Centre centre , String requete ) {
return getCurrentSession ( ) . createQuery ( " select s from Queue s where s.fkPatient.fkCentre=:centre " + requete ) . setParameter ( " centre " , centre ) . list ( ) ;
}
2026-07-26 14:39:10 +02:00
}