Skip to content

Commit

Permalink
Merge branch 'master' into Issue#6627
Browse files Browse the repository at this point in the history
  • Loading branch information
DamithDeshan authored Jul 27, 2024
2 parents f524706 + eb93bbe commit e78d278
Show file tree
Hide file tree
Showing 26 changed files with 831 additions and 199 deletions.
2 changes: 1 addition & 1 deletion .github/counter.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1
5
2 changes: 1 addition & 1 deletion .github/last_date.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20240727
20240727
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ Developed using Java Enterprise Edition, the system offers both a web applicatio

## Current Version




Current Version: 3.0.0.20240727.1 (This line will be automatically updated to reflect the latest version)

Current Version: 3.0.0.20240727.5 (This line will be automatically updated to reflect the latest version)

## History

Expand Down
2 changes: 1 addition & 1 deletion nb-configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Any value defined here will override the pom.xml file value but is only applicab
-->
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>pfv5ee8</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
<org-netbeans-modules-maven-j2ee.netbeans_2e_deploy_2e_on_2e_save>false</org-netbeans-modules-maven-j2ee.netbeans_2e_deploy_2e_on_2e_save>
<netbeans.compile.on.save>none</netbeans.compile.on.save>
<org-netbeans-modules-maven-j2ee.netbeans_2e_deploy_2e_on_2e_save>false</org-netbeans-modules-maven-j2ee.netbeans_2e_deploy_2e_on_2e_save>
</properties>
</project-shared-configuration>
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>vfs</artifactId>
<version>3.0.0</version>
<packaging>war</packaging>
<name>sethma</name>
<name>ruhunu-demo</name>

<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ private void recreateModel() {
}

