Skip to content

Commit

Permalink
Merge branch 'main' into feature/internal-comment-in-email
Browse files Browse the repository at this point in the history
  • Loading branch information
kk-chung authored Feb 21, 2025
2 parents 42a8e5e + 241de08 commit e89cfdd
Show file tree
Hide file tree
Showing 25 changed files with 689 additions and 223 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# Oscar EMR (Open Fork)
# Open-O

## What is Oscar?
## What is OSCAR EMR?

An open source electronic medical record system.

## What is OpenOscar?
## What is Open-O?

A community driven fork of Oscar EMR.
A community driven fork of OSCAR EMR.

## Installation

For a Dockerized installation, see [OpenOSP](https://github.com/open-osp/open-osp)

## Jenkins Integration
1 change: 1 addition & 0 deletions database/mysql/updates/update-2024-12-04.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE prescription ADD COLUMN digital_signature_id INT NULL DEFAULT NULL;
38 changes: 26 additions & 12 deletions src/main/java/org/oscarehr/billing/CA/BC/dao/Hl7MshDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
import java.util.List;

import javax.persistence.Query;
import javax.persistence.TypedQuery;

import org.oscarehr.billing.CA.BC.model.Hl7Msh;
import org.oscarehr.billing.CA.BC.util.PathNetLabResults;
import org.oscarehr.common.dao.AbstractDaoImpl;
import org.springframework.stereotype.Repository;

Expand All @@ -40,8 +42,12 @@ public Hl7MshDao() {
super(Hl7Msh.class);
}

public List<Object[]> findPathnetResultsDataByPatientNameHinStatusAndProvider(String patientName, String patientHealthNumber, String status, String providerNo, String labType) {
String sql = "SELECT msh, pid, orc, obr, providerLabRouting, MIN(obr.resultStatus) " +
public List<PathNetLabResults> findPathnetResultsDataByPatientNameHinStatusAndProvider(String patientName, String patientHealthNumber, String status, String providerNo, String labType) {
/*
* Below query use a constructor expression (SELECT new org.oscarehr.billing.CA.BC.model.PathNetLabResults(Hl7Msh, Hl7Pid, Hl7Orc, Hl7Obr, ProviderLabRoutingModel, String))
* and TypedQuery<PathNetLabResults> to directly create instances of PathNetLabResults from the database results
* */
String sql = "SELECT new org.oscarehr.billing.CA.BC.util.PathNetLabResults( msh, pid, orc, obr, providerLabRouting, MIN(obr.resultStatus) )" +
"FROM Hl7Msh msh, Hl7Pid pid, Hl7Orc orc, Hl7Obr obr, ProviderLabRoutingModel providerLabRouting " +
"WHERE providerLabRouting.labNo = pid.messageId " +
"AND pid.messageId = msh.messageId " +
Expand All @@ -53,8 +59,8 @@ public List<Object[]> findPathnetResultsDataByPatientNameHinStatusAndProvider(St
"AND pid.patientName like :patientName " +
"AND pid.externalId like :patientHealthNumber " +
"GROUP BY pid.id";
Query query = entityManager.createQuery(sql);

TypedQuery<PathNetLabResults> query = entityManager.createQuery(sql, PathNetLabResults.class);
query.setParameter("status", status);
query.setParameter("providerNo", providerNo);
query.setParameter("labType", labType);
Expand All @@ -63,23 +69,31 @@ public List<Object[]> findPathnetResultsDataByPatientNameHinStatusAndProvider(St
return query.getResultList();
}

public List<Object[]> findPathnetResultsByLabNo(Integer labNo) {
String sql = "SELECT msh, pid, orc, obr, providerLabRouting, MIN(obr.resultStatus) " +
public List<PathNetLabResults> findPathnetResultsByLabNo(Integer labNo) {
/*
* Below query use a constructor expression (SELECT new org.oscarehr.billing.CA.BC.model.PathNetLabResults(Hl7Msh, Hl7Pid, Hl7Orc, Hl7Obr, ProviderLabRoutingModel, String))
* and TypedQuery<PathNetLabResults> to directly create instances of PathNetLabResults from the database results
* */
String sql = "SELECT new org.oscarehr.billing.CA.BC.util.PathNetLabResults( msh, pid, orc, obr, providerLabRouting, MIN(obr.resultStatus) )" +
"FROM Hl7Msh msh, Hl7Pid pid, Hl7Orc orc, Hl7Obr obr, ProviderLabRoutingModel providerLabRouting " +
"WHERE providerLabRouting.labNo = pid.messageId " +
"AND pid.messageId = msh.messageId " +
"AND pid.id = orc.pidId " +
"AND pid.id = obr.pidId "+
"AND pid.messageId= :labNo " +
"GROUP BY pid.id";
Query query = entityManager.createQuery(sql);

TypedQuery<PathNetLabResults> query = entityManager.createQuery(sql, PathNetLabResults.class);
query.setParameter("labNo", labNo);
return query.getResultList();
}

public List<Object[]> findPathnetResultsDeomgraphicNo(Integer demographicNo, String labType) {
String sql = "SELECT msh, pid, orc, obr, patientLabRouting, MIN(obr.resultStatus) " +

public List<PathNetLabResults> findPathnetResultsDeomgraphicNo(Integer demographicNo, String labType) {
/*
* Below query use a constructor expression (SELECT new org.oscarehr.billing.CA.BC.model.PathNetLabResults(Hl7Msh, Hl7Pid, Hl7Orc, Hl7Obr, PatientLabRouting, String))
* and TypedQuery<PathNetLabResults> to directly create instances of PathNetLabResults from the database results
* */
String sql = "SELECT new org.oscarehr.billing.CA.BC.util.PathNetLabResults( msh, pid, orc, obr, patientLabRouting, MIN(obr.resultStatus) )" +
"FROM Hl7Msh msh, Hl7Pid pid, Hl7Orc orc, Hl7Obr obr, PatientLabRouting patientLabRouting " +
"WHERE patientLabRouting.labNo = pid.id " +
"AND pid.id = orc.pidId " +
Expand All @@ -89,7 +103,7 @@ public List<Object[]> findPathnetResultsDeomgraphicNo(Integer demographicNo, Str
"AND patientLabRouting.demographicNo = :demographicNo " +
"GROUP BY pid.id";

Query query = entityManager.createQuery(sql);
TypedQuery<PathNetLabResults> query = entityManager.createQuery(sql, PathNetLabResults.class);
query.setParameter("demographicNo", demographicNo);
query.setParameter("labType", labType);
return query.getResultList();
Expand Down
114 changes: 114 additions & 0 deletions src/main/java/org/oscarehr/billing/CA/BC/util/PathNetLabResults.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/**
* Copyright (c) 2005-2012. Centre for Research on Inner City Health, St. Michael's Hospital, Toronto. All Rights Reserved.
* This software is published under the GPL GNU General Public License.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* <p>
* This software was written for
* Centre for Research on Inner City Health, St. Michael's Hospital,
* Toronto, Ontario, Canada
*/

package org.oscarehr.billing.CA.BC.util;

import org.oscarehr.billing.CA.BC.model.Hl7Msh;
import org.oscarehr.billing.CA.BC.model.Hl7Obr;
import org.oscarehr.billing.CA.BC.model.Hl7Orc;
import org.oscarehr.billing.CA.BC.model.Hl7Pid;
import org.oscarehr.common.model.PatientLabRouting;
import org.oscarehr.common.model.ProviderLabRoutingModel;

public class PathNetLabResults {
private Hl7Msh hl7Msh;
private Hl7Pid hl7Pid;
private Hl7Orc hl7Orc;
private Hl7Obr hl7Obr;
private ProviderLabRoutingModel providerLabRouting;
private PatientLabRouting patientLabRouting;
private Long minResultStatus;

public PathNetLabResults(Hl7Msh hl7Msh, Hl7Pid hl7Pid, Hl7Orc hl7Orc, Hl7Obr hl7Obr, ProviderLabRoutingModel providerLabRouting, String minResultStatus) {
this.hl7Msh = hl7Msh;
this.hl7Pid = hl7Pid;
this.hl7Orc = hl7Orc;
this.hl7Obr = hl7Obr;
this.providerLabRouting = providerLabRouting;
this.minResultStatus = Long.valueOf(minResultStatus);
}

public PathNetLabResults(Hl7Msh hl7Msh, Hl7Pid hl7Pid, Hl7Orc hl7Orc, Hl7Obr hl7Obr, PatientLabRouting patientLabRouting, String minResultStatus) {
this.hl7Msh = hl7Msh;
this.hl7Pid = hl7Pid;
this.hl7Orc = hl7Orc;
this.hl7Obr = hl7Obr;
this.patientLabRouting = patientLabRouting;
this.minResultStatus = Long.valueOf(minResultStatus);
}

public Hl7Msh getHl7Msh() {
return hl7Msh;
}

public void setHl7Msh(Hl7Msh hl7Msh) {
this.hl7Msh = hl7Msh;
}

public Hl7Pid getHl7Pid() {
return hl7Pid;
}

public void setHl7Pid(Hl7Pid hl7Pid) {
this.hl7Pid = hl7Pid;
}

public Hl7Orc getHl7Orc() {
return hl7Orc;
}

public void setHl7Orc(Hl7Orc hl7Orc) {
this.hl7Orc = hl7Orc;
}

public Hl7Obr getHl7Obr() {
return hl7Obr;
}

public void setHl7Obr(Hl7Obr hl7Obr) {
this.hl7Obr = hl7Obr;
}

public ProviderLabRoutingModel getProviderLabRouting() {
return providerLabRouting;
}

public void setProviderLabRouting(ProviderLabRoutingModel providerLabRouting) {
this.providerLabRouting = providerLabRouting;
}

public PatientLabRouting getPatientLabRouting() {
return patientLabRouting;
}

public void setPatientLabRouting(PatientLabRouting patientLabRouting) {
this.patientLabRouting = patientLabRouting;
}

public Long getMinResultStatus() {
return minResultStatus;
}

public void setMinResultStatus(Long minResultStatus) {
this.minResultStatus = minResultStatus;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ public void printPreventions(List<Prevention> preventions) throws DocumentExcept
curFont = normal;
phrase = new Phrase(LEADING, "", curFont);
String refused = prevention.isRefused()?" (Refused)":"";
phrase.add(formatter.format(prevention.getPreventionDate()) + " - ");
String preventionDate = prevention.getPreventionDate() == null ? "Unknown" : formatter.format(prevention.getPreventionDate());
phrase.add(preventionDate + " - ");
phrase.add(prevention.getPreventionType() + refused);
p.add(phrase);
document.add(p);
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/org/oscarehr/common/model/Demographic.java
Original file line number Diff line number Diff line change
Expand Up @@ -1589,10 +1589,12 @@ public String getStandardIdentificationHTML() {
if(getHin() != null && getHin().length()>0) {
sb.append("<div id='patient-hin'>");
sb.append("<div class='label'>");
sb.append("hin");
sb.append("</div>");
sb.append(Encode.forHtml(getHin()));
sb.append("hin (");
sb.append(Encode.forHtml(getHcType()));
sb.append(")</div>");
sb.append(Encode.forHtml(getHin()));
sb.append("&nbsp;");
sb.append(Encode.forHtml(getVer()));
sb.append("</div>");
}

Expand Down
11 changes: 11 additions & 0 deletions src/main/java/org/oscarehr/common/model/Prescription.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public class Prescription extends AbstractModel<Integer> implements Serializable
@Temporal(TemporalType.TIMESTAMP)
private Date lastUpdateDate;

@Column(name = "digital_signature_id")
private Integer digitalSignatureId;

@PreRemove
protected void jpaPreventDelete() {
throw (new UnsupportedOperationException("Remove is not allowed for this type of item."));
Expand Down Expand Up @@ -181,4 +184,12 @@ public int getReprintCount() {
if (!isReprinted()) return 0;
return getDatesReprinted().split(",").length;
}

public Integer getDigitalSignatureId() {
return digitalSignatureId;
}

public void setDigitalSignatureId(Integer digitalSignatureId) {
this.digitalSignatureId = digitalSignatureId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,5 @@ public List<Prescription> getPrescriptionsByProgramProviderDemographicDate(Logge

public boolean print(LoggedInInfo loggedInInfo, int scriptNo);

boolean setPrescriptionSignature(LoggedInInfo loggedInInfo, int scriptNo, Integer digitalSignatureId);
}
11 changes: 11 additions & 0 deletions src/main/java/org/oscarehr/managers/PrescriptionManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -429,4 +429,15 @@ public boolean print(LoggedInInfo loggedInInfo, int scriptNo) {

}

@Override
public boolean setPrescriptionSignature(LoggedInInfo loggedInInfo, int scriptNo, Integer digitalSignatureId) {

Prescription prescription = prescriptionDao.find(scriptNo);
prescription.setDigitalSignatureId(digitalSignatureId);

prescriptionDao.merge(prescription);

return true;
}

}
36 changes: 20 additions & 16 deletions src/main/java/oscar/login/tld/SecurityTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@

package oscar.login.tld;

import java.util.List;
import java.util.Properties;
import java.util.Vector;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import oscar.OscarProperties;
import oscar.util.OscarRoleObjectPrivilege;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.Tag;

import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import oscar.util.OscarRoleObjectPrivilege;
import java.util.List;
import java.util.Properties;
import java.util.Vector;

public class SecurityTag implements Tag {
private PageContext pageContext;
Expand All @@ -45,7 +45,6 @@ public class SecurityTag implements Tag {
private String objectName;
private String rights = "r";
private boolean reverse = false;
//private Vector roleInObj = new Vector();

public void setPageContext(PageContext arg0) {
this.pageContext = arg0;
Expand All @@ -61,22 +60,27 @@ public Tag getParent() {
}

public int doStartTag() throws JspException {
/*
* try { JspWriter out = pageContext.getOut(); out.print("goooooooo"); } catch (Exception e) { }
*/
int ret = 0;
Vector v = OscarRoleObjectPrivilege.getPrivilegeProp(objectName);
// if (checkPrivilege(roleName, (Properties) getPrivilegeProp(objectName).get(0), (Vector) getPrivilegeProp(
/// objectName).get(1)))
/*TODO: temporily allow current security work, the if statement should be removed */
if (roleName == null)
{

ret = SKIP_BODY;

}
else
{
if(OscarProperties.getInstance().isPropertyActive("ENABLE_SECURITY_OBJECT_DEBUG")) {
try {
JspWriter out = pageContext.getOut();
out.println(
"<div class='role-object' style='font-size:12px;color:red;z-index:100000; background-color:white; padding:5px;'>"
+ objectName
+ "</div>"
);
} catch (Exception e) {
// do nothing.
}
}
if (OscarRoleObjectPrivilege.checkPrivilege(roleName, (Properties)v.get(0), (List<String>)v.get(1), (List<String>)v.get(2), rights)){
ret = EVAL_BODY_INCLUDE;
}else{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ public static String routeReport(LoggedInInfo loggedInInfo, String serviceName,
search = "provider_no";
}

if( "MEDITECH".equals(type) ) {
search = "practitionerNo";
if( "MEDITECH".equals(type) || "ExcellerisON".equals(type) ) {
search = "practitionerNo"; // ie the college number <oscarDB>.Provider.practitionerNo
}

if( "IHAPOI".equals(type) ) {
Expand Down
Loading

0 comments on commit e89cfdd

Please sign in to comment.