Skip to content

Commit

Permalink
Merge branch 'develop' into OP-1305
Browse files Browse the repository at this point in the history
  • Loading branch information
dbmalkovsky authored Oct 29, 2024
2 parents 1070bef + 5a95235 commit 0d95dce
Show file tree
Hide file tree
Showing 13 changed files with 2,087 additions and 1,973 deletions.
3,478 changes: 1,739 additions & 1,739 deletions sql/load_demo_data.sql

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions sql/step_04_all_following_steps.sql
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,4 @@ source step_a107_add_permission_admin_access.sql;
source step_a108_audit_dicom_type_and_dicom_data.sql;
source step_a109_update_user_settings_table_constraints_and_add_usergroups_permissions.sql;
source step_a110_update_operations_table_change_ope_for_to_enum.sql;
source step_a111_add_missing_lock_columns.sql;
33 changes: 33 additions & 0 deletions sql/step_a111_add_missing_lock_columns.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
--
-- Add lock (version) column in tables where it's missing
--

ALTER TABLE `oh_bills`
ADD COLUMN `BLL_LOCK` INT(11) NOT NULL DEFAULT 0;

ALTER TABLE `oh_agetype`
ADD COLUMN `AT_LOCK` INT(11) NOT NULL DEFAULT 0;

ALTER TABLE `oh_patienthistory`
ADD COLUMN `PAH_LOCK` INT(11) NOT NULL DEFAULT 0;

ALTER TABLE `oh_patientexamination`
ADD COLUMN `PEX_LOCK` INT(11) NOT NULL DEFAULT 0;

ALTER TABLE `oh_user_settings`
ADD COLUMN `USS_LOCK` INT(11) NOT NULL DEFAULT 0;

ALTER TABLE `oh_prices`
ADD COLUMN `PRC_LOCK` INT(11) NOT NULL DEFAULT 0;

ALTER TABLE `oh_pricelists`
ADD COLUMN `LST_LOCK` INT(11) NOT NULL DEFAULT 0;

ALTER TABLE `oh_supplier`
ADD COLUMN `SUP_LOCK` INT(11) NOT NULL DEFAULT 0;

ALTER TABLE `oh_pricesothers`
ADD COLUMN `OTH_LOCK` INT(11) NOT NULL DEFAULT 0;

ALTER TABLE `oh_visits`
ADD COLUMN `VST_LOCK` INT(11) NOT NULL DEFAULT 0;
16 changes: 12 additions & 4 deletions src/main/java/org/isf/accounting/model/Bill.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;
import jakarta.persistence.Version;
import jakarta.validation.constraints.NotNull;

import org.isf.admission.model.Admission;
Expand Down Expand Up @@ -97,6 +98,10 @@ public class Bill extends Auditable<String> implements Cloneable, Comparable<Bil
@Column(name = "BLL_BALANCE")
private Double balance;

@Version
@Column(name = "BLL_LOCK")
private int lock;

@NotNull
@Column(name = "BLL_USR_ID_A")
private String user;
Expand Down Expand Up @@ -124,8 +129,8 @@ public Bill() {
}

