Sunday, February 8, 2015

date and time insert and select into mysqlDatabase using java


 //******************************** It is  INSERT Query Modal add calendar
    public void insertCalendarModalData(String meetingTpeModal,String meetingTitleModal,String meetingRoomModal,String insetStartTimeFullcalendar,String onestartTime,String twostartTime,String meetingDescriptionModal,String kaniz){
           System.out.println("kaniz");
           boolean fg = true;
           con = dbc.connectDB();

            if (con == null) {
                fg = false;
            }
       
       if (fg) {
        try {

               st = con.createStatement();
    
      query = "insert into rbs_room_booking(type_id,title,room_id,booking_date,start_time,end_time,description,entered_by,entry_timestamp) values ('"+meetingTpeModal+"','"+meetingTitleModal+"','"+meetingRoomModal+"','"+insetStartTimeFullcalendar+"','"+onestartTime+"','"+twostartTime+"','"+meetingDescriptionModal+"','"+kaniz+"','2015-01-31 15:37:17')";
       System.out.println("Query" + query);
       st.execute(query);

   

       } catch (SQLException sq) {       
         sq.printStackTrace();
       } finally {
         try {
             if (rs != null) {
                 rs.close();
             }
       
             con.close();
         } catch (SQLException ex) {
             ex.printStackTrace();
         }
       }
       }
    
              // return "subBankInformation";// As void not String
           }

   
     
   
    public List selectCalendarModalData() {   //** It is select query tree menu Need
         List roomBookingInfoDataList = new ArrayList();

         boolean fg = true;
         this.con = this.dbc.connectDB();

         if (this.con == null) {
             fg = false;
         }

         if (fg) {
             try {
                 this.st = this.con.createStatement();

              
               
                 String query = "SELECT booking_id,type_id,title,room_id,booking_date,start_time,end_time,description FROM rbs_room_booking";
                 this.rs = this.st.executeQuery(query);

                 while (this.rs.next()) {
                     MultiSetupModalInfo multiSetupModalInfo = new MultiSetupModalInfo();
                  
                     multiSetupModalInfo.setBooking_id(rs.getString("booking_id"));
                     multiSetupModalInfo.setType_id(rs.getString("type_id"));
                     multiSetupModalInfo.setTitle(rs.getString("title"));
                     multiSetupModalInfo.setRoom_id(rs.getString("room_id"));
                     multiSetupModalInfo.setStart_time(rs.getString("start_time"));
                     multiSetupModalInfo.setEnd_time(rs.getString("end_time"));
                
                     roomBookingInfoDataList.add(multiSetupModalInfo);
                 }
             } catch (SQLException sq) {
                 System.out.println("Tree  data  Info Query Exception "
                         + sq.getMessage());
                 try {
                     if (this.rs != null) {
                         this.rs.close();
                     }
                   

                     this.con.close();
                 } catch (SQLException ex) {
                     ex.printStackTrace();
                 }
             } finally {
                 try {
                     if (this.rs != null) {
                         this.rs.close();
                     }

                     this.con.close();
                 } catch (SQLException ex) {
                     ex.printStackTrace();
                 }
             }
         }

         return roomBookingInfoDataList;
     }
   

Meta data and json

What is meta data ?



What is json ?
 If  I get value from database with coloum name , it is called json.

Monday, January 19, 2015

Sql query in oracle ( My write )


 Value get from 2 table :
select t. thrapgrp_name,t.thrapgrp_id from pm_theragrp t,pm_thrapgrp_atc a where t. thrapgrp_id=a.thrapgrp_id


 Value get from 3 table using AND :
SELECT t.thrapgrp_name, t.thrapgrp_id, g.generic_no, G.GENERIC_NAME
  FROM pm_theragrp t, pm_thrapgrp_atc a, PM_GENERIC G
 WHERE t.thrapgrp_id = a.thrapgrp_id
 AND A.GENERIC_NO=G.GENERIC_NO

Wednesday, January 14, 2015

ORacle Query Writing Way

Patient View tab : this data get using sysdate (and trunc(consult_dt)=trunc(sysdate) order by reg_no) :

select distinct reg_no,fnc_patientname(reg_no) patname,consult_by,consult_no,consult_dt,
(select cal_dob from op_registration where reg_no=c.reg_no) dob,
(select findings from eh_patexamination where consult_no=c.consult_no) cc
from op_consultation  c
where consult_by='E011001000425'
and consult_dt =(select max(consult_dt) from op_consultation where consult_by=c.consult_by and reg_no=c.reg_no )
order by reg_no;



select distinct reg_no,fnc_patientname(reg_no) patname,consult_by,consult_no,
consult_dt,(select TO_CHAR(cal_dob,'DD/MM/YYYY')age from op_registration where reg_no=c.reg_no) dob, (select findings from eh_patexamination
where consult_no=c.consult_no) cc from op_consultation  c where consult_by='E011001000425'
and trunc(consult_dt) =trunc(sysdate) order by reg_no

This is use for previous date appointment :
select distinct reg_no,fnc_patientname(reg_no) patname,consult_by,consult_no,
consult_dt,(select TO_CHAR(cal_dob,'DD/MM/YYYY')age from op_registration where reg_no=c.reg_no) dob, (select findings from eh_patexamination
where consult_no=c.consult_no) cc from op_consultation  c where consult_by='E011001000425'
and trunc(consult_dt)<trunc(sysdate) order by reg_no

Thursday, January 8, 2015

Generic array in java

Generic array in java :


aliasNameApply_onDateValue



 aliasNameApply_onDateValue :



Other Way :
sql :
            String query = "select reg_no,dob from op_registration  where reg_no in (select distinct(reg_no)  from op_consultation  where CONSULT_BY = 'E011001000425')";
  while (this.rs.next()) {
                 RadiologyTestInfo radiologyTestInfo = new RadiologyTestInfo();
                
                radiologyTestInfo.setReg_no(rs.getString("reg_no"));
                   //radiologyTestInfo.setDob(rs.getString("DoBB"));
                   //radiologyTestInfo.setCal_dob(rs.getString("dob"));
               radiologyTestInfo.setDob(rs.getDate("dob"));
               
               
               patientViewDataList.add(radiologyTestInfo);
            }
Model /Info class file : declare way 
private Date dob;// it is set get

jsp page :
 <td><s:date name='dob' format='dd/MM/yyyy'/></td>

Wednesday, January 7, 2015

Query write by two query using distinct

Query write by two query using distinct :distinct means at a time not show same id more time
Suppose :
id 1 = patient one
id 1 = patient two
id 1 = patient three

If I use distinct :
id 1 = patient one
     = patient two
     = patient three




op_consultation
hr_employee


select distinct(reg_no)  from op_consultation  where CONSULT_BY = 'E011001000425'

select *from op_registration where reg_no='R011002000101'




select * from op_registration where reg_no in (select distinct(reg_no)  from op_consultation  where CONSULT_BY = 'E011001000425')