Skip to content

Commit

Permalink
Merge branch 'master' into Issue#6198
Browse files Browse the repository at this point in the history
  • Loading branch information
DamithDeshan authored Jul 27, 2024
2 parents d0bb8de + 075cbb8 commit f497f85
Show file tree
Hide file tree
Showing 15 changed files with 631 additions and 145 deletions.
2 changes: 1 addition & 1 deletion .github/counter.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1
15
2 changes: 1 addition & 1 deletion .github/last_date.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20240727
20240727
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +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.15 (This line will be automatically updated to reflect the latest version)

## History

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.divudi.bean.common.SessionController;
import com.divudi.bean.common.util.JsfUtil;
import com.divudi.data.SymanticType;
import com.divudi.entity.Department;
import com.divudi.entity.clinical.ClinicalEntity;
import com.divudi.facade.ClinicalEntityFacade;
import java.io.Serializable;
Expand Down Expand Up @@ -51,10 +52,34 @@ public class ClinicalEntityController implements Serializable {
private ClinicalEntity current;
private List<ClinicalEntity> items = null;
String selectText = "";
Department department;

public String navigateToManageClinicalEntities() {
return "/emr/admin/clinical_entities";
}

public String navigateToMangeSurgeries() {
return "/emr/admin/clinical_entities";
}

public ClinicalEntity findItemByName(String name,Department dept) {
try {
String jpql;
Map m = new HashMap();
jpql = "select i "
+ " from ClinicalEntity i "
+ " where i.retired=:ret "
+ " and i.department=:dept "
+ " and i.name=:name ";
m.put("ret", false);
m.put("name", name);
m.put("dept", dept);
ClinicalEntity item = getFacade().findFirstByJpql(jpql, m);
return item;
} catch (Exception e) {
return null;
}
}

public List<ClinicalEntity> listClinicalEntity(SymanticType type) {
List<ClinicalEntity> c;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ public Institution findAndSaveInstitutionByName(String name) {
+ " where i.name=:name"
+ " and i.retired=:ret";
Institution i = getFacade().findFirstByJpql(sql, m);
System.out.println("i = " + i);
if (i == null) {
i = new Institution();
i.setName(name);
Expand Down
202 changes: 195 additions & 7 deletions src/main/java/com/divudi/bean/emr/DataUploadController.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.divudi.bean.emr;

import com.divudi.bean.clinical.ClinicalEntityController;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
Expand Down Expand Up @@ -177,6 +178,8 @@ public class DataUploadController implements Serializable {
CreditCompanyController creditCompanyController;
@Inject
DoctorController doctorController;
@Inject
ClinicalEntityController clinicalEntityController;

@EJB
PatientFacade patientFacade;
Expand Down Expand Up @@ -230,6 +233,11 @@ public class DataUploadController implements Serializable {
private boolean pollActive;
private boolean uploadComplete;

private List<ClinicalEntity> surgeries;
private List<ClinicalEntity> surgeriesToSave;
private List<ClinicalEntity> surgeriesToSkiped;


public String navigateToCollectingCenterUpload() {
uploadComplete = false;
return "/admin/institutions/collecting_centre_upload?faces-redirect=true";
Expand Down Expand Up @@ -311,13 +319,11 @@ public String navigateToUploadOutSourceInvestigationFees() {
return "/admin/items/item_and_fee_upload_for_outsource_Investigation?faces-redirect=true";
}


public String navigateToUploadOpdItemsAndHospitalFees() {
pollActive = false;
return "/admin/items/opd_items_and_hospital_fee_upload?faces-redirect=true";
}


public String navigateToCollectingCentreSpecialFeeUpload() {
pollActive = false;
return "/admin/items/collecting_centre_special_fee_upload?faces-redirect=true";
Expand Down Expand Up @@ -455,6 +461,18 @@ public void uploadItemsAndHospitalFees() {
}
}

public void uploadSurgeries() {
surgeries = new ArrayList<>();
if (file != null) {
try ( InputStream inputStream = file.getInputStream()) {
surgeries = readSurgeriesFromExcel(inputStream);
System.out.println("surgeries = " + surgeries.size());
} catch (IOException e) {
e.printStackTrace();
}
}
}

public void uploadAddProfessionalFees() {
itemFees = new ArrayList<>();
if (file != null) {
Expand Down Expand Up @@ -1297,9 +1315,154 @@ private List<Item> readOpdItemsAndFeesFromExcel(InputStream inputStream) throws

return itemsToSave;
}


private List<ItemFee> addProfessionalFeesFromExcel(InputStream inputStream) throws IOException {
private List<ClinicalEntity> readSurgeriesFromExcel(InputStream inputStream) throws IOException {
Workbook workbook = new XSSFWorkbook(inputStream);
Sheet sheet = workbook.getSheetAt(0);
Iterator<Row> rowIterator = sheet.rowIterator();

surgeriesToSave = new ArrayList<>();
surgeriesToSkiped = new ArrayList<>();
departmentsSaved = new ArrayList<>();
itemsSkipped = new ArrayList<>();
institutionsSaved= new ArrayList<>();
itemsToSave= new ArrayList<>();
ClinicalEntity item;
// New running financial category

// Assuming the first row contains headers, skip it
if (rowIterator.hasNext()) {
rowIterator.next();
}

while (rowIterator.hasNext()) {
Institution runningIns = null;
Department runningDept = null;
Row row = rowIterator.next();

Institution institution;
Department department;

String name = null;
String description = "";
String printingName = null;
String fullName = null;
String code = null;
String categoryName = null;
String financialCategoryName = null;
String institutionName = null;
String departmentName = null;
String inwardName = null;

Cell insCell = row.getCell(6);
if (insCell != null && insCell.getCellType() == CellType.STRING) {
institutionName = insCell.getStringCellValue();
}
if (institutionName == null || institutionName.trim().equals("")) {
institutionName = sessionController.getInstitution().getName();
}

if (runningIns == null) {
institution = institutionController.findAndSaveInstitutionByName(institutionName);
institutionsSaved.add(institution);
runningIns = institution;
} else if (runningIns.getName().equals(institutionName)) {
institution = runningIns;
} else {
institution = institutionController.findAndSaveInstitutionByName(institutionName);
institutionsSaved.add(institution);
runningIns = institution;
}

Cell deptCell = row.getCell(3);
if (deptCell != null && deptCell.getCellType() == CellType.STRING) {
departmentName = deptCell.getStringCellValue();
}
if (departmentName == null || departmentName.trim().equals("")) {
departmentName = sessionController.getDepartment().getName();
}
if (runningDept == null) {
department = departmentController.findAndSaveDepartmentByName(departmentName, institution);
runningDept = department;
departmentsSaved.add(department);
} else if (runningDept.getName().equals(departmentName)) {
department = runningDept;
} else {
department = departmentController.getDefaultDepatrment(institution);
runningDept = department;
departmentsSaved.add(department);
}

Cell nameCell = row.getCell(0);
if (nameCell != null && nameCell.getCellType() == CellType.STRING) {
name = nameCell.getStringCellValue();
if (name == null || name.trim().equals("")) {
continue;
}
}

Cell printingNameCell = row.getCell(2);
if (printingNameCell != null && printingNameCell.getCellType() == CellType.STRING) {
printingName = printingNameCell.getStringCellValue();
}
if (printingName == null || printingName.trim().equals("")) {
printingName = name;
}

Cell fullNameCell = row.getCell(1);
if (fullNameCell != null && fullNameCell.getCellType() == CellType.STRING) {
fullName = fullNameCell.getStringCellValue();
}
if (fullName == null || fullName.trim().equals("")) {
fullName = name;
}

name = CommonFunctions.sanitizeStringForDatabase(name);
item = clinicalEntityController.findItemByName(name, department);
if (item != null) {
itemsSkipped.add(item);
continue;
}

Cell codeCell = row.getCell(3);
if (codeCell != null && codeCell.getCellType() == CellType.STRING) {
code = codeCell.getStringCellValue();
} else if (codeCell != null && codeCell.getCellType() == CellType.NUMERIC) {
code = codeCell.getNumericCellValue() + "";
}
if (code == null || code.trim().equals("")) {
code = serviceController.generateShortCode(name);
}

Cell descriptionCell = row.getCell(1);
if (descriptionCell != null && descriptionCell.getCellType() == CellType.STRING) {
description = descriptionCell.getStringCellValue();
}
if (description == null || description.trim().equals("")) {
description = name;
}

ClinicalEntity cli = new ClinicalEntity();
cli.setName(name);
cli.setPrintName(printingName);
cli.setFullName(fullName);
cli.setCode(code);
cli.setInstitution(institution);
cli.setDepartment(department);
cli.setSymanticType(SymanticType.Therapeutic_Procedure);
cli.setCreater(sessionController.getLoggedUser());
cli.setCreatedAt(new Date());
item = cli;
itemController.saveSelected(item);
if (item != null) {
itemsToSave.add(item);
}
}
return surgeriesToSave;
}


private List<ItemFee> addProfessionalFeesFromExcel(InputStream inputStream) throws IOException {
Workbook workbook = new XSSFWorkbook(inputStream);
Sheet sheet = workbook.getSheetAt(0);
Iterator<Row> rowIterator = sheet.rowIterator();
Expand Down Expand Up @@ -2844,9 +3007,10 @@ public void uploadDiagnoses() {
InputStream inputStream = file.getInputStream();
readDiagnosesFromExcel(inputStream);

} catch (IOException ex) {
Logger.getLogger(DataUploadController.class
.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(DataUploadController.class

.getName()).log(Level.SEVERE, null, ex);
}
}
}
Expand Down Expand Up @@ -4700,4 +4864,28 @@ public void setDepartments(List<Department> departments) {
this.departments = departments;
}

public List<ClinicalEntity> getSurgeries() {
return surgeries;
}

public void setSurgeries(List<ClinicalEntity> surgeries) {
this.surgeries = surgeries;
}

public List<ClinicalEntity> getSurgeriesToSave() {
return surgeriesToSave;
}

public void setSurgeriesToSave(List<ClinicalEntity> surgeriesToSave) {
this.surgeriesToSave = surgeriesToSave;
}

public List<ClinicalEntity> getSurgeriesToSkiped() {
return surgeriesToSkiped;
}

public void setSurgeriesToSkiped(List<ClinicalEntity> surgeriesToSkiped) {
this.surgeriesToSkiped = surgeriesToSkiped;
}

}
1 change: 0 additions & 1 deletion src/main/resources/META-INF/persistence.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.2" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd">
<persistence-unit name="hmisPU" transaction-type="JTA">

<jta-data-source>jdbc/arogya</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0.20240727.1
3.0.0.20240727.15
2 changes: 1 addition & 1 deletion src/main/webapp/admin/institutions/area.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<ui:define name="admin">

<h:panelGroup >
<h:form >
<h:form>
<p:growl />
<p:focus id="selectFocus" for="lstSelect" />
<p:focus id="detailFocus" for="txtName" />
Expand Down
Loading

0 comments on commit f497f85

Please sign in to comment.