public void saveSelected() {

if(getCurrent().getName() == null || getCurrent().getName().isEmpty()){
JsfUtil.addErrorMessage("Name is required");
return;
}

// if(getCurrent().getDescription()== null || getCurrent().getDescription().isEmpty() ){
// JsfUtil.addErrorMessage("Description is required");
// return;
// }

if (getCurrent().getId() != null && getCurrent().getId() > 0) {
getFacade().edit(current);
Expand Down
46 changes: 29 additions & 17 deletions src/main/java/com/divudi/bean/common/PatientController.java
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ public void downloadAllPatients() {
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=Patients.xlsx");

try ( ServletOutputStream outputStream = response.getOutputStream()) {
try (ServletOutputStream outputStream = response.getOutputStream()) {
workbook.write(outputStream);
} catch (IOException e) {
e.printStackTrace();
Expand Down Expand Up @@ -571,7 +571,7 @@ public void downloadPatientsPhoneNumbers() {
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=PatientPhoneNumbers.xlsx");

try ( ServletOutputStream outputStream = response.getOutputStream()) {
try (ServletOutputStream outputStream = response.getOutputStream()) {
workbook.write(outputStream);
} catch (IOException e) {
e.printStackTrace();
Expand Down Expand Up @@ -914,6 +914,16 @@ public String navigateToReceiveDepositsFromPatientProfile() {
JsfUtil.addErrorMessage("No patient selected");
return "";
}

if(current.getHasAnAccount() == null){
JsfUtil.addErrorMessage("Patient has No Account");
return "";
}
if(!current.getHasAnAccount()){
JsfUtil.addErrorMessage("Patient has No Account");
return "";
}

paymentMethodData = new PaymentMethodData();
bill = new Bill();
billItem = new BillItem();
Expand Down Expand Up @@ -1047,7 +1057,6 @@ public void createPatientInvestigationsTableAllByLoggedInstitution() {
temMap.put("ins", getSessionController().getInstitution());
sql += " order by pi.approveAt desc ";

//System.err.println("Sql " + sql);
// patientInvestigations = getPatientInvestigationFacade().findByJpql(sql, temMap, TemporalType.TIMESTAMP);
// patientInvestigations=
}
Expand Down Expand Up @@ -1563,6 +1572,7 @@ public void quickSearchPatientLongPhoneNumber(ControllerWithPatient controller)
Long searchedPhoneNumber = CommonFunctions.removeSpecialCharsInPhonenumber(quickSearchPhoneNumber);
m.put("pp", searchedPhoneNumber);
quickSearchPatientList = getFacade().findByJpql(j, m);
opdBillController.setPaymentMethod(null);
if (quickSearchPatientList == null) {
JsfUtil.addErrorMessage("No Patient found !");
controller.setPatient(null);
Expand All @@ -1581,6 +1591,14 @@ public void quickSearchPatientLongPhoneNumber(ControllerWithPatient controller)
patientSearched = quickSearchPatientList.get(0);
controller.setPatient(patientSearched);
controller.setPatientDetailsEditable(false);
opdBillController.setPaymentMethod(null);
if (controller.getPatient().getHasAnAccount() != null) {
if (patientSearched.getHasAnAccount() && configOptionApplicationController.getBooleanValueByKey("Automatically set the PatientDeposit payment Method if a Deposit is Available", false)) {
opdBillController.setPaymentMethod(PaymentMethod.PatientDeposit);
opdBillController.listnerForPaymentMethodChange();
}
}

quickSearchPatientList = null;
} else {
controller.setPatient(null);
Expand Down Expand Up @@ -1608,6 +1626,14 @@ public void selectQuickOneFromQuickSearchPatient(ControllerWithPatient controlle
controller.setPatient(current);
admissionController.fillCurrentPatientAllergies(current);
controller.setPatientDetailsEditable(false);
opdBillController.setPaymentMethod(null);
if (controller.getPatient().getHasAnAccount() != null) {
if (controller.getPatient().getHasAnAccount() && configOptionApplicationController.getBooleanValueByKey("Automatically set the PatientDeposit payment Method if a Deposit is Available", false)) {
opdBillController.setPaymentMethod(PaymentMethod.PatientDeposit);
opdBillController.listnerForPaymentMethodChange();
}
}

quickSearchPatientList = null;
}

Expand Down Expand Up @@ -2042,22 +2068,18 @@ public void createPatientBarcode() {
// return str;

} catch (Exception ex) {
// ////System.out.println("ex = " + ex.getMessage());
}
} else {
// ////System.out.println("else = ");
try {
Barcode bc = BarcodeFactory.createCode128A("0000");
bc.setBarHeight(5);
bc.setBarWidth(3);
bc.setDrawingText(true);
BarcodeImageHandler.saveJPEG(bc, barcodeFile);
// ////System.out.println("12");
InputStream targetStream = new FileInputStream(barcodeFile);
StreamedContent str = DefaultStreamedContent.builder().contentType("image/jpeg").name(barcodeFile.getName()).stream(() -> targetStream).build();
barcode = str;
} catch (Exception ex) {
// ////System.out.println("ex = " + ex.getMessage());
}
}
}
Expand Down Expand Up @@ -2155,15 +2177,13 @@ public void dobChangeListen() {
}

public StreamedContent getPhoto(Patient p) {
//////System.out.println("p is " + p);
FacesContext context = FacesContext.getCurrentInstance();
if (context.getRenderResponse()) {
return new DefaultStreamedContent();
} else if (p == null) {
return new DefaultStreamedContent();
} else {
if (p.getId() != null && p.getBaImage() != null) {
//////System.out.println("giving image");
InputStream targetStream = new ByteArrayInputStream(p.getBaImage());
StreamedContent str = DefaultStreamedContent.builder().contentType(p.getFileType()).name(p.getFileName()).stream(() -> targetStream).build();
return str;
Expand Down Expand Up @@ -2306,7 +2326,6 @@ public List<Patient> completePatient(String query) {
+ " or (p.person.mobile) like :q "
+ " order by p.person.name";
hm.put("q", "%" + query.toUpperCase() + "%");
//////System.out.println(sql);
suggestions = getFacade().findByJpql(sql, hm, 20);
}
return suggestions;
Expand Down Expand Up @@ -2782,11 +2801,6 @@ public String getCountPatientCode(String s) {
String st = "";
if (p != null) {
String str = p.getCode();
// //System.out.println("str.substring(0,1) = " + str.substring(0, 1));
// //System.out.println("str.substring(0,2) = " + str.substring(0, 2));
// //System.out.println("str.substring(2) = " + str.substring(2));
// //System.out.println("str.substring(3) = " + str.substring(3));
// //System.out.println("str.substring(3,7) = " + str.substring(3, 7));
long l = Long.parseLong(str.substring(2));
l++;
st += s;
Expand Down Expand Up @@ -3691,13 +3705,11 @@ public Object getAsObject(FacesContext facesContext, UIComponent component, Stri
}
PatientController controller = (PatientController) facesContext.getApplication().getELResolver().
getValue(facesContext.getELContext(), null, "patientController");
//////System.out.println("value at converter getAsObject is " + value);
return controller.getEjbFacade().find(getKey(value));
}

java.lang.Long getKey(String value) {
java.lang.Long key;
//////System.out.println(value);
if (value == null || value.equals("null") || value.trim().equals("")) {
key = 0l;
} else {
Expand Down
22 changes: 17 additions & 5 deletions src/main/java/com/divudi/bean/common/SessionController.java
Original file line number Diff line number Diff line change
Expand Up @@ -1084,9 +1084,12 @@ private boolean checkUsersWithoutDepartment() {
m.put("un", userName.toLowerCase());
List<WebUser> allUsers = getFacede().findByJpql(jpql, m);
for (WebUser u : allUsers) {
System.out.println("u = " + u.getName());
System.out.println("u = " + u.getId());
if ((u.getName()).equalsIgnoreCase(userName)) {
boolean passwordIsOk = SecurityController.matchPassword(password, u.getWebUserPassword());
if (passwordIsOk) {
System.out.println("password ok");

departments = listLoggableDepts(u);

Expand Down Expand Up @@ -1187,15 +1190,20 @@ public void loadDashboards() {
}

public String selectDepartment() {
System.out.println("loggedUser = " + loggedUser);
if (loggedUser == null) {
JsfUtil.addErrorMessage("No User logged");
return "/login?faces-redirect=true";
}
System.out.println("loggedUser.getId() = " + loggedUser.getId());
if (loggedUser.getWebUserPerson() == null) {
Person p = new Person();
p.setName(loggedUser.getName());
personFacade.create(p);
loggedUser.setWebUserPerson(p);
webUserFacade.edit(loggedUser);
JsfUtil.addErrorMessage("No person");
return "";
// Person p = new Person();
// p.setName(loggedUser.getName());
// personFacade.create(p);
// loggedUser.setWebUserPerson(p);
// webUserFacade.edit(loggedUser);
}

loggedUser.setDepartment(department);
Expand Down Expand Up @@ -1699,6 +1707,7 @@ public WebUser getLoggedUser() {
* @param loggedUser
*/
public void setLoggedUser(WebUser loggedUser) {
System.out.println("loggedUser = " + loggedUser);
this.loggedUser = loggedUser;
}

Expand Down Expand Up @@ -1728,7 +1737,10 @@ public List<WebUserPrivilege> fillUserPrivileges(WebUser twu, Department tdept,
}
m.put("ret", true);
m.put("wu", twu);
System.out.println("m = " + m);
System.out.println("sql = " + sql);
List<WebUserPrivilege> twups = getWebUserPrivilegeFacade().findByJpql(sql, m);
System.out.println("twups = " + twups);
return twups;
}

Expand Down
Loading

0 comments on commit e78d278

Please sign in to comment.