You are on page 1of 2

/*

* To change this template, choose Tools | Templates


* and open the template in the editor.
*/
package Utils;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import services.Referalmstr;
import services.Mlctypes;
import services.Serviceinsttype;
import services.Consltunitmstr;
import services.Roomcatgry;
import services.Patient;
public class ipAdmisson {
Configuration cfg=new Configuration();
SessionFactory sn=cfg.configure().buildSessionFactory();
private List patientList;
public List search(Integer idPatient){
Session session=sn.openSession();
Query qry=session.createQuery("from Patient p where p.idPatient="+idPati
ent);
patientList=qry.list();
session.close();
sn.close();
return patientList;
}

List ReferalList=new ArrayList();


List MlcList=new ArrayList();
List ServiceList=new ArrayList();
List ConsultantList=new ArrayList();
List RoomCategoryList=new ArrayList();
public List getReferalMaster()
{
try{
Session session=sn.openSession();
Query qry=session.createQuery("select r.referalName from Referalmstr r ");

ReferalList=qry.list();

session.close();
}catch(Exception e){System.out.println("Pls Read it"+e);}
return ReferalList;
}
public List getMlcMaster()
{
try{
Session session=sn.openSession();
Query qry=session.createQuery("select b.mlcTypeCode from Mlctypes b ");

MlcList=qry.list();

session.close();
}catch(Exception e){System.out.println("Pls Read it"+e);}
return MlcList ;

}
public List getServiceMaster()
{
try{
Session session=sn.openSession();
Query qry=session.createQuery("select s.serviceInstTypeCode from Serviceinst
type s ");

ServiceList=qry.list();

session.close();
}catch(Exception e){System.out.println("Pls Read it"+e);}
return ServiceList ;
}
public List getConsultantMaster()
{
try{
Session session=sn.openSession();
Query qry=session.createQuery("select c.consltUnitName from Consltunitmstr c
");

ConsultantList=qry.list();

session.close();
}catch(Exception e){System.out.println("Pls Read it"+e);}
return ConsultantList ;
}
public List getRoomCategoryMaster()
{
try{
Session session=sn.openSession();
Query qry=session.createQuery("select c.roomHospCatgry from Roomcatgry c ");

RoomCategoryList=qry.list();

session.close();
}catch(Exception e){System.out.println("Pls Read it"+e);}
return RoomCategoryList ;
}
}