Skip to content

Commit

Permalink
Merge branch 'develop' into OP-312-telemetry-module
Browse files Browse the repository at this point in the history
  • Loading branch information
mwithi authored Nov 6, 2023
2 parents e23a3ac + 7d21d8e commit e0652a5
Show file tree
Hide file tree
Showing 98 changed files with 2,536 additions and 1,897 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The Core component is used by the [Java Swing desktop GUI][openhospital-gui], an

## How to build

After having installed Java JDK 8+ and Maven, to build this project issue:
After having installed Java JDK 11+ and Maven (or using the provided Maven Wrapper `mvnw`), to build this project issue:

mvn package

Expand Down
32 changes: 16 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
<oh.version>1.13.0-SNAPSHOT</oh.version>
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.framework.version>5.3.29</spring.framework.version>
<spring.boot.version>2.7.15</spring.boot.version>
<jasperreports.version>6.20.5</jasperreports.version>
<spring.framework.version>5.3.30</spring.framework.version>
<spring.boot.version>2.7.17</spring.boot.version>
<jasperreports.version>6.20.6</jasperreports.version>
<spring.cloud.starter.openfeign.version>3.1.8</spring.cloud.starter.openfeign.version>
<license.maven.plugin.version>4.2</license.maven.plugin.version>
<license.maven.plugin.version>4.3</license.maven.plugin.version>
</properties>

<build>
Expand Down Expand Up @@ -268,7 +268,7 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>2.2.222</version>
<version>2.2.224</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -289,12 +289,12 @@
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>4.0.3</version>
<version>4.0.4</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>4.0.3</version>
<version>4.0.4</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
Expand All @@ -304,32 +304,32 @@
<dependency>
<groupId>org.dcm4che</groupId>
<artifactId>dcm4che-core</artifactId>
<version>5.31.0</version>
<version>5.31.1</version>
</dependency>
<dependency>
<groupId>org.dcm4che</groupId>
<artifactId>dcm4che-image</artifactId>
<version>5.31.0</version>
<version>5.31.1</version>
</dependency>
<dependency>
<groupId>org.dcm4che</groupId>
<artifactId>dcm4che-imageio</artifactId>
<version>5.31.0</version>
<version>5.31.1</version>
</dependency>
<dependency>
<groupId>org.dcm4che</groupId>
<artifactId>dcm4che-imageio-opencv</artifactId>
<version>5.31.0</version>
<version>5.31.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.3</version>
<version>5.2.4</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.3</version>
<version>5.2.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down Expand Up @@ -410,7 +410,7 @@
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>2.7.15</version>
<version>2.7.17</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -539,12 +539,12 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.15.2</version>
<version>2.15.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-modules-java8</artifactId>
<version>2.15.2</version>
<version>2.15.3</version>
<type>pom</type>
<scope>runtime</scope>
</dependency>
Expand Down
579 changes: 569 additions & 10 deletions sql/load_demo_data.sql

Large diffs are not rendered by default.

