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')