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
pStmt=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.setString(1, userCode);
rs = pStmt.executeQuery();
......@@ -458,7 +458,7 @@ public class Appointment
errSting = genericUtility.getErrorString("SC_CODE", "VISUNAVAIL", userCode);
jsonObject = convertXmlToJsonInError(errSting);
System.out.println("2............."+visitplaces);
getMailFormatDetails(visitPLaceItr, "0", userCode, fromDtTStmp, toDtTStmp, userInfoBean, conn);
getMailFormatDetails("0", userCode, fromDtTStmp, toDtTStmp, userInfoBean, conn, visitplaces);
}
}
else
......@@ -467,9 +467,10 @@ public class Appointment
}
}
SimpleDateFormat format2 = new SimpleDateFormat("DD-MOM-YY");
frDate = output.parse(fromDateStr);
toDate = output.parse(toDateStr);
SimpleDateFormat format2 = new SimpleDateFormat("DD-MMM-YY");
SimpleDateFormat smpDtForm = new SimpleDateFormat("dd/mm/yy");
frDate = smpDtForm.parse(fromDateStr);
toDate = smpDtForm.parse(toDateStr);
System.out.println(format2.format(frDate));
fromDateStr = format2.format(frDate);
......@@ -587,7 +588,7 @@ public class Appointment
if(updCount > 0)
{
conn.commit();
getMailFormatDetails(null, lineNo, userCode, fromDtTStmp, toDtTStmp, userInfoBean, conn);
getMailFormatDetails(lineNo, userCode, fromDtTStmp, toDtTStmp, userInfoBean, conn, null);
}
}
else
......@@ -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);
toDate = output.parse(toDateStr);
System.out.println(format2.format(frDate));
......@@ -620,7 +621,7 @@ public class Appointment
}
catch(Exception e)
{
System.out.println("Exception in getDoctorDetails :: "+e.getMessage());
System.out.println("Appointment.insertUnableToVisit() .. "+e);
}
finally
{
......@@ -647,6 +648,7 @@ public class Appointment
System.out.println("Exception While Closing resourses ..... :: "+e);
}
}
System.out.println("jsonObject.toString() : "+jsonObject.toString());
return jsonObject.toString();
}
......@@ -783,7 +785,7 @@ public class Appointment
String mobNo = "", name = "", dob = "", gender = "", ediArr = "", chgDate = "",
chgUSer = "", chgTerm = "", emailId = "", entityCode = "", siteCodeDef = "",
userLev = "", profileId = "", entityType = "", userType = "", transDb = "",
firstName = "", middleName = "", lastName = "", regNo = "",
firstName = "", middleName = "", lastName = "", regNo = "",stanCode = "", stateCode = "",
qualification = "", address = "", state = "", city = "", pinCode = "",errorString = "";
org.json.JSONArray speciltyArr = new org.json.JSONArray();
try
......@@ -814,6 +816,8 @@ public class Appointment
qualification = jsonData.getString("qualification");
state = jsonData.getString("state");
pinCode = jsonData.getString("pin");
stanCode = jsonData.getString("stan_code");
stateCode = jsonData.getString("state_code");
Object specialtyObj = jsonData.get("speciality");
if(specialtyObj.toString().length() > 0)
{
......@@ -848,8 +852,8 @@ public class Appointment
pStmt.setString(8, "");
pStmt.setString(9, "");
pStmt.setString(10, city);
pStmt.setString(11, "DUMMY");
pStmt.setString(12, state);
pStmt.setString(11, stanCode);
pStmt.setString(12, stateCode);
pStmt.setString(13, pinCode);
pStmt.setString(14, "IND");
pStmt.setString(15, mobNo);
......@@ -980,8 +984,8 @@ public class Appointment
lName = s[2];
}
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("values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ");
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 (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ");
pStmt = conn1.prepareStatement(builder1.toString());
pStmt.setString(1, mobNo);
pStmt.setString(2, fName);
......@@ -1004,6 +1008,8 @@ public class Appointment
pStmt.setString(19, serviceType);
pStmt.setString(20, serviceNo);
pStmt.setString(21, name);
pStmt.setString(22, emailId);
int patCount = pStmt.executeUpdate();
if(patCount > 0)
{
......@@ -1338,8 +1344,8 @@ public class Appointment
}
//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,
Timestamp frDate, Timestamp toDate, UserInfoBean userInfo, Connection conn)
public void getMailFormatDetails(String visitRefNo, String doctorCode,
Timestamp frDate, Timestamp toDate, UserInfoBean userInfo, Connection conn, List<String> visitplaces)
{
System.out.println("Appointment.getMailFormatDetails()");
String lineNo = "", apptId = "", visitPlace = "",
......@@ -1353,7 +1359,7 @@ public class Appointment
final List<String> docNameArr = new ArrayList<String>();
final List<String> emailIdArr = new ArrayList<String>();
final List<String> patCodeArr = new ArrayList<String>();
Iterator<String> visitPLaceItr = null;
try
{
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
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 ? ");
psmt = conn.prepareStatement(builder.toString());
if(itr != null)
if(visitplaces != null)
{
visitPLaceItr = visitplaces.iterator();
}
if(visitPLaceItr != null)
{
while(itr.hasNext())
while(visitPLaceItr.hasNext())
{
lineNo = itr.next();
lineNo = visitPLaceItr.next();
System.out.println("Inside 1386................" +lineNo);
psmt.setString(1, doctorCode);
psmt.setString(2, lineNo);
psmt.setTimestamp(3, frDate);
......@@ -1956,30 +1968,96 @@ public class Appointment
public String getStateList()
{
System.out.println("Inside getStateList .... ");
String sql = "";
String sql = "",stateCode="",state="",stanCode="",city="";
ConnDriver connDriver = new ConnDriver();
Connection conn = null;
PreparedStatement pStmt = null;
ResultSet rs = null;
JSONObject jsonObject = null;
JSONObject jsonStateObject = null;
JSONObject jsonCityObject = null;
JSONObject jsonFieldObject = null;
JSONArray jsonArray = new JSONArray();
JSONArray cityArray = null;
int stateCount = 0;
try
{
System.out.println("1.........................");
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);
rs = pStmt.executeQuery();
while(rs.next())
{
//jsonObject = new JSONObject();
// jsonObject.put("key", E12GenericUtility.checkNull(rs.getString("state_code")));
// 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);
jsonCityObject = null;
}
cityArray = null;
jsonObject = null;
jsonStateObject = null;
jsonCityObject = null;
stanCode = tempStanCode;
stateCode = tempStateCode ;
jsonObject = new JSONObject();
jsonObject.put("key", E12GenericUtility.checkNull(rs.getString("state_code")));
jsonObject.put("label", E12GenericUtility.checkNull(rs.getString("state")));
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;
}
if(jsonObject != null)
{
jsonObject.put("city", cityArray);
jsonArray.add(jsonObject);
jsonObject = null;
jsonCityObject = null;
}
System.out.println("state jsonArray "+jsonArray);
state = "";
stanCode = "";
System.out.println("state jsonArray stateCount "+stateCount);
jsonObject = new JSONObject();
jsonObject.put("state", jsonArray);
}
......@@ -2022,10 +2100,17 @@ public class Appointment
String stateList = getStateList();
System.out.println("jsonArray stateList "+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.put("speciality", jsonArray);
jsonObject.put("state", stateJSONObject.get("state"));
jsonObject.put("qualification", qualificationJSONObject.get("qualification"));
}
catch(Exception e)
{
......@@ -2040,6 +2125,20 @@ public class Appointment
{
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());
return jsonObject.toString();
}
......@@ -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