66 changes: 31 additions & 35 deletions src/main/java/org/isf/accounting/manager/BillBrowserManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,91 +140,87 @@ public List<BillPayments> getPayments(int billID) throws OHServiceException {

/**
* Stores a new {@link Bill} along with all its {@link BillItems} and {@link BillPayments}
* @param newBill - the bill to store.
* @param bill - the bill to store.
* @param billItems - the list of bill's items
* @param billPayments - the list of bill's payments
* @return <code>true</code> if the bill has been stored, <code>false</code> otherwise.
* @throws OHServiceException
* @returns the persisted Bill object
* @throws OHServiceException
*/
@Transactional(rollbackFor=OHServiceException.class)
@TranslateOHServiceException
public boolean newBill(
Bill newBill,
public Bill newBill(
Bill bill,
List<BillItems> billItems,
List<BillPayments> billPayments) throws OHServiceException
{
validateBill(newBill, billItems, billPayments);
int billId = newBill(newBill);
boolean result = billId > 0;
List<BillPayments> billPayments) throws OHServiceException {
validateBill(bill, billItems, billPayments);
Bill newBill = newBill(bill);
int billId = newBill.getId();
if (!billItems.isEmpty()) {
result = newBillItems(billId, billItems);
newBillItems(billId, billItems);
}
if (!billPayments.isEmpty()) {
result = result && newBillPayments(billId, billPayments);
newBillPayments(billId, billPayments);
}
return result;
return newBill;
}

/**
* Stores a new {@link Bill}.
* @param newBill the bill to store.
* @return the generated id.
* @return the persisted Bill object
* @throws OHServiceException
*/
private int newBill(Bill newBill) throws OHServiceException {
private Bill newBill(Bill newBill) throws OHServiceException {
return ioOperations.newBill(newBill);
}

/**
* Stores a list of {@link BillItems} associated to a {@link Bill}.
* @param billID the bill id.
* @param billItems the bill items to store.
* @return <code>true</code> if the {@link BillItems} have been store, <code>false</code> otherwise.
* @throws OHServiceException
*/
private boolean newBillItems(int billID, List<BillItems> billItems) throws OHServiceException {
return ioOperations.newBillItems(ioOperations.getBill(billID), billItems);
private void newBillItems(int billID, List<BillItems> billItems) throws OHServiceException {
ioOperations.newBillItems(ioOperations.getBill(billID), billItems);
}

/**
* Stores a list of {@link BillPayments} associated to a {@link Bill}.
* @param billID the bill id.
* @param payItems the bill payments.
* @return <code>true</code> if the payments have been stored, <code>false</code> otherwise.
* @throws OHServiceException
*/
private boolean newBillPayments(int billID, List<BillPayments> payItems) throws OHServiceException {
return ioOperations.newBillPayments(ioOperations.getBill(billID), payItems);
private void newBillPayments(int billID, List<BillPayments> payItems) throws OHServiceException {
ioOperations.newBillPayments(ioOperations.getBill(billID), payItems);
}

/**
* Updates the specified {@link Bill} along with all its {@link BillItems} and {@link BillPayments}
* @param updateBill - the bill to update.
* @param billItems - the list of bill's items
* @param billPayments - the list of bill's payments
* @return <code>true</code> if the bill has been updated, <code>false</code> otherwise.
* @return the updated Bill object
* @throws OHServiceException
*/
@Transactional(rollbackFor=OHServiceException.class)
@TranslateOHServiceException
public boolean updateBill(Bill updateBill,
public Bill updateBill(Bill updateBill,
List<BillItems> billItems,
List<BillPayments> billPayments) throws OHServiceException {
validateBill(updateBill, billItems, billPayments);
boolean result = updateBill(updateBill);
result = result && newBillItems(updateBill.getId(), billItems);
result = result && newBillPayments(updateBill.getId(), billPayments);
return result;

Bill updatedBill = updateBill(updateBill);
newBillItems(updateBill.getId(), billItems);
newBillPayments(updateBill.getId(), billPayments);
return updatedBill;
}

/**
* Updates the specified {@link Bill}.
* @param updateBill the bill to update.
* @return <code>true</code> if the bill has been updated, <code>false</code> otherwise.
* @return the updated Bill object
* @throws OHServiceException
*/
private boolean updateBill(Bill updateBill) throws OHServiceException {
private Bill updateBill(Bill updateBill) throws OHServiceException {
return ioOperations.updateBill(updateBill);
}

Expand Down Expand Up @@ -258,13 +254,13 @@ public List<String> getUsers() throws OHServiceException {
}

/**
* Deletes the specified {@link Bill}.
* Deletes the specified {@link Bill}. If the argument is NULL then an error is thrown.
* If the Bill is not found it is silently ignored.
* @param deleteBill the bill to delete.
* @return <code>true</code> if the bill has been deleted, <code>false</code> otherwise.
* @throws OHServiceException
* @throws OHServiceException
*/
public boolean deleteBill(Bill deleteBill) throws OHServiceException {
return ioOperations.deleteBill(deleteBill);
public void deleteBill(Bill deleteBill) throws OHServiceException {
ioOperations.deleteBill(deleteBill);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import org.isf.accounting.model.Bill;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
Expand All @@ -42,10 +41,6 @@ public interface AccountingBillIoOperationRepository extends JpaRepository<Bill,

List<Bill> findByBillPatientCode(int patientCode);

@Modifying
@Query(value = "update Bill b set b.status='D' where b.id = :billId")
void updateDeleteWhereId(@Param("billId") Integer billId);

@Query(value = "select b from Bill b where b.date >= :dateFrom and b.date < :dateTo")
List<Bill> findByDateBetween(@Param("dateFrom") LocalDateTime dateFrom, @Param("dateTo") LocalDateTime dateTo);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,64 +140,59 @@ public List<BillPayments> getPayments(int billID) throws OHServiceException {
/**
* Stores a new {@link Bill}.
* @param newBill the bill to store.
* @return the generated {@link Bill} id.
* @return the persisted Bill object
* @throws OHServiceException if an error occurs storing the bill.
*/
public int newBill(Bill newBill) throws OHServiceException {
return billRepository.save(newBill).getId();
public Bill newBill(Bill newBill) throws OHServiceException {
return billRepository.save(newBill);
}

/**
* Stores a list of {@link BillItems} associated to a {@link Bill}.
* @param bill the bill.
* @param billItems the bill items to store.
* @return <code>true</code> if the {@link BillItems} have been store, <code>false</code> otherwise.
* @throws OHServiceException if an error occurs during the store operation.
*/
public boolean newBillItems(Bill bill, List<BillItems> billItems) throws OHServiceException {
public void newBillItems(Bill bill, List<BillItems> billItems) throws OHServiceException {
billItemsRepository.deleteWhereId(bill.getId());
for (BillItems item : billItems) {
item.setBill(bill);
billItemsRepository.save(item);
}
return true;
}

/**
* Stores a list of {@link BillPayments} associated to a {@link Bill}.
* @param bill the bill.
* @param payItems the bill payments.
* @return <code>true</code> if the payment have stored, <code>false</code> otherwise.
* @throws OHServiceException if an error occurs during the store procedure.
*/
public boolean newBillPayments(Bill bill, List<BillPayments> payItems) throws OHServiceException {
public void newBillPayments(Bill bill, List<BillPayments> payItems) throws OHServiceException {
billPaymentRepository.deleteWhereId(bill.getId());
for (BillPayments payment : payItems) {
payment.setBill(bill);
billPaymentRepository.save(payment);
}
return true;
}

/**
* Updates the specified {@link Bill}.
* @param updateBill the bill to update.
* @return <code>true</code> if the bill has been updated, <code>false</code> otherwise.
* @return the updated Bill object
* @throws OHServiceException if an error occurs during the update.
*/
public boolean updateBill(Bill updateBill) throws OHServiceException {
return billRepository.save(updateBill) != null;
public Bill updateBill(Bill updateBill) throws OHServiceException {
return billRepository.save(updateBill);
}

/**
* Deletes the specified {@link Bill}.
* Deletes the specified {@link Bill}. If the argument is NULL then an error is thrown.
* If the Bill is not found it is silently ignored.
* @param deleteBill the bill to delete.
* @return <code>true</code> if the bill has been deleted, <code>false</code> otherwise.
* @throws OHServiceException if an error occurs deleting the bill.
*/
public boolean deleteBill(Bill deleteBill) throws OHServiceException {
billRepository.updateDeleteWhereId(deleteBill.getId());
return true;
public void deleteBill(Bill deleteBill) throws OHServiceException {
billRepository.deleteById(deleteBill.getId());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,10 @@ public Admission updateAdmission(Admission admission) throws OHServiceException
* Sets an admission record as deleted.
*
* @param admissionId the admission id.
* @return <code>true</code> if the record has been set to delete.
* @return return the "deleted" admission or null if the admissionis not found
* @throws OHServiceException
*/
public boolean setDeleted(int admissionId) throws OHServiceException {
public Admission setDeleted(int admissionId) throws OHServiceException {
return ioOperations.setDeleted(admissionId);
}

Expand All @@ -284,10 +284,10 @@ public int getUsedWardBed(String wardId) throws OHServiceException {
* Deletes the patient photo.
*
* @param id the patient id.
* @return <code>true</code> if the photo has been deleted, <code>false</code> otherwise.
* @return the updated patient object or null if not found
* @throws OHServiceException
*/
public boolean deletePatientPhoto(int id) throws OHServiceException {
public Patient deletePatientPhoto(int id) throws OHServiceException {
return ioOperations.deletePatientPhoto(id);
}

Expand Down Expand Up @@ -416,7 +416,7 @@ else if (dateOut.isBefore(ad.getAdmDate()) || dateOut.equals(ad.getAdmDate())) {
errors.add(new OHExceptionMessage(MessageBundle.getMessage("angal.admission.pleaseinsertavalidweightvalue.msg")));
}

if (ward != null && ward.getCode().equalsIgnoreCase("M")) {
if (ward != null && "M".equalsIgnoreCase(ward.getCode())) {

LocalDateTime visitDate = admission.getVisitDate();
if (visitDate != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class PatientAdmission {
*/
private final Integer admissionId;

public PatientAdmission(final Integer patientId, final Integer admissionId) {
public PatientAdmission(Integer patientId, Integer admissionId) {
this.patientId = patientId;
this.admissionId = admissionId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ public class AdmissionIoOperationRepositoryImpl implements AdmissionIoOperationR
private EntityManager entityManager;

@Override
public List<AdmittedPatient> findPatientAdmissionsBySearchAndDateRanges(final String searchTerms, final LocalDateTime[] admissionRange,
final LocalDateTime[] dischargeRange) throws OHServiceException {
public List<AdmittedPatient> findPatientAdmissionsBySearchAndDateRanges(String searchTerms, LocalDateTime[] admissionRange,
LocalDateTime[] dischargeRange) throws OHServiceException {
String[] terms = getTermsToSearch(searchTerms);
List<AdmittedPatient> admittedPatients = new ArrayList<>();
if (terms.length == 1) {
Expand Down
Loading

0 comments on commit e0652a5

Please sign in to comment.