Commit 89e66637 authored by CORP\sonam.kamble's avatar CORP\sonam.kamble

Changes done for state, city suggestion box

parent ef09f2ab
...@@ -248,7 +248,7 @@ public class Appointment ...@@ -248,7 +248,7 @@ public class Appointment
pStmt=null; pStmt=null;
rs= null; rs= null;
sql = "SELECT VISIT_PLACE FROM STRG_VISIT_HOURS WHERE SC_CODE = ?"; sql = "SELECT DISTINCT VISIT_PLACE FROM STRG_VISIT_HOURS WHERE SC_CODE = ?";
pStmt = conn.prepareStatement(sql); pStmt = conn.prepareStatement(sql);
pStmt.setString(1, userCode); pStmt.setString(1, userCode);
rs = pStmt.executeQuery(); rs = pStmt.executeQuery();
...@@ -458,7 +458,7 @@ public class Appointment ...@@ -458,7 +458,7 @@ public class Appointment
errSting = genericUtility.getErrorString("SC_CODE", "VISUNAVAIL", userCode); errSting = genericUtility.getErrorString("SC_CODE", "VISUNAVAIL", userCode);
jsonObject = convertXmlToJsonInError(errSting); jsonObject = convertXmlToJsonInError(errSting);
System.out.println("2............."+visitplaces); System.out.println("2............."+visitplaces);
getMailFormatDetails(visitPLaceItr, "0", userCode, fromDtTStmp, toDtTStmp, userInfoBean, conn); getMailFormatDetails("0", userCode, fromDtTStmp, toDtTStmp, userInfoBean, conn, visitplaces);
} }
} }
else else
...@@ -467,9 +467,10 @@ public class Appointment ...@@ -467,9 +467,10 @@ public class Appointment
} }
} }
SimpleDateFormat format2 = new SimpleDateFormat("DD-MOM-YY"); SimpleDateFormat format2 = new SimpleDateFormat("DD-MMM-YY");
frDate = output.parse(fromDateStr); SimpleDateFormat smpDtForm = new SimpleDateFormat("dd/mm/yy");
toDate = output.parse(toDateStr); frDate = smpDtForm.parse(fromDateStr);
toDate = smpDtForm.parse(toDateStr);
System.out.println(format2.format(frDate)); System.out.println(format2.format(frDate));
fromDateStr = format2.format(frDate); fromDateStr = format2.format(frDate);
...@@ -587,7 +588,7 @@ public class Appointment ...@@ -587,7 +588,7 @@ public class Appointment
if(updCount > 0) if(updCount > 0)
{ {
conn.commit(); conn.commit();
getMailFormatDetails(null, lineNo, userCode, fromDtTStmp, toDtTStmp, userInfoBean, conn); getMailFormatDetails(lineNo, userCode, fromDtTStmp, toDtTStmp, userInfoBean, conn, null);
} }
} }
else else
...@@ -596,7 +597,7 @@ public class Appointment ...@@ -596,7 +597,7 @@ public class Appointment
} }
} }
SimpleDateFormat format2 = new SimpleDateFormat("DD-MON-YY"); SimpleDateFormat format2 = new SimpleDateFormat("dd-MMM-yy");
frDate = output.parse(fromDateStr); frDate = output.parse(fromDateStr);
toDate = output.parse(toDateStr); toDate = output.parse(toDateStr);
System.out.println(format2.format(frDate)); System.out.println(format2.format(frDate));
...@@ -620,7 +621,7 @@ public class Appointment ...@@ -620,7 +621,7 @@ public class Appointment
} }
catch(Exception e) catch(Exception e)
{ {
System.out.println("Exception in getDoctorDetails :: "+e.getMessage()); System.out.println("Appointment.insertUnableToVisit() .. "+e);
} }
finally finally
{ {
...@@ -647,6 +648,7 @@ public class Appointment ...@@ -647,6 +648,7 @@ public class Appointment
System.out.println("Exception While Closing resourses ..... :: "+e); System.out.println("Exception While Closing resourses ..... :: "+e);
} }
} }
System.out.println("jsonObject.toString() : "+jsonObject.toString());
return jsonObject.toString(); return jsonObject.toString();
} }
...@@ -783,7 +785,7 @@ public class Appointment ...@@ -783,7 +785,7 @@ public class Appointment
String mobNo = "", name = "", dob = "", gender = "", ediArr = "", chgDate = "", String mobNo = "", name = "", dob = "", gender = "", ediArr = "", chgDate = "",
chgUSer = "", chgTerm = "", emailId = "", entityCode = "", siteCodeDef = "", chgUSer = "", chgTerm = "", emailId = "", entityCode = "", siteCodeDef = "",
userLev = "", profileId = "", entityType = "", userType = "", transDb = "", userLev = "", profileId = "", entityType = "", userType = "", transDb = "",
firstName = "", middleName = "", lastName = "", regNo = "", firstName = "", middleName = "", lastName = "", regNo = "",stanCode = "", stateCode = "",
qualification = "", address = "", state = "", city = "", pinCode = "",errorString = ""; qualification = "", address = "", state = "", city = "", pinCode = "",errorString = "";
org.json.JSONArray speciltyArr = new org.json.JSONArray(); org.json.JSONArray speciltyArr = new org.json.JSONArray();
try try
...@@ -814,6 +816,8 @@ public class Appointment ...@@ -814,6 +816,8 @@ public class Appointment
qualification = jsonData.getString("qualification"); qualification = jsonData.getString("qualification");
state = jsonData.getString("state"); state = jsonData.getString("state");
pinCode = jsonData.getString("pin"); pinCode = jsonData.getString("pin");
stanCode = jsonData.getString("stan_code");
stateCode = jsonData.getString("state_code");
Object specialtyObj = jsonData.get("speciality"); Object specialtyObj = jsonData.get("speciality");
if(specialtyObj.toString().length() > 0) if(specialtyObj.toString().length() > 0)
{ {
...@@ -848,8 +852,8 @@ public class Appointment ...@@ -848,8 +852,8 @@ public class Appointment
pStmt.setString(8, ""); pStmt.setString(8, "");
pStmt.setString(9, ""); pStmt.setString(9, "");
pStmt.setString(10, city); pStmt.setString(10, city);
pStmt.setString(11, "DUMMY"); pStmt.setString(11, stanCode);
pStmt.setString(12, state); pStmt.setString(12, stateCode);
pStmt.setString(13, pinCode); pStmt.setString(13, pinCode);
pStmt.setString(14, "IND"); pStmt.setString(14, "IND");
pStmt.setString(15, mobNo); pStmt.setString(15, mobNo);
...@@ -980,8 +984,8 @@ public class Appointment ...@@ -980,8 +984,8 @@ public class Appointment
lName = s[2]; lName = s[2];
} }
StringBuilder builder1 = new StringBuilder("Insert into patient (PATIENT_CODE,FIRST_NAME,MIDDLE_NAME,LAST_NAME,ADDR1,ADDR2,ADDR3,CITY," ); StringBuilder builder1 = new StringBuilder("Insert into patient (PATIENT_CODE,FIRST_NAME,MIDDLE_NAME,LAST_NAME,ADDR1,ADDR2,ADDR3,CITY," );
builder1.append("MOBILE_NO,STATUS,SEX,BIRTH_DATE,ADD_DATE,ADD_USER,ADD_TERM,CHG_DATE,CHG_USER,CHG_TERM,SERVICE_TYPE,SERVICE_NO,NAME)"); builder1.append("MOBILE_NO,STATUS,SEX,BIRTH_DATE,ADD_DATE,ADD_USER,ADD_TERM,CHG_DATE,CHG_USER,CHG_TERM,SERVICE_TYPE,SERVICE_NO,NAME,EMAIL_ID)");
builder1.append("values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) "); builder1.append("values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ");
pStmt = conn1.prepareStatement(builder1.toString()); pStmt = conn1.prepareStatement(builder1.toString());
pStmt.setString(1, mobNo); pStmt.setString(1, mobNo);
pStmt.setString(2, fName); pStmt.setString(2, fName);
...@@ -1004,6 +1008,8 @@ public class Appointment ...@@ -1004,6 +1008,8 @@ public class Appointment
pStmt.setString(19, serviceType); pStmt.setString(19, serviceType);
pStmt.setString(20, serviceNo); pStmt.setString(20, serviceNo);
pStmt.setString(21, name); pStmt.setString(21, name);
pStmt.setString(22, emailId);
int patCount = pStmt.executeUpdate(); int patCount = pStmt.executeUpdate();
if(patCount > 0) if(patCount > 0)
{ {
...@@ -1338,8 +1344,8 @@ public class Appointment ...@@ -1338,8 +1344,8 @@ public class Appointment
} }
//Added by Amey W. [ To update status of appointment when delete ] on 3-04-2020 END //Added by Amey W. [ To update status of appointment when delete ] on 3-04-2020 END
public void getMailFormatDetails(Iterator<String> itr, String visitRefNo, String doctorCode, public void getMailFormatDetails(String visitRefNo, String doctorCode,
Timestamp frDate, Timestamp toDate, UserInfoBean userInfo, Connection conn) Timestamp frDate, Timestamp toDate, UserInfoBean userInfo, Connection conn, List<String> visitplaces)
{ {
System.out.println("Appointment.getMailFormatDetails()"); System.out.println("Appointment.getMailFormatDetails()");
String lineNo = "", apptId = "", visitPlace = "", String lineNo = "", apptId = "", visitPlace = "",
...@@ -1353,7 +1359,7 @@ public class Appointment ...@@ -1353,7 +1359,7 @@ public class Appointment
final List<String> docNameArr = new ArrayList<String>(); final List<String> docNameArr = new ArrayList<String>();
final List<String> emailIdArr = new ArrayList<String>(); final List<String> emailIdArr = new ArrayList<String>();
final List<String> patCodeArr = new ArrayList<String>(); final List<String> patCodeArr = new ArrayList<String>();
Iterator<String> visitPLaceItr = null;
try try
{ {
builder.append("SELECT APPT.APPOINT_ID, TO_CHAR(APPT.APPOINT_DATE, 'DD-MON-YY') APPOINT_DATE , SVH.VISIT_PLACE, PAT.EMAIL_ID ,"); builder.append("SELECT APPT.APPOINT_ID, TO_CHAR(APPT.APPOINT_DATE, 'DD-MON-YY') APPOINT_DATE , SVH.VISIT_PLACE, PAT.EMAIL_ID ,");
...@@ -1363,11 +1369,17 @@ public class Appointment ...@@ -1363,11 +1369,17 @@ public class Appointment
builder.append("AND APPT.VISIT_REF_NO = SVH.LINE_NO AND APPT.DOCTOR_CODE = SVH.SC_CODE AND DOCTOR_CODE = ? "); builder.append("AND APPT.VISIT_REF_NO = SVH.LINE_NO AND APPT.DOCTOR_CODE = SVH.SC_CODE AND DOCTOR_CODE = ? ");
builder.append("AND VISIT_REF_NO = ? AND APPOINT_DATE BETWEEN ? AND ? "); builder.append("AND VISIT_REF_NO = ? AND APPOINT_DATE BETWEEN ? AND ? ");
psmt = conn.prepareStatement(builder.toString()); psmt = conn.prepareStatement(builder.toString());
if(itr != null) if(visitplaces != null)
{ {
while(itr.hasNext()) visitPLaceItr = visitplaces.iterator();
}
if(visitPLaceItr != null)
{ {
lineNo = itr.next();
while(visitPLaceItr.hasNext())
{
lineNo = visitPLaceItr.next();
System.out.println("Inside 1386................" +lineNo);
psmt.setString(1, doctorCode); psmt.setString(1, doctorCode);
psmt.setString(2, lineNo); psmt.setString(2, lineNo);
psmt.setTimestamp(3, frDate); psmt.setTimestamp(3, frDate);
...@@ -1956,30 +1968,96 @@ public class Appointment ...@@ -1956,30 +1968,96 @@ public class Appointment
public String getStateList() public String getStateList()
{ {
System.out.println("Inside getStateList .... "); System.out.println("Inside getStateList .... ");
String sql = ""; String sql = "",stateCode="",state="",stanCode="",city="";
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
Connection conn = null; Connection conn = null;
PreparedStatement pStmt = null; PreparedStatement pStmt = null;
ResultSet rs = null; ResultSet rs = null;
JSONObject jsonObject = null; JSONObject jsonObject = null;
JSONObject jsonStateObject = null;
JSONObject jsonCityObject = null;
JSONObject jsonFieldObject = null;
JSONArray jsonArray = new JSONArray(); JSONArray jsonArray = new JSONArray();
JSONArray cityArray = null;
int stateCount = 0;
try try
{ {
System.out.println("1........................."); System.out.println("1.........................");
conn = connDriver.getConnectDB("APPVIS"); conn = connDriver.getConnectDB("APPVIS");
sql = "select DISTINCT(state_code),descr as state from state where count_code = 'IND' and state_code is not null order by state"; //sql = "select DISTINCT(state_code),descr as state from state where count_code = 'IND' and state_code is not null order by state";
sql = " SELECT DISTINCT(ST.STATE_CODE),ST.DESCR AS STATE ,STN.STAN_CODE,INITCAP(CITY) CITY\n" +
" FROM STATE ST " +
" JOIN STATION STN " +
" ON STN.STATE_CODE = ST.STATE_CODE " +
" WHERE ST.COUNT_CODE = 'IND' AND ST.STATE_CODE IS NOT NULL AND STN.CITY IS NOT NULL " +
" ORDER BY STATE,CITY ";
pStmt = conn.prepareStatement(sql); pStmt = conn.prepareStatement(sql);
rs = pStmt.executeQuery(); rs = pStmt.executeQuery();
while(rs.next()) while(rs.next())
{ {
jsonObject = new JSONObject(); //jsonObject = new JSONObject();
jsonObject.put("key", E12GenericUtility.checkNull(rs.getString("state_code"))); // jsonObject.put("key", E12GenericUtility.checkNull(rs.getString("state_code")));
jsonObject.put("label", E12GenericUtility.checkNull(rs.getString("state"))); // jsonObject.put("label", E12GenericUtility.checkNull(rs.getString("state")));
String tempStateCode = rs.getString("STATE_CODE");
String tempStanCode = rs.getString("STAN_CODE");
if(!tempStateCode.equalsIgnoreCase(stateCode) && !tempStanCode.equalsIgnoreCase(stanCode))
{
stateCount++;
if(jsonObject != null)
{
jsonObject.put("city", cityArray);
jsonArray.add(jsonObject); jsonArray.add(jsonObject);
jsonCityObject = null;
}
cityArray = null;
jsonObject = null; jsonObject = null;
jsonStateObject = null;
jsonCityObject = null;
stanCode = tempStanCode;
stateCode = tempStateCode ;
jsonObject = new JSONObject();
jsonStateObject = new JSONObject();
jsonCityObject = new JSONObject();
cityArray = new JSONArray();
jsonStateObject.put("key", E12GenericUtility.checkNull(rs.getString("STATE_CODE")));
jsonStateObject.put("label", E12GenericUtility.checkNull(rs.getString("STATE")));
jsonObject.put("state", jsonStateObject);
jsonCityObject.put("key", E12GenericUtility.checkNull(rs.getString("STAN_CODE")));
jsonCityObject.put("label", E12GenericUtility.checkNull(rs.getString("CITY")));
cityArray.add(jsonCityObject);
}
else if(tempStateCode.equalsIgnoreCase(stateCode) && !tempStanCode.equalsIgnoreCase(stanCode))
{
stanCode = tempStanCode;
stateCode = tempStateCode ;
jsonCityObject = null;
jsonCityObject = new JSONObject();
jsonCityObject.put("key", E12GenericUtility.checkNull(rs.getString("STAN_CODE")));
jsonCityObject.put("label", E12GenericUtility.checkNull(rs.getString("CITY")));
cityArray.add(jsonCityObject);
}
//jsonArray.add(jsonObject);
//jsonObject = null;
} }
System.out.println("state jsonArray "+jsonArray);
if(jsonObject != null)
{
jsonObject.put("city", cityArray);
jsonArray.add(jsonObject);
jsonCityObject = null;
}
state = "";
stanCode = "";
System.out.println("state jsonArray stateCount "+stateCount);
jsonObject = new JSONObject(); jsonObject = new JSONObject();
jsonObject.put("state", jsonArray); jsonObject.put("state", jsonArray);
} }
...@@ -2022,10 +2100,17 @@ public class Appointment ...@@ -2022,10 +2100,17 @@ public class Appointment
String stateList = getStateList(); String stateList = getStateList();
System.out.println("jsonArray stateList "+stateList); System.out.println("jsonArray stateList "+stateList);
org.json.JSONObject stateJSONObject = new org.json.JSONObject(stateList); org.json.JSONObject stateJSONObject = new org.json.JSONObject(stateList);
System.out.println("Vicky :: "+stateJSONObject.get("state")); System.out.println("stateJSONObject :: "+stateJSONObject.get("state"));
String qualificationList = getQualification();
System.out.println("jsonArray qualificationList "+qualificationList);
org.json.JSONObject qualificationJSONObject = new org.json.JSONObject(qualificationList);
System.out.println("qualificationJSONObject :: "+qualificationJSONObject.get("qualification"));
jsonObject = new JSONObject(); jsonObject = new JSONObject();
jsonObject.put("speciality", jsonArray); jsonObject.put("speciality", jsonArray);
jsonObject.put("state", stateJSONObject.get("state")); jsonObject.put("state", stateJSONObject.get("state"));
jsonObject.put("qualification", qualificationJSONObject.get("qualification"));
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -2040,6 +2125,20 @@ public class Appointment ...@@ -2040,6 +2125,20 @@ public class Appointment
{ {
System.out.println("Exception .. "+e); System.out.println("Exception .. "+e);
} }
finally {
try
{
if(conn != null)
{
conn.close();
conn = null;
}
}
catch(Exception e)
{
System.out.println("Exception getDoctorSpecialityList : "+e);
}
}
System.out.println("final state list :: "+jsonObject.toString()); System.out.println("final state list :: "+jsonObject.toString());
return jsonObject.toString(); return jsonObject.toString();
} }
...@@ -2157,4 +2256,124 @@ public class Appointment ...@@ -2157,4 +2256,124 @@ public class Appointment
} }
} }
} }
public String getMyVisitDefaultData(UserInfoBean userInfo)
{
System.out.println("Inside getMyVisitDefaultData ....");
String sql = "";
ConnDriver connDriver = new ConnDriver();
Connection conn = null;
PreparedStatement pStmt = null;
ResultSet rs = null;
JSONObject jsonObject = null;
JSONArray jsonArray = new JSONArray();
String transDB = userInfo.getTransDB();
String userCode = userInfo.getLoginCode();
try
{
conn = connDriver.getConnectDB(transDB);
//SELECT UPPER(SC.CITY) AS CITY ,UPPER(ST.DESCR) AS STATE,ST.STATE_CODE FROM STRG_CUSTOMER SC, STATE ST WHERE SC_CODE = 'DOC0000016' AND SC.STATE_CODE = ST.STATE_CODE;
sql = " SELECT UPPER(SC.CITY) AS CITY ,UPPER(ST.DESCR) AS STATE , ST.STATE_CODE FROM STRG_CUSTOMER SC, STATE ST " +
" WHERE SC_CODE = ? AND SC.STATE_CODE = ST.STATE_CODE ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, userCode);
rs = pStmt.executeQuery();
while(rs.next())
{
jsonObject = new JSONObject();
jsonObject.put("default_city", E12GenericUtility.checkNull(rs.getString("CITY")));
jsonObject.put("default_state", E12GenericUtility.checkNull(rs.getString("STATE")));
jsonObject.put("default_state_code", E12GenericUtility.checkNull(rs.getString("STATE_CODE")));
jsonArray.add(jsonObject);
jsonObject = null;
}
try
{
String stateList = getStateList();
System.out.println("jsonArray stateList "+stateList);
org.json.JSONObject stateJSONObject = new org.json.JSONObject(stateList);
jsonArray.add(stateJSONObject);
// System.out.println("Final Array :: "+jsonArray.toString());
}
catch(Exception e)
{
System.out.println("Exception getMyVisitDefaultData "+e);
}
}
catch(Exception e)
{
System.out.println("Exception .. getMyVisitDefaultData "+e);
}
finally {
try
{
if(conn != null)
{
conn.close();
conn = null;
}
}
catch(Exception e)
{
System.out.println("Exception getMyVisitDefaultData : "+e);
}
}
System.out.println("final getMyVisitDefaultData :: "+jsonArray.toString());
return jsonArray.toString();
}
public String getQualification() {
//SELECT SH_DESCR AS QUALIFICATION,QLF_CODE, DESCR FROM QUALIFICATION WHERE TYPE ='MEDICAL';
System.out.println("Inside getQualification ....");
String sql = "";
ConnDriver connDriver = new ConnDriver();
Connection conn = null;
PreparedStatement pStmt = null;
ResultSet rs = null;
JSONObject jsonObject = null;
JSONObject finalObject = null;
JSONArray jsonArray = new JSONArray();
try
{
conn = connDriver.getConnectDB("APPVIS");
sql = "SELECT SH_DESCR AS QUALIFICATION,QLF_CODE, DESCR FROM QUALIFICATION WHERE TYPE ='MEDICAL'";
pStmt = conn.prepareStatement(sql);
rs = pStmt.executeQuery();
while(rs.next())
{
jsonObject = new JSONObject();
jsonObject.put("key", E12GenericUtility.checkNull(rs.getString("QLF_CODE")));
jsonObject.put("label", E12GenericUtility.checkNull(rs.getString("QUALIFICATION")));
jsonArray.add(jsonObject);
jsonObject = null;
}
finalObject = new JSONObject();
finalObject.put("qualification", jsonArray);
}
catch(Exception e)
{
System.out.println("Exception .. "+e);
}
finally {
try
{
if(conn != null)
{
conn.close();
conn = null;
}
}
catch(Exception e)
{
System.out.println("Exception getQualification : "+e);
}
}
System.out.println("final getQualification list :: "+finalObject.toString());
return finalObject.toString();
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment