Skip to content

Commit

Permalink
Op 171 vezo 2 examination window changes (informatici#66)
Browse files Browse the repository at this point in the history
* OP-171 #comment added UoM to Saturation parameter #time 30min
* Re-mapped Examination module with immutable nullable types
* Set all values to 'int' except UoM (String) and steps (double).
- SAT_MAX deprecated (it is always 100)
- HEIGHT_STEP default set to 1 (cm)

* PatientExamination refactoring and settings
- Fixed UoM: removed user defined UoM and adopted SI (Kg for the Weight
and meter for the Height)
- Renamed some DB fields names
- Porting script for previous data

* OP-171 #comment added Remove methods

* Moved getBMIdescription() method to Manager

* OP-171 #comment Added new fields HGT, Diuresis and Bowel

* Included temporary step_XX in dockerfile

* Update .travis.yml

Debuggin docker

* Debugging docker

* Debugging Docker

* Debugging Docker-Compose

* Fixed table name cases

* Removing debugger

* Rename step_XX_examination_changes.sql to step_60_examination_changes.sql

Op 172 vezo 3 laboratory default material (informatici#67)

* Fixed Laboratory demo data
* OP-172 #comment Added 'undefined' default material

Op 173 vezo 4 new dicom features (informatici#68)

* Enabled FileSystemDicomManager to Spring (@component)
* Removed useless constructor's argument
* Enabled JPG and JPEG formats
* Added method for SeriesNumber exist check
* Fixing DICOM libraries and dependencies
* First version of JPEG compatibility in DICOM module
* Added utility FileTools for retrieving information from filesystem
* Added new Dialog upon dicom/images loading

TODO:
- possibility to add images to the same series
- handle big size images (IndexOutOfBoundsException)

Updated OH-core artifact version

Upload changelog

Fixed step_61

removed duplicated dependencies

Fixed step_61

ADWA_6_print labels buttons added (informatici#73)

* fixed pom.xml error

Co-authored-by: nicola punzi <[email protected]>

Op 207 automaticlot not working (informatici#93)

* Commented useless methods
* Removed no longer existing parameters from javadoc
* More explanatory comments although the logic seems uselsess
* OP-207 #comment fixed AUTOMATICLOT behavior #time 2h
* Rearranged lot validation logic
* Changed fields position
* Fixed lot creation when LOTWITHCOST=no
* Added missing testIoNewAutomaticDischargingMovementDifferentLots

"first commit"

- add lot information ward to ward

ADWA_13_Lot_information_at_the_wards_level: added ward to ward lot information

Fixed some tests

TODO:
- improved MovementWard validationsts with check on lot
- fix remaining tests
- verify that all movements between wards are consistent

added AUTOMATICLOTWARD_TOWARD option and multiple discharge ward to

added script Primary key MDSRWRD_LT_ID_A

Fixed script and added comments

Cosmetic changes to the code

Fixed MovementWard tests

added choose lot in rectify

fixed bug implementation rectify

Add some cleaning and refactoring

TODO: missing javadocs

Fixed some TODOs: simplified methods and added javadoc

Finalized script step number

Removed duplicated files from rebase

Added missing method

Fixed JPA mapping
  • Loading branch information
mwithi committed Jun 11, 2020
1 parent 69caf7d commit 13cfe35
Show file tree
Hide file tree
Showing 20 changed files with 401 additions and 105 deletions.
1 change: 1 addition & 0 deletions mysql/db/from_step_05.sql
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ source step_62_patient_profession_and_marital_status.sql;
source step_63_respiratory_rate_and_auscultation.sql;
source step_64_operations_in_opd.sql;
source step_65_daily_worksheet_for_services.sql;
source step_66_lot_information_at_the_wards_level.sql;
52 changes: 52 additions & 0 deletions mysql/db/step_66_lot_information_at_the_wards_level.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
-- adding LOT id
ALTER TABLE MEDICALDSRWARD
ADD COLUMN MDSRWRD_LT_ID_A VARCHAR(50) NULL AFTER MDSRWRD_OUT_QTI,
ADD INDEX FK_LOT (MDSRWRD_LT_ID_A ASC);
ALTER TABLE MEDICALDSRWARD
ADD CONSTRAINT FK_MEDICALDSRWARD_MEDICALDSRLOT
FOREIGN KEY (MDSRWRD_LT_ID_A)
REFERENCES MEDICALDSRLOT (LT_ID_A)
ON DELETE NO ACTION
ON UPDATE NO ACTION;

ALTER TABLE MEDICALDSRSTOCKMOVWARD
ADD COLUMN MMVN_LT_ID VARCHAR(50) NULL AFTER MMVN_WRD_ID_A_TO,
ADD INDEX FK_FK_MEDICALDSRSTOCKMOVWARD_LOT (MMVN_LT_ID ASC);
ALTER TABLE MEDICALDSRSTOCKMOVWARD
ADD CONSTRAINT FK_MEDICALDSRSTOCKMOVWARD_LOT
FOREIGN KEY (MMVN_LT_ID)
REFERENCES MEDICALDSRLOT (LT_ID_A)
ON DELETE NO ACTION
ON UPDATE NO ACTION;

-- adding medical id
ALTER TABLE MEDICALDSRLOT
ADD COLUMN LT_MDSR_ID INT(11) NULL AFTER LT_ID_A;
ALTER TABLE MEDICALDSRLOT
ADD INDEX FK_MEDICALDSRLOT_MEDICALDSR_idx (LT_MDSR_ID ASC);
ALTER TABLE MEDICALDSRLOT
ADD CONSTRAINT FK_MEDICALDSRLOT_MEDICALDSR
FOREIGN KEY (LT_MDSR_ID)
REFERENCES MEDICALDSR (MDSR_ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION;

-- populating medical id
UPDATE MEDICALDSRLOT
JOIN MEDICALDSRSTOCKMOV
ON MEDICALDSRLOT.LT_ID_A = MEDICALDSRSTOCKMOV.MMV_LT_ID_A
SET MEDICALDSRLOT.LT_MDSR_ID =MEDICALDSRSTOCKMOV.MMV_MDSR_ID;

-- changing compound primary key
ALTER TABLE MEDICALDSRWARD
DROP FOREIGN KEY FK_MEDICALDSRWARD_MEDICALDSRLOT;
ALTER TABLE MEDICALDSRWARD
CHANGE COLUMN MDSRWRD_LT_ID_A MDSRWRD_LT_ID_A VARCHAR(50) NOT NULL ,
DROP PRIMARY KEY,
ADD PRIMARY KEY (MDSRWRD_WRD_ID_A, MDSRWRD_MDSR_ID, MDSRWRD_LT_ID_A);
ALTER TABLE MEDICALDSRWARD
ADD CONSTRAINT FK_MEDICALDSRWARD_MEDICALDSRLOT
FOREIGN KEY (MDSRWRD_LT_ID_A)
REFERENCES MEDICALDSRLOT (LT_ID_A)
ON DELETE NO ACTION
ON UPDATE NO ACTION;
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
*/
package org.isf.examination.service;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.GregorianCalendar;

import org.isf.examination.model.PatientExamination;
Expand Down
17 changes: 13 additions & 4 deletions src/main/java/org/isf/generaldata/GeneralData.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ public class GeneralData {
public static String LANGUAGE;
public static boolean SINGLEUSER;
public static boolean OPDOPERATION; //TODO: Evaluate the real need of this one: if false should also hidden the ability to specify the OPE_FOR property
public static boolean AUTOMATICLOT;
public static boolean AUTOMATICLOT_IN;
public static boolean AUTOMATICLOT_OUT;
public static boolean AUTOMATICLOTWARD_TOWARD;
public static boolean LOTWITHCOST;
public static String PATIENTSHEET;
public static String VISITSHEET;
Expand All @@ -42,6 +44,7 @@ public class GeneralData {
public static String BILLSREPORTMONTHLY;
public static String PHARMACEUTICALORDER;
public static String PHARMACEUTICALSTOCK;
public static String PHARMACEUTICALSTOCKLOT;
public static String PHARMACEUTICALAMC;
public static boolean PATIENTEXTENDED;
public static boolean OPDEXTENDED;
Expand Down Expand Up @@ -69,7 +72,9 @@ public class GeneralData {

private static String DEFAULT_LANGUAGE = "en";
private static boolean DEFAULT_SINGLEUSER = false;
private static boolean DEFAULT_AUTOMATICLOT = true;
private static boolean DEFAULT_AUTOMATICLOT_IN = true;
private static boolean DEFAULT_AUTOMATICLOT_OUT = true;
private static boolean DEFAULT_AUTOMATICLOTWARD_TOWARD=true;
private static boolean DEFAULT_LOTWITHCOST = false;

private static String DEFAULT_PATIENTSHEET = "patient_clinical_sheet";
Expand All @@ -83,7 +88,8 @@ public class GeneralData {
private static String DEFAULT_BILLSREPORTPENDING = "BillsReportPending";
private static String DEFAULT_BILLSREPORTMONTHLY = "BillsReportMonthly";
private static String DEFAULT_PHARMACEUTICALORDER = "PharmaceuticalOrder";
private static String DEFAULT_PHARMACEUTICALSTOCK = "PharmaceuticalStock";
private static String DEFAULT_PHARMACEUTICALSTOCK = "PharmaceuticalStock_ver4";
private static String DEFAULT_PHARMACEUTICALSTOCKLOT = "PharmaceuticalStock_ver5"; //TODO: verify if really used
private static String DEFAULT_PHARMACEUTICALAMC = "PharmaceuticalAMC";
private static boolean DEFAULT_PATIENTEXTENDED = false;
private static boolean DEFAULT_OPDEXTENDED = false;
Expand Down Expand Up @@ -119,7 +125,9 @@ private GeneralData() {
LANGUAGE = myGetProperty("LANGUAGE", DEFAULT_LANGUAGE);
SINGLEUSER = myGetProperty("SINGLEUSER", DEFAULT_SINGLEUSER);
OPDOPERATION= myGetProperty("OPDOPERATION", DEFAULT_SINGLEUSER);
AUTOMATICLOT = myGetProperty("AUTOMATICLOT", DEFAULT_AUTOMATICLOT);
AUTOMATICLOT_IN = myGetProperty("AUTOMATICLOT_IN", DEFAULT_AUTOMATICLOT_IN);
AUTOMATICLOT_OUT = myGetProperty("AUTOMATICLOT_OUT", DEFAULT_AUTOMATICLOT_OUT);
AUTOMATICLOTWARD_TOWARD = myGetProperty("AUTOMATICLOTWARD_TOWARD", DEFAULT_AUTOMATICLOTWARD_TOWARD);
LOTWITHCOST = myGetProperty("LOTWITHCOST", DEFAULT_LOTWITHCOST);
PATIENTSHEET = myGetProperty("PATIENTSHEET", DEFAULT_PATIENTSHEET);
VISITSHEET = myGetProperty("VISITSHEET", DEFAULT_VISITSHEET);
Expand All @@ -133,6 +141,7 @@ private GeneralData() {
BILLSREPORTMONTHLY = myGetProperty("BILLSREPORTMONTHLY", DEFAULT_BILLSREPORTMONTHLY);
PHARMACEUTICALORDER = myGetProperty("PHARMACEUTICALORDER", DEFAULT_PHARMACEUTICALORDER);
PHARMACEUTICALSTOCK = myGetProperty("PHARMACEUTICALSTOCK", DEFAULT_PHARMACEUTICALSTOCK);
PHARMACEUTICALSTOCKLOT = myGetProperty("PHARMACEUTICALSTOCKLOT", DEFAULT_PHARMACEUTICALSTOCKLOT);
PHARMACEUTICALAMC = myGetProperty("PHARMACEUTICALAMC", DEFAULT_PHARMACEUTICALAMC);
PATIENTEXTENDED = myGetProperty("PATIENTEXTENDED", DEFAULT_PATIENTEXTENDED);
OPDEXTENDED = myGetProperty("OPDEXTENDED", DEFAULT_OPDEXTENDED);
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/isf/medicals/model/Medical.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ public class Medical extends Auditable<String> implements Comparable<Medical>, C

public Medical() { }


public Medical(Integer code) {
super();
this.code = code;
}
/**
* Constructor
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected void validateMovement(Movement movement, boolean checkReference) throw
}

// Check Lot
if (!isAutomaticLot()) {
if (!isAutomaticLot_Out()) {
Lot lot = movement.getLot();
{
errors.addAll(validateLot(lot));
Expand Down Expand Up @@ -196,8 +196,25 @@ protected List<OHExceptionMessage> checkReferenceNumber(String referenceNumber)
return errors;
}

private boolean isAutomaticLot() {
return GeneralData.AUTOMATICLOT;
// Replaced by getMedical in MedicalBrowsingManager
/*
* Gets the current quantity for the specified {@link Medical}.
*
* @param medical the medical to check.
*
* @return the current quantity of medical.
*
* public int getCurrentQuantity(Medical medical){ try { return
* ioOperations.getCurrentQuantity(medical); } catch (OHException e) {
* JOptionPane.showMessageDialog(null, e.getMessage()); return 0; } }
*/

private boolean isAutomaticLot_In() {
return GeneralData.AUTOMATICLOT_IN;
}

private boolean isAutomaticLot_Out() {
return GeneralData.AUTOMATICLOT_OUT;
}

/**
Expand All @@ -214,6 +231,14 @@ public ArrayList<Lot> getLotByMedical(Medical medical) throws OHServiceException
}
return ioOperations.getLotsByMedical(medical);
}


public ArrayList<Lot> getLotByMedicalId(String medical) throws OHServiceException {
if (medical == null) {
return new ArrayList<Lot>();
}
return ioOperations.getLotsByMedicalId(medical);
}

/**
* Checks if the provided quantity is under the medical limits.
Expand Down Expand Up @@ -315,6 +340,11 @@ private boolean prepareChargingMovement(Movement movement, boolean checkReferenc
return ioOperations.prepareChargingMovement(movement);
}

public boolean storeLot(String LotCode, Lot lot, Medical med) throws OHServiceException {

return ioOperations.storeLot(LotCode, lot, med);
}

// /**
// * Insert a list of discharging {@link Movement}s
// *
Expand Down Expand Up @@ -372,11 +402,14 @@ public boolean newMultipleDischargingMovements(ArrayList<Movement> movements, St
* @throws OHServiceException
*/
private boolean prepareDishargingMovement(Movement movement, boolean checkReference) throws OHServiceException {
validateMovement(movement, checkReference);
if (isAutomaticLot()) {
return ioOperations.newAutomaticDischargingMovement(movement);
} else {
return ioOperations.prepareDischargingMovement(movement);
}
try {
validateMovement(movement, checkReference);
if (isAutomaticLot_Out()) {
return ioOperations.newAutomaticDischargingMovement(movement);
} else
return ioOperations.prepareDischargingMovement(movement);
} catch (OHServiceException e) {
throw e;
}
}
}
18 changes: 17 additions & 1 deletion src/main/java/org/isf/medicalstock/model/Lot.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

import org.isf.utils.db.Auditable;
import org.isf.generaldata.MessageBundle;
import org.isf.medicals.model.Medical;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

/*------------------------------------------
Expand All @@ -41,6 +44,10 @@ public class Lot extends Auditable<String>
@Column(name="LT_ID_A")
private String code;

@ManyToOne
@JoinColumn(name="LT_MDSR_ID")
private Medical medical;

@NotNull
@Column(name="LT_PREP_DATE")
private GregorianCalendar preparationDate;
Expand All @@ -61,7 +68,10 @@ public class Lot extends Auditable<String>

public Lot() {
}

public Lot(String aCode){
code=aCode;

}
public Lot(String aCode,GregorianCalendar aPreparationDate,GregorianCalendar aDueDate){
code=aCode;
preparationDate=aPreparationDate;
Expand All @@ -85,6 +95,9 @@ public String getCode(){
public int getQuantity(){
return quantity;
}
public Medical getMedical(){
return medical;
}
public GregorianCalendar getPreparationDate(){
return preparationDate;
}
Expand All @@ -103,6 +116,9 @@ public void setPreparationDate(GregorianCalendar aPreparationDate){
public void setQuantity(int aQuantity){
quantity=aQuantity;
}
public void setMedical(Medical aMedical){
medical=aMedical;
}
public void setDueDate(GregorianCalendar aDueDate){
dueDate=aDueDate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,13 @@ public interface LotIoOperationRepository extends JpaRepository<Lot, String> {
+ "((MEDICALDSRLOT join MEDICALDSRSTOCKMOV on MMV_LT_ID_A=LT_ID_A) join MEDICALDSR on MMV_MDSR_ID=MDSR_ID)"
+ " join MEDICALDSRSTOCKMOVTYPE on MMV_MMVT_ID_A=MMVT_ID_A "
+ "where MDSR_ID=:code group by LT_ID_A order by LT_DUE_DATE", nativeQuery= true)
List<Object[]> findAllWhereMedical(@Param("code") Integer code);
public List<Object[]> findAllWhereMedical(@Param("code") Integer code);


@Query(value = "select LT_ID_A,LT_PREP_DATE,LT_DUE_DATE,LT_COST,"
+ "SUM(IF(MMVT_TYPE LIKE '%+%',MMV_QTY,-MMV_QTY)) as quantity from "
+ "((MEDICALDSRLOT join MEDICALDSRSTOCKMOV on MMV_LT_ID_A=LT_ID_A) join MEDICALDSR on MMV_MDSR_ID=MDSR_ID)"
+ " join MEDICALDSRSTOCKMOVTYPE on MMV_MMVT_ID_A=MMVT_ID_A "
+ "where LT_ID_A=:code group by LT_ID_A order by LT_DUE_DATE", nativeQuery= true)
public List<Object[]> findAllWhereLot(@Param("code") String code);
}
Loading

0 comments on commit 13cfe35

Please sign in to comment.