Skip to content

Commit

Permalink
Merge pull request #2116 from informatici/develop
Browse files Browse the repository at this point in the history
Align with develop
  • Loading branch information
mwithi authored Jan 9, 2025
2 parents ed52130 + 0946a59 commit ba30d23
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 22 deletions.
3 changes: 3 additions & 0 deletions bundle/language_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,7 @@ angal.lab.exam
angal.lab.film.txt = Film
angal.lab.in = In
angal.lab.insertvalidage.msg = Insert a valid age.
angal.lab.insertvalidpatientid.msg = Insert a valid patient ID.
angal.lab.laboratorybrowser.title = Laboratory Browser
angal.lab.material = Material
angal.lab.multipleresults.txt = Multiple results
Expand All @@ -735,6 +736,7 @@ angal.lab.positive.txt
angal.lab.positiveabbr.btn = P
angal.lab.printtable.btn = Print Table
angal.lab.printtable.btn.key = P
angal.lab.searchbycodepatientpressenter = Search by Code (Press ENTER)
angal.lab.selectanexam = Select an exam
angal.lab.selectapatient = Select a patient
angal.lab.sexmf = Sex (M/F)
Expand All @@ -745,6 +747,7 @@ angal.lab.tissues.txt
angal.lab.undefined.txt = Undefined
angal.lab.unknownprocedure.msg = Unknown procedure.
angal.lab.urine.txt = Urine
angal.lab.noprinter.msg = No printer available.
angal.labnew.changepatient = Change Patient
angal.labnew.exam.btn = Exam
angal.labnew.exam.btn.key = E
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -336,19 +336,19 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.11.3</version>
<version>5.11.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.26.3</version>
<version>3.27.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>5.14.2</version>
<version>5.15.2</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Binary file modified rpt_base/Laboratory.jasper
Binary file not shown.
6 changes: 3 additions & 3 deletions rpt_base/Laboratory.jrxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.15.0.final using JasperReports Library version 6.15.0-dd49bfb94918336b8321d5507193f0169ead4e95 -->
<!-- Created with Jaspersoft Studio version 6.21.2.final using JasperReports Library version 6.21.2-8434a0bd7c3bbc37cbf916f2968d35e4b165821a -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Laboratory" pageWidth="595" pageHeight="842" whenNoDataType="NoPages" columnWidth="535" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20" resourceBundle="Laboratory" whenResourceMissingType="Key" uuid="455b698a-3a6c-447d-9570-be963546da05">
<property name="ireport.scriptlethandling" value="0"/>
<property name="ireport.encoding" value="UTF-8"/>
Expand All @@ -13,7 +13,7 @@
<parameter name="ospedaleIndirizzo" class="java.lang.String" isForPrompting="false"/>
<parameter name="ospedaleCitta" class="java.lang.String" isForPrompting="false"/>
<field name="exam" class="java.lang.String"/>
<field name="date" class="java.lang.String"/>
<field name="date" class="java.time.LocalDateTime"/>
<field name="result" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
Expand Down Expand Up @@ -172,7 +172,7 @@
<textElement textAlignment="Left">
<font fontName="DejaVu Sans" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{date}]]></textFieldExpression>
<textFieldExpression><![CDATA[$F{date}.format(java.time.format.DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm"))]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" isBlankWhenNull="false">
<reportElement key="textField" x="258" y="0" width="277" height="13" uuid="09da5319-3f04-42d5-8027-d1de436685a2"/>
Expand Down
Binary file modified rpt_stat/OH010_OutPatientReport.jasper
Binary file not shown.
8 changes: 4 additions & 4 deletions rpt_stat/OH010_OutPatientReport.jrxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.19.0.final using JasperReports Library version 6.19.0-646c68931cebf1a58bc65c4359d1f0ca223c5e94 -->
<!-- Created with Jaspersoft Studio version 6.21.2.final using JasperReports Library version 6.21.2-8434a0bd7c3bbc37cbf916f2968d35e4b165821a -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="OH010_OutPatientReport" pageWidth="1133" pageHeight="793" orientation="Landscape" columnWidth="1073" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20" isFloatColumnFooter="true" resourceBundle="OH010_OutPatientReport" whenResourceMissingType="Key" uuid="1ae95539-9794-4bfc-954e-7879664f4181">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="344"/>
Expand Down Expand Up @@ -230,7 +230,7 @@ $F{ATTENDANCE}.equals( "Re" ) ? new Integer(1) : new Integer(0)]]></variableExpr
<textFieldExpression><![CDATA[$P{Telephone}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" pattern="dd/MM/yyyy" isBlankWhenNull="false">
<reportElement key="textField-8" x="50" y="122" width="64" height="17" uuid="83adc030-5739-4a9e-83a9-1a3017e5bfa6">
<reportElement key="textField-8" x="50" y="122" width="85" height="17" uuid="83adc030-5739-4a9e-83a9-1a3017e5bfa6">
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
Expand Down Expand Up @@ -261,7 +261,7 @@ $F{ATTENDANCE}.equals( "Re" ) ? new Integer(1) : new Integer(0)]]></variableExpr
<textFieldExpression><![CDATA[$R{From}]]></textFieldExpression>
</textField>
<textField>
<reportElement key="staticText-2" x="114" y="122" width="30" height="17" uuid="774511e3-5965-4822-8546-cfd8199a2189">
<reportElement key="staticText-2" x="135" y="122" width="30" height="17" uuid="774511e3-5965-4822-8546-cfd8199a2189">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<box>
Expand All @@ -277,7 +277,7 @@ $F{ATTENDANCE}.equals( "Re" ) ? new Integer(1) : new Integer(0)]]></variableExpr
<textFieldExpression><![CDATA[$R{To}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight" pattern="dd/MM/yyyy" isBlankWhenNull="false">
<reportElement key="textField-9" x="144" y="122" width="64" height="17" uuid="1985a4d2-3de0-4911-8639-a40e4614dbe4">
<reportElement key="textField-9" x="165" y="122" width="95" height="17" uuid="1985a4d2-3de0-4911-8639-a40e4614dbe4">
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
Expand Down
103 changes: 91 additions & 12 deletions src/main/java/org/isf/lab/gui/LabBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -38,6 +40,7 @@
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.SpringLayout;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumnModel;
Expand All @@ -51,6 +54,7 @@
import org.isf.lab.gui.LabEditExtended.LabEditExtendedListener;
import org.isf.lab.gui.LabNew.LabListener;
import org.isf.lab.manager.LabManager;
import org.isf.patient.manager.PatientBrowserManager;
import org.isf.lab.model.Laboratory;
import org.isf.lab.model.LaboratoryForPrint;
import org.isf.menu.gui.MainMenu;
Expand All @@ -59,14 +63,18 @@
import org.isf.patient.model.Patient;
import org.isf.serviceprinting.manager.PrintLabels;
import org.isf.serviceprinting.manager.PrintManager;
import org.isf.utils.exception.OHException;
import org.isf.utils.exception.OHServiceException;
import org.isf.utils.exception.gui.OHServiceExceptionUtil;
import org.isf.utils.exception.model.OHExceptionMessage;
import org.isf.utils.jobjects.GoodDateChooser;
import org.isf.utils.jobjects.MessageDialog;
import org.isf.utils.jobjects.ModalJFrame;
import org.isf.utils.layout.SpringUtilities;
import org.isf.utils.time.TimeTools;

import net.sf.jasperreports.engine.JRException;

/**
* LabBrowser - list all labs
*/
Expand Down Expand Up @@ -95,6 +103,7 @@ public void labUpdated() {
private JPanel jSelectionPanel;
private JTable jTable;
private JComboBox comboExams;
private JTextField patientCodeField;
private int pfrmHeight = 100;
private List<Laboratory> pLabs;
private String[] pColumns = {
Expand All @@ -108,6 +117,7 @@ public void labUpdated() {
private int[] maxWidth = {150, 200, 200, 200};
private boolean[] columnsVisible = { true, GeneralData.LABEXTENDED, true, true};
private LabManager labManager = Context.getApplicationContext().getBean(LabManager.class);
private PatientBrowserManager patManager = Context.getApplicationContext().getBean(PatientBrowserManager.class);
private PrintManager printManager = Context.getApplicationContext().getBean(PrintManager.class);
private ExamBrowsingManager examBrowsingManager = Context.getApplicationContext().getBean(ExamBrowsingManager.class);
private LabBrowsingModel model;
Expand Down Expand Up @@ -231,10 +241,11 @@ private JButton getPrintLabelButton() {
}
try {
new PrintLabels("LabelForSamples", patId);
} catch (OHServiceException e) {
OHServiceExceptionUtil.showMessages(e);
} catch (OHException e) {
OHServiceExceptionUtil.showMessages(new OHServiceException(new OHExceptionMessage(e.getMessage())));
} catch (JRException e) {
OHServiceExceptionUtil.showMessages(new OHServiceException(new OHExceptionMessage(MessageBundle.getMessage("angal.lab.noprinter.msg"))));
}

});
}
return printLabelButton;
Expand Down Expand Up @@ -358,6 +369,8 @@ private JPanel getJSelectionPanel() {
if (jSelectionPanel == null) {
jSelectionPanel = new JPanel();
jSelectionPanel.setPreferredSize(new Dimension(225, pfrmHeight));
jSelectionPanel.add(new JLabel(MessageBundle.getMessage("angal.lab.searchbycodepatientpressenter")));
jSelectionPanel.add(getPatientCodeField());
jSelectionPanel.add(new JLabel(MessageBundle.getMessage("angal.lab.selectanexam")));
jSelectionPanel.add(getComboExams());
jSelectionPanel.add(getDateFilterPanel());
Expand Down Expand Up @@ -392,6 +405,39 @@ private JTable getJTable() {
return jTable;
}

/**
* This method initializes the patient code search text field.
*
* @return patientCodeField (JTextField)
*/
private JTextField getPatientCodeField() {
if (patientCodeField == null) {
patientCodeField = new JTextField();
patientCodeField.setPreferredSize(new Dimension(215, 30));
patientCodeField.addKeyListener(new KeyListener() {
@Override
public void keyPressed(KeyEvent e) {
int key = e.getKeyCode();
if (key == KeyEvent.VK_ENTER) {
model = new LabBrowsingModel(patientCodeField.getText());
model.fireTableDataChanged();
jTable.updateUI();
}
}

@Override
public void keyReleased(KeyEvent e) {
}

@Override
public void keyTyped(KeyEvent e) {
}
});
}
return patientCodeField;
}


/**
* This method initializes comboExams, that allows to choose which Exam the
* user want to display on the Table
Expand Down Expand Up @@ -453,9 +499,9 @@ private JButton getFilterButton() {
filterButton.addActionListener(actionEvent -> {
typeSelected = comboExams.getSelectedItem().toString();
if (typeSelected.equalsIgnoreCase(MessageBundle.getMessage("angal.common.all.txt"))) {
typeSelected = null;
typeSelected = "";
}
model = new LabBrowsingModel(typeSelected, dateFrom.getDate(), dateTo.getDate());
model = new LabBrowsingModel(typeSelected, dateFrom.getDate(), dateTo.getDate(), patientCodeField.getText());
model.fireTableDataChanged();
jTable.updateUI();
});
Expand All @@ -473,14 +519,47 @@ class LabBrowsingModel extends DefaultTableModel {

private static final long serialVersionUID = 1L;

public LabBrowsingModel(String exam, LocalDate dateFrom, LocalDate dateTo) {
try {
pLabs = labManager.getLaboratory(exam, dateFrom.atStartOfDay(), dateTo.atStartOfDay());
} catch (OHServiceException e) {
public LabBrowsingModel(String exam, LocalDate dateFrom, LocalDate dateTo, String patid) {
try {
if (!patid.isEmpty()) {
Patient pat = patManager.getPatientById(Integer.parseInt(patid));
if (pat == null) {
pLabs = new ArrayList<>();
} else {
pLabs = labManager.getLaboratory(exam, dateFrom.atStartOfDay(), dateTo.atStartOfDay(), pat);
}
} else {
pLabs = labManager.getLaboratory(exam, dateFrom.atStartOfDay(), dateTo.atStartOfDay(), null);
}
} catch (OHServiceException e) {
pLabs = new ArrayList<>();
OHServiceExceptionUtil.showMessages(e);
} catch (NumberFormatException e) {
pLabs = new ArrayList<>();
OHServiceExceptionUtil.showMessages(e);
MessageDialog.error(null, "angal.lab.insertvalidpatientid.msg");
}
}
}

public LabBrowsingModel(String patid) {
try {
if (!patid.isEmpty()) {
Patient pat = patManager.getPatientById(Integer.parseInt(patid));
if (pat == null) {
pLabs = new ArrayList<>();
} else {
pLabs = labManager.getLaboratory(pat);
}
} else {
pLabs = new ArrayList<>();
}
} catch (OHServiceException e) {
pLabs = new ArrayList<>();
OHServiceExceptionUtil.showMessages(e);
} catch (NumberFormatException e) {
pLabs = new ArrayList<>();
MessageDialog.error(null, "angal.lab.insertvalidpatientid.msg");
}
}

public LabBrowsingModel() {
try {
Expand Down Expand Up @@ -562,4 +641,4 @@ public void laboratoryInserted() {
}
}

}
}

0 comments on commit ba30d23

Please sign in to comment.