public Bill(int id, LocalDateTime date, LocalDateTime update,
boolean isList, PriceList list, String listName, boolean isPatient,
Patient billPatient, String patName, String status, Double amount, Double balance, String user, Admission admission) {
boolean isList, PriceList list, String listName, boolean isPatient,
Patient billPatient, String patName, String status, Double amount, Double balance, String user, Admission admission) {
super();
this.id = id;
this.date = TimeTools.truncateToSeconds(date);
Expand Down Expand Up @@ -237,6 +242,10 @@ public void setAdmission(Admission admission) {
this.admission = admission;
}

public int getLock() { return lock; }

public void setLock(int lock) { this.lock = lock; }

@Override
public int compareTo(Bill obj) {
return this.id - obj.getId();
Expand All @@ -248,11 +257,10 @@ public boolean equals(Object obj) {
return true;
}

if (!(obj instanceof Bill)) {
if (!(obj instanceof Bill bill)) {
return false;
}

Bill bill = (Bill) obj;
return (id == bill.getId());
}

Expand Down
113 changes: 61 additions & 52 deletions src/main/java/org/isf/agetype/model/AgeType.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;
import jakarta.persistence.Version;
import jakarta.validation.constraints.NotNull;

import org.isf.utils.db.Auditable;
Expand All @@ -43,39 +44,43 @@
@AttributeOverride(name = "lastModifiedDate", column = @Column(name = "AT_LAST_MODIFIED_DATE"))
public class AgeType extends Auditable<String> {

@Id
@Column(name="AT_CODE")
private String code;
@Id
@Column(name="AT_CODE")
private String code;

@NotNull
@Column(name="AT_DESC")
private String description;
@Column(name="AT_DESC")
private String description;

@NotNull
@Column(name="AT_FROM")
private int from;
@Column(name="AT_FROM")
private int from;

@NotNull
@Column(name="AT_TO")
private int to;
private int to;

@Version
@Column(name = "AT_LOCK")
private int lock;

@Transient
private volatile int hashCode;
public AgeType()
{

public AgeType()
{
super();
}
/**
* @param aCode
* @param aDescription
*/
public AgeType(String aCode, String aDescription) {
super();
this.code = aCode;
this.description = aDescription;
}
}

/**
* @param aCode Age type code
* @param aDescription Age type description
*/
public AgeType(String aCode, String aDescription) {
super();
this.code = aCode;
this.description = aDescription;
}

public AgeType(String aCode, int from, int to, String aDescription) {
super();
Expand All @@ -86,18 +91,18 @@ public AgeType(String aCode, int from, int to, String aDescription) {
}

public String getCode() {
return this.code;
}
public void setCode(String aCode) {
this.code = aCode;
}
public String getDescription() {
return this.description;
}
public void setDescription(String aDescription) {
this.description = aDescription;
}
public void setFrom(int from) {
return this.code;
}
public void setCode(String aCode) {
this.code = aCode;
}
public String getDescription() {
return this.description;
}
public void setDescription(String aDescription) {
this.description = aDescription;
}
public void setFrom(int from) {
this.from = from;
}
public int getFrom() {
Expand All @@ -109,36 +114,40 @@ public void setTo(int to) {
public int getTo() {
return to;
}

public int getLock() { return lock; }

public void setLock(int lock) { this.lock = lock; }

@Override
public String toString() {
return getDescription();
}
return getDescription();
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof AgeType)) {

if (!(obj instanceof AgeType ageType)) {
return false;
}

AgeType ageType = (AgeType)obj;

return (this.getCode().equals(ageType.getCode()));
}

@Override
public int hashCode() {
if (this.hashCode == 0) {
final int m = 23;
int c = 133;
c = m * c + code.hashCode();
this.hashCode = c;
}
return this.hashCode;
if (this.hashCode == 0) {
final int m = 23;
int c = 133;

c = m * c + code.hashCode();

this.hashCode = c;
}

return this.hashCode;
}
}
7 changes: 7 additions & 0 deletions src/main/java/org/isf/anamnesis/model/PatientHistory.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.Version;

import org.hibernate.annotations.ColumnDefault;
import org.isf.utils.db.Auditable;
Expand Down Expand Up @@ -279,6 +280,10 @@ public class PatientHistory extends Auditable<String> implements Comparable<Pati
@Column(name = "PAH_PHY_PREG_ABORT")
private int phyPregnancyAbort;

@Version
@Column(name = "PAH_LOCK")
private int lock;

@Override
public int compareTo(PatientHistory obj) {
return this.id - obj.getId();
Expand Down Expand Up @@ -780,5 +785,7 @@ public void setPatOpenNote(String patOpenNote) {
this.patOpenNote = patOpenNote;
}

public int getLock() { return lock; }

public void setLock(int lock) { this.lock = lock; }
}
46 changes: 27 additions & 19 deletions src/main/java/org/isf/examination/model/PatientExamination.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;
import jakarta.persistence.Version;
import jakarta.validation.constraints.NotNull;

import org.isf.patient.model.Patient;
Expand Down Expand Up @@ -114,6 +115,10 @@ public class PatientExamination extends Auditable<String> implements Comparable<

@Column(name="PEX_NOTE", length=PEX_NOTE_LENGTH)
private String pex_note;

@Version
@Column(name = "PEX_LOCK")
private int lock;

@Transient
private volatile int hashCode;
Expand All @@ -123,22 +128,22 @@ public PatientExamination() {
}

/**
* @param pex_date
* @param patient
* @param pex_height
* @param pex_weight
* @param pex_ap_min
* @param pex_ap_max
* @param pex_hr
* @param pex_temp
* @param pex_sat
* @param pex_hgt
* @param pex_diuresis
* @param pex_diuresis_desc
* @param pex_bowel_desc
* @param pex_rr
* @param pex_ausc
* @param pex_note
* @param pex_date Examination date
* @param patient Patient
* @param pex_height Patient Height
* @param pex_weight Patient Weight
* @param pex_ap_min Patient min arterial pression
* @param pex_ap_max Patient max arterial pression
* @param pex_hr Patient heart beat rate
* @param pex_temp Patient temperature
* @param pex_sat Patient's saturation
* @param pex_hgt Patient HGT
* @param pex_diuresis Patient diuresis
* @param pex_diuresis_desc Patient diuresis description
* @param pex_bowel_desc Patient bowel
* @param pex_rr Patient RR
* @param pex_ausc Patient auscultation
* @param pex_note Extra note
*/
public PatientExamination(
LocalDateTime pex_date,
Expand Down Expand Up @@ -414,6 +419,10 @@ public void setPex_note(String pex_note) {
this.pex_note = pex_note;
}

public int getLock() { return lock; }

public void setLock(int lock) { this.lock = lock; }

@Override
public int compareTo(PatientExamination o) {
return this.pex_date.compareTo(o.getPex_date());
Expand All @@ -436,11 +445,10 @@ public boolean equals(Object obj) {
return true;
}

if (!(obj instanceof PatientExamination)) {
if (!(obj instanceof PatientExamination patex)) {
return false;
}

PatientExamination patex = (PatientExamination)obj;

return (pex_ID == patex.getPex_ID());
}

Expand Down
8 changes: 8 additions & 0 deletions src/main/java/org/isf/menu/model/UserSetting.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.Version;
import jakarta.validation.constraints.NotNull;

import org.isf.utils.db.Auditable;
Expand Down Expand Up @@ -61,6 +62,10 @@ public class UserSetting extends Auditable<String> {
@Column(name = "USS_CONFIG_VALUE")
private String configValue;

@Version
@Column(name = "USS_LOCK")
private int lock;

public UserSetting() {
}

Expand Down Expand Up @@ -102,4 +107,7 @@ public void setConfigValue(String configValue) {
this.configValue = configValue;
}

public int getLock() { return lock; }

public void setLock(int lock) { this.lock = lock; }
}
Loading

0 comments on commit 0d95dce

Please sign in to comment.