Commit e6b63d04 authored by CORP\sonam.kamble's avatar CORP\sonam.kamble

changes done for notification sending.

parent fa2ebfe2
...@@ -20,6 +20,8 @@ import ibase.utility.E12GenericUtility; ...@@ -20,6 +20,8 @@ import ibase.utility.E12GenericUtility;
import ibase.utility.EMail; import ibase.utility.EMail;
import ibase.utility.UserInfoBean; import ibase.utility.UserInfoBean;
import ibase.webitm.ejb.DBAccessEJB; import ibase.webitm.ejb.DBAccessEJB;
import ibase.webitm.notification.ejb.PublishPushNotificationEJB;
import ibase.webitm.notification.ejb.PublishPushNotificationRemote;
public class Appointment public class Appointment
{ {
...@@ -955,9 +957,17 @@ public class Appointment ...@@ -955,9 +957,17 @@ public class Appointment
mobNo = E12GenericUtility.checkNull(jsonData.getString("mobile_no")); mobNo = E12GenericUtility.checkNull(jsonData.getString("mobile_no"));
address = E12GenericUtility.checkNull(jsonData.getString("addr1")); address = E12GenericUtility.checkNull(jsonData.getString("addr1"));
city = jsonData.getString("city"); city = jsonData.getString("city");
try
{
dateOfBirth = output.parse(dob); dateOfBirth = output.parse(dob);
dtOfBirth = Timestamp.valueOf(String.valueOf(this.genericUtility.getValidDateString(dob, this.genericUtility.getApplDateFormat(), this.genericUtility.getDBDateFormat())) + " 00:00:00.00"); dtOfBirth = Timestamp.valueOf(String.valueOf(this.genericUtility.getValidDateString(dob, this.genericUtility.getApplDateFormat(), this.genericUtility.getDBDateFormat())) + " 00:00:00.00");
}
catch(Exception e)
{
errString = genericUtility.getErrorString("dateOfBirth", "VTBIRTH", mobNo);
jsonObject = this.convertXmlToJsonInError(errString);
return jsonObject.toString();
}
/* /*
* if (emailId.length() == 0) { errString = * if (emailId.length() == 0) { errString =
* genericUtility.getErrorString("email_id", "VTEMAILBK", mobNo); jsonObject = * genericUtility.getErrorString("email_id", "VTEMAILBK", mobNo); jsonObject =
...@@ -1366,7 +1376,7 @@ public class Appointment ...@@ -1366,7 +1376,7 @@ public class Appointment
{ {
System.out.println("Appointment.getMailFormatDetails()"); System.out.println("Appointment.getMailFormatDetails()");
String lineNo = "", apptId = "", visitPlace = "", String lineNo = "", apptId = "", visitPlace = "",
docName = "", apptDate = "", emailId = ""; docName = "", apptDate = "", emailId = "", patientCode = "";
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
PreparedStatement psmt = null; PreparedStatement psmt = null;
ResultSet rs = null; ResultSet rs = null;
...@@ -1375,11 +1385,12 @@ public class Appointment ...@@ -1375,11 +1385,12 @@ public class Appointment
final List<String> visiPlaceArr = new ArrayList<String>(); final List<String> visiPlaceArr = new ArrayList<String>();
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>();
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 ,");
builder.append("SC.FIRST_NAME || ' ' || SC.MIDDLE_NAME || ' ' || SC.LAST_NAME AS DOC_NAME "); builder.append("SC.FIRST_NAME || ' ' || SC.MIDDLE_NAME || ' ' || SC.LAST_NAME AS DOC_NAME, APPT.PATIENT_CODE ");
builder.append("FROM APPOINTMENT APPT, STRG_CUSTOMER SC, STRG_VISIT_HOURS SVH, PATIENT PAT "); builder.append("FROM APPOINTMENT APPT, STRG_CUSTOMER SC, STRG_VISIT_HOURS SVH, PATIENT PAT ");
builder.append("WHERE APPT.DOCTOR_CODE = SC.SC_CODE AND APPT.PATIENT_CODE = PAT.PATIENT_CODE "); builder.append("WHERE APPT.DOCTOR_CODE = SC.SC_CODE AND APPT.PATIENT_CODE = PAT.PATIENT_CODE ");
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 = ? ");
...@@ -1402,12 +1413,14 @@ public class Appointment ...@@ -1402,12 +1413,14 @@ public class Appointment
docName = rs.getString("doc_name"); docName = rs.getString("doc_name");
apptDate = rs.getString("appoint_date"); apptDate = rs.getString("appoint_date");
emailId = rs.getString("email_id"); emailId = rs.getString("email_id");
patientCode = rs.getString("patient_code");
apptIdArr.add(apptId); apptIdArr.add(apptId);
visiPlaceArr.add(visitPlace); visiPlaceArr.add(visitPlace);
docNameArr.add(docName); docNameArr.add(docName);
apptDateArr.add(apptDate); apptDateArr.add(apptDate);
emailIdArr.add(emailId); emailIdArr.add(emailId);
patCodeArr.add(patientCode);
} }
} }
} }
...@@ -1425,12 +1438,14 @@ public class Appointment ...@@ -1425,12 +1438,14 @@ public class Appointment
docName = rs.getString("doc_name"); docName = rs.getString("doc_name");
apptDate = rs.getString("appoint_date"); apptDate = rs.getString("appoint_date");
emailId = rs.getString("email_id"); emailId = rs.getString("email_id");
patientCode = rs.getString("patient_code");
apptIdArr.add(apptId); apptIdArr.add(apptId);
visiPlaceArr.add(visitPlace); visiPlaceArr.add(visitPlace);
docNameArr.add(docName); docNameArr.add(docName);
apptDateArr.add(apptDate); apptDateArr.add(apptDate);
emailIdArr.add(emailId); emailIdArr.add(emailId);
patCodeArr.add(patientCode);
} }
} }
...@@ -1439,7 +1454,7 @@ public class Appointment ...@@ -1439,7 +1454,7 @@ public class Appointment
public void run() public void run()
{ {
System.out.println("apptDateArr L "+apptDateArr); System.out.println("apptDateArr L "+apptDateArr);
sendMail(apptIdArr, docNameArr, apptDateArr, visiPlaceArr, emailIdArr, userInfo); sendMail(apptIdArr, docNameArr, apptDateArr, visiPlaceArr, emailIdArr, patCodeArr, userInfo);
}; };
}.start(); }.start();
...@@ -1451,15 +1466,18 @@ public class Appointment ...@@ -1451,15 +1466,18 @@ public class Appointment
} }
public void sendMail(List<String> refId, List<String> docName, List<String> apptDate, public void sendMail(List<String> refId, List<String> docName, List<String> apptDate,
List<String> visitPlace, List<String> emailId, UserInfoBean userInfo) List<String> visitPlace, List<String> emailId, List<String> patCodeArr, UserInfoBean userInfo)
{ {
EMail email = new EMail(); EMail email = new EMail();
ArrayList<String> userIdList = null;
try try
{ {
if(refId != null) if(refId != null)
{ {
for (int i = 0; i < refId.size(); i++) for (int i = 0; i < refId.size(); i++)
{ {
userIdList = new ArrayList<String>();
userIdList.add(patCodeArr.get(i));
String patientMailDomStr = "<ROOT><TRANS_INFO><OBJ_NAME>APPOINTMENT</OBJ_NAME>"+ String patientMailDomStr = "<ROOT><TRANS_INFO><OBJ_NAME>APPOINTMENT</OBJ_NAME>"+
"<REF_SER>APPT</REF_SER><REF_ID>"+refId.get(i)+"</REF_ID>"+ "<REF_SER>APPT</REF_SER><REF_ID>"+refId.get(i)+"</REF_ID>"+
"<LINE_NO></LINE_NO><XSL_FILE_NAME></XSL_FILE_NAME></TRANS_INFO>"+ "<LINE_NO></LINE_NO><XSL_FILE_NAME></XSL_FILE_NAME></TRANS_INFO>"+
...@@ -1475,6 +1493,17 @@ public class Appointment ...@@ -1475,6 +1493,17 @@ public class Appointment
//Changed by pankaj T. on 10-04-2020 for Configure SMTP mail server against ENTERPRISE //Changed by pankaj T. on 10-04-2020 for Configure SMTP mail server against ENTERPRISE
//email.sendMail(patientMailDomStr, "ITM", conn); //email.sendMail(patientMailDomStr, "ITM", conn);
email.sendMail(patientMailDomStr, "ITM", userInfo); email.sendMail(patientMailDomStr, "ITM", userInfo);
try
{
String postMessage = "Your appotment with Dr. "+docName.get(i)+" scheduled on Date "+apptDate.get(i)+","+visitPlace.get(i)+" has been cancelled.";
String refSer ="APPT-D";
PublishPushNotificationEJB publishPushNotificationEJB = new PublishPushNotificationEJB();
publishPushNotificationEJB.invockPushNotification(postMessage, "", PublishPushNotificationRemote.OPEN_TARGET_TRANSACTION,refId.get(i), userIdList , "", refId.get(i), refSer, userInfo.getLoginCode(), 0,userInfo);
}
catch (Exception e) {
System.out.println("Exception Appointment.sendMail() while sending Notification...."+e);
}
} }
} }
} }
......
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