diff --git a/.github/workflows/publish-frontend-dev.yml b/.github/workflows/publish-frontend-dev.yml
index a12f89ec3f..e7bc479d78 100644
--- a/.github/workflows/publish-frontend-dev.yml
+++ b/.github/workflows/publish-frontend-dev.yml
@@ -12,8 +12,10 @@ on:
env:
- REGISTRY: ghcr.io
+ REGISTRY: docker.io
IMAGE_NAME: ${{ github.repository }}-frontend-dev
+ DOCKER_NAME: ${{ vars.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}-frontend-dev
+
jobs:
build-and-push-image:
@@ -26,23 +28,33 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- - name: Log in to the Container registry
- uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
+ # Add support for more platforms with QEMU (optional)
+ # https://github.com/docker/setup-qemu-action
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v3
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Login to DockerHub
+ uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
- username: ${{ github.actor }}
- password: ${{ secrets.GITHUB_TOKEN }}
+ username: ${{ vars.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
- uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
+ uses: docker/metadata-action@v5
with:
- images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
+ images: ${{ env.DOCKER_NAME }}
- name: Build and push Docker image
- uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
+ uses: docker/build-push-action@v5
with:
context: ./frontend
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
+ cache-from: type=registry,ref=${{github.repository}}:latest
+ cache-to: type=inline
diff --git a/.github/workflows/publish-frontend.yml b/.github/workflows/publish-frontend.yml
index e27474cf97..d179639ca5 100644
--- a/.github/workflows/publish-frontend.yml
+++ b/.github/workflows/publish-frontend.yml
@@ -14,8 +14,9 @@ on:
env:
- REGISTRY: ghcr.io
+ REGISTRY: docker.io
IMAGE_NAME: ${{ github.repository }}-frontend
+ DOCKER_NAME: ${{ vars.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}-frontend
jobs:
build-and-push-image:
@@ -28,24 +29,34 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
+ # Add support for more platforms with QEMU (optional)
+ # https://github.com/docker/setup-qemu-action
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v3
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
- name: Log in to the Container registry
- uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
+ uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
- username: ${{ github.actor }}
- password: ${{ secrets.GITHUB_TOKEN }}
+ username: ${{ vars.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
- uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
+ uses: docker/metadata-action@v5
with:
- images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
+ images: ${{ env.DOCKER_NAME }}
- name: Build and push Docker image
- uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
+ uses: docker/build-push-action@v5
with:
context: ./frontend
file: ./frontend/Dockerfile.prod
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
+ cache-from: type=registry,ref=${{github.repository}}:latest
+ cache-to: type=inline
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 023def28a6..53bb343800 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -14,8 +14,9 @@ on:
env:
- REGISTRY: ghcr.io
+ REGISTRY: docker.io
IMAGE_NAME: ${{ github.repository }}
+ DOCKER_NAME: ${{ vars.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}
jobs:
build-and-push-image:
@@ -28,23 +29,34 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- - name: Log in to the Container registry
- uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
+ # Add support for more platforms with QEMU (optional)
+ # https://github.com/docker/setup-qemu-action
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v3
+
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Login to DockerHub
+ uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
- username: ${{ github.actor }}
- password: ${{ secrets.GITHUB_TOKEN }}
+ username: ${{ vars.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
- uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
+ uses: docker/metadata-action@v5
with:
- images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
+ images: ${{ env.DOCKER_NAME }}
- name: Build and push Docker image
- uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
+ uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
+ cache-from: type=registry,ref=${{github.repository}}:latest
+ cache-to: type=inline
diff --git a/README.md b/README.md
index 0eb28459e3..ddb604d3ff 100644
--- a/README.md
+++ b/README.md
@@ -14,10 +14,10 @@ You can find more information on how to set up OpenELIS at our [docs page](http:
#### Building the docker images directly from source code
docker-compose -f build.docker-compose.yml up -d --build
-#### Running docker containers With locally compiled Artifacts (ie the War file and local frontend Source files)
+#### Running docker containers With locally compiled Artifacts (ie the War file)
1. Clone the Repository
- git clone https://github.com/I-TECH-UW/OpenELIS-Global-2.git -b 2.8
+ git clone https://github.com/I-TECH-UW/OpenELIS-Global-2.git
2. innitialize and build sub modules
diff --git a/build.docker-compose.yml b/build.docker-compose.yml
index 063f966e2b..4172d12905 100644
--- a/build.docker-compose.yml
+++ b/build.docker-compose.yml
@@ -2,7 +2,7 @@ version: '3.3'
services:
certs:
container_name: oe-certs
- image: ghcr.io/i-tech-uw/certgen:main
+ image: itechuw/certgen:main
restart: always
environment:
- KEYSTORE_PW="kspass"
@@ -13,26 +13,27 @@ services:
- key_trust-store-volume:/etc/openelis-global
- keys-vol:/etc/ssl/private/
- certs-vol:/etc/ssl/certs/
+
database:
- container_name: openelisglobal-database
- image: postgres:9.5
- ports:
- - "15432:5432"
- restart: always
- env_file:
- - ./volume/database/database.env
- volumes:
- # preserves the database between containers
- - db-data:/var/lib/postgresql/data
- # files here will run on install
- - ./volume/database/dbInit:/docker-entrypoint-initdb.d
- networks:
- - default
- healthcheck:
- test: [ "CMD", "pg_isready", "-q", "-d", "clinlims", "-U", "clinlims" ]
- timeout: 45s
- interval: 10s
- retries: 10
+ container_name: openelisglobal-database
+ image: postgres:9.5
+ ports:
+ - "15432:5432"
+ restart: always
+ env_file:
+ - ./volume/database/database.env
+ volumes:
+ # preserves the database between containers
+ - db-data:/var/lib/postgresql/data
+ # files here will run on install
+ - ./volume/database/dbInit:/docker-entrypoint-initdb.d
+ networks:
+ - default
+ healthcheck:
+ test: [ "CMD", "pg_isready", "-q", "-d", "clinlims", "-U", "clinlims" ]
+ timeout: 45s
+ interval: 10s
+ retries: 10
oe.openelis.org:
build:
@@ -72,8 +73,11 @@ services:
- default
restart: always
environment:
+ spring.datasource.url : jdbc:postgresql://database:5432/clinlims?currentSchema=clinlims
+ spring.datasource.username : clinlims
+ spring.datasource.password : clinlims
+ spring.datasource.driverClassName: org.postgresql.Driver
TZ: Africa/Nairobi
-
JAVA_OPTS: "-Djavax.net.ssl.trustStore=/etc/openelis-global/truststore
-Djavax.net.ssl.trustStorePassword=tspass
-Djavax.net.ssl.trustStoreType=pkcs12
diff --git a/dev.docker-compose.yml b/dev.docker-compose.yml
index 95f7245364..a19a52ad96 100644
--- a/dev.docker-compose.yml
+++ b/dev.docker-compose.yml
@@ -2,7 +2,7 @@ version: '3.3'
services:
certs:
container_name: oe-certs
- image: ghcr.io/i-tech-uw/certgen:main
+ image: itechuw/certgen:main
restart: always
environment:
- KEYSTORE_PW="kspass"
@@ -37,7 +37,7 @@ services:
oe.openelis.org:
container_name: openelisglobal-webapp
- image: ghcr.io/i-tech-uw/openelis-global-2:2.8
+ image: itechuw/openelis-global-2:2.8
depends_on:
- database
ports:
@@ -72,6 +72,10 @@ services:
- default
restart: always
environment:
+ spring.datasource.url : jdbc:postgresql://database:5432/clinlims?currentSchema=clinlims
+ spring.datasource.username : clinlims
+ spring.datasource.password : clinlims
+ spring.datasource.driverClassName: org.postgresql.Driver
TZ: Africa/Nairobi
JAVA_OPTS: "-Djavax.net.ssl.trustStore=/etc/openelis-global/truststore
@@ -87,7 +91,7 @@ services:
frontend.openelis.org:
- image: ghcr.io/i-tech-uw/openelis-global-2-frontend-dev:2.8
+ image: itechuw/openelis-global-2-frontend-dev:2.8
container_name: openelisglobal-front-end
networks:
- default
diff --git a/docker-compose.yml b/docker-compose.yml
index e301958047..14e0b56384 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -2,7 +2,7 @@ version: '3.3'
services:
certs:
container_name: oe-certs
- image: ghcr.io/i-tech-uw/certgen:main
+ image: itechuw/certgen:main
restart: always
environment:
- KEYSTORE_PW="kspass"
@@ -37,7 +37,7 @@ services:
oe.openelis.org:
container_name: openelisglobal-webapp
- image: ghcr.io/i-tech-uw/openelis-global-2:2.8
+ image: itechuw/openelis-global-2:2.8
depends_on:
- database
ports:
@@ -57,6 +57,8 @@ services:
- key_trust-store-volume:/etc/openelis-global
- ./volume/plugins/:/var/lib/openelis-global/plugins
- ./volume/tomcat/oe_server.xml:/usr/local/tomcat/conf/server.xml
+ #Runing the OpenELIS with the locally compiled war file
+ #- ./target/OpenELIS-Global.war:/usr/local/tomcat/webapps/OpenELIS-Global.war
secrets:
- source: datasource.password
- source: common.properties
@@ -71,6 +73,10 @@ services:
- default
restart: always
environment:
+ spring.datasource.url : jdbc:postgresql://database:5432/clinlims?currentSchema=clinlims
+ spring.datasource.username : clinlims
+ spring.datasource.password : clinlims
+ spring.datasource.driverClassName: org.postgresql.Driver
TZ: Africa/Nairobi
JAVA_OPTS: "-Djavax.net.ssl.trustStore=/etc/openelis-global/truststore
@@ -86,7 +92,7 @@ services:
frontend.openelis.org:
- image: ghcr.io/i-tech-uw/openelis-global-2-frontend:2.8
+ image: itechuw/openelis-global-2-frontend:2.8
container_name: openelisglobal-front-end
networks:
- default
diff --git a/docs/.readthedocs.yaml b/docs/.readthedocs.yaml
new file mode 100644
index 0000000000..f3aa1f5af0
--- /dev/null
+++ b/docs/.readthedocs.yaml
@@ -0,0 +1,22 @@
+# .readthedocs.yaml
+# Read the Docs configuration file
+# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
+
+# Required
+version: 2
+
+# Set the version of Python and other tools you might need
+build:
+ os: ubuntu-22.04
+ tools:
+ python: "3.11"
+
+# Build documentation in the docs/ directory with Sphinx
+sphinx:
+ configuration: docs/conf.py
+
+# We recommend specifying your dependencies to enable reproducible builds:
+# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
+# python:
+# install:
+# - requirements: docs/requirements.txt
diff --git a/docs/about.md b/docs/about.md
index 8b4e2792ca..884bbe1558 100644
--- a/docs/about.md
+++ b/docs/about.md
@@ -8,7 +8,7 @@ The software serves as both an effective laboratory software solution and busine
##A Global LIS
Laboratory Information System for Global Health
-The global health version of [OpenELIS Global](http://openelisglobal.org) builds on the foundation provided by the original US Public Health Lab version of OpenELIS Global. Our challenge is to provide the flexibility demanded by different laboratories while maintaining a common code base. Some examples:
+The global health version of [OpenELIS Global](https://openelis-global.org) builds on the foundation provided by the original US Public Health Lab version of OpenELIS Global. Our challenge is to provide the flexibility demanded by different laboratories while maintaining a common code base. Some examples:
Some laboratories refer to the number attached to the sample as an accession number while others refer to it as a laboratory number.
@@ -21,4 +21,4 @@ Some laboratories refer to the number attached to the sample as an accession num
Our goal in meeting these challenges is to ensure that the code does not become fractured by each variation in requirements. We have so far been successful and all of the implementations differ only by configuration files. Designed to support quality laboratory services and test results from high volume clinical and reference laboratories.
-The work is done in partnership with International Training and Education Center for Health (I-TECH). They provide a wide perspective on the background, goals and collaborators of the work being done worldwide. For specifics of I-TECH’s work in two countries where OpenELIS Global is being implemented: [I-TECH in Haiti](https://www.go2itech.org/where-we-work/haiti/), [I-TECH in Côte d’Ivoire](https://www.go2itech.org/where-we-work/cote-divoire/).
\ No newline at end of file
+The work is done in partnership with International Training and Education Center for Health (I-TECH). They provide a wide perspective on the background, goals and collaborators of the work being done worldwide. For specifics of I-TECH’s work in two countries where OpenELIS Global is being implemented: [I-TECH in Haiti](https://www.go2itech.org/where-we-work/haiti/), [I-TECH in Côte d’Ivoire](https://www.go2itech.org/where-we-work/cote-divoire/).
diff --git a/docs/gsoc.md b/docs/gsoc.md
new file mode 100644
index 0000000000..a9923b8ff3
--- /dev/null
+++ b/docs/gsoc.md
@@ -0,0 +1,64 @@
+
+
+
+[**OpenELIS**](https://openelis-global.org/) is hoping to be a mentoring organization for [Google Summer of Code](https://summerofcode.withgoogle.com/) 2024 for the first Time. We're extremely excited about the projects and mentorship opportunities available this year. Coding for **OpenELIS** is a great way to practice your coding skills and, at the same time help making a positive impact on the world through empowering labs with the best tools and support to deliver quality health care to clients.
+
+If you are new to **OpenELIS**, we recommend starting with our [Installation](install.md) and [Developer](dev_setup.md) Instructions
+
+||Page Outline |
+|--|--|
+ |1|[GSoC 2024 Program Administrators](#gsoc-2024-program-administrators)|
+ |2| [Selected Projects for GSoC 2024](#selected-projects-for-gsoc-2024)|
+ |3 |[Program Timeline](#program-timeline)|
+ |4 |[Guidelines](#guidelines)|
+
+
+## GSoC 2024 Program Administrators
+1. Mutesasira Moses
+1. Casey Iiams-Hauser
+1. Herbert Yiga
+
+## Selected Projects for GSoC 2024
+ |Project Name|Project Rating|Project Description|Required Skills |Selected Contributor | Mentors|
+ |--|--|--|--|--|--|
+ |Improve Responsiveness for OpenELIS3| Medium |Making OE3 Resposnsive|React , Typescript , Javascript| `TBD`| Mutesasira Moses|
+ |Improve OpenELIS Search Operations|Medium| Integrate a Search Engine library for OpenELIS Search |Java , Spring |`TBD`| `TBD`|
+ |Improve Integration Tests Coverage | Medium| Improve Integration Tests Coverage for the backend Service layer |Java , Spring ,J-Unit|`TBD`| `TBD`|
+ |Improve E2E Tests Coverage| Medium| Improve end to end ui Tests Coverage for the new React Frontend |react , cypress |`TBD`| `TBD`|
+
+## Program Timeline
+| Date | Status | Activity |
+|------|--------|----------|
+| | ✅ | GSoC 2024 preparations |
+| | ⌛ | Mentoring organizations can begin submitting applications to Google |
+| | ⌛ | Mentoring organization application deadline |
+| | ⌛ | List of accepted mentoring organizations announced |
+| | ⌛ | March 19: Potential GSoC contributors discuss application ideas with mentoring organizations |
+| | ⌛ | GSoC contributor application period begins |
+| | ⌛ | GSoC contributor application deadline |
+| | ⌛ | GSoC contributor proposal rankings due from Org Admins |
+| | ⌛ | Accepted GSoC contributor projects announced |
+| | ⌛ | Community Bonding Period. Students get to know mentors, read documentation, prepare for work on their projects |
+| | ⌛ | Coding officially begins |
+| | ⌛ | Coding Period for Medium project |
+| | ⌛ | Coding Period for Advanced project |
+| | ⌛ | Mentors and GSoC contributors can begin submitting midterm evaluations |
+| | ⌛ | Midterm evaluation deadline (standard coding period) |
+| | ⌛ | Work Period. GSoC contributors work on their project with guidance from Mentors |
+| | ⌛ | Final week. GSoC contributors submit their final work product and their final mentor evaluation (coding period) |
+| | ⌛ | Mentors submit final GSoC contributor evaluations (standard coding period) for medium size project. |
+| | ⌛ | Initial results of Google Summer of Code 2023 announced |
+| | ⌛ | GSoC contributors with extended timelines continue coding |
+| | ⌛ | Final date for all GSoC contributors to submit their final work product and final evaluation |
+| | ⌛ | Final date for mentors to submit evaluations for GSoC contributor projects with extended deadlines |
+
+
+## Guidelines
+### Student's guidelines
+* [GSoC - Guidelines for Students](gsocstudentguide.md)
+### Mentor's guidelines
+* GSoC - Guidelines for Mentors
+
+!!! tip
+ Please Ensure to Follow the Students Guidelines Above
+
diff --git a/docs/gsocstudentguide.md b/docs/gsocstudentguide.md
new file mode 100644
index 0000000000..9a8e85e6d7
--- /dev/null
+++ b/docs/gsocstudentguide.md
@@ -0,0 +1,43 @@
+Welcome! Are you interested in working on a Google Summer of Code project with *OpenELIS*? We' want you to be a successful GSoC developer in our community so we've put together a few guidelines to answer some of your initial questions and help you understand what is expected of students before submitting a proposal, after being accepted, and during the coding period.
+
+!!! caution
+ Only Students who meet both Google's Contributor [Eligibility Requirements](GSoC Contributors) and also follow our Guidelines will be Selected
+
+|Page OutLine|
+|--|
+|[Before the Application](#before-the-application)|
+|[Proposal Template](#proposal-template)|
+|[After being accepted](#after-being-accepted)|
+|[During the coding period](#during-the-coding-period)|
+|[After GSoC](#after-gsoc)|
+
+## Before the Application
+ 1. Sign Up at [OpenELIS Talk](https://talk.openelis-global.org/) and get an ID
+ 1. Introduce yourself on OpenELIS Talk on the [community introduction page](https://talk.openelis-global.org/t/welcome-please-introduce-yourself/155/8)
+ 1. Become familiar with **OpenELIS**
+ See our [Installation](https://docs.openelis-global.org/en/latest/install/) and [Developer](https://docs.openelis-global.org/en/latest/dev_setup/) Instructions
+ 1. Review project ideas & ask questions [here ](https://github.com/I-TECH-UW/OpenELIS-Global-2/wiki/Google-Summer-of-Code-(GSOC)#selected-projects-for-gsoc-2024)
+1. Work on [Introductory Issues](https://github.com/orgs/I-TECH-UW/projects/6) to get Familiar with the Project
+
+## Proposal Template
+ 1. Use this [GSOC Template](https://docs.google.com/document/d/1nPcu-UMaibHuASPU6sLnG18sf0ZRoh0fEjzeGZvHcYQ/edit#heading=h.3tq62aycf5sk) to create your Application and Proposal write up.
+ 1. Complete all the mandatory Fields for your application to be accepted
+ 1. Submit your application through Google’s website. See Google's GSOC Get Started page [here](https://summerofcode.withgoogle.com/get-started/)
+
+## After being accepted
+1. Set up a blog for your Project on OpenELIS Talk where you will be posting Updates weekly
+1. Contact your mentor immediately. Make a plan to communicate with them regularly.
+1. Review any [Issues ](https://github.com/orgs/I-TECH-UW/projects/3) related to your project
+1. Prepare a detailed project plan together with your mentor.
+
+## During the coding period
+1. Complete a short required "progress report" each week so we can make sure things are on track and there are no problems with your project. Contact organization admins any time if you have concerns about working with your mentor(s).
+1. Write at least one blog post every week to help stay on schedule and to share your work publicly.
+1. Commit early. Commit often. This is an important value in our open source community
+1. Prepare mid-term & final project presentation videos about your project's status, progress, and any questions you have for the community.
+
+## After GSoC
+1. Write a final blog post summarizing your overall experience! If you like, talk to the org admins for consideration to cross-post this article to the Google Open Source Blog.
+1. Stay involved with your project or other projects as your schedule permits! There is always plenty of development work needed for OpenELIS volunteers like you.
+
+
diff --git a/docs/img/oe_full_logo.png b/docs/img/oe_full_logo.png
new file mode 100644
index 0000000000..6e7fb6763b
Binary files /dev/null and b/docs/img/oe_full_logo.png differ
diff --git a/docs/img/openelis_logo.png b/docs/img/openelis_logo.png
new file mode 100644
index 0000000000..fffc9fedd5
Binary files /dev/null and b/docs/img/openelis_logo.png differ
diff --git a/docs/index.md b/docs/index.md
index 067aab9547..06be245969 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -1,5 +1,5 @@
# Welcome to The OpenELIS Global 2.0 Documentation
-For more OpenELIS Information, please visit [openelisglobal.org](http://openelisglobal.org).
+For more OpenELIS Information, please visit [openelisglobal.org](https://openelis-global.org).
This Documentation is broken down into broad catagories, with links at the top, information for Software Developers (this is mostly information about how to write the code for OpenELIS, how to contribute to the code case, ETC) and Information for those deploying OpenELIS Global (this contains SOPs focused on how to deploy, installation of software, setup of a bulid server, etc)
diff --git a/docs/install.md b/docs/install.md
index 466d7472de..14ad626789 100644
--- a/docs/install.md
+++ b/docs/install.md
@@ -38,14 +38,68 @@ This updates the system from the sources in the sources list. It updates what ne
3. Install Python
sudo apt install python3
-
-### Create and Load SSL Certificates
+
+### Options for installing OpenELIS Global software
+
+You can choose to install OpenELIS in an online mode for servers with fast internet connections, and offline, using less internet connectivity by providing a local copy of the images to be loaded.
+
+### Online OpenELIS installation with Docker-Compose
+This Option can be used where there is fast internet connectivity
+
+#### Prerequisites for OpenELIS Online Setup
+1. Install [Docker](https://linuxize.com/post/how-to-install-and-use-docker-on-ubuntu-20-04/) and [Docker Compose](https://linuxize.com/post/how-to-install-and-use-docker-compose-on-ubuntu-20-04/)
+
+2. Install [git](https://github.com/git-guides/install-git)
+
+#### Steps to Run Online Setup
+1. Clone the [OpenELIS-Global docker](https://github.com/I-TECH-UW/openelis-docker) repository.
+
+ git clone https://github.com/I-TECH-UW/openelis-docker.git
+
+1. Move to the Project directory
+
+ cd openelis-docker
+
+##### Running OpenELIS Global 3x in Docker
+ docker-compose up -d
+
+###### The Instaces can be accesed at
+
+| Instance | URL | credentials (user : password)|
+|---------- |:-------------:|------: |
+| Legacy UI | https://localhost/api/OpenELIS-Global/ | admin: adminADMIN! |
+| New React UI | https://localhost/ | admin: adminADMIN!
+
+##### Running OpenELIS Global 2x in Docker
+ docker-compose -f docker-compose-2x.yml up -d
+
+###### The Instaces can be accesed at
+
+| Instance | URL | credentials (user : password)|
+|---------- |:-------------:|------: |
+| OpenElis | https://localhost:8443/OpenELIS-Global/ | admin: adminADMIN! |
+
+##### Running OpenELIS-Global2 from source code in docker
+ 1. Clone the [OpenELIS Global](https://github.com/I-TECH-UW/OpenELIS-Global-2) repository.
+
+ git clone https://github.com/I-TECH-UW/OpenELIS-Global-2.git
+
+ 1. Build and Run the docker images from source code
+
+ docker-compose -f build.docker-compose.yml up -d --build
+
+
+### Downloaded Installer Offline Setup
+This Option can be used where there is a slow/unstable internet connectivity
+#### Prerequisites for the OpenELIS Offline Setup
+
+##### Create and Load SSL Certificates
OpenELIS uses SSL certificates to securely communicate with other software or consolidated lab data servers. For a test or temporary instance, use a self-signed certificate, and for a production instance create a proper signed certifcate. **You must have a cert and key created and in the keystore and truststore for the installer to run**
I will include 2 paths, one for generating your own self-signed cert, this is good for just starting out or experimenting, and for using your real certs, which is appropriate for production servers. If you have real certificates skip down to [Use a real certificate, best for production uses](#Use-a-real-certificate-best-for-production-uses)
-#### Use a self signed certificate.
+##### Use a self signed certificate.
##### Generate a .crt and .key file for the domain you want to use.
@@ -68,7 +122,7 @@ and then
**Be sure to remember your keystore password, you will need it later **
-#### Create truststore with OpenELIS-Global's cert (or a CA that signs OE certs)
+##### Create truststore with OpenELIS-Global's cert (or a CA that signs OE certs)
**Choose ONE of the two methods below to create your truststore**
@@ -91,7 +145,7 @@ and then
openssl pkcs12 -export -nokeys -in /etc/ssl/certs/apache-selfsigned.crt -out /etc/openelis-global/truststore
-#### Use a real certificate, best for production uses
+##### Use a real certificate, best for production uses
##### Create keystore from key and cert
Make the directories for the keystore
@@ -132,32 +186,16 @@ and then
openssl pkcs12 -export -nokeys -in path/to/your/cert -out /etc/openelis-global/truststore
-#### Ensure keystore/truststore permissions are all correct
+##### Ensure keystore/truststore permissions are all correct
Ensure all keystores have global read permission
sudo chmod 644 /etc/openelis-global/keystore /etc/openelis-global/truststore /etc/openelis-global/client_facing_keystore
-## Options for installing OpenELIS Global software
-
-You can choose to install OpenELIS in an online mode for servers with fast internet connections, and offline, using less internet connectivity by providing a local copy of the images to be loaded.
-### Online OpenELIS installation with Docker
-#### Running with published docker images
- docker-compose up -d
+#### DownLoad and Unzip the Installation Files for Offline Setup
-#### Building the docker images from source code
- docker-compose -f build.docker-compose.yml up -d --build
-
-#### The Instaces can be accesed at
-
-| Instance | URL | credentials (user : password)|
-|---------- |:-------------:|------: |
-| OpenElis | https://localhost:8443/OpenELIS-Global/ | admin: adminADMIN! |
-
-### Downloaded Installer Offline Setup
-
-1. Install OpenELIS Global
+1. Download OpenELIS Global2 Installer
a. [Download latest installer package Here:](https://www.dropbox.com/sh/47lagjht4ynpcg8/AABORyLmkpVTtRReeD6wSnJra?dl=0)
@@ -184,7 +222,7 @@ You can choose to install OpenELIS in an online mode for servers with fast inter
sudo python3 setup_OpenELIS.py
-### Install OpenELIS Global ###
+#### Install OpenELIS Global2
**OpenELIS Global uses the following file to set things like the consolidated server address, it is not overwritten by the installer. /var/lib/openelisglobal/secrets/extra.properties**
@@ -206,7 +244,6 @@ OpenELIS uses FHIR for much of its internal and external communication, if you d
1. The Consolidated Sevrer is a central server which collects lab data for reporting, serves as a master facility list, etc.
-
Wait while install procedure completes
@@ -224,27 +261,4 @@ Follow the SOP at: [Backup Configuration](../backups)
To set the identifier for this particular instance, use the /var/lib/openelisglobal/secrets/extra.properties file, and set the organization value to the same identifier as is set in the consolidated server FHIR location object.
EG: `org.openelisglobal.remote.source.identifier=Organization/8136bd30-901c-4d47-b133-72de813404ee`
-### Run OpenELIS Global 2 With Docker Compose
-
-1. Install [Docker](https://linuxize.com/post/how-to-install-and-use-docker-on-ubuntu-20-04/) and [Docker Compose](https://linuxize.com/post/how-to-install-and-use-docker-compose-on-ubuntu-20-04/)
-
-1. Clone the OpenELIS Global repository.
- For Open Elis Global 2.7.x
-
- git clone https://github.com/I-TECH-UW/OpenELIS-Global-2.git
-
- For the Open Elis Global 2.8.x
-
- git clone https://github.com/I-TECH-UW/OpenELIS-Global-2.git -b 2.8
-
-1. Move to the Project directory
-
- cd OpenELIS-Global-2
-
-1. Start the containers
-
- docker-compose up -d
-
- For OpenELIS Global 2.7.x ,you should acces the Instance at https://localhost:8443/OpenELIS-Global/
- For OpenELIS Global 2.8.x , you should acces the instances at https://localhost/ for the new UI and https://localhost/api/OpenELIS-Global/ for the Old UI
diff --git a/frontend/src/components/Login.js b/frontend/src/components/Login.js
index 62d5692fe7..0930a4a966 100644
--- a/frontend/src/components/Login.js
+++ b/frontend/src/components/Login.js
@@ -75,7 +75,7 @@ function Login(props) {
} else {
setNotificationBody({
title: ,
- message: ,
+ message: ,
kind: NotificationKinds.error,
});
setNotificationVisible(true);
@@ -157,10 +157,12 @@ function Login(props) {
/>
+
- {submitting && (
-
- )}
)}
diff --git a/frontend/src/components/Style.css b/frontend/src/components/Style.css
index 3b00ae81ca..fc15ec5416 100644
--- a/frontend/src/components/Style.css
+++ b/frontend/src/components/Style.css
@@ -389,3 +389,10 @@ button {
margin: 10px !important;
}
+.cds--date-picker__input{
+ max-width: 200px;
+}
+
+.hidden {
+ visibility: hidden;
+}
diff --git a/frontend/src/components/addOrder/AddOrder.js b/frontend/src/components/addOrder/AddOrder.js
index 8e4a032331..a5670ecb59 100644
--- a/frontend/src/components/addOrder/AddOrder.js
+++ b/frontend/src/components/addOrder/AddOrder.js
@@ -8,6 +8,7 @@ import {
TextInput,
TimePicker,
} from "@carbon/react";
+import CustomLabNumberInput from "../common/CustomLabNumberInput";
import CustomDatePicker from "../common/CustomDatePicker";
import { getFromOpenElisServer } from "../utils/Utils";
import { NotificationContext } from "../layout/Layout";
@@ -165,7 +166,9 @@ const AddOrder = (props) => {
}
const handleLabNoGeneration = (e) => {
- e.preventDefault();
+ if (e) {
+ e.preventDefault();
+ }
getFromOpenElisServer(
"/rest/SampleEntryGenerateScanProvider",
fetchGeneratedAccessionNo,
@@ -249,12 +252,12 @@ const AddOrder = (props) => {
setDepartments(data);
};
- function handleLabNo(e) {
+ function handleLabNo(e, rawVal) {
setOrderFormValues({
...orderFormValues,
sampleOrderItems: {
...orderFormValues.sampleOrderItems,
- labNo: e.target.value,
+ labNo: rawVal ? rawVal : e.target.value,
},
});
setNotificationVisible(false);
@@ -375,6 +378,12 @@ const AddOrder = (props) => {
}
};
+ const handleKeyPress = (event) => {
+ if (event.key === "Enter") {
+ handleLabNoGeneration(event);
+ }
+ };
+
useEffect(() => {
getFromOpenElisServer("/rest/SamplePatientEntry", getSampleEntryPreform);
window.scrollTo(0, 0);
@@ -392,11 +401,12 @@ const AddOrder = (props) => {
-
handleLabNo(e)}
+ onChange={handleLabNo}
+ onKeyPress={handleKeyPress}
labelText={ }
id="labNo"
className="inputText"
@@ -404,7 +414,7 @@ const AddOrder = (props) => {
{" "}
handleLabNoGeneration(e)}>
-
+
@@ -603,15 +613,16 @@ const AddOrder = (props) => {
required
>
- {paymentOptions.map((option) => {
- return (
-
- );
- })}
+ {paymentOptions &&
+ paymentOptions.map((option) => {
+ return (
+
+ );
+ })}
diff --git a/frontend/src/components/addOrder/add-order.scss b/frontend/src/components/addOrder/add-order.scss
index c20d6d50c0..573d228600 100644
--- a/frontend/src/components/addOrder/add-order.scss
+++ b/frontend/src/components/addOrder/add-order.scss
@@ -44,7 +44,7 @@
background-color: #FFFFFF;
border-radius: 5px;
margin: 2%;
- padding: 4%;
+ padding: 2%;
}
.ProgressIndicator {
diff --git a/frontend/src/components/admin/calculatedValue/CalculatedValueForm.tsx b/frontend/src/components/admin/calculatedValue/CalculatedValueForm.tsx
index 3b6e8b1568..ca954fa147 100644
--- a/frontend/src/components/admin/calculatedValue/CalculatedValueForm.tsx
+++ b/frontend/src/components/admin/calculatedValue/CalculatedValueForm.tsx
@@ -11,9 +11,11 @@ import {
Toggle,
Loading,
Checkbox,
- RadioButtonGroup,
- RadioButton,
ModalWrapper,
+ Grid,
+ Column,
+ Section,
+ Heading
} from "@carbon/react";
import AutoComplete from "../../common/AutoComplete.js";
import { Add, Subtract, Save } from "@carbon/react/icons";
@@ -583,6 +585,17 @@ const CalculatedValue: React.FC
= () => {
return (
+
+
+
+
+
{notificationVisible === true ?
: ""}
{loading &&
}
{calculationList.map((calculation, index) => (
diff --git a/frontend/src/components/admin/labNumber/LabNumberManagement.js b/frontend/src/components/admin/labNumber/LabNumberManagement.js
index f6306ddc5e..3f7cdeed2e 100644
--- a/frontend/src/components/admin/labNumber/LabNumberManagement.js
+++ b/frontend/src/components/admin/labNumber/LabNumberManagement.js
@@ -9,6 +9,9 @@ import {
SelectItem,
Button,
Loading,
+ Grid,
+ Column,
+ Section,
} from "@carbon/react";
import LabNumberFormValues from "./LabNumberFormValues";
import {
@@ -163,12 +166,18 @@ function LabNumberManagement() {
{notificationVisible === true ?
: ""}
{loading &&
}
>
);
}
diff --git a/frontend/src/components/layout/Header.js b/frontend/src/components/layout/Header.js
index ac758409c0..f2d1c6de9c 100644
--- a/frontend/src/components/layout/Header.js
+++ b/frontend/src/components/layout/Header.js
@@ -221,40 +221,48 @@ function OEHeader(props) {
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ )}
+ {configurationProperties.nonConformityTab == "true" && (
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ )}
@@ -322,14 +330,17 @@ function OEHeader(props) {
-
-
-
+ {configurationProperties.studyManagementTab ==
+ "true" && (
+
+
+
+ )}
diff --git a/frontend/src/components/modifyOrder/EditOrder.js b/frontend/src/components/modifyOrder/EditOrder.js
index 160ef57337..43d6af4c58 100644
--- a/frontend/src/components/modifyOrder/EditOrder.js
+++ b/frontend/src/components/modifyOrder/EditOrder.js
@@ -8,6 +8,7 @@ import {
TextInput,
TimePicker,
} from "@carbon/react";
+import CustomLabNumberInput from "../common/CustomLabNumberInput";
import CustomDatePicker from "../common/CustomDatePicker";
import { getFromOpenElisServer } from "../utils/Utils";
import { NotificationContext } from "../layout/Layout";
@@ -369,6 +370,12 @@ const AddOrder = (props) => {
}
};
+ const handleKeyPress = (event) => {
+ if (event.key === "Enter") {
+ handleLabNoGeneration(event);
+ }
+ };
+
useEffect(() => {
getFromOpenElisServer("/rest/SamplePatientEntry", getSampleEntryPreform);
window.scrollTo(0, 0);
@@ -391,11 +398,12 @@ const AddOrder = (props) => {
-
handleLabNo(e)}
+ onChange={handleLabNo}
+ onKeyPress={handleKeyPress}
labelText={ }
id="labNo"
className="inputText"
@@ -403,7 +411,7 @@ const AddOrder = (props) => {
{" "}
handleLabNoGeneration(e)}>
-
+
diff --git a/frontend/src/components/pathology/PathologyDashboard.js b/frontend/src/components/pathology/PathologyDashboard.js
index 5f81f6121d..4d05c28c97 100644
--- a/frontend/src/components/pathology/PathologyDashboard.js
+++ b/frontend/src/components/pathology/PathologyDashboard.js
@@ -18,6 +18,7 @@ import {
TableCell,
Tile,
Loading,
+ Pagination,
} from "@carbon/react";
import UserSessionDetailsContext from "../../UserSessionDetailsContext";
import { Search } from "@carbon/react";
@@ -38,6 +39,8 @@ function PathologyDashboard() {
const { userSessionDetails } = useContext(UserSessionDetailsContext);
const [statuses, setStatuses] = useState([]);
const [pathologyEntries, setPathologyEntries] = useState([]);
+ const [page, setPage] = useState(1);
+ const [pageSize, setPageSize] = useState(10);
const [filters, setFilters] = useState({
searchTerm: "",
myCases: false,
@@ -74,6 +77,16 @@ function PathologyDashboard() {
);
};
+ const handlePageChange = (pageInfo) => {
+ if (page != pageInfo.page) {
+ setPage(pageInfo.page);
+ }
+
+ if (pageSize != pageInfo.pageSize) {
+ setPageSize(pageInfo.pageSize);
+ }
+ };
+
const renderCell = (cell, row) => {
var status = row.cells.find((e) => e.info.header === "status").value;
var pathologySampleId = row.id;
@@ -254,122 +267,134 @@ function PathologyDashboard() {
))}
-
-
-
- setFilters({ ...filters, searchTerm: e.target.value })
- }
- placeholder="Search by LabNo or Family Name"
- labelText="Search by LabNo or Family Name"
- />
-
-
-
-
Filters:
-
+
+
+
- setFilters({ ...filters, myCases: e.target.checked })
+ setFilters({ ...filters, searchTerm: e.target.value })
}
+ placeholder="Search by LabNo or Family Name"
+ labelText="Search by LabNo or Family Name"
/>
-
-
-
- {statuses.map((status, index) => {
- return (
-
- );
- })}
-
-
-
+
+
+
+
Filters:
+
+ setFilters({ ...filters, myCases: e.target.checked })
+ }
+ />
+
+
+
+ {statuses.map((status, index) => {
+ return (
+
+ );
+ })}
+
+
+
-
-
- {({ rows, headers, getHeaderProps, getTableProps }) => (
-
-
-
-
- {headers.map((header) => (
-
- {header.header}
-
- ))}
-
-
-
- <>
- {rows.map((row) => (
- {
- openCaseView(row.id);
- }}
- >
- {row.cells.map((cell) => renderCell(cell, row))}
-
- ))}
- >
-
-
-
- )}
-
-
-
+
+
+ {({ rows, headers, getHeaderProps, getTableProps }) => (
+
+
+
+
+ {headers.map((header) => (
+
+ {header.header}
+
+ ))}
+
+
+
+ <>
+ {rows.map((row) => (
+ {
+ openCaseView(row.id);
+ }}
+ >
+ {row.cells.map((cell) => renderCell(cell, row))}
+
+ ))}
+ >
+
+
+
+ )}
+
+
+
+
+
>
);
}
diff --git a/frontend/src/components/patient/CreatePatientForm.js b/frontend/src/components/patient/CreatePatientForm.js
index dadbe194aa..caa1311d32 100644
--- a/frontend/src/components/patient/CreatePatientForm.js
+++ b/frontend/src/components/patient/CreatePatientForm.js
@@ -41,7 +41,11 @@ function CreatePatientForm(props) {
const [formAction, setFormAction] = useState("ADD");
const componentMounted = useRef(false);
const intl = useIntl();
- const [dateOfBirthFormatter,setDateOfBirthFormatter] = useState({"years": "", "months": "", "days": ""})
+ const [dateOfBirthFormatter, setDateOfBirthFormatter] = useState({
+ years: "",
+ months: "",
+ days: "",
+ });
const handleDatePickerChange = (values, ...e) => {
var patient = values;
patient.birthDateForDisplay = e[1];
@@ -236,6 +240,15 @@ function CreatePatientForm(props) {
};
const handleSubmit = (values) => {
+ if ("years" in values) {
+ delete values.years;
+ }
+ if ("months" in values) {
+ delete values.months;
+ }
+ if ("days" in values) {
+ delete values.days;
+ }
console.log(JSON.stringify(values));
postToOpenElisServer(
"/rest/patient-management",
@@ -377,78 +390,6 @@ function CreatePatientForm(props) {
)}
-
-
-
-
- {({ field }) => (
-
- )}
-
-
- {({ field }) => (
-
- )}
-
-
-
-
- {({ field }) => (
-
- )}
-
-
- {({ field }) => (
-
- )}
-
-
-
-
-
-
-
-
@@ -456,7 +397,13 @@ function CreatePatientForm(props) {
@@ -471,8 +418,16 @@ function CreatePatientForm(props) {
className="inputText"
id="create_patient_gender"
>
-
-
+
+
)}
@@ -505,7 +460,7 @@ function CreatePatientForm(props) {
value={dateOfBirthFormatter.years}
name="years"
labelText={intl.formatMessage({
- id: "patient.female",
+ id: "patient.age.years",
})}
id="years"
type="number"
@@ -526,7 +481,8 @@ function CreatePatientForm(props) {
handleDaysChange(e, values)}
labelText={intl.formatMessage({ id: "patient.age.days" })}
id="days"
className="inputText"
@@ -537,26 +493,122 @@ function CreatePatientForm(props) {
-
+
-
+
+
+
+ {({ field }) => (
+
+ )}
+
+
+ {({ field }) => (
+
+ )}
+
+
+
+
+ {({ field }) => (
+
+ )}
+
+
+ {({ field }) => (
+
+ )}
+
+
+
+
+
+
+
+
{({ field }) => (
)}
+ />
+ )}
{({ field }) => (
@@ -567,7 +619,9 @@ function CreatePatientForm(props) {
@@ -581,7 +635,9 @@ function CreatePatientForm(props) {
id="health_region"
value={values.healthRegion}
name={field.name}
- labelText={intl.formatMessage({id: "patient.address.healthregion",})}
+ labelText={intl.formatMessage({
+ id: "patient.address.healthregion",
+ })}
className="inputText"
onChange={(e) => handleRegionSelection(e, values)}
>
@@ -602,7 +658,9 @@ function CreatePatientForm(props) {
id="health_district"
value={values.healthDistrict}
name={field.name}
- labelText={intl.formatMessage({id: "patient.address.healthdistrict",})}
+ labelText={intl.formatMessage({
+ id: "patient.address.healthdistrict",
+ })}
className="inputText"
onChange={() => {}}
>
@@ -625,7 +683,9 @@ function CreatePatientForm(props) {
id="education"
value={values.education}
name={field.name}
- labelText={intl.formatMessage({id: "pateint.eduction",})}
+ labelText={intl.formatMessage({
+ id: "pateint.eduction",
+ })}
className="inputText"
onChange={() => {}}
>
@@ -646,7 +706,9 @@ function CreatePatientForm(props) {
id="maritialStatus"
value={values.maritialStatus}
name={field.name}
- labelText={intl.formatMessage({id: "patient.maritalstatus",})}
+ labelText={intl.formatMessage({
+ id: "patient.maritalstatus",
+ })}
className="inputText"
onChange={() => {}}
>
@@ -669,7 +731,9 @@ function CreatePatientForm(props) {
id="nationality"
value={values.nationality}
name={field.name}
- labelText={intl.formatMessage({id: "patient.nationality",})}
+ labelText={intl.formatMessage({
+ id: "patient.nationality",
+ })}
className="inputText"
onChange={() => {}}
>
@@ -689,7 +753,9 @@ function CreatePatientForm(props) {
diff --git a/frontend/src/components/patient/SearchPatientForm.js b/frontend/src/components/patient/SearchPatientForm.js
index 2b2ab613b0..ff4134bea5 100644
--- a/frontend/src/components/patient/SearchPatientForm.js
+++ b/frontend/src/components/patient/SearchPatientForm.js
@@ -1,5 +1,5 @@
import React, { useContext, useState } from "react";
-import { FormattedMessage, injectIntl ,useIntl} from "react-intl";
+import { FormattedMessage, injectIntl, useIntl } from "react-intl";
import "../Style.css";
import { getFromOpenElisServer } from "../utils/Utils";
import {
@@ -20,8 +20,9 @@ import {
TableBody,
TableCell,
Pagination,
- Loading
+ Loading,
} from "@carbon/react";
+import CustomLabNumberInput from "../common/CustomLabNumberInput";
import { patientSearchHeaderData } from "../data/PatientResultsTableHeaders";
import { Formik, Field } from "formik";
import SearchPatientFormValues from "../formModel/innitialValues/SearchPatientFormValues";
@@ -74,7 +75,7 @@ function SearchPatientForm(props) {
});
setNotificationVisible(true);
}
- setLoading(false)
+ setLoading(false);
};
const fetchPatientDetails = (patientDetails) => {
@@ -106,7 +107,7 @@ function SearchPatientForm(props) {
return (
<>
- {loading && }
+ {loading && }
(
)}
- {({ field }) => (
- (
+ {
+ setFieldValue(rawValue);
+ }}
/>
)}
@@ -153,7 +163,10 @@ function SearchPatientForm(props) {
{({ field }) => (
@@ -163,7 +176,10 @@ function SearchPatientForm(props) {
{({ field }) => (
@@ -184,7 +200,10 @@ function SearchPatientForm(props) {
@@ -196,18 +215,27 @@ function SearchPatientForm(props) {
@@ -217,7 +245,10 @@ function SearchPatientForm(props) {
-
+
diff --git a/frontend/src/components/resultPage/SearchResultForm.js b/frontend/src/components/resultPage/SearchResultForm.js
index 137a223044..7e1e0b733d 100644
--- a/frontend/src/components/resultPage/SearchResultForm.js
+++ b/frontend/src/components/resultPage/SearchResultForm.js
@@ -4,6 +4,7 @@ import "../Style.css";
import {
getFromOpenElisServer,
postToOpenElisServerJsonResponse,
+ convertAlphaNumLabNumForDisplay,
} from "../utils/Utils";
import {
Heading,
@@ -24,12 +25,15 @@ import {
SelectItem,
Loading,
} from "@carbon/react";
+import CustomLabNumberInput from "../common/CustomLabNumberInput";
import DataTable from "react-data-table-component";
import { Formik, Field } from "formik";
import SearchResultFormValues from "../formModel/innitialValues/SearchResultFormValues";
import { AlertDialog, NotificationKinds } from "../common/CustomNotification";
import { NotificationContext } from "../layout/Layout";
import SearchPatientForm from "../patient/SearchPatientForm";
+import { ConfigurationContext } from "../layout/Layout";
+import config from "../../config.json";
function ResultSearchPage() {
const [resultForm, setResultForm] = useState({ testResult: [] });
@@ -52,6 +56,9 @@ export function SearchResultForm(props) {
const [searchBy, setSearchBy] = useState({ type: "", doRange: false });
const [patient, setPatient] = useState({ patientPK: "" });
const [testSections, setTestSections] = useState([]);
+ const [searchFormValues, setSearchFormValues] = useState(
+ SearchResultFormValues,
+ );
const componentMounted = useRef(false);
@@ -81,7 +88,7 @@ export function SearchResultForm(props) {
setPatient(patient);
};
useEffect(() => {
- querySearch(SearchResultFormValues);
+ querySearch(searchFormValues);
}, [patient]);
const querySearch = (values) => {
@@ -149,6 +156,11 @@ export function SearchResultForm(props) {
setTestSections(response);
};
+ const submitOnSelect = (e) => {
+ var values = { unitType: e.target.value };
+ handleSubmit(values);
+ };
+
useEffect(() => {
componentMounted.current = true;
getFromOpenElisServer("/rest/test-list", getTests);
@@ -168,21 +180,37 @@ export function SearchResultForm(props) {
});
}, []);
+ useEffect(() => {
+ let accessionNumber = new URLSearchParams(window.location.search).get(
+ "accessionNumber",
+ );
+ if (accessionNumber) {
+ let searchValues = {
+ ...searchFormValues,
+ accessionNumber: accessionNumber,
+ };
+ setSearchFormValues(searchValues);
+ querySearch(searchValues);
+ }
+ }, [searchBy]);
+
return (
<>
{notificationVisible === true ? : ""}
{loading && }
{({
- // values,
+ values,
// errors,
// touched,
handleChange,
+ setFieldValue,
// handleBlur,
handleSubmit,
}) => (
@@ -198,51 +226,22 @@ export function SearchResultForm(props) {
-
- {searchBy.type === "unit" && (
- <>
-
-
- {({ field }) => (
-
- }
- name={field.name}
- id={field.name}
- >
-
- {testSections.map((test, index) => {
- return (
-
- );
- })}
-
- )}
-
-
-
- >
- )}
-
{searchBy.type === "order" && (
<>
{({ field }) => (
-
}
+ onChange={(e, rawValue) => {
+ setFieldValue(field.name, rawValue);
+ }}
/>
)}
@@ -258,7 +257,6 @@ export function SearchResultForm(props) {
{({ field }) => (
(
(
(
{({ field }) => (
}
@@ -348,7 +342,6 @@ export function SearchResultForm(props) {
{({ field }) => (
}
@@ -373,7 +366,6 @@ export function SearchResultForm(props) {
{({ field }) => (
}
@@ -398,17 +390,15 @@ export function SearchResultForm(props) {
>
)}
- {searchBy.type !== "patient" && (
+ {searchBy.type !== "patient" && searchBy.type !== "unit" && (
-
-
-
-
-
+
+
+
)}
@@ -421,6 +411,29 @@ export function SearchResultForm(props) {
getSelectedPatient={getSelectedPatient}
>
)}
+
+ {searchBy.type === "unit" && (
+ <>
+
+
+ }
+ name="unitType"
+ id="unitType"
+ onChange={submitOnSelect}
+ >
+
+ {testSections.map((test, index) => {
+ return (
+
+ );
+ })}
+
+
+
+
+ >
+ )}
>
);
}
@@ -428,13 +441,16 @@ export function SearchResultForm(props) {
export function SearchResults(props) {
const { notificationVisible, setNotificationBody, setNotificationVisible } =
useContext(NotificationContext);
+ const { configurationProperties } = useContext(ConfigurationContext);
const [page, setPage] = useState(1);
- const [pageSize, setPageSize] = useState(100);
+ const [pageSize, setPageSize] = useState(20);
const [acceptAsIs, setAcceptAsIs] = useState([]);
const [referalOrganizations, setReferalOrganizations] = useState([]);
const [methods, setMethods] = useState([]);
const [referralReasons, setReferralReasons] = useState([]);
+ const [rejectReasons, setRejectReasons] = useState([]);
+ const [rejectedItems, setRejectedItems] = useState({});
const saveStatus = "";
const componentMounted = useRef(true);
@@ -451,6 +467,17 @@ export function SearchResults(props) {
"/rest/displayList/REFERRAL_REASONS",
loadReferalReasons,
);
+ getFromOpenElisServer(
+ "/rest/displayList/REJECTION_REASONS",
+ loadRejectReasons,
+ );
+ if (props.results.testResult.length > 0) {
+ var defaultRejectedItems = {};
+ props.results.testResult.forEach((result) => {
+ defaultRejectedItems[result.id] = false;
+ });
+ setRejectedItems(defaultRejectedItems);
+ }
return () => {
componentMounted.current = false;
};
@@ -474,14 +501,41 @@ export function SearchResults(props) {
}
};
- const columns = [
+ const loadRejectReasons = (values) => {
+ if (componentMounted.current) {
+ setRejectReasons(values);
+ }
+ };
+
+ const addRejectResult = () => {
+ const resultColumn = {
+ name: "Reject",
+ cell: (row, index, column, id) => {
+ return renderCell(row, index, column, id);
+ },
+ width: "12rem",
+ };
+
+ if (configurationProperties.allowResultRejection == "true") {
+ if (columns) {
+ const updatedList = [
+ ...columns.slice(0, 8),
+ resultColumn,
+ ...columns.slice(8),
+ ];
+ columns = updatedList;
+ }
+ }
+ };
+
+ var columns = [
{
name: "Sample Info",
cell: (row, index, column, id) => {
return renderCell(row, index, column, id);
},
sortable: true,
- width: "19rem",
+ width: "15rem",
},
{
name: "Test Date",
@@ -500,20 +554,20 @@ export function SearchResults(props) {
name: "Test Name",
selector: (row) => row.testName,
sortable: true,
- width: "10rem",
+ width: "8rem",
},
{
name: "Normal Range",
selector: (row) => row.normalRange,
sortable: true,
- width: "7rem",
+ width: "8rem",
},
{
name: "Accept",
cell: (row, index, column, id) => {
return renderCell(row, index, column, id);
},
- width: "8rem",
+ width: "5rem",
},
{
name: "Result",
@@ -534,11 +588,13 @@ export function SearchResults(props) {
cell: (row, index, column, id) => {
return renderCell(row, index, column, id);
},
- width: "16rem",
+ width: "7rem",
},
];
const renderCell = (row, index, column, id) => {
+ let formatLabNum = configurationProperties.AccessionFormat === "ALPHANUM";
+
console.log("renderCell: index: " + index + ", id: " + id);
switch (column.name) {
case "Sample Info":
@@ -548,7 +604,9 @@ export function SearchResults(props) {
+ {row.nonconforming && (
+
+
+
+ )}
>
);
@@ -582,6 +650,47 @@ export function SearchResults(props) {
>
);
+ case "Reject":
+ return (
+ <>
+
+
+
+ {() => (
+ handleRejectCheckBoxChange(e, row.id)}
+ />
+ )}
+
+
+ {rejectedItems[row.id] == true && (
+
+ handleChange(e, row.id)}
+ >
+ {/* {...updateShadowResult(e, this, param.rowId)} */}
+
+ {rejectReasons.map((reason, reason_index) => (
+
+ ))}
+
+
+ )}
+
+ >
+ );
+
case "Notes":
return (
<>
@@ -589,11 +698,11 @@ export function SearchResults(props) {
handleChange(e, row.id)}
>
@@ -602,6 +711,8 @@ export function SearchResults(props) {
case "Result":
switch (row.resultType) {
+ case "M":
+ case "C":
case "D":
return (
handleChange(e, row.id)}
/>
);
@@ -644,10 +753,7 @@ export function SearchResults(props) {
id={"ResultValue" + row.id}
name={"testResult[" + row.id + "].resultValue"}
style={{ width: "10px", height: "20px" }}
- //type="text"
- // value={resultForm.testResult[row.id].resultValue}
labelText=""
- // helperText="Optional help text"
onChange={(e) => handleChange(e, row.id)}
/>
);
@@ -658,10 +764,7 @@ export function SearchResults(props) {
id={"ResultValue" + row.id}
name={"testResult[" + row.id + "].resultValue"}
style={{ width: "10px", height: "20px" }}
- //type="text"
- // value={resultForm.testResult[row.id].resultValue}
labelText=""
- // helperText="Optional help text"
onChange={(e) => handleChange(e, row.id)}
/>
);
@@ -672,69 +775,17 @@ export function SearchResults(props) {
case "Current Result":
switch (row.resultType) {
+ case "M":
+ case "C":
case "D":
return (
- validateResults(e, row.id)}
- value={row.resultValue}
- >
- {/* {...updateShadowResult(e, this, param.rowId)} */}
-
- {row.dictionaryResults.map(
- (dictionaryResult, dictionaryResult_index) => (
-
- ),
- )}
-
- );
-
- case "N":
- return (
- handleChange(e, row.id)}
- />
- );
-
- case "R":
- return (
- handleChange(e, row.id)}
- />
- );
-
- case "A":
- return (
- handleChange(e, row.id)}
- />
+ <>
+ {
+ row.dictionaryResults.find(
+ (result) => result.id == row.resultValue,
+ )?.value
+ }
+ >
);
default:
@@ -842,6 +893,7 @@ export function SearchResults(props) {
+
);
const validateResults = (e, rowId) => {
@@ -862,6 +914,33 @@ export function SearchResults(props) {
jp.value(form, isModified, "true");
};
+ const handleRejectCheckBoxChange = (e, rowId) => {
+ const { name, checked } = e.target;
+ var form = props.results;
+ var jp = require("jsonpath");
+ jp.value(form, name, checked);
+ var shadowRejected = "testResult[" + rowId + "].shadowRejected";
+ jp.value(form, shadowRejected, checked);
+ var isModified = "testResult[" + rowId + "].isModified";
+ jp.value(form, isModified, "true");
+
+ var allrejectedItems = { ...rejectedItems };
+ allrejectedItems[rowId] = checked;
+ setRejectedItems(allrejectedItems);
+
+ var message =
+ "Rejecting the result will permanently delete test results \n" +
+ "The results will no longer be available.";
+ setNotificationBody({
+ title:
,
+ message: message,
+ kind: NotificationKinds.warning,
+ });
+ if (checked) {
+ setNotificationVisible(true);
+ }
+ };
+
const handleDatePickerChange = (date, rowId) => {
console.log("handleDatePickerChange:" + date);
const d = new Date(date).toLocaleDateString("fr-FR");
@@ -908,7 +987,6 @@ export function SearchResults(props) {
result.reportable = result.reportable === "N" ? false : true;
delete result.result;
});
- console.log(props.results);
postToOpenElisServerJsonResponse(
searchEndPoint,
JSON.stringify(props.results),
@@ -960,7 +1038,27 @@ export function SearchResults(props) {
return (
<>
{notificationVisible === true ?
: ""}
+ {addRejectResult()}
<>
+ {props.results.testResult.length > 0 && (
+
+
+
+
+
+
+
+ {" "}
+
+
+
+
+ )}
diff --git a/frontend/src/components/utils/Utils.js b/frontend/src/components/utils/Utils.js
index 0d34550b16..6948eb7e9b 100644
--- a/frontend/src/components/utils/Utils.js
+++ b/frontend/src/components/utils/Utils.js
@@ -160,17 +160,36 @@ export const hasRole = (userSessionDetails, role) => {
};
export const convertAlphaNumLabNumForDisplay = (labNumber) => {
- let labNumberForDisplay = labNumber.slice(0, 2) + "-";
- if (labNumber.length > 8) {
- labNumberForDisplay =
- labNumberForDisplay + labNumber.slice(2, labNumber.length - 6) + "-";
+ if (!labNumber) {
+ return labNumber;
+ }
+ if (labNumber.length > 13) {
+ console.log("labNumber is not alphanumeric (too long), ignoring format");
+ return labNumber;
}
- labNumberForDisplay =
- labNumberForDisplay +
- labNumber.slice(labNumber.length - 6, labNumber.length - 3) +
- "-";
+ let labNumberForDisplay = labNumber;
+ //incomplete lab number
+ if (labNumber.length < 8) {
+ labNumberForDisplay = labNumber.slice(0, 2);
+ if (labNumber.length > 2) {
+ labNumberForDisplay = labNumberForDisplay + "-";
+ labNumberForDisplay = labNumberForDisplay + labNumber.slice(2);
+ }
+ } else {
+ //possibly complete lab number
+ labNumberForDisplay = labNumber.slice(0, 2) + "-";
+ if (labNumber.length > 8) {
+ // lab number contains prefix
+ labNumberForDisplay =
+ labNumberForDisplay + labNumber.slice(2, labNumber.length - 6) + "-";
+ }
+ labNumberForDisplay =
+ labNumberForDisplay +
+ labNumber.slice(labNumber.length - 6, labNumber.length - 3) +
+ "-";
- labNumberForDisplay =
- labNumberForDisplay + labNumber.slice(labNumber.length - 3);
+ labNumberForDisplay =
+ labNumberForDisplay + labNumber.slice(labNumber.length - 3);
+ }
return labNumberForDisplay.toUpperCase();
};
diff --git a/frontend/src/components/validation/SearchForm.js b/frontend/src/components/validation/SearchForm.js
index 342bfb7344..e71c4f2064 100644
--- a/frontend/src/components/validation/SearchForm.js
+++ b/frontend/src/components/validation/SearchForm.js
@@ -14,8 +14,9 @@ import {
DatePicker,
DatePickerInput,
Loading,
- Grid
+ Grid,
} from "@carbon/react";
+import CustomLabNumberInput from "../common/CustomLabNumberInput";
import { FormattedMessage } from "react-intl";
import { Formik, Field } from "formik";
import ValidationSearchFormValues from "../formModel/innitialValues/ValidationSearchFormValues";
@@ -36,6 +37,7 @@ const SearchForm = (props) => {
const validationResults = (data) => {
if (data) {
setSearchResults(data);
+ setIsLoading(false);
if (data.resultList.length > 0) {
const newResultsList = data.resultList.map((data, id) => {
let tempData = { ...data };
@@ -47,6 +49,7 @@ const SearchForm = (props) => {
resultList: newResultsList,
}));
} else {
+ setIsLoading(false);
setSearchResults((prevState) => ({
...prevState,
resultList: [],
@@ -60,7 +63,6 @@ const SearchForm = (props) => {
setNotificationVisible(true);
}
}
- setIsLoading(false);
};
useEffect(() => {
@@ -91,6 +93,11 @@ const SearchForm = (props) => {
setTestSections(response);
};
+ const submitOnSelect = (e) => {
+ var values = { unitType: e.target.value };
+ handleSubmit(values);
+ };
+
function handleDatePickerChange(e) {
let date = new Date(e[0]);
const formatDate = format(new Date(date), "dd/MM/yyyy");
@@ -140,9 +147,8 @@ const SearchForm = (props) => {
{({ field }) => (
- {
>
)}
- {searchBy === "routine" && (
- <>
-
-
- {({ field }) => (
-
- }
- name={field.name}
- id={field.name}
- >
-
- {testSections.map((test, index) => {
- return (
-
- );
- })}
-
- )}
-
-
-
- >
- )}
-
{searchBy === "testDate" && (
<>
@@ -200,7 +175,6 @@ const SearchForm = (props) => {
name={field.name}
id={field.id}
dateFormat="d/m/Y"
- className="inputText"
datePickerType="single"
value={testDate}
onChange={(e) => {
@@ -223,21 +197,45 @@ const SearchForm = (props) => {
>
)}
-
-
-
-
-
-
+ {searchBy !== "routine" && (
+
+
+
+
+
+ )}
)}
+
+ {searchBy === "routine" && (
+ <>
+
+
+ }
+ name="unitType"
+ id="unitType"
+ onChange={submitOnSelect}
+ >
+
+ {testSections.map((test, index) => {
+ return (
+
+ );
+ })}
+
+
+
+
+ >
+ )}
>
);
};
diff --git a/frontend/src/components/validation/Validation.js b/frontend/src/components/validation/Validation.js
index 58f4e5a02e..39c6a10b01 100644
--- a/frontend/src/components/validation/Validation.js
+++ b/frontend/src/components/validation/Validation.js
@@ -21,52 +21,26 @@ import { NotificationKinds } from "../common/CustomNotification";
import { postToOpenElisServer } from "../utils/Utils";
import { NotificationContext } from "../layout/Layout";
import { getFromOpenElisServer } from "../utils/Utils";
+import { ConfigurationContext } from "../layout/Layout";
+import { convertAlphaNumLabNumForDisplay } from "../utils/Utils";
+import config from "../../config.json";
const Validation = (props) => {
const { setNotificationVisible, setNotificationBody } =
useContext(NotificationContext);
- const [page, setPage] = useState(0);
- const [pageSize, setPageSize] = useState(0);
- const [referalOrganizations, setReferalOrganizations] = useState([]);
- const [methods, setMethods] = useState([]);
- const [referralReasons, setReferralReasons] = useState([]);
+ const { configurationProperties } = useContext(ConfigurationContext);
+ const [page, setPage] = useState(1);
+ const [pageSize, setPageSize] = useState(20);
const componentMounted = useRef(false);
useEffect(() => {
componentMounted.current = true;
- getFromOpenElisServer(
- "/rest/displayList/REFERRAL_ORGANIZATIONS",
- loadReferalOrganizations,
- );
- getFromOpenElisServer("/rest/displayList/METHODS", loadMehtods);
- getFromOpenElisServer(
- "/rest/displayList/REFERRAL_REASONS",
- loadReferalReasons,
- );
return () => {
componentMounted.current = false;
};
}, []);
- const loadReferalOrganizations = (results) => {
- if (componentMounted.current) {
- setReferalOrganizations(results);
- }
- };
-
- const loadMehtods = (results) => {
- if (componentMounted.current) {
- setMethods(results);
- }
- };
-
- const loadReferalReasons = (results) => {
- if (componentMounted.current) {
- setReferralReasons(results);
- }
- };
-
const columns = [
{
name: "Sample Info",
@@ -114,6 +88,13 @@ const Validation = (props) => {
cell: (row, index, column, id) => {
return renderCell(row, index, column, id);
},
+ width: "10rem",
+ },
+ {
+ name: "Past Notes",
+ cell: (row, index, column, id) => {
+ return renderCell(row, index, column, id);
+ },
width: "16rem",
},
];
@@ -140,7 +121,14 @@ const Validation = (props) => {
setNotificationVisible(true);
};
- const handlePageChange = () => {};
+ const handlePageChange = (pageInfo) => {
+ if (page != pageInfo.page) {
+ setPage(pageInfo.page);
+ }
+ if (pageSize != pageInfo.pageSize) {
+ setPageSize(pageInfo.pageSize);
+ }
+ };
const handleChange = (e, rowId) => {
const { name, id, value } = e.target;
@@ -157,26 +145,48 @@ const Validation = (props) => {
jp.value(form, "resultList[" + rowId + "].sentDate_", d);
};
const handleCheckBox = (e, rowId) => {
- handleChange(e, rowId);
+ const { name, id, checked } = e.target;
+ let form = props.results;
+ var jp = require("jsonpath");
+ jp.value(form, name, checked);
+ };
+
+ const handleAutomatedCheck = (checked, name) => {
+ let form = props.results;
+ var jp = require("jsonpath");
+ jp.value(form, name, checked);
};
const validateResults = (e, rowId) => {
handleChange(e, rowId);
};
const renderCell = (row, index, column, id) => {
+ let formatLabNum = configurationProperties.AccessionFormat === "ALPHANUM";
switch (column.name) {
case "Sample Info":
return (
<>
-
-
-
+
+ {row.nonconforming && (
+
+
+
+ )}
>
);
@@ -221,7 +231,6 @@ const Validation = (props) => {
{
>
);
+ case "Past Notes":
+ return (
+ <>
+
+
+
+ >
+ );
+
case "Result":
switch (row.resultType) {
+ case "M":
+ case "C":
case "D":
return (
{
name={"resultList[" + row.id + "].result"}
labelText=""
type="number"
- defaultValue={
- props.results ? props.results.resultList[row.id]?.result : ""
- }
+ defaultValue={row.result ? row.result : ""}
onChange={(e) => handleChange(e, row.id)}
/>
);
@@ -278,133 +304,112 @@ const Validation = (props) => {
}
return row.result;
};
- const renderReferral = ({ data }) => {
- return (
-
-
-
-
- handleChange(e, data.id)}
- value={data.method}
- >
-
- {methods.map((method, method_index) => (
-
- ))}
-
-
-
-
-
- handleChange(e, data.id)}
- >
-
- {referralReasons.map((method, method_index) => (
-
- ))}
-
-
+
+ return (
+ <>
+ {props.results?.resultList?.length > 0 && (
+
+
+
+
+
+
+ {" "}
+
+
-
- handleChange(e, data.id)}
- >
-
- {referalOrganizations.map((method, method_index) => (
-
- ))}
-
-
+ {
+ const nomalResults = props.results.resultList?.filter(
+ (result) => result.normal == true,
+ );
+ nomalResults.forEach((result) => {
+ const checkbox = document.getElementById(
+ "resultList" + result.id + ".isAccepted",
+ );
+ checkbox.checked = e.target.checked;
+ handleAutomatedCheck(e.target.checked, checkbox.name);
+ });
+ }}
+ />
-
- handleChange(e, data.id)}
- >
-
-
-
+ {
+ const nomalResults = props.results.resultList;
+ nomalResults.forEach((result) => {
+ const checkbox = document.getElementById(
+ "resultList" + result.id + ".isAccepted",
+ );
+ checkbox.checked = e.target.checked;
+ handleAutomatedCheck(e.target.checked, checkbox.name);
+ });
+ }}
+ />
- handleDatePickerChange(date, data.id)}
- >
-
-
+ {
+ const nomalResults = props.results.resultList;
+ nomalResults.forEach((result) => {
+ const checkbox = document.getElementById(
+ "resultList" + result.id + ".isRejected",
+ );
+ checkbox.checked = e.target.checked;
+ handleAutomatedCheck(e.target.checked, checkbox.name);
+ });
+ }}
+ />
-
- );
- };
- return (
- <>
+ )}
- {({
- values,
- errors,
- touched,
- handleChange,
- //handleBlur,
- handleSubmit,
- }) => (
-
+ {({ values, errors, touched, handleChange }) => (
+
{
setSelectedLabel(val);
};
+ const handlePageChange = (pageInfo) => {
+ if (page != pageInfo.page) {
+ setPage(pageInfo.page);
+ }
+
+ if (pageSize != pageInfo.pageSize) {
+ setPageSize(pageInfo.pageSize);
+ }
+ };
const printWorkplan = () => {
let form = {
@@ -119,194 +137,223 @@ export default function Workplan(props) {
-
-
-
-
-
- {testsList.length !== 0 && (
- <>
-
-
-
-
-
-
-
-
-
-
-
-
- = {testsList.length}
-
- =
-
-
-
-
-
-
- <>
-
-
-
-
-
-
- {type === "test" && }
-
-
-
- {subjectOnWorkplan.toLowerCase() === "true" && (
+
+
+
+
+
+
+ {testsList.length !== 0 && (
+ <>
+
+
+
+
+
+
+
+
+
+
+
+
+ = {testsList.length}
+
+ =
+
+
+
+
+
+
+ <>
+
- >
-
-
-
-
-
-
-
-
-
-
-
- >
- )}
- {selectedValue && testsList.length === 0 && (
-
-
-
- )}
+
+ {showAccessionNumber && (
+
+
+ {convertAlphaNumLabNumForDisplay(
+ row.accessionNumber,
+ )}
+
+
+ )}
+
+ {subjectOnWorkplan.toLowerCase() === "true" && (
+
+ {showAccessionNumber && row.patientInfo}
+
+ )}
+ {nextVisitOnWorkplan.toLowerCase() === "true" && (
+
+ {showAccessionNumber && row.nextVisitDate}
+
+ )}
+ {type !== "test" && (
+
+ {row.nonconforming && (
+
+ )}
+
+ )}
+ {type !== "test" && (
+
{row.testName}
+ )}
+
{row.receivedDate}
+
+ );
+ })}
+
+
+
+ >
+
+
+
+
+
+
+
+
+
+
+
+ >
+ )}
+ {selectedValue && testsList.length === 0 && (
+
+
+
+
+
+
+
+ )}
+
>
);
}
diff --git a/frontend/src/languages/en.json b/frontend/src/languages/en.json
index 49d809a776..ee13c348c1 100644
--- a/frontend/src/languages/en.json
+++ b/frontend/src/languages/en.json
@@ -208,8 +208,8 @@
"sidenav.label.results.testdate" : "By Test Date" ,
"sidenav.label.results.byrange" : "By Range of Order numbers" ,
"sidenav.label.validation" : "Validation" ,
- "sidenav.label.validation.routine" : "Search By Routine",
- "sidenav.label.validation.study" : "Search By Study",
+ "sidenav.label.validation.routine" : "Routine",
+ "sidenav.label.validation.study" : "Study",
"sidenav.label.validation.order" : "Search By Order" ,
"sidenav.label.validation.testdate" : "Search By Test Date" ,
"sidenav.label.reports" : "Reports" ,
@@ -217,8 +217,8 @@
"sidenav.label.reports.study" : "Study" ,
"sidenav.label.admin" : "Admin" ,
"sidenav.label.admin.testmgt" : "Test Management" ,
- "sidenav.label.admin.testmgt.reflex" : "Manage Reflex tests" ,
- "sidenav.label.admin.testmgt.calculated" : "Manage Calculated Value tests" ,
+ "sidenav.label.admin.testmgt.reflex" : "Reflex Tests Management" ,
+ "sidenav.label.admin.testmgt.calculated" : "Calculated Value Tests Management" ,
"sidenav.label.admin.program" : "Program Entry" ,
"sidenav.label.admin.organizationmgt" : "Organization Management" ,
"sidenav.label.admin.usermgt" : "User Management",
@@ -229,6 +229,7 @@
"patient.label.nopatientid" : "Patient Id Doest Exist" ,
"sample.label.orderdate" : "Oder Date" ,
"sample.label.labnumber" : "Lab Number" ,
+ "sample.label.labnumber.generate": "Generate",
"sample.label.facility" : "Referring Facility",
"sample.label.requester" : "Requester" ,
"sample.label.dept" : "Ward/Dept/Unit" ,
@@ -368,6 +369,7 @@
"search.label.sample" : "Select Sample Status" ,
"pathology.label.report" : "Pathology Report",
"patient.natioanalid":"National ID",
+ "patient.label.additionalInfo": "Additional Information" ,
"sample.label.orderpanel":"Order Panels",
"sample.label.noorder":"Order Doesnt Exist",
"sample.label.labnumber.new" : "New Lab Number" ,
@@ -403,5 +405,6 @@
"labNumber.usePrefix": "Use Prefix",
"labNumber.prefix": "Prefix",
"labNumber.format.new": "New Format",
- "labNumber.format.current": "Current Format"
+ "labNumber.format.current": "Current Format" ,
+ "validation.label.nonconform" : "= Sample or Order is nonconforming or Test has been rejected"
}
diff --git a/frontend/src/languages/fr.json b/frontend/src/languages/fr.json
index b496135eff..21d2238940 100644
--- a/frontend/src/languages/fr.json
+++ b/frontend/src/languages/fr.json
@@ -213,8 +213,8 @@
"sidenav.label.results.testdate" : "Par Date de Test",
"sidenav.label.results.byrange" : "Par plage de numéros de commande",
"sidenav.label.validation" : "Validation",
- "sidenav.label.validation.routine" : "Recherche Par Routine",
- "sidenav.label.validation.study" : "Recherche Par Étude",
+ "sidenav.label.validation.routine" : "Routine",
+ "sidenav.label.validation.study" : "Étude",
"sidenav.label.validation.order" : "Recherche Par Commande",
"sidenav.label.validation.testdate" : "Recherche Par Date de Test",
"sidenav.label.reports" : "Rapports",
@@ -222,8 +222,8 @@
"sidenav.label.reports.study" : "Étude",
"sidenav.label.admin" : "Administration",
"sidenav.label.admin.testmgt" : "Gestion des Tests",
- "sidenav.label.admin.testmgt.reflex" : "Gérer les Tests de Réflexe",
- "sidenav.label.admin.testmgt.calculated" : "Gérer les Tests de Valeur Calculée",
+ "sidenav.label.admin.testmgt.reflex": "Gestion des tests de réflexes",
+ "sidenav.label.admin.testmgt.calculated": "Gestion des tests de valeur calculée",
"sidenav.label.admin.program" : "Entrée du Programme",
"sidenav.label.admin.organizationmgt" : "Gestion de l'Organisation",
"sidenav.label.admin.usermgt" : "Gestion des Utilisateurs",
@@ -234,6 +234,7 @@
"patient.label.nopatientid" : "Identifiant du Patient N'existe Pas",
"sample.label.orderdate" : "Date de Commande",
"sample.label.labnumber" : "Numéro de Laboratoire",
+ "sample.label.labnumber.generate": "Générer",
"sample.label.facility" : "Établissement Référant",
"sample.label.requester" : "Demandeur",
"sample.label.dept" : "Service/Département/Unité",
@@ -341,6 +342,7 @@
"patient.label.contactphone": "Téléphone de contact : {PHONE_FORMAT}",
"patient.lable.primaryphone": "Téléphone principal : {PHONE_FORMAT}",
"patient.gender": "Genre",
+ "patient.label.additionalInfo": "Informations Complémentaires" ,
"emergencyContactInfo.title":"Informations de contact d'urgence",
"label.button.select.status": "Sélectionner l'état",
"label.button.select.technician": "Sélectionner le technicien",
@@ -398,5 +400,6 @@
"labNumber.usePrefix": "Utiliser le préfixe",
"labNumber.prefix": "Préfixe",
"labNumber.format.new": "Nouveau format",
- "labNumber.format.current": "Format actuel"
+ "labNumber.format.current": "Format actuel" ,
+ "validation.label.nonconform": "= L'échantillon ou la commande est non conforme ou le test a été rejeté"
}
diff --git a/mkdocs.yml b/mkdocs.yml
index 5672a576b1..f590a2bfed 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -1,4 +1,14 @@
site_name: OpenELIS Global Documentation
+site_description: "Technical documentation for the OpenELIS Global2"
+site_author: "I‐TECH (DIGI) - University Of Washington"
+site_url: "https://openelis-global.org/"
+
+# Repository
+repo_name: "OpenELIS-Global-2"
+repo_url: "https://github.com/I-TECH-UW/OpenELIS-Global-2"
+
+# Copyright
+copyright: "Copyright © 2023 I‐TECH (DIGI) - University Of Washington"
nav:
- Home: index.md
- About: about.md
@@ -26,16 +36,23 @@ nav:
- Database Profiles Mass facility and test catalog updates: dbprofiles.md
- Entity Relation Diagram: entity relation diagram.md
- Troubleshooting: troubleshooting.md
+ - Google Summer of Code :
+ - GSoC 2024: gsoc.md
+ - GSoC ‐ Guidelines for Students : gsocstudentguide.md
- Website: http://openelis-global.org
-theme: readthedocs
-markdown_extensions:
+# Theme
+theme:
+ name: "material"
+ logo: img/openelis_logo.png
- # Python Markdown
- - toc:
- permalink: true
- - tables
markdown_extensions:
- - tables
+ - admonition
+ - codehilite:
+ guess_lang: false
+ - toc:
+ toc_depth : "3"
+ - footnotes
+
diff --git a/pom.xml b/pom.xml
index 53f0cbad7a..bdf6f5ab79 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,7 @@
2
8
1
- 8
+ 11
UTF-8
${project.basedir}/liquibase/liquibase.properties
1.4.1
diff --git a/readthedocs.yml b/readthedocs.yml
index 94a04e61bd..4a9a54eb94 100644
--- a/readthedocs.yml
+++ b/readthedocs.yml
@@ -17,7 +17,11 @@ mkdocs:
#formats: all
# Optionally set the version of Python and requirements required to build your docs
-#python:
-# version: 3.7
-# install:
-# - requirements: docs/requirements.txt
\ No newline at end of file
+# Set the version of Python and other tools you might need
+build:
+ os: ubuntu-22.04
+ tools:
+ python: "3.11"
+python:
+ install:
+ - requirements: requirements.txt
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000000..fcd284a368
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,2 @@
+mkdocs-versioning==0.4.0
+mkdocs-material==8.1.11
diff --git a/src/main/java/org/openelisglobal/analyzerresults/action/beanitems/AnalyzerResultItem.java b/src/main/java/org/openelisglobal/analyzerresults/action/beanitems/AnalyzerResultItem.java
index 1d02c6aa5d..e3c5839f1a 100644
--- a/src/main/java/org/openelisglobal/analyzerresults/action/beanitems/AnalyzerResultItem.java
+++ b/src/main/java/org/openelisglobal/analyzerresults/action/beanitems/AnalyzerResultItem.java
@@ -40,7 +40,7 @@ public class AnalyzerResultItem implements Serializable {
// TODO move all accession number to the same format so they can be validated
// properly
// @ValidAccessionNumber(groups = { AnalyzerResultsForm.AnalyzerResuts.class })
- @Pattern(regexp = "^[0-9a-zA-Z -]*$", groups = { AnalyzerResultsForm.AnalyzerResuts.class })
+ @Pattern(regexp = "^[0-9a-zA-Z -:]*$", groups = { AnalyzerResultsForm.AnalyzerResuts.class })
private String accessionNumber;
@SafeHtml(level = SafeHtml.SafeListLevel.NONE, groups = { AnalyzerResultsForm.AnalyzerResuts.class })
diff --git a/src/main/java/org/openelisglobal/barcode/BarcodeLabelMaker.java b/src/main/java/org/openelisglobal/barcode/BarcodeLabelMaker.java
index dc0f507e06..214c53f155 100644
--- a/src/main/java/org/openelisglobal/barcode/BarcodeLabelMaker.java
+++ b/src/main/java/org/openelisglobal/barcode/BarcodeLabelMaker.java
@@ -403,6 +403,7 @@ private PdfPCell create128Barcode(Label label, PdfWriter writer, int colspan)
Barcode128 barcode = new Barcode128();
barcode.setCodeType(Barcode.CODE128);
barcode.setCode(label.getCode());
+ barcode.setAltText(label.getCodeLabel());
// shrink bar code height inversely with number of text rows
barcode.setBarHeight((10 - (label.getNumTextRowsBefore() + label.getNumTextRowsAfter())) * 30 / 10);
PdfPCell cell = new PdfPCell(barcode.createImageWithBarcode(writer.getDirectContent(), null, null), true);
diff --git a/src/main/java/org/openelisglobal/barcode/labeltype/Label.java b/src/main/java/org/openelisglobal/barcode/labeltype/Label.java
index daf0f22581..b6431d317b 100644
--- a/src/main/java/org/openelisglobal/barcode/labeltype/Label.java
+++ b/src/main/java/org/openelisglobal/barcode/labeltype/Label.java
@@ -48,6 +48,7 @@ public abstract class Label {
protected ArrayList aboveFields;
protected ArrayList belowFields;
private String code;
+ private String codeLabel;
// information stored in/for database
private BarcodeLabelInfo labelInfo;
@@ -210,6 +211,14 @@ public void setCode(String code) {
this.code = code;
}
+ public String getCodeLabel() {
+ return codeLabel == null ? code : codeLabel;
+ }
+
+ public void setCodeLabel(String codeLabel) {
+ this.codeLabel = codeLabel;
+ }
+
/**
* Get number of labels to attempt to print
*
diff --git a/src/main/java/org/openelisglobal/barcode/labeltype/OrderLabel.java b/src/main/java/org/openelisglobal/barcode/labeltype/OrderLabel.java
index fdacf55163..c4667da39f 100644
--- a/src/main/java/org/openelisglobal/barcode/labeltype/OrderLabel.java
+++ b/src/main/java/org/openelisglobal/barcode/labeltype/OrderLabel.java
@@ -5,6 +5,8 @@
import org.apache.commons.lang.StringUtils;
import org.openelisglobal.barcode.LabelField;
import org.openelisglobal.common.log.LogEvent;
+import org.openelisglobal.common.provider.validation.AccessionNumberValidatorFactory.AccessionFormat;
+import org.openelisglobal.common.provider.validation.AlphanumAccessionValidator;
import org.openelisglobal.common.services.SampleOrderService;
import org.openelisglobal.common.util.ConfigurationProperties;
import org.openelisglobal.common.util.ConfigurationProperties.Property;
@@ -54,13 +56,20 @@ public OrderLabel(String labNo, String facility) {
aboveFields.add(siteField);
// adding bar code
+ if (AccessionFormat.ALPHANUM.toString()
+ .equals(ConfigurationProperties.getInstance().getPropertyValue(Property.AccessionFormat))) {
+ setCodeLabel(AlphanumAccessionValidator.convertAlphaNumLabNumForDisplay(labNo));
+ }
setCode(labNo);
}
/**
- * @param patient Who to include on order label
- * @param sample What to include on order label
- * @param labNo Code to include in bar code
+ * @param patient
+ * Who to include on order label
+ * @param sample
+ * What to include on order label
+ * @param labNo
+ * Code to include in bar code
*/
public OrderLabel(Patient patient, Sample sample, String labNo) {
// set dimensions
@@ -91,13 +100,18 @@ public OrderLabel(Patient patient, Sample sample, String labNo) {
aboveFields.add(siteField);
// adding bar code
+ if (AccessionFormat.ALPHANUM.toString()
+ .equals(ConfigurationProperties.getInstance().getPropertyValue(Property.AccessionFormat))) {
+ setCodeLabel(AlphanumAccessionValidator.convertAlphaNumLabNumForDisplay(labNo));
+ }
setCode(labNo);
}
/**
* Get first available id to identify a patient (Subject Number > National Id)
*
- * @param patient Who to find identification for
+ * @param patient
+ * Who to find identification for
* @return label field containing patient id
*/
private LabelField getAvailableIdField(Patient patient) {
diff --git a/src/main/java/org/openelisglobal/common/provider/query/SampleItemTestProvider.java b/src/main/java/org/openelisglobal/common/provider/query/SampleItemTestProvider.java
index a5e56e97a3..cdafc0a169 100644
--- a/src/main/java/org/openelisglobal/common/provider/query/SampleItemTestProvider.java
+++ b/src/main/java/org/openelisglobal/common/provider/query/SampleItemTestProvider.java
@@ -32,6 +32,7 @@
import org.apache.commons.validator.GenericValidator;
import org.openelisglobal.analysis.service.AnalysisService;
import org.openelisglobal.analysis.valueholder.Analysis;
+import org.openelisglobal.common.log.LogEvent;
import org.openelisglobal.sample.form.ProjectData;
import org.openelisglobal.sample.util.CI.BaseProjectFormMapper.TypeOfSampleTests;
import org.openelisglobal.sample.util.CI.IProjectFormMapper;
@@ -50,123 +51,131 @@
*/
public class SampleItemTestProvider extends BaseQueryProvider {
- protected static AnalysisService analysisService = SpringContext.getBean(AnalysisService.class);
- protected SampleItemService sampleItemService = SpringContext.getBean(SampleItemService.class);
-
- /**
- * @see org.openelisglobal.common.provider.query.BaseQueryProvider#processRequest(javax.servlet.http.HttpServletRequest,
- * javax.servlet.http.HttpServletResponse)
- */
- @Override
- public void processRequest(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- /**
- * The primary Key for a sample
- */
- String sampleKey = request.getParameter("sampleKey");
- /**
- * the particular project form we are trying to fill validate.
- */
- String projectFormName = request.getParameter("projectFormName");
-
- /**
- * the name (something derived from html form id) of the check box for the
- * relevant sample item type
- */
- String sampleItemTypeTag = request.getParameter("sampleItemTypeTag");
-
- /**
- * the name (something derived from html form id)
- */
- String testTag = request.getParameter("testTag");
-
- StringBuilder xml = new StringBuilder();
- String result = VALID;
-
- boolean isChecked;
- if (GenericValidator.isBlankOrNull(testTag)) {
- isChecked = wasSampleTypeSelected(sampleKey, projectFormName, sampleItemTypeTag);
- } else {
- try {
- isChecked = wasTestSelected(sampleKey, projectFormName, sampleItemTypeTag, testTag);
- } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
- throw new ServletException(e);
- }
- }
-
- xml.append(isChecked);
-
- ajaxServlet.sendData(xml.toString(), result, request, response);
- }
-
- /**
- * Figure out if the given "test" (actually something of a test panel) Ask the
- * project form mapper
- *
- */
- private boolean wasTestSelected(String sampleKey, String projectFormName, String sampleItemType, String testTag)
- throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
- ProjectData projectData = new ProjectData();
- Map miniForm = new HashMap<>();
- miniForm.put(sampleItemType + "Taken", Boolean.TRUE);
- miniForm.put(testTag, Boolean.TRUE);
- PropertyUtils.copyProperties(projectData, miniForm);
-
- List analysis = findAnalysis(sampleKey, projectFormName, projectData);
- return analysis.size() != 0;
- }
-
- /***
- * Fill in one (or more?) sampleType fields of project data and one (or more?)
- * *Test fields, e.g. transaminaseTest and you'll get back a list Analysis which
- * where submitted because of that selection.
- *
- * @param sampleKey - PK of a sample
- * @param projectFormName particular study we are working on
- * @param projectData the data with two flags set.
- * @return List of analysis
- */
- // TODO PAHill - refactor - needs to be moved to some type of a utility
- // class.
- public static List findAnalysis(String sampleKey, String projectFormName, ProjectData projectData) {
- IProjectFormMapper projectFormMapper = new ProjectFormMapperFactory().getProjectInitializer(projectFormName,
- null);
- projectFormMapper.setProjectData(projectData);
- List typeOfSampleTestsList = projectFormMapper.getTypeOfSampleTests();
- if (typeOfSampleTestsList.size() == 0) {
- throw new IllegalArgumentException("The combination of sampleItem type and test (panel) is not valid.");
- }
- TypeOfSampleTests sampleTests = typeOfSampleTestsList.get(0);
- List tests = sampleTests.tests;
-
- List testIds = new ArrayList<>();
- for (Test test : tests) {
- testIds.add(Integer.valueOf(test.getId()));
- }
- return analysisService.getAnalysisBySampleAndTestIds(sampleKey, testIds);
-
- }
-
- private boolean wasSampleTypeSelected(String sampleId, String projectFormName, String sampleItemType) {
- String sampleItemDesc = changeUIIdToDescription(sampleItemType);
- IProjectFormMapper projectFormMapper = new ProjectFormMapperFactory().getProjectInitializer(projectFormName,
- null);
- TypeOfSample typeOfSample = projectFormMapper.getTypeOfSample(sampleItemDesc);
- List sampleItems = sampleItemService.getSampleItemsBySampleId(sampleId);
- for (SampleItem sampleItem : sampleItems) {
- if (sampleItem.getTypeOfSampleId().equals(typeOfSample.getId())) {
- return true;
- }
- }
- return false;
- }
-
- private String changeUIIdToDescription(String sampleTypeId) {
- String description = sampleTypeId;
- int i = sampleTypeId.indexOf("Tube");
- if (i != -1) {
- description = sampleTypeId.substring(0, i) + " Tube";
- }
- return description;
- }
+ protected static AnalysisService analysisService = SpringContext.getBean(AnalysisService.class);
+ protected SampleItemService sampleItemService = SpringContext.getBean(SampleItemService.class);
+
+ /**
+ * @see org.openelisglobal.common.provider.query.BaseQueryProvider#processRequest(javax.servlet.http.HttpServletRequest,
+ * javax.servlet.http.HttpServletResponse)
+ */
+ @Override
+ public void processRequest(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ /**
+ * The primary Key for a sample
+ */
+ String sampleKey = request.getParameter("sampleKey");
+ /**
+ * the particular project form we are trying to fill validate.
+ */
+ String projectFormName = request.getParameter("projectFormName");
+
+ /**
+ * the name (something derived from html form id) of the check box for the
+ * relevant sample item type
+ */
+ String sampleItemTypeTag = request.getParameter("sampleItemTypeTag");
+ if (sampleItemTypeTag.endsWith("vl")) {
+ sampleItemTypeTag = sampleItemTypeTag.substring(0, sampleItemTypeTag.length() - 2);
+ }
+
+ /**
+ * the name (something derived from html form id)
+ */
+ String testTag = request.getParameter("testTag");
+
+ StringBuilder xml = new StringBuilder();
+ String result = VALID;
+
+ boolean isChecked;
+ if (GenericValidator.isBlankOrNull(testTag)) {
+ isChecked = wasSampleTypeSelected(sampleKey, projectFormName, sampleItemTypeTag);
+ } else {
+ try {
+ isChecked = wasTestSelected(sampleKey, projectFormName, sampleItemTypeTag, testTag);
+ } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
+ throw new ServletException(e);
+ }
+ }
+
+ xml.append(isChecked);
+
+ ajaxServlet.sendData(xml.toString(), result, request, response);
+ }
+
+ /**
+ * Figure out if the given "test" (actually something of a test panel) Ask the
+ * project form mapper
+ *
+ */
+ private boolean wasTestSelected(String sampleKey, String projectFormName, String sampleItemType, String testTag)
+ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
+ ProjectData projectData = new ProjectData();
+ Map miniForm = new HashMap<>();
+ miniForm.put(sampleItemType + "Taken", Boolean.TRUE);
+ miniForm.put(testTag, Boolean.TRUE);
+ PropertyUtils.copyProperties(projectData, miniForm);
+
+ List analysis = findAnalysis(sampleKey, projectFormName, projectData);
+ return analysis.size() != 0;
+ }
+
+ /***
+ * Fill in one (or more?) sampleType fields of project data and one (or more?)
+ * *Test fields, e.g. transaminaseTest and you'll get back a list Analysis which
+ * where submitted because of that selection.
+ *
+ * @param sampleKey - PK of a sample
+ * @param projectFormName particular study we are working on
+ * @param projectData the data with two flags set.
+ * @return List of analysis
+ */
+ // TODO PAHill - refactor - needs to be moved to some type of a utility
+ // class.
+ public static List findAnalysis(String sampleKey, String projectFormName, ProjectData projectData) {
+ IProjectFormMapper projectFormMapper = new ProjectFormMapperFactory().getProjectInitializer(projectFormName,
+ null);
+ projectFormMapper.setProjectData(projectData);
+ List typeOfSampleTestsList = projectFormMapper.getTypeOfSampleTests();
+ if (typeOfSampleTestsList.size() == 0) {
+ throw new IllegalArgumentException("The combination of sampleItem type and test (panel) is not valid.");
+ }
+ TypeOfSampleTests sampleTests = typeOfSampleTestsList.get(0);
+ List tests = sampleTests.tests;
+
+ List testIds = new ArrayList<>();
+ for (Test test : tests) {
+ testIds.add(Integer.valueOf(test.getId()));
+ }
+ return analysisService.getAnalysisBySampleAndTestIds(sampleKey, testIds);
+
+ }
+
+ private boolean wasSampleTypeSelected(String sampleId, String projectFormName, String sampleItemType) {
+ try {
+ String sampleItemDesc = changeUIIdToDescription(sampleItemType);
+ IProjectFormMapper projectFormMapper = new ProjectFormMapperFactory().getProjectInitializer(projectFormName,
+ null);
+ TypeOfSample typeOfSample = projectFormMapper.getTypeOfSample(sampleItemDesc);
+ List sampleItems = sampleItemService.getSampleItemsBySampleId(sampleId);
+ for (SampleItem sampleItem : sampleItems) {
+ if (sampleItem.getTypeOfSampleId().equals(typeOfSample.getId())) {
+ return true;
+ }
+ }
+ return false;
+ } catch (Exception e) {
+ LogEvent.logError(e);
+ return false;
+ }
+ }
+
+ private String changeUIIdToDescription(String sampleTypeId) {
+ String description = sampleTypeId;
+ int i = sampleTypeId.indexOf("Tube");
+ if (i != -1) {
+ description = sampleTypeId.substring(0, i) + " Tube";
+ }
+ return description;
+ }
}
diff --git a/src/main/java/org/openelisglobal/common/provider/validation/AccessionNumberValidatorFactory.java b/src/main/java/org/openelisglobal/common/provider/validation/AccessionNumberValidatorFactory.java
index c44c0d57ec..b972863658 100644
--- a/src/main/java/org/openelisglobal/common/provider/validation/AccessionNumberValidatorFactory.java
+++ b/src/main/java/org/openelisglobal/common/provider/validation/AccessionNumberValidatorFactory.java
@@ -158,7 +158,7 @@ private IAccessionNumberGenerator getYearNumValidator(int length, Character sepa
}
private IAccessionNumberGenerator getAlphanumValidator() {
- return new Base27AccessionValidator();
+ return new AlphanumAccessionValidator();
}
private IAccessionNumberGenerator getSiteYearValidator() {
diff --git a/src/main/java/org/openelisglobal/common/provider/validation/Base27AccessionValidator.java b/src/main/java/org/openelisglobal/common/provider/validation/AlphanumAccessionValidator.java
similarity index 98%
rename from src/main/java/org/openelisglobal/common/provider/validation/Base27AccessionValidator.java
rename to src/main/java/org/openelisglobal/common/provider/validation/AlphanumAccessionValidator.java
index b7b4913a7d..477f35be4f 100644
--- a/src/main/java/org/openelisglobal/common/provider/validation/Base27AccessionValidator.java
+++ b/src/main/java/org/openelisglobal/common/provider/validation/AlphanumAccessionValidator.java
@@ -19,7 +19,7 @@
import org.openelisglobal.sample.util.AccessionNumberUtil;
import org.openelisglobal.spring.util.SpringContext;
-public class Base27AccessionValidator implements IAccessionNumberGenerator {
+public class AlphanumAccessionValidator implements IAccessionNumberGenerator {
protected SampleService sampleService = SpringContext.getBean(SampleService.class);
protected AccessionService accessionService = SpringContext.getBean(AccessionService.class);
@@ -123,7 +123,7 @@ public ValidationResults validFormat(String accessionNumber, boolean checkDate)
}
try {
- Long.parseLong(accessionNumber.substring(getIncrementStartIndex()));
+ IntegerUtil.parseIntBase27(accessionNumber.substring(getIncrementStartIndex()));
} catch (NumberFormatException e) {
return ValidationResults.FORMAT_FAIL;
}
diff --git a/src/main/java/org/openelisglobal/common/rest/DisplayListController.java b/src/main/java/org/openelisglobal/common/rest/DisplayListController.java
index 94df0b2aa1..ae13b8e493 100644
--- a/src/main/java/org/openelisglobal/common/rest/DisplayListController.java
+++ b/src/main/java/org/openelisglobal/common/rest/DisplayListController.java
@@ -31,6 +31,8 @@
import org.openelisglobal.provider.service.ProviderService;
import org.openelisglobal.provider.valueholder.Provider;
import org.openelisglobal.role.service.RoleService;
+import org.openelisglobal.siteinformation.service.SiteInformationService;
+import org.openelisglobal.siteinformation.valueholder.SiteInformation;
import org.openelisglobal.spring.util.SpringContext;
import org.openelisglobal.systemuser.service.UserService;
import org.openelisglobal.test.service.TestService;
@@ -74,6 +76,9 @@ public class DisplayListController extends BaseRestController{
@Autowired
private OrganizationService organizationService;
+ @Autowired
+ private SiteInformationService siteInformationService;
+
private static boolean HAS_NFS_PANEL = false;
static {
@@ -254,7 +259,12 @@ private List getSiteNameList() {
@ResponseBody
private Map getConfigurationProperties() {
Map configs = getOpenConfigurationProperties();
+
+ configs.put(Property.allowResultRejection.toString() ,ConfigurationProperties.getInstance().getPropertyValue(
+ Property.allowResultRejection));
+
configs.put(Property.AccessionFormat.toString(), ConfigurationProperties.getInstance().getPropertyValue(Property.AccessionFormat));
+
return configs;
}
@@ -281,6 +291,12 @@ private Map getOpenConfigurationProperties() {
configs.put("currentTimeAsText",DateUtil.getCurrentTimeAsText());
configs.put(Property.BANNER_TEXT.toString(), localizationService
.getLocalizedValueById(ConfigurationProperties.getInstance().getPropertyValue(Property.BANNER_TEXT)));
+ SiteInformation patientManagementTab = siteInformationService.getSiteInformationByName("Patient management tab");
+ SiteInformation studyManagementTab = siteInformationService.getSiteInformationByName("Study Management tab");
+ SiteInformation nonConformityTab = siteInformationService.getSiteInformationByName("Non Conformity tab");
+ configs.put("patientManagementTab", patientManagementTab != null ? patientManagementTab.getValue() : "false");
+ configs.put("studyManagementTab", studyManagementTab != null ? studyManagementTab.getValue() : "false");
+ configs.put("nonConformityTab", nonConformityTab != null ? nonConformityTab.getValue() : "false");
return configs;
}
diff --git a/src/main/java/org/openelisglobal/common/service/servlet/reports/LogoUploadServiceImpl.java b/src/main/java/org/openelisglobal/common/service/servlet/reports/LogoUploadServiceImpl.java
index cc5db51066..4946f84c0c 100644
--- a/src/main/java/org/openelisglobal/common/service/servlet/reports/LogoUploadServiceImpl.java
+++ b/src/main/java/org/openelisglobal/common/service/servlet/reports/LogoUploadServiceImpl.java
@@ -34,7 +34,7 @@ public void saveImage(Image image, boolean newImage, String imageId, SiteInforma
image.setId(imageId);
imageService.delete(image);
}
- Image savedImage = imageService.save(image);
+ Image savedImage = imageService.save(image);
logoInformation.setValue(savedImage.getId());
logoInformation.setSysUserId("1");
diff --git a/src/main/java/org/openelisglobal/common/services/DisplayListService.java b/src/main/java/org/openelisglobal/common/services/DisplayListService.java
index 46d279ba18..52749fb962 100644
--- a/src/main/java/org/openelisglobal/common/services/DisplayListService.java
+++ b/src/main/java/org/openelisglobal/common/services/DisplayListService.java
@@ -41,6 +41,7 @@
import org.openelisglobal.method.service.MethodService;
import org.openelisglobal.method.valueholder.Method;
import org.openelisglobal.organization.service.OrganizationService;
+import org.openelisglobal.organization.util.OrganizationTypeList;
import org.openelisglobal.organization.valueholder.Organization;
import org.openelisglobal.panel.service.PanelService;
import org.openelisglobal.panel.valueholder.Panel;
@@ -98,7 +99,9 @@ public enum ListType {
PATHOLOGIST_CONCLUSIONS ,IMMUNOHISTOCHEMISTRY_REPORT_TYPES ,IMMUNOHISTOCHEMISTRY_MARKERS_TESTS ,CYTOLOGY_STATUS,
CYTOLOGY_SATISFACTORY_FOR_EVALUATION ,CYTOLOGY_UN_SATISFACTORY_FOR_EVALUATION ,CYTOLOGY_REPORT_TYPES,
CYTOLOGY_DIAGNOSIS_RESULT_EPITHELIAL_CELL_SQUAMOUS ,CYTOLOGY_DIAGNOSIS_RESULT_EPITHELIAL_CELL_GLANDULAR ,CYTOLOGY_DIAGNOSIS_RESULT_NON_NEO_PLASTIC_CELLULAR,
- CYTOLOGY_DIAGNOSIS_RESULT_REACTIVE_CELLULAR ,CYTOLOGY_DIAGNOSIS_RESULT_ORGANISMS , CYTOLOGY_DIAGNOSIS_RESULT_OTHER ;
+ CYTOLOGY_DIAGNOSIS_RESULT_REACTIVE_CELLULAR ,CYTOLOGY_DIAGNOSIS_RESULT_ORGANISMS , CYTOLOGY_DIAGNOSIS_RESULT_OTHER,
+ TB_ORDER_REASONS, TB_DIAGNOSTIC_REASONS, TB_FOLLOWUP_REASONS, TB_ANALYSIS_METHODS, TB_SAMPLE_ASPECTS,
+ TB_FOLLOWUP_LINE1, TB_FOLLOWUP_LINE2, ARV_ORG_LIST ;
}
private static Map> typeToListMap;
@@ -153,7 +156,7 @@ private List createDictionaryTestResults() {
List testResults = createFromDictionaryCategoryLocalizedSort("CG");
testResults.addAll(createFromDictionaryCategoryLocalizedSort("HL"));
testResults.addAll(createFromDictionaryCategoryLocalizedSort("KL"));
- testResults.addAll(createFromDictionaryCategoryLocalizedSort("Test Reslt"));
+ testResults.addAll(createFromDictionaryCategoryLocalizedSort("Test Result"));
testResults.addAll(createFromDictionaryCategoryLocalizedSort("HIV1NInd"));
testResults.addAll(createFromDictionaryCategoryLocalizedSort("PosNegIndInv"));
testResults.addAll(createFromDictionaryCategoryLocalizedSort("HIVResult"));
@@ -234,6 +237,14 @@ public void localeChanged(String locale) {
typeToListMap.put(ListType.CYTOLOGY_DIAGNOSIS_RESULT_REACTIVE_CELLULAR, createDictionaryListForCategory("cytology_reactive_cellular_changes"));
typeToListMap.put(ListType.CYTOLOGY_DIAGNOSIS_RESULT_ORGANISMS, createDictionaryListForCategory("cytology_diagnosis_organisms"));
typeToListMap.put(ListType.CYTOLOGY_DIAGNOSIS_RESULT_OTHER, createDictionaryListForCategory("cytology_diagnosis_other"));
+ typeToListMap.put(ListType.TB_ORDER_REASONS, createDictionaryListForCategory("TB Order Reasons"));
+ typeToListMap.put(ListType.TB_DIAGNOSTIC_REASONS, createDictionaryListForCategory("TB Diagnostic Reasons"));
+ typeToListMap.put(ListType.TB_FOLLOWUP_REASONS, createDictionaryListForCategory("TB Followup Reasons"));
+ typeToListMap.put(ListType.TB_ANALYSIS_METHODS, createDictionaryListForCategory("TB Analysis Methods"));
+ typeToListMap.put(ListType.TB_SAMPLE_ASPECTS, createDictionaryListForCategory("TB Sample Aspects"));
+ typeToListMap.put(ListType.TB_FOLLOWUP_LINE1, createTBFollowupLine1List());
+ typeToListMap.put(ListType.TB_FOLLOWUP_LINE2, createTBFollowupLine2List());
+ typeToListMap.put(ListType.ARV_ORG_LIST, createArvOrgList());
}
private List createPathologyStatusList() {
@@ -475,6 +486,14 @@ public synchronized void refreshLists() {
typeToListMap.put(ListType.CYTOLOGY_DIAGNOSIS_RESULT_REACTIVE_CELLULAR, createDictionaryListForCategory("cytology_reactive_cellular_changes"));
typeToListMap.put(ListType.CYTOLOGY_DIAGNOSIS_RESULT_ORGANISMS, createDictionaryListForCategory("cytology_diagnosis_organisms"));
typeToListMap.put(ListType.CYTOLOGY_DIAGNOSIS_RESULT_OTHER, createDictionaryListForCategory("cytology_diagnosis_other"));
+ typeToListMap.put(ListType.TB_ORDER_REASONS, createDictionaryListForCategory("TB Order Reasons"));
+ typeToListMap.put(ListType.TB_DIAGNOSTIC_REASONS, createDictionaryListForCategory("TB Diagnostic Reasons"));
+ typeToListMap.put(ListType.TB_FOLLOWUP_REASONS, createDictionaryListForCategory("TB Followup Reasons"));
+ typeToListMap.put(ListType.TB_ANALYSIS_METHODS, createDictionaryListForCategory("TB Analysis Methods"));
+ typeToListMap.put(ListType.TB_SAMPLE_ASPECTS, createDictionaryListForCategory("TB Sample Aspects"));
+ typeToListMap.put(ListType.TB_FOLLOWUP_LINE1, createTBFollowupLine1List());
+ typeToListMap.put(ListType.TB_FOLLOWUP_LINE2, createTBFollowupLine2List());
+ typeToListMap.put(ListType.ARV_ORG_LIST, createArvOrgList());
}
public void refreshList(ListType listType) {
@@ -570,6 +589,9 @@ public void refreshList(ListType listType) {
case DICTIONARY_TEST_RESULTS: {
typeToListMap.put(ListType.DICTIONARY_TEST_RESULTS, createDictionaryTestResults());
}
+ case ARV_ORG_LIST: {
+ typeToListMap.put(ListType.ARV_ORG_LIST, createArvOrgList());
+ }
}
}
@@ -610,6 +632,26 @@ private List createReferringClinicList() {
return requesterList;
}
+ private List createArvOrgList() {
+ List requesterList = new ArrayList<>();
+
+ List orgList = OrganizationTypeList.ARV_ORGS.getList();
+ orgList.sort((e, f) -> {
+ return e.getOrganizationName().compareTo(f.getOrganizationName());
+ });
+
+ for (Organization organization : orgList) {
+ if (GenericValidator.isBlankOrNull(organization.getShortName())) {
+ requesterList.add(new IdValuePair(organization.getId(), organization.getOrganizationName()));
+ } else {
+ requesterList.add(new IdValuePair(organization.getId(),
+ organization.getShortName() + " - " + organization.getOrganizationName()));
+ }
+ }
+
+ return requesterList;
+ }
+
private List createGenderList() {
List genders = new ArrayList<>();
@@ -843,163 +885,180 @@ private List createMethodList() {
private List createUnitOfMeasureList() {
List unitOfMeasuresPairs = new ArrayList<>();
// List unitOfMeasures = unitOfMeasureService.getAllActiveUnitOfMeasures();
- List unitOfMeasures = unitOfMeasureService.getAll();
-
- for (UnitOfMeasure unitOfMeasure : unitOfMeasures) {
- unitOfMeasuresPairs.add(new IdValuePair(unitOfMeasure.getId(), unitOfMeasure.getLocalizedName()));
- }
-
- return unitOfMeasuresPairs;
- }
-
- private List createTypeOfSampleList() {
- List typeOfSamplePairs = new ArrayList<>();
- List typeOfSamples = typeOfSampleService.getAllTypeOfSamplesSortOrdered();
-
- for (TypeOfSample typeOfSample : typeOfSamples) {
- typeOfSamplePairs.add(new IdValuePair(typeOfSample.getId(), typeOfSample.getLocalizedName()));
- }
-
- return typeOfSamplePairs;
- }
-
- private List createInactiveTestSection() {
- List testSectionsPairs = new ArrayList<>();
- List testSections = testSectionService.getAllInActiveTestSections();
-
- for (TestSection section : testSections) {
- testSectionsPairs.add(new IdValuePair(section.getId(), section.getLocalizedName()));
- }
-
- return testSectionsPairs;
- }
-
- private List createInactiveMethod() {
- List methodPairs = new ArrayList<>();
- List methods = methodService.getAllInActiveMethods();
-
- for (Method method : methods) {
- methodPairs.add(new IdValuePair(method.getId(), method.getLocalization().getLocalizedValue()));
- }
-
- return methodPairs;
- }
-
- private List createTestSectionByNameList() {
- List testSectionsPairs = new ArrayList<>();
- List testSections = testSectionService.getAllActiveTestSections();
-
- for (TestSection section : testSections) {
- testSectionsPairs.add(new IdValuePair(section.getId(), section.getTestSectionName()));
- }
-
- return testSectionsPairs;
- }
-
- private List createAddressDepartmentList() {
- List departmentPairs = new ArrayList<>();
- List departments = dictionaryService.getDictionaryEntrysByCategoryAbbreviation("description",
- "haitiDepartment", true);
-
- for (Dictionary dictionary : departments) {
- departmentPairs.add(new IdValuePair(dictionary.getId(), dictionary.getDictEntry()));
- }
-
- return departmentPairs;
- }
-
- private List createPatientSearchCriteria() {
- List searchCriteria = new ArrayList<>();
-
- // N.B. If the order is to be changed just change the order but keep the
- // id:value pairing the same
- searchCriteria.add(new IdValuePair("0", MessageUtil.getMessage("label.select.search.by")));
- searchCriteria.add(new IdValuePair("2", "1. " + MessageUtil.getMessage("label.select.last.name")));
- searchCriteria.add(new IdValuePair("1", "2. " + MessageUtil.getMessage("label.select.first.name")));
- searchCriteria.add(new IdValuePair("3", "3. " + MessageUtil.getMessage("label.select.last.first.name")));
- searchCriteria.add(new IdValuePair("4", "4. " + MessageUtil.getMessage("label.select.patient.ID")));
- searchCriteria
- .add(new IdValuePair("5", "5. " + MessageUtil.getContextualMessage("quick.entry.accession.number")));
-
- return searchCriteria;
- }
-
- private List createConsequencesList() {
- List consequencesList = new ArrayList<>();
-
- // N.B. If the order is to be changed just change the order but keep the
- // id:value pairing the same
- consequencesList.add(new IdValuePair("0", MessageUtil.getMessage("label.select.one")));
- consequencesList.add(new IdValuePair("1", MessageUtil.getMessage("label.select.consequences.none")));
- consequencesList.add(new IdValuePair("2", MessageUtil.getMessage("label.select.consequences.moderate")));
- consequencesList.add(new IdValuePair("3", MessageUtil.getMessage("label.select.consequences.high")));
- return consequencesList;
- }
-
- private List createRecurrenceList() {
- List recurrenceList = new ArrayList<>();
-
- // N.B. If the order is to be changed just change the order but keep the
- // id:value pairing the same
- recurrenceList.add(new IdValuePair("0", MessageUtil.getMessage("label.select.one")));
- recurrenceList.add(new IdValuePair("1", MessageUtil.getMessage("label.select.recurrence.not")));
- recurrenceList.add(new IdValuePair("2", MessageUtil.getMessage("label.select.recurrence.somewhat")));
- recurrenceList.add(new IdValuePair("3", MessageUtil.getMessage("label.select.recurrence.highly")));
- return recurrenceList;
- }
-
- private List createActionTypeList() {
- List recurrenceList = new ArrayList<>();
-
- // N.B. If the order is to be changed just change the order but keep the
- // id:value pairing the same
- recurrenceList.add(new IdValuePair("1", MessageUtil.getMessage("label.input.actiontype.corrective")));
- recurrenceList.add(new IdValuePair("2", MessageUtil.getMessage("label.input.actiontype.preventive")));
- recurrenceList.add(new IdValuePair("3", MessageUtil.getMessage("label.input.actiontype.concurrent")));
- return recurrenceList;
- }
-
- private List createLaboratoryComponentList() {
- List recurrenceList = new ArrayList<>();
-
- // N.B. If the order is to be changed just change the order but keep the
- // id:value pairing the same
- recurrenceList.add(
- new IdValuePair("1", MessageUtil.getMessage("label.select.laboratoryComponent.facilitiesAndSafety")));
- recurrenceList
- .add(new IdValuePair("2", MessageUtil.getMessage("label.select.laboratoryComponent.organization")));
- recurrenceList.add(new IdValuePair("3", MessageUtil.getMessage("label.select.laboratoryComponent.personnel")));
- recurrenceList.add(new IdValuePair("4", MessageUtil.getMessage("label.select.laboratoryComponent.equipment")));
- recurrenceList.add(new IdValuePair("5", MessageUtil.getMessage("label.select.laboratoryComponent.purchasing")));
- recurrenceList.add(new IdValuePair("6", MessageUtil.getMessage("label.select.laboratoryComponent.process")));
- recurrenceList
- .add(new IdValuePair("7", MessageUtil.getMessage("label.select.laboratoryComponent.information")));
- recurrenceList.add(new IdValuePair("8", MessageUtil.getMessage("label.select.laboratoryComponent.documents")));
- recurrenceList.add(new IdValuePair("9", MessageUtil.getMessage("label.select.laboratoryComponent.assessment")));
- recurrenceList
- .add(new IdValuePair("10", MessageUtil.getMessage("label.select.laboratoryComponent.nceManagement")));
- recurrenceList.add(
- new IdValuePair("11", MessageUtil.getMessage("label.select.laboratoryComponent.continualImprovement")));
- return recurrenceList;
- }
-
- private List createMethodByNameList() {
- List methodsPairs = new ArrayList<>();
- List methods = methodService.getAllActiveMethods();
- for (Method method : methods) {
- methodsPairs.add(new IdValuePair(method.getId(), method.getMethodName()));
- }
- return methodsPairs;
- }
-
- private List createSamplePriorityList() {
- List priorities = new ArrayList<>();
- priorities.add(new IdValuePair(OrderPriority.ROUTINE.name(), MessageUtil.getMessage("label.priority.routine")));
- priorities.add(new IdValuePair(OrderPriority.ASAP.name(), MessageUtil.getMessage("label.priority.asap")));
- priorities.add(new IdValuePair(OrderPriority.STAT.name(), MessageUtil.getMessage("label.priority.stat")));
- priorities.add(new IdValuePair(OrderPriority.TIMED.name(), MessageUtil.getMessage("label.priority.timed")));
- priorities.add(
- new IdValuePair(OrderPriority.FUTURE_STAT.name(), MessageUtil.getMessage("label.priority.futureStat")));
- return priorities;
- }
+ List unitOfMeasures = unitOfMeasureService.getAll();
+
+ for (UnitOfMeasure unitOfMeasure : unitOfMeasures) {
+ unitOfMeasuresPairs.add(new IdValuePair(unitOfMeasure.getId(), unitOfMeasure.getLocalizedName()));
+ }
+
+ return unitOfMeasuresPairs;
+ }
+
+ private List createTypeOfSampleList() {
+ List typeOfSamplePairs = new ArrayList<>();
+ List typeOfSamples = typeOfSampleService.getAllTypeOfSamplesSortOrdered();
+
+ for (TypeOfSample typeOfSample : typeOfSamples) {
+ typeOfSamplePairs.add(new IdValuePair(typeOfSample.getId(), typeOfSample.getLocalizedName()));
+ }
+
+ return typeOfSamplePairs;
+ }
+
+ private List createInactiveTestSection() {
+ List testSectionsPairs = new ArrayList<>();
+ List testSections = testSectionService.getAllInActiveTestSections();
+
+ for (TestSection section : testSections) {
+ testSectionsPairs.add(new IdValuePair(section.getId(), section.getLocalizedName()));
+ }
+
+ return testSectionsPairs;
+ }
+
+ private List createInactiveMethod() {
+ List methodPairs = new ArrayList<>();
+ List methods = methodService.getAllInActiveMethods();
+
+ for (Method method : methods) {
+ methodPairs.add(new IdValuePair(method.getId(), method.getLocalization().getLocalizedValue()));
+ }
+
+ return methodPairs;
+ }
+
+ private List createTestSectionByNameList() {
+ List testSectionsPairs = new ArrayList<>();
+ List testSections = testSectionService.getAllActiveTestSections();
+
+ for (TestSection section : testSections) {
+ testSectionsPairs.add(new IdValuePair(section.getId(), section.getTestSectionName()));
+ }
+
+ return testSectionsPairs;
+ }
+
+ private List createAddressDepartmentList() {
+ List departmentPairs = new ArrayList<>();
+ List departments = dictionaryService.getDictionaryEntrysByCategoryAbbreviation("description",
+ "haitiDepartment", true);
+
+ for (Dictionary dictionary : departments) {
+ departmentPairs.add(new IdValuePair(dictionary.getId(), dictionary.getDictEntry()));
+ }
+
+ return departmentPairs;
+ }
+
+ private List createPatientSearchCriteria() {
+ List searchCriteria = new ArrayList<>();
+
+ // N.B. If the order is to be changed just change the order but keep the
+ // id:value pairing the same
+ searchCriteria.add(new IdValuePair("0", MessageUtil.getMessage("label.select.search.by")));
+ searchCriteria.add(new IdValuePair("2", "1. " + MessageUtil.getMessage("label.select.last.name")));
+ searchCriteria.add(new IdValuePair("1", "2. " + MessageUtil.getMessage("label.select.first.name")));
+ searchCriteria.add(new IdValuePair("3", "3. " + MessageUtil.getMessage("label.select.last.first.name")));
+ searchCriteria.add(new IdValuePair("4", "4. " + MessageUtil.getMessage("label.select.patient.ID")));
+ searchCriteria
+ .add(new IdValuePair("5", "5. " + MessageUtil.getContextualMessage("quick.entry.accession.number")));
+
+ return searchCriteria;
+ }
+
+ private List createConsequencesList() {
+ List consequencesList = new ArrayList<>();
+
+ // N.B. If the order is to be changed just change the order but keep the
+ // id:value pairing the same
+ consequencesList.add(new IdValuePair("0", MessageUtil.getMessage("label.select.one")));
+ consequencesList.add(new IdValuePair("1", MessageUtil.getMessage("label.select.consequences.none")));
+ consequencesList.add(new IdValuePair("2", MessageUtil.getMessage("label.select.consequences.moderate")));
+ consequencesList.add(new IdValuePair("3", MessageUtil.getMessage("label.select.consequences.high")));
+ return consequencesList;
+ }
+
+ private List createRecurrenceList() {
+ List recurrenceList = new ArrayList<>();
+
+ // N.B. If the order is to be changed just change the order but keep the
+ // id:value pairing the same
+ recurrenceList.add(new IdValuePair("0", MessageUtil.getMessage("label.select.one")));
+ recurrenceList.add(new IdValuePair("1", MessageUtil.getMessage("label.select.recurrence.not")));
+ recurrenceList.add(new IdValuePair("2", MessageUtil.getMessage("label.select.recurrence.somewhat")));
+ recurrenceList.add(new IdValuePair("3", MessageUtil.getMessage("label.select.recurrence.highly")));
+ return recurrenceList;
+ }
+
+ private List createTBFollowupLine1List() {
+ List tbFollowupLine1List = new ArrayList<>();
+ tbFollowupLine1List.add(new IdValuePair("M2", MessageUtil.getMessage("dictionary.tb.order.followup") + " M2"));
+ tbFollowupLine1List.add(new IdValuePair("M5", MessageUtil.getMessage("dictionary.tb.order.followup") + " M5"));
+ tbFollowupLine1List.add(new IdValuePair("M6", MessageUtil.getMessage("dictionary.tb.order.followup") + " M6"));
+ return tbFollowupLine1List;
+ }
+
+ private List createTBFollowupLine2List() {
+ List tbFollowupLine2List = new ArrayList<>();
+ for (int i = 0; i <= 24; i++) {
+ tbFollowupLine2List
+ .add(new IdValuePair("M" + i, MessageUtil.getMessage("dictionary.tb.order.followup") + " M" + i));
+ }
+ return tbFollowupLine2List;
+ }
+
+ private List createActionTypeList() {
+ List recurrenceList = new ArrayList<>();
+
+ // N.B. If the order is to be changed just change the order but keep the
+ // id:value pairing the same
+ recurrenceList.add(new IdValuePair("1", MessageUtil.getMessage("label.input.actiontype.corrective")));
+ recurrenceList.add(new IdValuePair("2", MessageUtil.getMessage("label.input.actiontype.preventive")));
+ recurrenceList.add(new IdValuePair("3", MessageUtil.getMessage("label.input.actiontype.concurrent")));
+ return recurrenceList;
+ }
+
+ private List createLaboratoryComponentList() {
+ List recurrenceList = new ArrayList<>();
+
+ // N.B. If the order is to be changed just change the order but keep the
+ // id:value pairing the same
+ recurrenceList.add(
+ new IdValuePair("1", MessageUtil.getMessage("label.select.laboratoryComponent.facilitiesAndSafety")));
+ recurrenceList
+ .add(new IdValuePair("2", MessageUtil.getMessage("label.select.laboratoryComponent.organization")));
+ recurrenceList.add(new IdValuePair("3", MessageUtil.getMessage("label.select.laboratoryComponent.personnel")));
+ recurrenceList.add(new IdValuePair("4", MessageUtil.getMessage("label.select.laboratoryComponent.equipment")));
+ recurrenceList.add(new IdValuePair("5", MessageUtil.getMessage("label.select.laboratoryComponent.purchasing")));
+ recurrenceList.add(new IdValuePair("6", MessageUtil.getMessage("label.select.laboratoryComponent.process")));
+ recurrenceList
+ .add(new IdValuePair("7", MessageUtil.getMessage("label.select.laboratoryComponent.information")));
+ recurrenceList.add(new IdValuePair("8", MessageUtil.getMessage("label.select.laboratoryComponent.documents")));
+ recurrenceList.add(new IdValuePair("9", MessageUtil.getMessage("label.select.laboratoryComponent.assessment")));
+ recurrenceList
+ .add(new IdValuePair("10", MessageUtil.getMessage("label.select.laboratoryComponent.nceManagement")));
+ recurrenceList.add(
+ new IdValuePair("11", MessageUtil.getMessage("label.select.laboratoryComponent.continualImprovement")));
+ return recurrenceList;
+ }
+
+ private List createMethodByNameList() {
+ List methodsPairs = new ArrayList<>();
+ List methods = methodService.getAllActiveMethods();
+ for (Method method : methods) {
+ methodsPairs.add(new IdValuePair(method.getId(), method.getMethodName()));
+ }
+ return methodsPairs;
+ }
+
+ private List createSamplePriorityList() {
+ List priorities = new ArrayList<>();
+ priorities.add(new IdValuePair(OrderPriority.ROUTINE.name(), MessageUtil.getMessage("label.priority.routine")));
+ priorities.add(new IdValuePair(OrderPriority.ASAP.name(), MessageUtil.getMessage("label.priority.asap")));
+ priorities.add(new IdValuePair(OrderPriority.STAT.name(), MessageUtil.getMessage("label.priority.stat")));
+ priorities.add(new IdValuePair(OrderPriority.TIMED.name(), MessageUtil.getMessage("label.priority.timed")));
+ priorities.add(
+ new IdValuePair(OrderPriority.FUTURE_STAT.name(), MessageUtil.getMessage("label.priority.futureStat")));
+ return priorities;
+ }
}
diff --git a/src/main/java/org/openelisglobal/common/util/DateUtil.java b/src/main/java/org/openelisglobal/common/util/DateUtil.java
index 9987a57970..facfb7aa7a 100644
--- a/src/main/java/org/openelisglobal/common/util/DateUtil.java
+++ b/src/main/java/org/openelisglobal/common/util/DateUtil.java
@@ -620,7 +620,7 @@ public static Timestamp convertStringDateStringTimeToTimestamp(String date, Stri
if (!GenericValidator.isBlankOrNull(date) && !GenericValidator.isBlankOrNull(time)) {
date = date + " " + time;
} else if (!GenericValidator.isBlankOrNull(date) && GenericValidator.isBlankOrNull(time)) {
- date = date + " 00:00";
+ date = date + " 09:00";
} else {
return null;
}
diff --git a/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirApiWorkFlowServiceImpl.java b/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirApiWorkFlowServiceImpl.java
index 60806cae28..c636b4a0b8 100644
--- a/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirApiWorkFlowServiceImpl.java
+++ b/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirApiWorkFlowServiceImpl.java
@@ -498,6 +498,9 @@ private Task saveTaskBasedOnRemoteTask(IGenericClient fhirClient, Task remoteTas
referenceString = referenceString + "/";
}
referenceString = referenceString + ResourceType.Task.toString() + "/" + remoteTask.getIdElement().getIdPart();
+ if (referenceString.endsWith("null")) {
+ LogEvent.logWarn(this.getClass().getName(), "saveTaskBasedOnRemoteTask", "remote task has a null identifier: " + remoteTask.getId());
+ }
reference.setReference(referenceString);
taskBasedOnRemoteTask.addBasedOn(reference);
diff --git a/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirPersistanceService.java b/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirPersistanceService.java
index f2ab9026b0..cfced03d4f 100644
--- a/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirPersistanceService.java
+++ b/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirPersistanceService.java
@@ -40,6 +40,8 @@ Bundle createUpdateFhirResourcesInFhirStore(List fhirOperationsL
Optional getTaskBasedOnServiceRequest(String referringId);
+ Optional getServiceRequestByReferingId(String referringId);
+
Optional getTaskBasedOnTask(String taskId);
Bundle createUpdateFhirResourcesInFhirStore(Map createResources,
diff --git a/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirPersistanceServiceImpl.java b/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirPersistanceServiceImpl.java
index 48e13f2458..21aceeb1af 100644
--- a/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirPersistanceServiceImpl.java
+++ b/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirPersistanceServiceImpl.java
@@ -354,6 +354,40 @@ public Optional getTaskBasedOnServiceRequest(String referringId) {
return Optional.empty();
}
+ @Override
+ public Optional getServiceRequestByReferingId(String referringId) {
+ ServiceRequest serviceRequest = null;
+ Bundle bundle = localFhirClient.search()//
+ .forResource(ServiceRequest.class)//
+ .returnBundle(Bundle.class)//
+ .where(ServiceRequest.IDENTIFIER.exactly().identifier(referringId))//
+ .execute();
+ if (bundle.hasEntry()) {
+ serviceRequest = (ServiceRequest) bundle.getEntryFirstRep().getResource();
+ }
+ if (serviceRequest == null) {
+ LogEvent.logDebug(this.getClass().getName(), "", "no service request with identifier " + referringId);
+ for (String remotePath : fhirConfig.getRemoteStorePaths()) {
+
+ bundle = localFhirClient.search()//
+ .forResource(ServiceRequest.class)//
+ .returnBundle(Bundle.class)//
+ .where(ServiceRequest.IDENTIFIER.exactly().systemAndIdentifier(remotePath, referringId))//
+ .execute();
+ if (bundle.hasEntry()) {
+ serviceRequest = (ServiceRequest) bundle.getEntryFirstRep().getResource();
+ }
+ }
+ }
+ if (serviceRequest == null) {
+ LogEvent.logDebug(this.getClass().getName(), "",
+ "no service request with identifier " + referringId + " with configured systems");
+ } else {
+ return Optional.of(serviceRequest);
+ }
+ return Optional.empty();
+ }
+
@Override
public Optional getTaskBasedOnTask(String taskId) {
Bundle bundle = localFhirClient.search()//
diff --git a/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirTransformServiceImpl.java b/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirTransformServiceImpl.java
index ca026ee213..047893f8c7 100644
--- a/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirTransformServiceImpl.java
+++ b/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirTransformServiceImpl.java
@@ -118,72 +118,72 @@
@Service
public class FhirTransformServiceImpl implements FhirTransformService {
- @Autowired
- private FhirConfig fhirConfig;
- @Autowired
- private ElectronicOrderService electronicOrderService;
- @Autowired
- private PatientService patientService;
- @Autowired
- private TypeOfSampleService typeOfSampleService;
- @Autowired
- private SampleService sampleService;
- @Autowired
- private AnalysisService analysisService;
- @Autowired
- private TestService testService;
- @Autowired
- private ResultService resultService;
- @Autowired
- private SampleHumanService sampleHumanService;
- @Autowired
- private FhirPersistanceService fhirPersistanceService;
- @Autowired
- private DictionaryService dictionaryService;
- @Autowired
- private LocalizationService localizationService;
- @Autowired
- private NoteService noteService;
- @Autowired
- private SampleItemService sampleItemService;
- @Autowired
- private ObservationHistoryService observationHistoryService;
- @Autowired
- private IStatusService statusService;
- @Autowired
- private ProviderService providerService;
- @Autowired
- private ReferralSetService referralSetService;
- @Autowired
- private PersonAddressService personAddressService;
- @Autowired
- private AddressPartService addressPartService;
-
- private String ADDRESS_PART_VILLAGE_ID;
- private String ADDRESS_PART_COMMUNE_ID;
- private String ADDRESS_PART_DEPT_ID;
-
- @PostConstruct
- public void initializeGlobalVariables() {
- List partList = addressPartService.getAll();
- for (AddressPart addressPart : partList) {
- if ("department".equals(addressPart.getPartName())) {
- ADDRESS_PART_DEPT_ID = addressPart.getId();
- } else if ("commune".equals(addressPart.getPartName())) {
- ADDRESS_PART_COMMUNE_ID = addressPart.getId();
- } else if ("village".equals(addressPart.getPartName())) {
- ADDRESS_PART_VILLAGE_ID = addressPart.getId();
- }
- }
-
- }
-
- @Transactional
- @Async
- @Override
- public AsyncResult transformPersistPatients(List patientIds) throws FhirLocalPersistingException {
- FhirOperations fhirOperations = new FhirOperations();
- CountingTempIdGenerator tempIdGenerator = new CountingTempIdGenerator();
+ @Autowired
+ private FhirConfig fhirConfig;
+ @Autowired
+ private ElectronicOrderService electronicOrderService;
+ @Autowired
+ private PatientService patientService;
+ @Autowired
+ private TypeOfSampleService typeOfSampleService;
+ @Autowired
+ private SampleService sampleService;
+ @Autowired
+ private AnalysisService analysisService;
+ @Autowired
+ private TestService testService;
+ @Autowired
+ private ResultService resultService;
+ @Autowired
+ private SampleHumanService sampleHumanService;
+ @Autowired
+ private FhirPersistanceService fhirPersistanceService;
+ @Autowired
+ private DictionaryService dictionaryService;
+ @Autowired
+ private LocalizationService localizationService;
+ @Autowired
+ private NoteService noteService;
+ @Autowired
+ private SampleItemService sampleItemService;
+ @Autowired
+ private ObservationHistoryService observationHistoryService;
+ @Autowired
+ private IStatusService statusService;
+ @Autowired
+ private ProviderService providerService;
+ @Autowired
+ private ReferralSetService referralSetService;
+ @Autowired
+ private PersonAddressService personAddressService;
+ @Autowired
+ private AddressPartService addressPartService;
+
+ private String ADDRESS_PART_VILLAGE_ID;
+ private String ADDRESS_PART_COMMUNE_ID;
+ private String ADDRESS_PART_DEPT_ID;
+
+ @PostConstruct
+ public void initializeGlobalVariables() {
+ List partList = addressPartService.getAll();
+ for (AddressPart addressPart : partList) {
+ if ("department".equals(addressPart.getPartName())) {
+ ADDRESS_PART_DEPT_ID = addressPart.getId();
+ } else if ("commune".equals(addressPart.getPartName())) {
+ ADDRESS_PART_COMMUNE_ID = addressPart.getId();
+ } else if ("village".equals(addressPart.getPartName())) {
+ ADDRESS_PART_VILLAGE_ID = addressPart.getId();
+ }
+ }
+
+ }
+
+ @Transactional
+ @Async
+ @Override
+ public AsyncResult transformPersistPatients(List patientIds) throws FhirLocalPersistingException {
+ FhirOperations fhirOperations = new FhirOperations();
+ CountingTempIdGenerator tempIdGenerator = new CountingTempIdGenerator();
Map fhirPatients = new HashMap<>();
for (String patientId : patientIds) {
@@ -193,27 +193,28 @@ public AsyncResult transformPersistPatients(List patientIds) thr
}
org.hl7.fhir.r4.model.Patient fhirPatient = this.transformToFhirPatient(patient);
if (fhirPatients.containsKey(fhirPatient.getIdElement().getIdPart())) {
- LogEvent.logWarn(this.getClass().getSimpleName(), "transformPersistPatients", "patient collision with id: " + fhirPatient.getIdElement().getIdPart());
+ LogEvent.logWarn(this.getClass().getSimpleName(), "transformPersistPatients",
+ "patient collision with id: " + fhirPatient.getIdElement().getIdPart());
}
fhirPatients.put(fhirPatient.getIdElement().getIdPart(), fhirPatient);
- }
+ }
- for (org.hl7.fhir.r4.model.Patient fhirPatient : fhirPatients.values()) {
- this.addToOperations(fhirOperations, tempIdGenerator, fhirPatient);
- }
+ for (org.hl7.fhir.r4.model.Patient fhirPatient : fhirPatients.values()) {
+ this.addToOperations(fhirOperations, tempIdGenerator, fhirPatient);
+ }
- Bundle responseBundle = fhirPersistanceService.createUpdateFhirResourcesInFhirStore(fhirOperations);
- return new AsyncResult<>(responseBundle);
- }
+ Bundle responseBundle = fhirPersistanceService.createUpdateFhirResourcesInFhirStore(fhirOperations);
+ return new AsyncResult<>(responseBundle);
+ }
- @Transactional
- @Async
- @Override
- public AsyncResult transformPersistObjectsUnderSamples(List sampleIds)
- throws FhirLocalPersistingException {
- FhirOperations fhirOperations = new FhirOperations();
- CountingTempIdGenerator tempIdGenerator = new CountingTempIdGenerator();
+ @Transactional
+ @Async
+ @Override
+ public AsyncResult transformPersistObjectsUnderSamples(List sampleIds)
+ throws FhirLocalPersistingException {
+ FhirOperations fhirOperations = new FhirOperations();
+ CountingTempIdGenerator tempIdGenerator = new CountingTempIdGenerator();
Map tasks = new HashMap<>();
Map fhirPatients = new HashMap<>();
@@ -232,26 +233,26 @@ public AsyncResult transformPersistObjectsUnderSamples(List samp
List analysises = analysisService.getAnalysesBySampleId(sampleId);
List results = resultService.getResultsForSample(sample);
- if (sample.getFhirUuid() == null) {
- sample.setFhirUuid(UUID.randomUUID());
- }
- if (patient.getFhirUuid() == null) {
- patient.setFhirUuid(UUID.randomUUID());
- }
- if (provider.getFhirUuid() == null) {
- provider.setFhirUuid(UUID.randomUUID());
- }
- sampleItems.stream().forEach((e) -> {
- if (e.getFhirUuid() == null) {
- e.setFhirUuid(UUID.randomUUID());
- }
- });
-
- analysises.stream().forEach((e) -> {
- if (e.getFhirUuid() == null) {
- e.setFhirUuid(UUID.randomUUID());
- }
- });
+ if (sample.getFhirUuid() == null) {
+ sample.setFhirUuid(UUID.randomUUID());
+ }
+ if (patient.getFhirUuid() == null) {
+ patient.setFhirUuid(UUID.randomUUID());
+ }
+ if (provider.getFhirUuid() == null) {
+ provider.setFhirUuid(UUID.randomUUID());
+ }
+ sampleItems.stream().forEach((e) -> {
+ if (e.getFhirUuid() == null) {
+ e.setFhirUuid(UUID.randomUUID());
+ }
+ });
+
+ analysises.stream().forEach((e) -> {
+ if (e.getFhirUuid() == null) {
+ e.setFhirUuid(UUID.randomUUID());
+ }
+ });
results.stream().forEach((e) -> {
if (e.getFhirUuid() == null) {
@@ -260,7 +261,8 @@ public AsyncResult transformPersistObjectsUnderSamples(List samp
});
Task task = this.transformToTask(sample);
if (tasks.containsKey(task.getIdElement().getIdPart())) {
- LogEvent.logWarn(this.getClass().getSimpleName(), "transformPersistObjectsUnderSamples", "task collision with id: " + task.getIdElement().getIdPart());
+ LogEvent.logWarn(this.getClass().getSimpleName(), "transformPersistObjectsUnderSamples",
+ "task collision with id: " + task.getIdElement().getIdPart());
}
tasks.put(task.getIdElement().getIdPart(), task);
@@ -275,20 +277,23 @@ public AsyncResult transformPersistObjectsUnderSamples(List samp
org.hl7.fhir.r4.model.Patient fhirPatient = this.transformToFhirPatient(patient);
if (fhirPatients.containsKey(fhirPatient.getIdElement().getIdPart())) {
- LogEvent.logWarn(this.getClass().getSimpleName(), "transformPersistObjectsUnderSamples", "patient collision with id: " + fhirPatient.getIdElement().getIdPart());
+ LogEvent.logWarn(this.getClass().getSimpleName(), "transformPersistObjectsUnderSamples",
+ "patient collision with id: " + fhirPatient.getIdElement().getIdPart());
}
fhirPatients.put(fhirPatient.getIdElement().getIdPart(), fhirPatient);
Practitioner requester = transformProviderToPractitioner(provider);
if (requesters.containsKey(requester.getIdElement().getIdPart())) {
- LogEvent.logWarn(this.getClass().getSimpleName(), "transformPersistObjectsUnderSamples", "practitioner collision with id: " + fhirPatient.getIdElement().getIdPart());
+ LogEvent.logWarn(this.getClass().getSimpleName(), "transformPersistObjectsUnderSamples",
+ "practitioner collision with id: " + fhirPatient.getIdElement().getIdPart());
}
requesters.put(requester.getIdElement().getIdPart(), requester);
for (SampleItem sampleItem : sampleItems) {
Specimen specimen = this.transformToSpecimen(sampleItem);
if (specimens.containsKey(specimen.getIdElement().getIdPart())) {
- LogEvent.logWarn(this.getClass().getSimpleName(), "transformPersistObjectsUnderSamples", "specimen collision with id: " + specimen.getIdElement().getIdPart());
+ LogEvent.logWarn(this.getClass().getSimpleName(), "transformPersistObjectsUnderSamples",
+ "specimen collision with id: " + specimen.getIdElement().getIdPart());
}
specimens.put(specimen.getIdElement().getIdPart(), specimen);
}
@@ -318,43 +323,43 @@ public AsyncResult transformPersistObjectsUnderSamples(List samp
}
}
- for (Task task : tasks.values()) {
- this.addToOperations(fhirOperations, tempIdGenerator, task);
- }
- for (org.hl7.fhir.r4.model.Patient fhirPatient : fhirPatients.values()) {
- this.addToOperations(fhirOperations, tempIdGenerator, fhirPatient);
- }
- for (Specimen specimen : specimens.values()) {
- this.addToOperations(fhirOperations, tempIdGenerator, specimen);
- }
- for (ServiceRequest serviceRequest : serviceRequests.values()) {
- this.addToOperations(fhirOperations, tempIdGenerator, serviceRequest);
- }
- for (Observation observation : observations.values()) {
- this.addToOperations(fhirOperations, tempIdGenerator, observation);
- }
- for (DiagnosticReport diagnosticReport : diagnosticReports.values()) {
- this.addToOperations(fhirOperations, tempIdGenerator, diagnosticReport);
- }
-
- for (Practitioner requester : requesters.values()) {
- this.addToOperations(fhirOperations, tempIdGenerator, requester);
- }
-
- Bundle responseBundle = fhirPersistanceService.createUpdateFhirResourcesInFhirStore(fhirOperations);
- return new AsyncResult<>(responseBundle);
- }
-
- @Override
- @Async
- @Transactional(readOnly = true)
- public void transformPersistPatient(PatientManagementInfo patientInfo) throws FhirLocalPersistingException {
- CountingTempIdGenerator tempIdGenerator = new CountingTempIdGenerator();
- FhirOperations fhirOperations = new FhirOperations();
- org.hl7.fhir.r4.model.Patient patient = transformToFhirPatient(patientInfo.getPatientPK());
- this.addToOperations(fhirOperations, tempIdGenerator, patient);
- Bundle responseBundle = fhirPersistanceService.createUpdateFhirResourcesInFhirStore(fhirOperations);
- }
+ for (Task task : tasks.values()) {
+ this.addToOperations(fhirOperations, tempIdGenerator, task);
+ }
+ for (org.hl7.fhir.r4.model.Patient fhirPatient : fhirPatients.values()) {
+ this.addToOperations(fhirOperations, tempIdGenerator, fhirPatient);
+ }
+ for (Specimen specimen : specimens.values()) {
+ this.addToOperations(fhirOperations, tempIdGenerator, specimen);
+ }
+ for (ServiceRequest serviceRequest : serviceRequests.values()) {
+ this.addToOperations(fhirOperations, tempIdGenerator, serviceRequest);
+ }
+ for (Observation observation : observations.values()) {
+ this.addToOperations(fhirOperations, tempIdGenerator, observation);
+ }
+ for (DiagnosticReport diagnosticReport : diagnosticReports.values()) {
+ this.addToOperations(fhirOperations, tempIdGenerator, diagnosticReport);
+ }
+
+ for (Practitioner requester : requesters.values()) {
+ this.addToOperations(fhirOperations, tempIdGenerator, requester);
+ }
+
+ Bundle responseBundle = fhirPersistanceService.createUpdateFhirResourcesInFhirStore(fhirOperations);
+ return new AsyncResult<>(responseBundle);
+ }
+
+ @Override
+ @Async
+ @Transactional(readOnly = true)
+ public void transformPersistPatient(PatientManagementInfo patientInfo) throws FhirLocalPersistingException {
+ CountingTempIdGenerator tempIdGenerator = new CountingTempIdGenerator();
+ FhirOperations fhirOperations = new FhirOperations();
+ org.hl7.fhir.r4.model.Patient patient = transformToFhirPatient(patientInfo.getPatientPK());
+ this.addToOperations(fhirOperations, tempIdGenerator, patient);
+ Bundle responseBundle = fhirPersistanceService.createUpdateFhirResourcesInFhirStore(fhirOperations);
+ }
@Override
@Async
@@ -367,47 +372,53 @@ public void transformPersistOrderEntryFhirObjects(SamplePatientUpdateData update
CountingTempIdGenerator tempIdGenerator = new CountingTempIdGenerator();
FhirOperations fhirOperations = new FhirOperations();
- FhirOrderEntryObjects orderEntryObjects = new FhirOrderEntryObjects();
- // TODO should we create a task per service request that is part of this task so
- // we can have the ServiceRequest as the focus in those tasks?
- // task for entering the order
- Task task = transformToTask(updateData.getSample().getId());
- this.addToOperations(fhirOperations, tempIdGenerator, task);
-
- Optional referringTask = getReferringTaskForSample(updateData.getSample());
- if (referringTask.isPresent()) {
- updateReferringTaskWithTaskInfo(referringTask.get(), task);
- this.addToOperations(fhirOperations, tempIdGenerator, referringTask.get());
- }
-
- // patient
- org.hl7.fhir.r4.model.Patient patient = transformToFhirPatient(patientInfo.getPatientPK());
- this.addToOperations(fhirOperations, tempIdGenerator, patient);
- orderEntryObjects.patient = patient;
-
- // requester
- Practitioner requester = transformProviderToPractitioner(updateData.getProvider().getId());
- this.addToOperations(fhirOperations, tempIdGenerator, requester);
- orderEntryObjects.requester = requester;
-
- // Specimens and service requests
- for (SampleTestCollection sampleTest : updateData.getSampleItemsTests()) {
- FhirSampleEntryObjects fhirSampleEntryObjects = new FhirSampleEntryObjects();
- fhirSampleEntryObjects.specimen = transformToFhirSpecimen(sampleTest);
-
- // TODO collector
+ FhirOrderEntryObjects orderEntryObjects = new FhirOrderEntryObjects();
+ // TODO should we create a task per service request that is part of this task so
+ // we can have the ServiceRequest as the focus in those tasks?
+ // task for entering the order
+ Task task = transformToTask(updateData.getSample().getId());
+ this.addToOperations(fhirOperations, tempIdGenerator, task);
+
+ Optional referringTask = getReferringTaskForSample(updateData.getSample());
+ if (referringTask.isPresent()) {
+ updateReferringTaskWithTaskInfo(referringTask.get(), task);
+ this.addToOperations(fhirOperations, tempIdGenerator, referringTask.get());
+ }
+
+ Optional referingServiceRequest = getReferringServiceRequestForSample(updateData.getSample());
+ if (referingServiceRequest.isPresent()) {
+ updateReferringServiceRequestWithSampleInfo(updateData.getSample(), referingServiceRequest.get());
+ this.addToOperations(fhirOperations, tempIdGenerator, referingServiceRequest.get());
+ }
+
+ // patient
+ org.hl7.fhir.r4.model.Patient patient = transformToFhirPatient(patientInfo.getPatientPK());
+ this.addToOperations(fhirOperations, tempIdGenerator, patient);
+ orderEntryObjects.patient = patient;
+
+ // requester
+ Practitioner requester = transformProviderToPractitioner(updateData.getProvider().getId());
+ this.addToOperations(fhirOperations, tempIdGenerator, requester);
+ orderEntryObjects.requester = requester;
+
+ // Specimens and service requests
+ for (SampleTestCollection sampleTest : updateData.getSampleItemsTests()) {
+ FhirSampleEntryObjects fhirSampleEntryObjects = new FhirSampleEntryObjects();
+ fhirSampleEntryObjects.specimen = transformToFhirSpecimen(sampleTest);
+
+ // TODO collector
// fhirSampleEntryObjects.collector = transformCollectorToPractitioner(sampleTest.item.getCollector());
- fhirSampleEntryObjects.serviceRequests = transformToServiceRequests(updateData, sampleTest);
+ fhirSampleEntryObjects.serviceRequests = transformToServiceRequests(updateData, sampleTest);
- this.addToOperations(fhirOperations, tempIdGenerator, fhirSampleEntryObjects.specimen);
+ this.addToOperations(fhirOperations, tempIdGenerator, fhirSampleEntryObjects.specimen);
// this.addToOperations(fhirOperations, tempIdGenerator, fhirSampleEntryObjects.collector);
- for (ServiceRequest serviceRequest : fhirSampleEntryObjects.serviceRequests) {
- this.addToOperations(fhirOperations, tempIdGenerator, serviceRequest);
- }
+ for (ServiceRequest serviceRequest : fhirSampleEntryObjects.serviceRequests) {
+ this.addToOperations(fhirOperations, tempIdGenerator, serviceRequest);
+ }
- orderEntryObjects.sampleEntryObjectsList.add(fhirSampleEntryObjects);
- }
+ orderEntryObjects.sampleEntryObjectsList.add(fhirSampleEntryObjects);
+ }
if (updateData.getProgramQuestionnaireResponse() != null) {
updateData.getProgramQuestionnaireResponse()
@@ -418,578 +429,591 @@ public void transformPersistOrderEntryFhirObjects(SamplePatientUpdateData update
// TODO location?
// TODO create encounter?
- Bundle responseBundle = fhirPersistanceService.createUpdateFhirResourcesInFhirStore(fhirOperations);
-
- if (useReferral) {
- referralSetService.createSaveReferralSetsSamplePatientEntry(referralItems, updateData);
- }
- }
-
- private void updateReferringTaskWithTaskInfo(Task referringTask, Task task) {
- if (TaskStatus.COMPLETED.equals(task.getStatus())) {
- referringTask.setStatus(TaskStatus.COMPLETED);
- task.getOutput().forEach(outPut -> {
- referringTask.addOutput(outPut);
- });
- }
- }
-
- private Optional getReferringTaskForSample(Sample sample) {
- List eOrders = electronicOrderService.getElectronicOrdersByExternalId(sample.getReferringId());
- if (eOrders.size() > 0 && ElectronicOrderType.FHIR.equals(eOrders.get(0).getType())) {
- return fhirPersistanceService.getTaskBasedOnServiceRequest(sample.getReferringId());
- }
- return Optional.empty();
- }
-
- private Practitioner transformProviderToPractitioner(String providerId) {
- return transformProviderToPractitioner(providerService.get(providerId));
- }
-
- @Override
- public Practitioner transformProviderToPractitioner(Provider provider) {
- Practitioner practitioner = new Practitioner();
- practitioner.setId(provider.getFhirUuidAsString());
- practitioner.addIdentifier(
- this.createIdentifier(fhirConfig.getOeFhirSystem() + "/provider_uuid", provider.getFhirUuidAsString()));
- practitioner.addName(new HumanName().setFamily(provider.getPerson().getLastName())
- .addGiven(provider.getPerson().getFirstName()));
- practitioner.setTelecom(transformToTelecom(provider.getPerson()));
- practitioner.setActive(provider.getActive());
-
- return practitioner;
- }
-
- private List transformToTelecom(Person person) {
- List contactPoints = new ArrayList<>();
- contactPoints.add(new ContactPoint().setSystem(ContactPointSystem.PHONE).setValue(person.getPrimaryPhone()));
- contactPoints.add(new ContactPoint().setSystem(ContactPointSystem.EMAIL).setValue(person.getEmail()));
- contactPoints.add(new ContactPoint().setSystem(ContactPointSystem.FAX).setValue(person.getFax()));
- return contactPoints;
- }
-
- private Task transformToTask(String sampleId) {
- return this.transformToTask(sampleService.get(sampleId));
- }
-
- private Task transformToTask(Sample sample) {
- Task task = new Task();
- Patient patient = sampleHumanService.getPatientForSample(sample);
- List analysises = sampleService.getAnalysis(sample);
- task.setId(sample.getFhirUuidAsString());
- Optional referredTask = getReferringTaskForSample(sample);
- if (referredTask.isPresent()) {
- task.addPartOf(this.createReferenceFor(referredTask.get()));
- task.setIntent(TaskIntent.ORDER);
- } else {
- task.setIntent(TaskIntent.ORIGINALORDER);
- }
- if (sample.getStatusId().equals(statusService.getStatusID(OrderStatus.Entered))) {
- task.setStatus(TaskStatus.READY);
- } else if (sample.getStatusId().equals(statusService.getStatusID(OrderStatus.Started))) {
- task.setStatus(TaskStatus.INPROGRESS);
- } else if (sample.getStatusId().equals(statusService.getStatusID(OrderStatus.Finished))) {
- task.setStatus(TaskStatus.COMPLETED);
- } else {
- task.setStatus(TaskStatus.NULL);
- }
- task.setAuthoredOn(sample.getEnteredDate());
- task.setPriority(TaskPriority.ROUTINE);
- task.addIdentifier(
- this.createIdentifier(fhirConfig.getOeFhirSystem() + "/order_uuid", sample.getFhirUuidAsString()));
- task.addIdentifier(this.createIdentifier(fhirConfig.getOeFhirSystem() + "/order_accessionNumber",
- sample.getAccessionNumber()));
-
- for (Analysis analysis : analysises) {
- task.addBasedOn(this.createReferenceFor(ResourceType.ServiceRequest, analysis.getFhirUuidAsString()));
- if (sample.getStatusId().equals(statusService.getStatusID(OrderStatus.Finished))) {
- task.addOutput()//
- .setType(new CodeableConcept().addCoding(new Coding().setCode("reference")))//
- .setValue(
- this.createReferenceFor(ResourceType.DiagnosticReport, analysis.getFhirUuidAsString()));
- }
-
- }
- task.setFor(this.createReferenceFor(ResourceType.Patient, patient.getFhirUuidAsString()));
-
- return task;
- }
-
- private DateType transformToDateElement(String strDate) throws ParseException {
- boolean dayAmbiguous = false;
- boolean monthAmbiguous = false;
- // TODO look at this logic for detecting ambiguity
- if (strDate.contains(DateUtil.AMBIGUOUS_DATE_SEGMENT)) {
- strDate = strDate.replaceFirst(DateUtil.AMBIGUOUS_DATE_SEGMENT, "01");
- dayAmbiguous = true;
- }
- if (strDate.contains(DateUtil.AMBIGUOUS_DATE_SEGMENT)) {
- strDate = strDate.replaceFirst(DateUtil.AMBIGUOUS_DATE_SEGMENT, "01");
- monthAmbiguous = true;
- }
- Date birthDate = new SimpleDateFormat("dd/MM/yyyy").parse(strDate);
- DateType dateType = new DateType();
- if (monthAmbiguous) {
- dateType.setValue(birthDate, TemporalPrecisionEnum.YEAR);
- } else if (dayAmbiguous) {
- dateType.setValue(birthDate, TemporalPrecisionEnum.MONTH);
- } else {
- dateType.setValue(birthDate, TemporalPrecisionEnum.DAY);
- }
- return dateType;
- }
-
- @Override
- public org.hl7.fhir.r4.model.Patient transformToFhirPatient(String patientId) {
- return transformToFhirPatient(patientService.get(patientId));
- }
-
- private org.hl7.fhir.r4.model.Patient transformToFhirPatient(Patient patient) {
- org.hl7.fhir.r4.model.Patient fhirPatient = new org.hl7.fhir.r4.model.Patient();
- String subjectNumber = patientService.getSubjectNumber(patient);
- String nationalId = patientService.getNationalId(patient);
- String guid = patientService.getGUID(patient);
- String stNumber = patientService.getSTNumber(patient);
- String uuid = patient.getFhirUuidAsString();
-
- fhirPatient.setId(uuid);
- fhirPatient.setIdentifier(createPatientIdentifiers(subjectNumber, nationalId, stNumber, guid, uuid));
-
- HumanName humanName = new HumanName();
- List humanNameList = new ArrayList<>();
- humanName.setFamily(patient.getPerson().getLastName());
- humanName.addGiven(patient.getPerson().getFirstName());
- humanNameList.add(humanName);
- fhirPatient.setName(humanNameList);
-
- try {
- if (patient.getBirthDateForDisplay() != null) {
- fhirPatient.setBirthDateElement(transformToDateElement(patient.getBirthDateForDisplay()));
- }
- } catch (ParseException e) {
- LogEvent.logError("patient date unparseable", e);
- }
- if (GenericValidator.isBlankOrNull(patient.getGender())) {
- fhirPatient.setGender(AdministrativeGender.UNKNOWN);
- } else if (patient.getGender().equalsIgnoreCase("M")) {
- fhirPatient.setGender(AdministrativeGender.MALE);
- } else {
- fhirPatient.setGender(AdministrativeGender.FEMALE);
- }
- fhirPatient.setTelecom(transformToTelecom(patient.getPerson()));
-
- fhirPatient.addAddress(transformToAddress(patient.getPerson()));
-
- return fhirPatient;
- }
-
- private Address transformToAddress(Person person) {
- @SuppressWarnings("unused")
- PersonAddress village = null;
- PersonAddress commune = null;
- @SuppressWarnings("unused")
- PersonAddress dept = null;
- List personAddressList = personAddressService.getAddressPartsByPersonId(person.getId());
-
- for (PersonAddress address : personAddressList) {
- if (address.getAddressPartId().equals(ADDRESS_PART_COMMUNE_ID)) {
- commune = address;
- } else if (address.getAddressPartId().equals(ADDRESS_PART_VILLAGE_ID)) {
- village = address;
- } else if (address.getAddressPartId().equals(ADDRESS_PART_DEPT_ID)) {
- dept = address;
- }
- }
- Address address = new Address()//
- .addLine(person.getStreetAddress())//
- .setCity(person.getCity())//
+ Bundle responseBundle = fhirPersistanceService.createUpdateFhirResourcesInFhirStore(fhirOperations);
+
+ if (useReferral) {
+ referralSetService.createSaveReferralSetsSamplePatientEntry(referralItems, updateData);
+ }
+ }
+
+ private void updateReferringTaskWithTaskInfo(Task referringTask, Task task) {
+ if (TaskStatus.COMPLETED.equals(task.getStatus())) {
+ referringTask.setStatus(TaskStatus.COMPLETED);
+ task.getOutput().forEach(outPut -> {
+ referringTask.addOutput(outPut);
+ });
+ }
+ }
+
+ private void updateReferringServiceRequestWithSampleInfo(Sample sample, ServiceRequest serviceRequest) {
+ serviceRequest.setRequisition(
+ this.createIdentifier(fhirConfig.getOeFhirSystem() + "/samp_labNo", sample.getAccessionNumber()));
+ }
+
+ private Optional getReferringTaskForSample(Sample sample) {
+ List eOrders = electronicOrderService.getElectronicOrdersByExternalId(sample.getReferringId());
+ if (eOrders.size() > 0 && ElectronicOrderType.FHIR.equals(eOrders.get(0).getType())) {
+ return fhirPersistanceService.getTaskBasedOnServiceRequest(sample.getReferringId());
+ }
+ return Optional.empty();
+ }
+
+ private Optional getReferringServiceRequestForSample(Sample sample) {
+ List eOrders = electronicOrderService.getElectronicOrdersByExternalId(sample.getReferringId());
+ if (eOrders.size() > 0 && ElectronicOrderType.FHIR.equals(eOrders.get(0).getType())) {
+ return fhirPersistanceService.getServiceRequestByReferingId(sample.getReferringId());
+ }
+ return Optional.empty();
+ }
+
+ private Practitioner transformProviderToPractitioner(String providerId) {
+ return transformProviderToPractitioner(providerService.get(providerId));
+ }
+
+ @Override
+ public Practitioner transformProviderToPractitioner(Provider provider) {
+ Practitioner practitioner = new Practitioner();
+ practitioner.setId(provider.getFhirUuidAsString());
+ practitioner.addIdentifier(
+ this.createIdentifier(fhirConfig.getOeFhirSystem() + "/provider_uuid", provider.getFhirUuidAsString()));
+ practitioner.addName(new HumanName().setFamily(provider.getPerson().getLastName())
+ .addGiven(provider.getPerson().getFirstName()));
+ practitioner.setTelecom(transformToTelecom(provider.getPerson()));
+ practitioner.setActive(provider.getActive());
+
+ return practitioner;
+ }
+
+ private List transformToTelecom(Person person) {
+ List contactPoints = new ArrayList<>();
+ contactPoints.add(new ContactPoint().setSystem(ContactPointSystem.PHONE).setValue(person.getPrimaryPhone()));
+ contactPoints.add(new ContactPoint().setSystem(ContactPointSystem.EMAIL).setValue(person.getEmail()));
+ contactPoints.add(new ContactPoint().setSystem(ContactPointSystem.FAX).setValue(person.getFax()));
+ return contactPoints;
+ }
+
+ private Task transformToTask(String sampleId) {
+ return this.transformToTask(sampleService.get(sampleId));
+ }
+
+ private Task transformToTask(Sample sample) {
+ Task task = new Task();
+ Patient patient = sampleHumanService.getPatientForSample(sample);
+ List analysises = sampleService.getAnalysis(sample);
+ task.setId(sample.getFhirUuidAsString());
+ Optional referredTask = getReferringTaskForSample(sample);
+ if (referredTask.isPresent()) {
+ task.addPartOf(this.createReferenceFor(referredTask.get()));
+ task.setIntent(TaskIntent.ORDER);
+ } else {
+ task.setIntent(TaskIntent.ORIGINALORDER);
+ }
+ if (sample.getStatusId().equals(statusService.getStatusID(OrderStatus.Entered))) {
+ task.setStatus(TaskStatus.READY);
+ } else if (sample.getStatusId().equals(statusService.getStatusID(OrderStatus.Started))) {
+ task.setStatus(TaskStatus.INPROGRESS);
+ } else if (sample.getStatusId().equals(statusService.getStatusID(OrderStatus.Finished))) {
+ task.setStatus(TaskStatus.COMPLETED);
+ } else {
+ task.setStatus(TaskStatus.NULL);
+ }
+ task.setAuthoredOn(sample.getEnteredDate());
+ task.setPriority(TaskPriority.ROUTINE);
+ task.addIdentifier(
+ this.createIdentifier(fhirConfig.getOeFhirSystem() + "/order_uuid", sample.getFhirUuidAsString()));
+ task.addIdentifier(this.createIdentifier(fhirConfig.getOeFhirSystem() + "/order_accessionNumber",
+ sample.getAccessionNumber()));
+
+ for (Analysis analysis : analysises) {
+ task.addBasedOn(this.createReferenceFor(ResourceType.ServiceRequest, analysis.getFhirUuidAsString()));
+ if (sample.getStatusId().equals(statusService.getStatusID(OrderStatus.Finished))) {
+ task.addOutput()//
+ .setType(new CodeableConcept().addCoding(new Coding().setCode("reference")))//
+ .setValue(
+ this.createReferenceFor(ResourceType.DiagnosticReport, analysis.getFhirUuidAsString()));
+ }
+
+ }
+ task.setFor(this.createReferenceFor(ResourceType.Patient, patient.getFhirUuidAsString()));
+
+ return task;
+ }
+
+ private DateType transformToDateElement(String strDate) throws ParseException {
+ boolean dayAmbiguous = false;
+ boolean monthAmbiguous = false;
+ // TODO look at this logic for detecting ambiguity
+ if (strDate.contains(DateUtil.AMBIGUOUS_DATE_SEGMENT)) {
+ strDate = strDate.replaceFirst(DateUtil.AMBIGUOUS_DATE_SEGMENT, "01");
+ dayAmbiguous = true;
+ }
+ if (strDate.contains(DateUtil.AMBIGUOUS_DATE_SEGMENT)) {
+ strDate = strDate.replaceFirst(DateUtil.AMBIGUOUS_DATE_SEGMENT, "01");
+ monthAmbiguous = true;
+ }
+ Date birthDate = new SimpleDateFormat("dd/MM/yyyy").parse(strDate);
+ DateType dateType = new DateType();
+ if (monthAmbiguous) {
+ dateType.setValue(birthDate, TemporalPrecisionEnum.YEAR);
+ } else if (dayAmbiguous) {
+ dateType.setValue(birthDate, TemporalPrecisionEnum.MONTH);
+ } else {
+ dateType.setValue(birthDate, TemporalPrecisionEnum.DAY);
+ }
+ return dateType;
+ }
+
+ @Override
+ public org.hl7.fhir.r4.model.Patient transformToFhirPatient(String patientId) {
+ return transformToFhirPatient(patientService.get(patientId));
+ }
+
+ private org.hl7.fhir.r4.model.Patient transformToFhirPatient(Patient patient) {
+ org.hl7.fhir.r4.model.Patient fhirPatient = new org.hl7.fhir.r4.model.Patient();
+ String subjectNumber = patientService.getSubjectNumber(patient);
+ String nationalId = patientService.getNationalId(patient);
+ String guid = patientService.getGUID(patient);
+ String stNumber = patientService.getSTNumber(patient);
+ String uuid = patient.getFhirUuidAsString();
+
+ fhirPatient.setId(uuid);
+ fhirPatient.setIdentifier(createPatientIdentifiers(subjectNumber, nationalId, stNumber, guid, uuid));
+
+ HumanName humanName = new HumanName();
+ List humanNameList = new ArrayList<>();
+ humanName.setFamily(patient.getPerson().getLastName());
+ humanName.addGiven(patient.getPerson().getFirstName());
+ humanNameList.add(humanName);
+ fhirPatient.setName(humanNameList);
+
+ try {
+ if (patient.getBirthDateForDisplay() != null) {
+ fhirPatient.setBirthDateElement(transformToDateElement(patient.getBirthDateForDisplay()));
+ }
+ } catch (ParseException e) {
+ LogEvent.logError("patient date unparseable", e);
+ }
+ if (GenericValidator.isBlankOrNull(patient.getGender())) {
+ fhirPatient.setGender(AdministrativeGender.UNKNOWN);
+ } else if (patient.getGender().equalsIgnoreCase("M")) {
+ fhirPatient.setGender(AdministrativeGender.MALE);
+ } else {
+ fhirPatient.setGender(AdministrativeGender.FEMALE);
+ }
+ fhirPatient.setTelecom(transformToTelecom(patient.getPerson()));
+
+ fhirPatient.addAddress(transformToAddress(patient.getPerson()));
+
+ return fhirPatient;
+ }
+
+ private Address transformToAddress(Person person) {
+ @SuppressWarnings("unused")
+ PersonAddress village = null;
+ PersonAddress commune = null;
+ @SuppressWarnings("unused")
+ PersonAddress dept = null;
+ List personAddressList = personAddressService.getAddressPartsByPersonId(person.getId());
+
+ for (PersonAddress address : personAddressList) {
+ if (address.getAddressPartId().equals(ADDRESS_PART_COMMUNE_ID)) {
+ commune = address;
+ } else if (address.getAddressPartId().equals(ADDRESS_PART_VILLAGE_ID)) {
+ village = address;
+ } else if (address.getAddressPartId().equals(ADDRESS_PART_DEPT_ID)) {
+ dept = address;
+ }
+ }
+ Address address = new Address()//
+ .addLine(person.getStreetAddress())//
+ .setCity(person.getCity())//
// .setDistrict(value)
- .setState(person.getState())//
+ .setState(person.getState())//
// .setPostalCode(value)
- .setCountry(person.getCountry())//
- ;
- if (commune != null) {
- address.addLine("commune: " + commune.getValue());
- }
- return address;
- }
-
- private List createPatientIdentifiers(String subjectNumber, String nationalId, String stNumber,
- String guid, String fhirUuid) {
- List identifierList = new ArrayList<>();
- if (!GenericValidator.isBlankOrNull(subjectNumber)) {
- identifierList.add(createIdentifier(fhirConfig.getOeFhirSystem() + "/pat_subjectNumber", subjectNumber));
- }
- if (!GenericValidator.isBlankOrNull(nationalId)) {
- identifierList.add(createIdentifier(fhirConfig.getOeFhirSystem() + "/pat_nationalId", nationalId));
- }
- if (!GenericValidator.isBlankOrNull(stNumber)) {
- identifierList.add(createIdentifier(fhirConfig.getOeFhirSystem() + "/pat_stNumber", stNumber));
- }
- if (!GenericValidator.isBlankOrNull(guid)) {
- identifierList.add(createIdentifier(fhirConfig.getOeFhirSystem() + "/pat_guid", guid));
- }
- if (!GenericValidator.isBlankOrNull(fhirUuid)) {
- identifierList.add(createIdentifier(fhirConfig.getOeFhirSystem() + "/pat_uuid", fhirUuid));
- }
- return identifierList;
- }
-
- private List transformToServiceRequests(SamplePatientUpdateData updateData,
- SampleTestCollection sampleTestCollection) {
- List serviceRequestsForSampleItem = new ArrayList<>();
-
- for (Analysis analysis : sampleTestCollection.analysises) {
- serviceRequestsForSampleItem.add(this.transformToServiceRequest(analysis.getId()));
- }
- return serviceRequestsForSampleItem;
- }
-
- private ServiceRequest transformToServiceRequest(String anlaysisId) {
- return transformToServiceRequest(analysisService.get(anlaysisId));
- }
-
- private ServiceRequest transformToServiceRequest(Analysis analysis) {
- Sample sample = analysis.getSampleItem().getSample();
- Patient patient = sampleHumanService.getPatientForSample(sample);
- Provider provider = sampleHumanService.getProviderForSample(sample);
-
- Organization organization = sampleService.getOrganizationRequester(sample,
- TableIdService.getInstance().REFERRING_ORG_TYPE_ID);
- Organization organizationDepartment = sampleService.getOrganizationRequester(sample,
- TableIdService.getInstance().REFERRING_ORG_DEPARTMENT_TYPE_ID);
-
- Test test = analysis.getTest();
- ServiceRequest serviceRequest = new ServiceRequest();
- serviceRequest.setId(analysis.getFhirUuidAsString());
- serviceRequest.addIdentifier(
- this.createIdentifier(fhirConfig.getOeFhirSystem() + "/analysis_uuid", analysis.getFhirUuidAsString()));
- serviceRequest.setRequisition(this.createIdentifier(fhirConfig.getOeFhirSystem() + "/samp_labNo",
- analysis.getSampleItem().getSample().getAccessionNumber()));
- if (organization != null) {
- serviceRequest.addLocationReference(
- this.createReferenceFor(ResourceType.Location, organization.getFhirUuidAsString()));
- }
- if (organizationDepartment != null) {
- serviceRequest.addLocationReference(
- this.createReferenceFor(ResourceType.Location, organizationDepartment.getFhirUuidAsString()));
- }
-
- List eOrders = electronicOrderService.getElectronicOrdersByExternalId(sample.getReferringId());
-
- if (eOrders.size() <= 0) {
- serviceRequest.setIntent(ServiceRequestIntent.ORIGINALORDER);
- } else if (ElectronicOrderType.FHIR.equals(eOrders.get(eOrders.size() - 1).getType())) {
- serviceRequest.addBasedOn(this.createReferenceFor(ResourceType.ServiceRequest, sample.getReferringId()));
- serviceRequest.setIntent(ServiceRequestIntent.ORDER);
- } else if (ElectronicOrderType.HL7_V2.equals(eOrders.get(eOrders.size() - 1).getType())) {
- serviceRequest.setIntent(ServiceRequestIntent.ORDER);
- }
-
- if (analysis.getStatusId().equals(statusService.getStatusID(AnalysisStatus.NotStarted))) {
- serviceRequest.setStatus(ServiceRequestStatus.ACTIVE);
- } else if (analysis.getStatusId().equals(statusService.getStatusID(AnalysisStatus.TechnicalAcceptance))) {
- serviceRequest.setStatus(ServiceRequestStatus.ACTIVE);
- } else if (analysis.getStatusId().equals(statusService.getStatusID(AnalysisStatus.TechnicalRejected))) {
- serviceRequest.setStatus(ServiceRequestStatus.ACTIVE);
- } else if (analysis.getStatusId().equals(statusService.getStatusID(AnalysisStatus.Finalized))) {
- serviceRequest.setStatus(ServiceRequestStatus.COMPLETED);
- } else if (analysis.getStatusId().equals(statusService.getStatusID(AnalysisStatus.Canceled))) {
- serviceRequest.setStatus(ServiceRequestStatus.REVOKED);
- } else if (analysis.getStatusId().equals(statusService.getStatusID(AnalysisStatus.SampleRejected))) {
- serviceRequest.setStatus(ServiceRequestStatus.ENTEREDINERROR);
- } else {
- serviceRequest.setStatus(ServiceRequestStatus.UNKNOWN);
- }
- ObservationHistory program = observationHistoryService.getObservationHistoriesBySampleIdAndType(sample.getId(),
- observationHistoryService.getObservationTypeIdForType(ObservationType.PROGRAM));
- if (program != null && !GenericValidator.isBlankOrNull(program.getValue())) {
- serviceRequest.addCategory(transformSampleProgramToCodeableConcept(program));
- }
- serviceRequest.setPriority(ServiceRequestPriority.ROUTINE);
- serviceRequest.setCode(transformTestToCodeableConcept(test.getId()));
- serviceRequest.setAuthoredOn(new Date());
- for (Note note : noteService.getNotes(analysis)) {
- serviceRequest.addNote(transformNoteToAnnotation(note));
- }
- // TODO performer type?
-
- serviceRequest.addSpecimen(
- this.createReferenceFor(ResourceType.Specimen, analysis.getSampleItem().getFhirUuidAsString()));
- serviceRequest.setSubject(this.createReferenceFor(ResourceType.Patient, patient.getFhirUuidAsString()));
- if (provider != null && provider.getFhirUuid() != null) {
- serviceRequest
- .setRequester(this.createReferenceFor(ResourceType.Practitioner, provider.getFhirUuidAsString()));
- }
-
- return serviceRequest;
- }
-
- private CodeableConcept transformSampleProgramToCodeableConcept(ObservationHistory program) {
- CodeableConcept codeableConcept = new CodeableConcept();
- String programDisplay = "";
- String programCode = "";
- if ("D".equals(program.getValueType())) {
- Dictionary dictionary = dictionaryService.get(program.getValue());
- if (dictionary != null) {
- programCode = dictionary.getDictEntry();
- programDisplay = dictionary.getDictEntry();
- }
- } else {
- programCode = program.getValue();
- programDisplay = program.getValue();
- }
- codeableConcept
- .addCoding(new Coding(fhirConfig.getOeFhirSystem() + "/sample_program", programCode, programDisplay));
- return codeableConcept;
- }
-
- private CodeableConcept transformTestToCodeableConcept(String testId) {
- return transformTestToCodeableConcept(testService.get(testId));
- }
-
- private CodeableConcept transformTestToCodeableConcept(Test test) {
- CodeableConcept codeableConcept = new CodeableConcept();
- codeableConcept
- .addCoding(new Coding("http://loinc.org", test.getLoinc(), test.getLocalizedTestName().getEnglish()));
- return codeableConcept;
- }
-
- private Specimen transformToFhirSpecimen(SampleTestCollection sampleTest) {
- Specimen specimen = this.transformToSpecimen(sampleTest.item.getId());
- if (sampleTest.initialSampleConditionIdList != null) {
- for (ObservationHistory initialSampleCondition : sampleTest.initialSampleConditionIdList) {
- specimen.addCondition(transformSampleConditionToCodeableConcept(initialSampleCondition));
- }
- }
-
- return specimen;
- }
-
- private Specimen transformToSpecimen(String sampleItemId) {
- return transformToSpecimen(sampleItemService.get(sampleItemId));
- }
-
- private Specimen transformToSpecimen(SampleItem sampleItem) {
- Specimen specimen = new Specimen();
- Patient patient = sampleHumanService.getPatientForSample(sampleItem.getSample());
- specimen.setId(sampleItem.getFhirUuidAsString());
- specimen.addIdentifier(this.createIdentifier(fhirConfig.getOeFhirSystem() + "/sampleItem_uuid",
- sampleItem.getFhirUuidAsString()));
- specimen.setAccessionIdentifier(this.createIdentifier(fhirConfig.getOeFhirSystem() + "/sampleItem_labNo",
- sampleItem.getSample().getAccessionNumber() + "-" + sampleItem.getSortOrder()));
- specimen.setStatus(SpecimenStatus.AVAILABLE);
- specimen.setType(transformTypeOfSampleToCodeableConcept(sampleItem.getTypeOfSample()));
- specimen.setReceivedTime(new Date());
- specimen.setCollection(transformToCollection(sampleItem.getCollectionDate(), sampleItem.getCollector()));
-
- for (Analysis analysis : analysisService.getAnalysesBySampleItem(sampleItem)) {
- specimen.addRequest(this.createReferenceFor(ResourceType.ServiceRequest, analysis.getFhirUuidAsString()));
- }
- specimen.setSubject(this.createReferenceFor(ResourceType.Patient, patient.getFhirUuidAsString()));
-
- return specimen;
- }
-
- @SuppressWarnings("unused")
- private CodeableConcept transformSampleConditionToCodeableConcept(String sampleConditionId) {
- return transformSampleConditionToCodeableConcept(observationHistoryService.get(sampleConditionId));
- }
-
- private CodeableConcept transformSampleConditionToCodeableConcept(ObservationHistory initialSampleCondition) {
- String observationValue;
- String observationDisplay;
- if (ValueType.DICTIONARY.getCode().equals(initialSampleCondition.getValueType())) {
- observationValue = dictionaryService.get(initialSampleCondition.getValue()).getDictEntry();
- observationDisplay = dictionaryService.get(initialSampleCondition.getValue()).getDictEntryDisplayValue();
- } else if (ValueType.KEY.getCode().equals(initialSampleCondition.getValueType())) {
- observationValue = localizationService.get(initialSampleCondition.getValue()).getEnglish();
- observationDisplay = "";
- } else {
- observationValue = initialSampleCondition.getValue();
- observationDisplay = "";
- }
-
- CodeableConcept condition = new CodeableConcept();
- condition.addCoding(
- new Coding(fhirConfig.getOeFhirSystem() + "/sample_condition", observationValue, observationDisplay));
- return condition;
- }
+ .setCountry(person.getCountry())//
+ ;
+ if (commune != null) {
+ address.addLine("commune: " + commune.getValue());
+ }
+ return address;
+ }
+
+ private List createPatientIdentifiers(String subjectNumber, String nationalId, String stNumber,
+ String guid, String fhirUuid) {
+ List identifierList = new ArrayList<>();
+ if (!GenericValidator.isBlankOrNull(subjectNumber)) {
+ identifierList.add(createIdentifier(fhirConfig.getOeFhirSystem() + "/pat_subjectNumber", subjectNumber));
+ }
+ if (!GenericValidator.isBlankOrNull(nationalId)) {
+ identifierList.add(createIdentifier(fhirConfig.getOeFhirSystem() + "/pat_nationalId", nationalId));
+ }
+ if (!GenericValidator.isBlankOrNull(stNumber)) {
+ identifierList.add(createIdentifier(fhirConfig.getOeFhirSystem() + "/pat_stNumber", stNumber));
+ }
+ if (!GenericValidator.isBlankOrNull(guid)) {
+ identifierList.add(createIdentifier(fhirConfig.getOeFhirSystem() + "/pat_guid", guid));
+ }
+ if (!GenericValidator.isBlankOrNull(fhirUuid)) {
+ identifierList.add(createIdentifier(fhirConfig.getOeFhirSystem() + "/pat_uuid", fhirUuid));
+ }
+ return identifierList;
+ }
+
+ private List transformToServiceRequests(SamplePatientUpdateData updateData,
+ SampleTestCollection sampleTestCollection) {
+ List serviceRequestsForSampleItem = new ArrayList<>();
+
+ for (Analysis analysis : sampleTestCollection.analysises) {
+ serviceRequestsForSampleItem.add(this.transformToServiceRequest(analysis.getId()));
+ }
+ return serviceRequestsForSampleItem;
+ }
+
+ private ServiceRequest transformToServiceRequest(String anlaysisId) {
+ return transformToServiceRequest(analysisService.get(anlaysisId));
+ }
+
+ private ServiceRequest transformToServiceRequest(Analysis analysis) {
+ Sample sample = analysis.getSampleItem().getSample();
+ Patient patient = sampleHumanService.getPatientForSample(sample);
+ Provider provider = sampleHumanService.getProviderForSample(sample);
+
+ Organization organization = sampleService.getOrganizationRequester(sample,
+ TableIdService.getInstance().REFERRING_ORG_TYPE_ID);
+ Organization organizationDepartment = sampleService.getOrganizationRequester(sample,
+ TableIdService.getInstance().REFERRING_ORG_DEPARTMENT_TYPE_ID);
+
+ Test test = analysis.getTest();
+ ServiceRequest serviceRequest = new ServiceRequest();
+ serviceRequest.setId(analysis.getFhirUuidAsString());
+ serviceRequest.addIdentifier(
+ this.createIdentifier(fhirConfig.getOeFhirSystem() + "/analysis_uuid", analysis.getFhirUuidAsString()));
+ serviceRequest.setRequisition(this.createIdentifier(fhirConfig.getOeFhirSystem() + "/samp_labNo",
+ analysis.getSampleItem().getSample().getAccessionNumber()));
+ if (organization != null) {
+ serviceRequest.addLocationReference(
+ this.createReferenceFor(ResourceType.Location, organization.getFhirUuidAsString()));
+ }
+ if (organizationDepartment != null) {
+ serviceRequest.addLocationReference(
+ this.createReferenceFor(ResourceType.Location, organizationDepartment.getFhirUuidAsString()));
+ }
+
+ List eOrders = electronicOrderService.getElectronicOrdersByExternalId(sample.getReferringId());
+
+ if (eOrders.size() <= 0) {
+ serviceRequest.setIntent(ServiceRequestIntent.ORIGINALORDER);
+ } else if (ElectronicOrderType.FHIR.equals(eOrders.get(eOrders.size() - 1).getType())) {
+ serviceRequest.addBasedOn(this.createReferenceFor(ResourceType.ServiceRequest, sample.getReferringId()));
+ serviceRequest.setIntent(ServiceRequestIntent.ORDER);
+ } else if (ElectronicOrderType.HL7_V2.equals(eOrders.get(eOrders.size() - 1).getType())) {
+ serviceRequest.setIntent(ServiceRequestIntent.ORDER);
+ }
+
+ if (analysis.getStatusId().equals(statusService.getStatusID(AnalysisStatus.NotStarted))) {
+ serviceRequest.setStatus(ServiceRequestStatus.ACTIVE);
+ } else if (analysis.getStatusId().equals(statusService.getStatusID(AnalysisStatus.TechnicalAcceptance))) {
+ serviceRequest.setStatus(ServiceRequestStatus.ACTIVE);
+ } else if (analysis.getStatusId().equals(statusService.getStatusID(AnalysisStatus.TechnicalRejected))) {
+ serviceRequest.setStatus(ServiceRequestStatus.ACTIVE);
+ } else if (analysis.getStatusId().equals(statusService.getStatusID(AnalysisStatus.Finalized))) {
+ serviceRequest.setStatus(ServiceRequestStatus.COMPLETED);
+ } else if (analysis.getStatusId().equals(statusService.getStatusID(AnalysisStatus.Canceled))) {
+ serviceRequest.setStatus(ServiceRequestStatus.REVOKED);
+ } else if (analysis.getStatusId().equals(statusService.getStatusID(AnalysisStatus.SampleRejected))) {
+ serviceRequest.setStatus(ServiceRequestStatus.ENTEREDINERROR);
+ } else {
+ serviceRequest.setStatus(ServiceRequestStatus.UNKNOWN);
+ }
+ ObservationHistory program = observationHistoryService.getObservationHistoriesBySampleIdAndType(sample.getId(),
+ observationHistoryService.getObservationTypeIdForType(ObservationType.PROGRAM));
+ if (program != null && !GenericValidator.isBlankOrNull(program.getValue())) {
+ serviceRequest.addCategory(transformSampleProgramToCodeableConcept(program));
+ }
+ serviceRequest.setPriority(ServiceRequestPriority.ROUTINE);
+ serviceRequest.setCode(transformTestToCodeableConcept(test.getId()));
+ serviceRequest.setAuthoredOn(new Date());
+ for (Note note : noteService.getNotes(analysis)) {
+ serviceRequest.addNote(transformNoteToAnnotation(note));
+ }
+ // TODO performer type?
+
+ serviceRequest.addSpecimen(
+ this.createReferenceFor(ResourceType.Specimen, analysis.getSampleItem().getFhirUuidAsString()));
+ serviceRequest.setSubject(this.createReferenceFor(ResourceType.Patient, patient.getFhirUuidAsString()));
+ if (provider != null && provider.getFhirUuid() != null) {
+ serviceRequest
+ .setRequester(this.createReferenceFor(ResourceType.Practitioner, provider.getFhirUuidAsString()));
+ }
+
+ return serviceRequest;
+ }
+
+ private CodeableConcept transformSampleProgramToCodeableConcept(ObservationHistory program) {
+ CodeableConcept codeableConcept = new CodeableConcept();
+ String programDisplay = "";
+ String programCode = "";
+ if ("D".equals(program.getValueType())) {
+ Dictionary dictionary = dictionaryService.get(program.getValue());
+ if (dictionary != null) {
+ programCode = dictionary.getDictEntry();
+ programDisplay = dictionary.getDictEntry();
+ }
+ } else {
+ programCode = program.getValue();
+ programDisplay = program.getValue();
+ }
+ codeableConcept
+ .addCoding(new Coding(fhirConfig.getOeFhirSystem() + "/sample_program", programCode, programDisplay));
+ return codeableConcept;
+ }
+
+ private CodeableConcept transformTestToCodeableConcept(String testId) {
+ return transformTestToCodeableConcept(testService.get(testId));
+ }
+
+ private CodeableConcept transformTestToCodeableConcept(Test test) {
+ CodeableConcept codeableConcept = new CodeableConcept();
+ codeableConcept
+ .addCoding(new Coding("http://loinc.org", test.getLoinc(), test.getLocalizedTestName().getEnglish()));
+ return codeableConcept;
+ }
+
+ private Specimen transformToFhirSpecimen(SampleTestCollection sampleTest) {
+ Specimen specimen = this.transformToSpecimen(sampleTest.item.getId());
+ if (sampleTest.initialSampleConditionIdList != null) {
+ for (ObservationHistory initialSampleCondition : sampleTest.initialSampleConditionIdList) {
+ specimen.addCondition(transformSampleConditionToCodeableConcept(initialSampleCondition));
+ }
+ }
+
+ return specimen;
+ }
+
+ private Specimen transformToSpecimen(String sampleItemId) {
+ return transformToSpecimen(sampleItemService.get(sampleItemId));
+ }
+
+ private Specimen transformToSpecimen(SampleItem sampleItem) {
+ Specimen specimen = new Specimen();
+ Patient patient = sampleHumanService.getPatientForSample(sampleItem.getSample());
+ specimen.setId(sampleItem.getFhirUuidAsString());
+ specimen.addIdentifier(this.createIdentifier(fhirConfig.getOeFhirSystem() + "/sampleItem_uuid",
+ sampleItem.getFhirUuidAsString()));
+ specimen.setAccessionIdentifier(this.createIdentifier(fhirConfig.getOeFhirSystem() + "/sampleItem_labNo",
+ sampleItem.getSample().getAccessionNumber() + "-" + sampleItem.getSortOrder()));
+ specimen.setStatus(SpecimenStatus.AVAILABLE);
+ specimen.setType(transformTypeOfSampleToCodeableConcept(sampleItem.getTypeOfSample()));
+ specimen.setReceivedTime(new Date());
+ specimen.setCollection(transformToCollection(sampleItem.getCollectionDate(), sampleItem.getCollector()));
+
+ for (Analysis analysis : analysisService.getAnalysesBySampleItem(sampleItem)) {
+ specimen.addRequest(this.createReferenceFor(ResourceType.ServiceRequest, analysis.getFhirUuidAsString()));
+ }
+ specimen.setSubject(this.createReferenceFor(ResourceType.Patient, patient.getFhirUuidAsString()));
+
+ return specimen;
+ }
+
+ @SuppressWarnings("unused")
+ private CodeableConcept transformSampleConditionToCodeableConcept(String sampleConditionId) {
+ return transformSampleConditionToCodeableConcept(observationHistoryService.get(sampleConditionId));
+ }
+
+ private CodeableConcept transformSampleConditionToCodeableConcept(ObservationHistory initialSampleCondition) {
+ String observationValue;
+ String observationDisplay;
+ if (ValueType.DICTIONARY.getCode().equals(initialSampleCondition.getValueType())) {
+ observationValue = dictionaryService.get(initialSampleCondition.getValue()).getDictEntry();
+ observationDisplay = dictionaryService.get(initialSampleCondition.getValue()).getDictEntryDisplayValue();
+ } else if (ValueType.KEY.getCode().equals(initialSampleCondition.getValueType())) {
+ observationValue = localizationService.get(initialSampleCondition.getValue()).getEnglish();
+ observationDisplay = "";
+ } else {
+ observationValue = initialSampleCondition.getValue();
+ observationDisplay = "";
+ }
+
+ CodeableConcept condition = new CodeableConcept();
+ condition.addCoding(
+ new Coding(fhirConfig.getOeFhirSystem() + "/sample_condition", observationValue, observationDisplay));
+ return condition;
+ }
private SpecimenCollectionComponent transformToCollection(Timestamp collectionDate, String collector) {
SpecimenCollectionComponent specimenCollectionComponent = new SpecimenCollectionComponent();
specimenCollectionComponent.setCollected(new DateTimeType(collectionDate));
// TODO create a collector from this info
-// specimenCollectionComponent.setCollector(collector);
+ // specimenCollectionComponent.setCollector(collector);
return specimenCollectionComponent;
}
- private CodeableConcept transformTypeOfSampleToCodeableConcept(String typeOfSampleId) {
- return transformTypeOfSampleToCodeableConcept(typeOfSampleService.get(typeOfSampleId));
- }
-
- private CodeableConcept transformTypeOfSampleToCodeableConcept(TypeOfSample typeOfSample) {
- CodeableConcept codeableConcept = new CodeableConcept();
- codeableConcept.addCoding(new Coding(fhirConfig.getOeFhirSystem() + "/sampleType",
- typeOfSample.getLocalAbbreviation(), typeOfSample.getLocalizedName()));
- return codeableConcept;
- }
-
- @Override
- @Async
- @Transactional(readOnly = true)
- public void transformPersistResultsEntryFhirObjects(ResultsUpdateDataSet actionDataSet)
- throws FhirLocalPersistingException {
- CountingTempIdGenerator tempIdGenerator = new CountingTempIdGenerator();
- FhirOperations fhirOperations = new FhirOperations();
- for (ResultSet resultSet : actionDataSet.getNewResults()) {
- Observation observation = transformResultToObservation(resultSet.result.getId());
- this.addToOperations(fhirOperations, tempIdGenerator, observation);
- }
- for (ResultSet resultSet : actionDataSet.getModifiedResults()) {
- Observation observation = this.transformResultToObservation(resultSet.result.getId());
- this.addToOperations(fhirOperations, tempIdGenerator, observation);
- }
-
- for (Analysis analysis : actionDataSet.getModifiedAnalysis()) {
- ServiceRequest serviceRequest = this.transformToServiceRequest(analysis.getId());
- this.addToOperations(fhirOperations, tempIdGenerator, serviceRequest);
- if (statusService.matches(analysis.getStatusId(), AnalysisStatus.Finalized)) {
- DiagnosticReport diagnosticReport = this.transformResultToDiagnosticReport(analysis.getId());
- this.addToOperations(fhirOperations, tempIdGenerator, diagnosticReport);
- }
- }
-
- Bundle responseBundle = fhirPersistanceService.createUpdateFhirResourcesInFhirStore(fhirOperations);
-
- }
-
- @Async
- @Override
- @Transactional(readOnly = true)
- public void transformPersistResultValidationFhirObjects(List deletableList,
- List analysisUpdateList, ArrayList resultUpdateList, List resultItemList,
- ArrayList sampleUpdateList, ArrayList noteUpdateList) throws FhirLocalPersistingException {
- CountingTempIdGenerator tempIdGenerator = new CountingTempIdGenerator();
- FhirOperations fhirOperations = new FhirOperations();
-
- for (Result result : deletableList) {
- Observation observation = transformResultToObservation(result.getId());
- observation.setStatus(ObservationStatus.CANCELLED);
- this.addToOperations(fhirOperations, tempIdGenerator, observation);
- }
-
- for (Result result : resultUpdateList) {
- Observation observation = this.transformResultToObservation(result.getId());
- this.addToOperations(fhirOperations, tempIdGenerator, observation);
- }
-
- for (Analysis analysis : analysisUpdateList) {
- ServiceRequest serviceRequest = this.transformToServiceRequest(analysis.getId());
- this.addToOperations(fhirOperations, tempIdGenerator, serviceRequest);
- if (statusService.matches(analysis.getStatusId(), AnalysisStatus.Finalized)) {
- DiagnosticReport diagnosticReport = this.transformResultToDiagnosticReport(analysis.getId());
- this.addToOperations(fhirOperations, tempIdGenerator, diagnosticReport);
- }
- }
-
- Map referingTaskMap = new HashMap<>();
- for (Sample sample : sampleUpdateList) {
- Task task = this.transformToTask(sample.getId());
- Optional referringTask = getReferringTaskForSample(sample);
- if (referringTask.isPresent()) {
- if (referingTaskMap.containsKey(referringTask.get().getIdElement().getIdPart())) {
- Task existingReferingTask = referingTaskMap.get(referringTask.get().getIdElement().getIdPart());
- updateReferringTaskWithTaskInfo(existingReferingTask, task);
- referingTaskMap.put(existingReferingTask.getIdElement().getIdPart(), existingReferingTask);
- this.addToOperations(fhirOperations, tempIdGenerator, existingReferingTask);
- } else {
- updateReferringTaskWithTaskInfo(referringTask.get(), task);
- referingTaskMap.put(referringTask.get().getIdElement().getIdPart(), referringTask.get());
- this.addToOperations(fhirOperations, tempIdGenerator, referringTask.get());
- }
- }
- this.addToOperations(fhirOperations, tempIdGenerator, task);
- }
-
- Bundle responseBundle = fhirPersistanceService.createUpdateFhirResourcesInFhirStore(fhirOperations);
- }
-
- private void addToOperations(FhirOperations fhirOperations, TempIdGenerator tempIdGenerator, Resource resource) {
- if (this.setTempIdIfMissing(resource, tempIdGenerator)) {
- if (fhirOperations.createResources.containsKey(resource.getIdElement().getIdPart())) {
- LogEvent.logError("", "",
- "collision on id: " + resource.getResourceType() + "/" + resource.getIdElement().getIdPart());
- }
- fhirOperations.createResources.put(resource.getIdElement().getIdPart(), resource);
- } else {
- if (fhirOperations.updateResources.containsKey(resource.getIdElement().getIdPart())) {
- LogEvent.logError("", "",
- "collision on id: " + resource.getResourceType() + "/" + resource.getIdElement().getIdPart());
- }
- fhirOperations.updateResources.put(resource.getIdElement().getIdPart(), resource);
- }
- }
-
- private DiagnosticReport transformResultToDiagnosticReport(String analysisId) {
- return transformResultToDiagnosticReport(analysisService.get(analysisId));
- }
-
- private DiagnosticReport transformResultToDiagnosticReport(Analysis analysis) {
- List allResults = resultService.getResultsByAnalysis(analysis);
- SampleItem sampleItem = analysis.getSampleItem();
- Patient patient = sampleHumanService.getPatientForSample(sampleItem.getSample());
-
- DiagnosticReport diagnosticReport = genNewDiagnosticReport(analysis);
- Test test = analysis.getTest();
-
- if (analysis.getStatusId().equals(statusService.getStatusID(AnalysisStatus.Finalized))) {
- diagnosticReport.setStatus(DiagnosticReportStatus.FINAL);
- } else if (analysis.getStatusId().equals(statusService.getStatusID(AnalysisStatus.TechnicalAcceptance))) {
- diagnosticReport.setStatus(DiagnosticReportStatus.PRELIMINARY);
- } else if (analysis.getStatusId().equals(statusService.getStatusID(AnalysisStatus.TechnicalRejected))) {
- diagnosticReport.setStatus(DiagnosticReportStatus.PARTIAL);
- } else if (analysis.getStatusId().equals(statusService.getStatusID(AnalysisStatus.NotStarted))) {
- diagnosticReport.setStatus(DiagnosticReportStatus.REGISTERED);
- } else {
- diagnosticReport.setStatus(DiagnosticReportStatus.UNKNOWN);
- }
-
- diagnosticReport
- .addBasedOn(this.createReferenceFor(ResourceType.ServiceRequest, analysis.getFhirUuidAsString()));
- diagnosticReport.addSpecimen(this.createReferenceFor(ResourceType.Specimen, sampleItem.getFhirUuidAsString()));
- diagnosticReport.setSubject(this.createReferenceFor(ResourceType.Patient, patient.getFhirUuidAsString()));
- for (Result curResult : allResults) {
- diagnosticReport
- .addResult(this.createReferenceFor(ResourceType.Observation, curResult.getFhirUuidAsString()));
- }
- diagnosticReport.setCode(transformTestToCodeableConcept(test.getId()));
-
- return diagnosticReport;
- }
-
- private DiagnosticReport genNewDiagnosticReport(Analysis analysis) {
- DiagnosticReport diagnosticReport = new DiagnosticReport();
- diagnosticReport.setId(analysis.getFhirUuidAsString());
- diagnosticReport.addIdentifier(this.createIdentifier(fhirConfig.getOeFhirSystem() + "/analysisResult_uuid",
- analysis.getFhirUuidAsString()));
- return diagnosticReport;
- }
-
- private Observation transformResultToObservation(String resultId) {
- return transformResultToObservation(resultService.get(resultId));
- }
-
- private Observation transformResultToObservation(Result result) {
- Analysis analysis = result.getAnalysis();
- Test test = analysis.getTest();
- SampleItem sampleItem = analysis.getSampleItem();
- Patient patient = sampleHumanService.getPatientForSample(sampleItem.getSample());
- Observation observation = new Observation();
-
- observation.setId(result.getFhirUuidAsString());
- observation.addIdentifier(
- this.createIdentifier(fhirConfig.getOeFhirSystem() + "/result_uuid", result.getFhirUuidAsString()));
+ private CodeableConcept transformTypeOfSampleToCodeableConcept(String typeOfSampleId) {
+ return transformTypeOfSampleToCodeableConcept(typeOfSampleService.get(typeOfSampleId));
+ }
+
+ private CodeableConcept transformTypeOfSampleToCodeableConcept(TypeOfSample typeOfSample) {
+ CodeableConcept codeableConcept = new CodeableConcept();
+ codeableConcept.addCoding(new Coding(fhirConfig.getOeFhirSystem() + "/sampleType",
+ typeOfSample.getLocalAbbreviation(), typeOfSample.getLocalizedName()));
+ return codeableConcept;
+ }
+
+ @Override
+ @Async
+ @Transactional(readOnly = true)
+ public void transformPersistResultsEntryFhirObjects(ResultsUpdateDataSet actionDataSet)
+ throws FhirLocalPersistingException {
+ CountingTempIdGenerator tempIdGenerator = new CountingTempIdGenerator();
+ FhirOperations fhirOperations = new FhirOperations();
+ for (ResultSet resultSet : actionDataSet.getNewResults()) {
+ Observation observation = transformResultToObservation(resultSet.result.getId());
+ this.addToOperations(fhirOperations, tempIdGenerator, observation);
+ }
+ for (ResultSet resultSet : actionDataSet.getModifiedResults()) {
+ Observation observation = this.transformResultToObservation(resultSet.result.getId());
+ this.addToOperations(fhirOperations, tempIdGenerator, observation);
+ }
+
+ for (Analysis analysis : actionDataSet.getModifiedAnalysis()) {
+ ServiceRequest serviceRequest = this.transformToServiceRequest(analysis.getId());
+ this.addToOperations(fhirOperations, tempIdGenerator, serviceRequest);
+ if (statusService.matches(analysis.getStatusId(), AnalysisStatus.Finalized)) {
+ DiagnosticReport diagnosticReport = this.transformResultToDiagnosticReport(analysis.getId());
+ this.addToOperations(fhirOperations, tempIdGenerator, diagnosticReport);
+ }
+ }
+
+ Bundle responseBundle = fhirPersistanceService.createUpdateFhirResourcesInFhirStore(fhirOperations);
+
+ }
+
+ @Async
+ @Override
+ @Transactional(readOnly = true)
+ public void transformPersistResultValidationFhirObjects(List deletableList,
+ List analysisUpdateList, ArrayList resultUpdateList, List resultItemList,
+ ArrayList sampleUpdateList, ArrayList noteUpdateList) throws FhirLocalPersistingException {
+ CountingTempIdGenerator tempIdGenerator = new CountingTempIdGenerator();
+ FhirOperations fhirOperations = new FhirOperations();
+
+ for (Result result : deletableList) {
+ Observation observation = transformResultToObservation(result.getId());
+ observation.setStatus(ObservationStatus.CANCELLED);
+ this.addToOperations(fhirOperations, tempIdGenerator, observation);
+ }
+
+ for (Result result : resultUpdateList) {
+ Observation observation = this.transformResultToObservation(result.getId());
+ this.addToOperations(fhirOperations, tempIdGenerator, observation);
+ }
+
+ for (Analysis analysis : analysisUpdateList) {
+ ServiceRequest serviceRequest = this.transformToServiceRequest(analysis.getId());
+ this.addToOperations(fhirOperations, tempIdGenerator, serviceRequest);
+ if (statusService.matches(analysis.getStatusId(), AnalysisStatus.Finalized)) {
+ DiagnosticReport diagnosticReport = this.transformResultToDiagnosticReport(analysis.getId());
+ this.addToOperations(fhirOperations, tempIdGenerator, diagnosticReport);
+ }
+ }
+
+ Map referingTaskMap = new HashMap<>();
+ for (Sample sample : sampleUpdateList) {
+ Task task = this.transformToTask(sample.getId());
+ Optional referringTask = getReferringTaskForSample(sample);
+ if (referringTask.isPresent()) {
+ if (referingTaskMap.containsKey(referringTask.get().getIdElement().getIdPart())) {
+ Task existingReferingTask = referingTaskMap.get(referringTask.get().getIdElement().getIdPart());
+ updateReferringTaskWithTaskInfo(existingReferingTask, task);
+ referingTaskMap.put(existingReferingTask.getIdElement().getIdPart(), existingReferingTask);
+ this.addToOperations(fhirOperations, tempIdGenerator, existingReferingTask);
+ } else {
+ updateReferringTaskWithTaskInfo(referringTask.get(), task);
+ referingTaskMap.put(referringTask.get().getIdElement().getIdPart(), referringTask.get());
+ this.addToOperations(fhirOperations, tempIdGenerator, referringTask.get());
+ }
+ }
+ this.addToOperations(fhirOperations, tempIdGenerator, task);
+ }
+
+ Bundle responseBundle = fhirPersistanceService.createUpdateFhirResourcesInFhirStore(fhirOperations);
+ }
+
+ private void addToOperations(FhirOperations fhirOperations, TempIdGenerator tempIdGenerator, Resource resource) {
+ if (this.setTempIdIfMissing(resource, tempIdGenerator)) {
+ if (fhirOperations.createResources.containsKey(resource.getIdElement().getIdPart())) {
+ LogEvent.logError("", "",
+ "collision on id: " + resource.getResourceType() + "/" + resource.getIdElement().getIdPart());
+ }
+ fhirOperations.createResources.put(resource.getIdElement().getIdPart(), resource);
+ } else {
+ if (fhirOperations.updateResources.containsKey(resource.getIdElement().getIdPart())) {
+ LogEvent.logError("", "",
+ "collision on id: " + resource.getResourceType() + "/" + resource.getIdElement().getIdPart());
+ }
+ fhirOperations.updateResources.put(resource.getIdElement().getIdPart(), resource);
+ }
+ }
+
+ private DiagnosticReport transformResultToDiagnosticReport(String analysisId) {
+ return transformResultToDiagnosticReport(analysisService.get(analysisId));
+ }
+
+ private DiagnosticReport transformResultToDiagnosticReport(Analysis analysis) {
+ List allResults = resultService.getResultsByAnalysis(analysis);
+ SampleItem sampleItem = analysis.getSampleItem();
+ Patient patient = sampleHumanService.getPatientForSample(sampleItem.getSample());
+
+ DiagnosticReport diagnosticReport = genNewDiagnosticReport(analysis);
+ Test test = analysis.getTest();
+
+ if (analysis.getStatusId().equals(statusService.getStatusID(AnalysisStatus.Finalized))) {
+ diagnosticReport.setStatus(DiagnosticReportStatus.FINAL);
+ } else if (analysis.getStatusId().equals(statusService.getStatusID(AnalysisStatus.TechnicalAcceptance))) {
+ diagnosticReport.setStatus(DiagnosticReportStatus.PRELIMINARY);
+ } else if (analysis.getStatusId().equals(statusService.getStatusID(AnalysisStatus.TechnicalRejected))) {
+ diagnosticReport.setStatus(DiagnosticReportStatus.PARTIAL);
+ } else if (analysis.getStatusId().equals(statusService.getStatusID(AnalysisStatus.NotStarted))) {
+ diagnosticReport.setStatus(DiagnosticReportStatus.REGISTERED);
+ } else {
+ diagnosticReport.setStatus(DiagnosticReportStatus.UNKNOWN);
+ }
+
+ diagnosticReport
+ .addBasedOn(this.createReferenceFor(ResourceType.ServiceRequest, analysis.getFhirUuidAsString()));
+ diagnosticReport.addSpecimen(this.createReferenceFor(ResourceType.Specimen, sampleItem.getFhirUuidAsString()));
+ diagnosticReport.setSubject(this.createReferenceFor(ResourceType.Patient, patient.getFhirUuidAsString()));
+ for (Result curResult : allResults) {
+ diagnosticReport
+ .addResult(this.createReferenceFor(ResourceType.Observation, curResult.getFhirUuidAsString()));
+ }
+ diagnosticReport.setCode(transformTestToCodeableConcept(test.getId()));
+
+ return diagnosticReport;
+ }
+
+ private DiagnosticReport genNewDiagnosticReport(Analysis analysis) {
+ DiagnosticReport diagnosticReport = new DiagnosticReport();
+ diagnosticReport.setId(analysis.getFhirUuidAsString());
+ diagnosticReport.addIdentifier(this.createIdentifier(fhirConfig.getOeFhirSystem() + "/analysisResult_uuid",
+ analysis.getFhirUuidAsString()));
+ return diagnosticReport;
+ }
+
+ private Observation transformResultToObservation(String resultId) {
+ return transformResultToObservation(resultService.get(resultId));
+ }
+
+ private Observation transformResultToObservation(Result result) {
+ Analysis analysis = result.getAnalysis();
+ Test test = analysis.getTest();
+ SampleItem sampleItem = analysis.getSampleItem();
+ Patient patient = sampleHumanService.getPatientForSample(sampleItem.getSample());
+ Observation observation = new Observation();
+
+ observation.setId(result.getFhirUuidAsString());
+ observation.addIdentifier(
+ this.createIdentifier(fhirConfig.getOeFhirSystem() + "/result_uuid", result.getFhirUuidAsString()));
// TODO make sure these align with each other.
// we may need to add detection for when result is changed and add those status
@@ -1005,7 +1029,14 @@ private Observation transformResultToObservation(Result result) {
}
if (!GenericValidator.isBlankOrNull(result.getValue())) {
- if (TypeOfTestResultServiceImpl.ResultType.isMultiSelectVariant(result.getResultType())
+ // in case of Viral load test
+ if (result.getAnalysis().getTest().getName().equalsIgnoreCase("Viral Load")) {
+ Quantity quantity = new Quantity();
+ long finalResult = result.getVLValueAsNumber();
+ quantity.setValue(finalResult);
+ quantity.setUnit(resultService.getUOM(result));
+ observation.setValue(quantity);
+ } else if (TypeOfTestResultServiceImpl.ResultType.isMultiSelectVariant(result.getResultType())
&& !"0".equals(result.getValue())) {
Dictionary dictionary = dictionaryService.getDataForId(result.getValue());
observation.setValue(new CodeableConcept(
@@ -1032,268 +1063,271 @@ private Observation transformResultToObservation(Result result) {
observation.addBasedOn(this.createReferenceFor(ResourceType.ServiceRequest, analysis.getFhirUuidAsString()));
observation.setSpecimen(this.createReferenceFor(ResourceType.Specimen, sampleItem.getFhirUuidAsString()));
observation.setSubject(this.createReferenceFor(ResourceType.Patient, patient.getFhirUuidAsString()));
-// observation.setIssued(result.getOriginalLastupdated());
- observation.setIssued(result.getLastupdated());
- observation.setEffective(new DateTimeType(result.getLastupdated()));
-// observation.setIssued(new Date());
+ // observation.setIssued(result.getOriginalLastupdated());
+ observation.setIssued(analysis.getReleasedDate());//update to get Released Date instead of commpleted date observation.setEffective(new DateTimeType(result.getLastupdated()));
+ // observation.setIssued(new Date());
return observation;
}
- @Override
- public Practitioner transformNameToPractitioner(String practitionerName) {
- Practitioner practitioner = new Practitioner();
- HumanName name = practitioner.addName();
-
- if (practitionerName.contains(",")) {
- String[] names = practitionerName.split(",", 2);
- name.setFamily(names[0]);
- for (int i = 1; i < names.length; ++i) {
- name.addGiven(names[i]);
- }
- } else {
- String[] names = practitionerName.split(" ");
- if (names.length >= 1) {
- name.setFamily(names[names.length - 1]);
- for (int i = 0; i < names.length - 1; ++i) {
- name.addGiven(names[i]);
- }
- }
- }
- return practitioner;
- }
-
- @Override
- @Transactional(readOnly = true)
- public org.hl7.fhir.r4.model.Organization transformToFhirOrganization(Organization organization) {
- org.hl7.fhir.r4.model.Organization fhirOrganization = new org.hl7.fhir.r4.model.Organization();
- fhirOrganization
- .setId(organization.getFhirUuid() == null ? organization.getId() : organization.getFhirUuidAsString());
- fhirOrganization.setName(organization.getOrganizationName());
- fhirOrganization.setActive(organization.getIsActive() == IActionConstants.YES ? true : false);
- this.setFhirOrganizationIdentifiers(fhirOrganization, organization);
- this.setFhirAddressInfo(fhirOrganization, organization);
- this.setFhirOrganizationTypes(fhirOrganization, organization);
- return fhirOrganization;
- }
-
- @Override
- @Transactional(readOnly = true)
- public Organization transformToOrganization(org.hl7.fhir.r4.model.Organization fhirOrganization) {
- Organization organization = new Organization();
- organization.setOrganizationName(fhirOrganization.getName());
- organization.setIsActive(Boolean.FALSE == fhirOrganization.getActiveElement().getValue() ? IActionConstants.NO
- : IActionConstants.YES);
-
- setOeOrganizationIdentifiers(organization, fhirOrganization);
- setOeOrganizationAddressInfo(organization, fhirOrganization);
- setOeOrganizationTypes(organization, fhirOrganization);
-
- organization.setMlsLabFlag(IActionConstants.NO);
- organization.setMlsSentinelLabFlag(IActionConstants.NO);
-
- return organization;
- }
-
- private void setOeOrganizationIdentifiers(Organization organization,
- org.hl7.fhir.r4.model.Organization fhirOrganization) {
- organization.setFhirUuid(UUID.fromString(fhirOrganization.getIdElement().getIdPart()));
- for (Identifier identifier : fhirOrganization.getIdentifier()) {
- if (identifier.getSystem().equals(fhirConfig.getOeFhirSystem() + "/org_cliaNum")) {
- organization.setCliaNum(identifier.getValue());
- } else if (identifier.getSystem().equals(fhirConfig.getOeFhirSystem() + "/org_shortName")) {
- organization.setShortName(identifier.getValue());
- } else if (identifier.getSystem().equals(fhirConfig.getOeFhirSystem() + "/org_code")) {
- organization.setCode(identifier.getValue());
- } else if (identifier.getSystem().equals(fhirConfig.getOeFhirSystem() + "/org_uuid")) {
- organization.setFhirUuid(UUID.fromString(identifier.getValue()));
- }
- }
- }
-
- private void setFhirOrganizationIdentifiers(org.hl7.fhir.r4.model.Organization fhirOrganization,
- Organization organization) {
- if (!GenericValidator.isBlankOrNull(organization.getCliaNum())) {
- fhirOrganization.addIdentifier(new Identifier().setSystem(fhirConfig.getOeFhirSystem() + "/org_cliaNum")
- .setValue(organization.getCliaNum()));
- }
- if (!GenericValidator.isBlankOrNull(organization.getShortName())) {
- fhirOrganization.addIdentifier(new Identifier().setSystem(fhirConfig.getOeFhirSystem() + "/org_shortName")
- .setValue(organization.getShortName()));
- }
- if (!GenericValidator.isBlankOrNull(organization.getCode())) {
- fhirOrganization.addIdentifier(new Identifier().setSystem(fhirConfig.getOeFhirSystem() + "/org_code")
- .setValue(organization.getCode()));
- }
- if (!GenericValidator.isBlankOrNull(organization.getCode())) {
- fhirOrganization.addIdentifier(new Identifier().setSystem(fhirConfig.getOeFhirSystem() + "/org_uuid")
- .setValue(organization.getFhirUuidAsString()));
- }
- }
-
- private void setOeOrganizationTypes(Organization organization,
- org.hl7.fhir.r4.model.Organization fhirOrganization) {
- Set orgTypes = new HashSet<>();
- OrganizationType orgType = null;
- for (CodeableConcept type : fhirOrganization.getType()) {
- for (Coding coding : type.getCoding()) {
- if (coding.getSystem() != null
- && coding.getSystem().equals(fhirConfig.getOeFhirSystem() + "/orgType")) {
- orgType = new OrganizationType();
- orgType.setName(coding.getCode());
- orgType.setDescription(type.getText());
- orgType.setNameKey("org_type." + coding.getCode() + ".name");
- orgType.setOrganizations(new HashSet<>());
- orgType.getOrganizations().add(organization);
- orgTypes.add(orgType);
- }
- }
- }
- organization.setOrganizationTypes(orgTypes);
- }
-
- private void setFhirOrganizationTypes(org.hl7.fhir.r4.model.Organization fhirOrganization,
- Organization organization) {
- Set orgTypes = organization.getOrganizationTypes();
- for (OrganizationType orgType : orgTypes) {
- fhirOrganization.addType(new CodeableConcept() //
- .setText(orgType.getDescription()) //
- .addCoding(new Coding() //
- .setSystem(fhirConfig.getOeFhirSystem() + "/orgType") //
- .setCode(orgType.getName())));
- }
- }
-
- private void setOeOrganizationAddressInfo(Organization organization,
- org.hl7.fhir.r4.model.Organization fhirOrganization) {
- organization.setStreetAddress(fhirOrganization.getAddressFirstRep().getLine().stream()
- .map(e -> e.asStringValue()).collect(Collectors.joining("\\n")));
- organization.setCity(fhirOrganization.getAddressFirstRep().getCity());
- organization.setState(fhirOrganization.getAddressFirstRep().getState());
- organization.setZipCode(fhirOrganization.getAddressFirstRep().getPostalCode());
- }
-
- private void setFhirAddressInfo(org.hl7.fhir.r4.model.Organization fhirOrganization, Organization organization) {
- if (!GenericValidator.isBlankOrNull(organization.getStreetAddress())) {
- fhirOrganization.getAddressFirstRep().addLine(organization.getStreetAddress());
- }
- if (!GenericValidator.isBlankOrNull(organization.getCity())) {
- fhirOrganization.getAddressFirstRep().setCity(organization.getCity());
- }
- if (!GenericValidator.isBlankOrNull(organization.getState())) {
- fhirOrganization.getAddressFirstRep().setState(organization.getState());
- }
- if (!GenericValidator.isBlankOrNull(organization.getZipCode())) {
- fhirOrganization.getAddressFirstRep().setPostalCode(organization.getZipCode());
- }
- }
-
- private Annotation transformNoteToAnnotation(Note note) {
- Annotation annotation = new Annotation();
- annotation.setText(note.getText());
- return annotation;
- }
-
- @Override
- public boolean setTempIdIfMissing(Resource resource, TempIdGenerator tempIdGenerator) {
- if (GenericValidator.isBlankOrNull(resource.getId())) {
- resource.setId(tempIdGenerator.getNextId());
- return true;
- }
- return false;
- }
-
- @Override
- public Reference createReferenceFor(Resource resource) {
- if (resource == null) {
- return null;
- }
- Reference reference = new Reference(resource);
- reference.setReference(resource.getResourceType() + "/" + resource.getIdElement().getIdPart());
- return reference;
- }
+ @Override
+ public Practitioner transformNameToPractitioner(String practitionerName) {
+ Practitioner practitioner = new Practitioner();
+ HumanName name = practitioner.addName();
+
+ if (practitionerName.contains(",")) {
+ String[] names = practitionerName.split(",", 2);
+ name.setFamily(names[0]);
+ for (int i = 1; i < names.length; ++i) {
+ name.addGiven(names[i]);
+ }
+ } else {
+ String[] names = practitionerName.split(" ");
+ if (names.length >= 1) {
+ name.setFamily(names[names.length - 1]);
+ for (int i = 0; i < names.length - 1; ++i) {
+ name.addGiven(names[i]);
+ }
+ }
+ }
+ return practitioner;
+ }
+
+ @Override
+ @Transactional(readOnly = true)
+ public org.hl7.fhir.r4.model.Organization transformToFhirOrganization(Organization organization) {
+ org.hl7.fhir.r4.model.Organization fhirOrganization = new org.hl7.fhir.r4.model.Organization();
+ fhirOrganization
+ .setId(organization.getFhirUuid() == null ? organization.getId() : organization.getFhirUuidAsString());
+ fhirOrganization.setName(organization.getOrganizationName());
+ fhirOrganization.setActive(organization.getIsActive() == IActionConstants.YES ? true : false);
+ this.setFhirOrganizationIdentifiers(fhirOrganization, organization);
+ this.setFhirAddressInfo(fhirOrganization, organization);
+ this.setFhirOrganizationTypes(fhirOrganization, organization);
+ return fhirOrganization;
+ }
+
+ @Override
+ @Transactional(readOnly = true)
+ public Organization transformToOrganization(org.hl7.fhir.r4.model.Organization fhirOrganization) {
+ Organization organization = new Organization();
+ organization.setOrganizationName(fhirOrganization.getName());
+ organization.setIsActive(Boolean.FALSE == fhirOrganization.getActiveElement().getValue() ? IActionConstants.NO
+ : IActionConstants.YES);
+
+ setOeOrganizationIdentifiers(organization, fhirOrganization);
+ setOeOrganizationAddressInfo(organization, fhirOrganization);
+ setOeOrganizationTypes(organization, fhirOrganization);
+
+ organization.setMlsLabFlag(IActionConstants.NO);
+ organization.setMlsSentinelLabFlag(IActionConstants.NO);
+
+ return organization;
+ }
+
+ private void setOeOrganizationIdentifiers(Organization organization,
+ org.hl7.fhir.r4.model.Organization fhirOrganization) {
+ organization.setFhirUuid(UUID.fromString(fhirOrganization.getIdElement().getIdPart()));
+ for (Identifier identifier : fhirOrganization.getIdentifier()) {
+ if (identifier.getSystem().equals(fhirConfig.getOeFhirSystem() + "/org_cliaNum")) {
+ organization.setCliaNum(identifier.getValue());
+ } else if (identifier.getSystem().equals(fhirConfig.getOeFhirSystem() + "/org_shortName")) {
+ organization.setShortName(identifier.getValue());
+ } else if (identifier.getSystem().equals(fhirConfig.getOeFhirSystem() + "/org_code")) {
+ organization.setCode(identifier.getValue());
+ } else if (identifier.getSystem().equals(fhirConfig.getOeFhirSystem() + "/org_uuid")) {
+ organization.setFhirUuid(UUID.fromString(identifier.getValue()));
+ }
+ }
+ }
+
+ private void setFhirOrganizationIdentifiers(org.hl7.fhir.r4.model.Organization fhirOrganization,
+ Organization organization) {
+ if (!GenericValidator.isBlankOrNull(organization.getCliaNum())) {
+ fhirOrganization.addIdentifier(new Identifier().setSystem(fhirConfig.getOeFhirSystem() + "/org_cliaNum")
+ .setValue(organization.getCliaNum()));
+ }
+ if (!GenericValidator.isBlankOrNull(organization.getShortName())) {
+ fhirOrganization.addIdentifier(new Identifier().setSystem(fhirConfig.getOeFhirSystem() + "/org_shortName")
+ .setValue(organization.getShortName()));
+ }
+ if (!GenericValidator.isBlankOrNull(organization.getCode())) {
+ fhirOrganization.addIdentifier(new Identifier().setSystem(fhirConfig.getOeFhirSystem() + "/org_code")
+ .setValue(organization.getCode()));
+ }
+ if (!GenericValidator.isBlankOrNull(organization.getCode())) {
+ fhirOrganization.addIdentifier(new Identifier().setSystem(fhirConfig.getOeFhirSystem() + "/org_uuid")
+ .setValue(organization.getFhirUuidAsString()));
+ }
+ }
+
+ private void setOeOrganizationTypes(Organization organization,
+ org.hl7.fhir.r4.model.Organization fhirOrganization) {
+ Set orgTypes = new HashSet<>();
+ OrganizationType orgType = null;
+ for (CodeableConcept type : fhirOrganization.getType()) {
+ for (Coding coding : type.getCoding()) {
+ if (coding.getSystem() != null
+ && coding.getSystem().equals(fhirConfig.getOeFhirSystem() + "/orgType")) {
+ orgType = new OrganizationType();
+ orgType.setName(coding.getCode());
+ orgType.setDescription(type.getText());
+ orgType.setNameKey("org_type." + coding.getCode() + ".name");
+ orgType.setOrganizations(new HashSet<>());
+ orgType.getOrganizations().add(organization);
+ orgTypes.add(orgType);
+ }
+ }
+ }
+ organization.setOrganizationTypes(orgTypes);
+ }
+
+ private void setFhirOrganizationTypes(org.hl7.fhir.r4.model.Organization fhirOrganization,
+ Organization organization) {
+ Set orgTypes = organization.getOrganizationTypes();
+ for (OrganizationType orgType : orgTypes) {
+ fhirOrganization.addType(new CodeableConcept() //
+ .setText(orgType.getDescription()) //
+ .addCoding(new Coding() //
+ .setSystem(fhirConfig.getOeFhirSystem() + "/orgType") //
+ .setCode(orgType.getName())));
+ }
+ }
+
+ private void setOeOrganizationAddressInfo(Organization organization,
+ org.hl7.fhir.r4.model.Organization fhirOrganization) {
+ organization.setStreetAddress(fhirOrganization.getAddressFirstRep().getLine().stream()
+ .map(e -> e.asStringValue()).collect(Collectors.joining("\\n")));
+ organization.setCity(fhirOrganization.getAddressFirstRep().getCity());
+ organization.setState(fhirOrganization.getAddressFirstRep().getState());
+ organization.setZipCode(fhirOrganization.getAddressFirstRep().getPostalCode());
+ }
+
+ private void setFhirAddressInfo(org.hl7.fhir.r4.model.Organization fhirOrganization, Organization organization) {
+ if (!GenericValidator.isBlankOrNull(organization.getStreetAddress())) {
+ fhirOrganization.getAddressFirstRep().addLine(organization.getStreetAddress());
+ }
+ if (!GenericValidator.isBlankOrNull(organization.getCity())) {
+ fhirOrganization.getAddressFirstRep().setCity(organization.getCity());
+ }
+ if (!GenericValidator.isBlankOrNull(organization.getState())) {
+ fhirOrganization.getAddressFirstRep().setState(organization.getState());
+ }
+ if (!GenericValidator.isBlankOrNull(organization.getZipCode())) {
+ fhirOrganization.getAddressFirstRep().setPostalCode(organization.getZipCode());
+ }
+ }
+
+ private Annotation transformNoteToAnnotation(Note note) {
+ Annotation annotation = new Annotation();
+ annotation.setText(note.getText());
+ return annotation;
+ }
+
+ @Override
+ public boolean setTempIdIfMissing(Resource resource, TempIdGenerator tempIdGenerator) {
+ if (GenericValidator.isBlankOrNull(resource.getId())) {
+ resource.setId(tempIdGenerator.getNextId());
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public Reference createReferenceFor(Resource resource) {
+ if (resource == null) {
+ return null;
+ }
+ Reference reference = new Reference(resource);
+ reference.setReference(resource.getResourceType() + "/" + resource.getIdElement().getIdPart());
+ return reference;
+ }
@Override
public Reference createReferenceFor(ResourceType resourceType, String id) {
+ if (GenericValidator.isBlankOrNull(id)) {
+ LogEvent.logWarn(this.getClass().getName(), "createReferenceFor",
+ "null or empty id used in resource:" + resourceType + "/" + id);
+ }
Reference reference = new Reference();
reference.setReference(resourceType + "/" + id);
return reference;
}
- @Override
- public String getIdFromLocation(String location) {
- String id = location.substring(location.indexOf("/") + 1);
- while (id.lastIndexOf("/") > 0) {
- id = id.substring(0, id.lastIndexOf("/"));
- }
- return id;
- }
-
- @Override
- public Identifier createIdentifier(String system, String value) {
- Identifier identifier = new Identifier();
- identifier.setSystem(system);
- identifier.setValue(value);
- return identifier;
- }
-
- private class FhirOrderEntryObjects {
- @SuppressWarnings("unused")
- public org.hl7.fhir.r4.model.Patient patient;
- public Practitioner requester;
- List sampleEntryObjectsList = new ArrayList<>();
- }
-
- private class FhirSampleEntryObjects {
- public Practitioner collector;
- public Specimen specimen;
- public List serviceRequests = new ArrayList<>();
- }
-
- public void addHumanNameToPerson(HumanName humanName, Person person) {
- person.setFirstName(
- humanName.getGivenAsSingleString() == null ? "" : humanName.getGivenAsSingleString().strip());
- person.setLastName(humanName.getFamily() == null ? "" : humanName.getFamily().strip());
- }
-
- public void addTelecomToPerson(List telecoms, Person person) {
- for (ContactPoint contact : telecoms) {
- String contactValue = contact.getValue();
- if (ContactPointSystem.EMAIL.equals(contact.getSystem())) {
- person.setEmail(contactValue);
- } else if (ContactPointSystem.FAX.equals(contact.getSystem())) {
- person.setFax(contactValue);
- } else if (ContactPointSystem.PHONE.equals(contact.getSystem())
- && ContactPointUse.MOBILE.equals(contact.getUse())) {
- person.setCellPhone(contactValue);
- person.setPrimaryPhone(contactValue);
- } else if (ContactPointSystem.PHONE.equals(contact.getSystem())
- && ContactPointUse.HOME.equals(contact.getUse())) {
- person.setHomePhone(contactValue);
- if (GenericValidator.isBlankOrNull(person.getPrimaryPhone())) {
- person.setPrimaryPhone(contactValue);
- }
- } else if (ContactPointSystem.PHONE.equals(contact.getSystem())
- && ContactPointUse.WORK.equals(contact.getUse())) {
- person.setWorkPhone(contactValue);
- if (GenericValidator.isBlankOrNull(person.getPrimaryPhone())) {
- person.setPrimaryPhone(contactValue);
- }
- }
- }
- }
-
- @Override
- public Provider transformToProvider(Practitioner practitioner) {
- Provider provider = new Provider();
- provider.setActive(practitioner.getActive());
- provider.setFhirUuid(UUID.fromString(practitioner.getIdElement().getIdPart()));
-
- provider.setPerson(new Person());
- addHumanNameToPerson(practitioner.getNameFirstRep(), provider.getPerson());
- addTelecomToPerson(practitioner.getTelecom(), provider.getPerson());
-
- return provider;
-
- }
+ @Override
+ public String getIdFromLocation(String location) {
+ String id = location.substring(location.indexOf("/") + 1);
+ while (id.lastIndexOf("/") > 0) {
+ id = id.substring(0, id.lastIndexOf("/"));
+ }
+ return id;
+ }
+
+ @Override
+ public Identifier createIdentifier(String system, String value) {
+ Identifier identifier = new Identifier();
+ identifier.setSystem(system);
+ identifier.setValue(value);
+ return identifier;
+ }
+
+ private class FhirOrderEntryObjects {
+ @SuppressWarnings("unused")
+ public org.hl7.fhir.r4.model.Patient patient;
+ public Practitioner requester;
+ List sampleEntryObjectsList = new ArrayList<>();
+ }
+
+ private class FhirSampleEntryObjects {
+ public Practitioner collector;
+ public Specimen specimen;
+ public List serviceRequests = new ArrayList<>();
+ }
+
+ public void addHumanNameToPerson(HumanName humanName, Person person) {
+ person.setFirstName(
+ humanName.getGivenAsSingleString() == null ? "" : humanName.getGivenAsSingleString().strip());
+ person.setLastName(humanName.getFamily() == null ? "" : humanName.getFamily().strip());
+ }
+
+ public void addTelecomToPerson(List telecoms, Person person) {
+ for (ContactPoint contact : telecoms) {
+ String contactValue = contact.getValue();
+ if (ContactPointSystem.EMAIL.equals(contact.getSystem())) {
+ person.setEmail(contactValue);
+ } else if (ContactPointSystem.FAX.equals(contact.getSystem())) {
+ person.setFax(contactValue);
+ } else if (ContactPointSystem.PHONE.equals(contact.getSystem())
+ && ContactPointUse.MOBILE.equals(contact.getUse())) {
+ person.setCellPhone(contactValue);
+ person.setPrimaryPhone(contactValue);
+ } else if (ContactPointSystem.PHONE.equals(contact.getSystem())
+ && ContactPointUse.HOME.equals(contact.getUse())) {
+ person.setHomePhone(contactValue);
+ if (GenericValidator.isBlankOrNull(person.getPrimaryPhone())) {
+ person.setPrimaryPhone(contactValue);
+ }
+ } else if (ContactPointSystem.PHONE.equals(contact.getSystem())
+ && ContactPointUse.WORK.equals(contact.getUse())) {
+ person.setWorkPhone(contactValue);
+ if (GenericValidator.isBlankOrNull(person.getPrimaryPhone())) {
+ person.setPrimaryPhone(contactValue);
+ }
+ }
+ }
+ }
+
+ @Override
+ public Provider transformToProvider(Practitioner practitioner) {
+ Provider provider = new Provider();
+ provider.setActive(practitioner.getActive());
+ provider.setFhirUuid(UUID.fromString(practitioner.getIdElement().getIdPart()));
+
+ provider.setPerson(new Person());
+ addHumanNameToPerson(practitioner.getNameFirstRep(), provider.getPerson());
+ addTelecomToPerson(practitioner.getTelecom(), provider.getPerson());
+
+ return provider;
+
+ }
}
diff --git a/src/main/java/org/openelisglobal/dataexchange/order/controller/StudyElectronicOrdersController.java b/src/main/java/org/openelisglobal/dataexchange/order/controller/StudyElectronicOrdersController.java
index fc9ff37e35..99c5dd4079 100644
--- a/src/main/java/org/openelisglobal/dataexchange/order/controller/StudyElectronicOrdersController.java
+++ b/src/main/java/org/openelisglobal/dataexchange/order/controller/StudyElectronicOrdersController.java
@@ -118,8 +118,6 @@ private ElectronicOrderDisplayItem convertToDisplayItem(ElectronicOrder electron
Patient patient = electronicOrder.getPatient();
if (patient != null) {
displayItem.setSubjectNumber(patientService.getSubjectNumber(patient));
- displayItem.setPatientLastName(patient.getPerson().getLastName());
- displayItem.setPatientFirstName(patient.getPerson().getFirstName());
displayItem.setPatientNationalId(patient.getNationalId());
displayItem.setBirthDate(patient.getBirthDateForDisplay());
displayItem.setGender(patient.getGender());
@@ -140,8 +138,6 @@ private ElectronicOrderDisplayItem convertToDisplayItem(ElectronicOrder electron
if (sample != null) {
displayItem.setLabNumber(sample.getAccessionNumber());
}
-
- if (useAllInfo) {
IGenericClient fhirClient = fhirUtil.getFhirClient(fhirConfig.getLocalFhirStorePath());
ServiceRequest serviceRequest = fhirClient.read().resource(ServiceRequest.class)
@@ -165,20 +161,6 @@ private ElectronicOrderDisplayItem convertToDisplayItem(ElectronicOrder electron
if (test != null) {
displayItem.setTestName(test.getLocalizedTestName().getLocalizedValue());
}
-
- String patientUuid = serviceRequest.getSubject().getReferenceElement().getIdPart();
- org.hl7.fhir.r4.model.Patient fhirPatient = fhirClient.read()
- .resource(org.hl7.fhir.r4.model.Patient.class).withId(patientUuid).execute();
-
- for (Identifier identifier : fhirPatient.getIdentifier()) {
- if ("passport".equals(identifier.getSystem())) {
- displayItem.setPassportNumber(identifier.getId());
- }
- if ((fhirConfig.getOeFhirSystem() + "/pat_subjectNumber").equals(identifier.getSystem())) {
- displayItem.setSubjectNumber(identifier.getId());
- }
- }
- }
} catch (ResourceNotFoundException e) {
String errorMsg = "error in data collection - FHIR resource not found";
displayItem.setWarnings(Arrays.asList(errorMsg));
diff --git a/src/main/java/org/openelisglobal/dataexchange/order/valueholder/ElectronicOrderDisplayItem.java b/src/main/java/org/openelisglobal/dataexchange/order/valueholder/ElectronicOrderDisplayItem.java
index 6f4b22705d..f42274ab7c 100644
--- a/src/main/java/org/openelisglobal/dataexchange/order/valueholder/ElectronicOrderDisplayItem.java
+++ b/src/main/java/org/openelisglobal/dataexchange/order/valueholder/ElectronicOrderDisplayItem.java
@@ -26,6 +26,8 @@ public class ElectronicOrderDisplayItem {
private String electronicOrderId;
private String externalOrderId;
+
+ private String patientUpid;
private String requestDateDisplay;
@@ -192,4 +194,13 @@ public OrderPriority getPriority() {
public void setPriority(OrderPriority priority) {
this.priority = priority;
}
+
+ public String getPatientUpid() {
+ return patientUpid;
+ }
+
+ public void setPatientUpid(String patientUpid) {
+ this.patientUpid = patientUpid;
+ }
+
}
diff --git a/src/main/java/org/openelisglobal/dictionary/ObservationHistoryList.java b/src/main/java/org/openelisglobal/dictionary/ObservationHistoryList.java
index 25b4659cf6..509271a162 100644
--- a/src/main/java/org/openelisglobal/dictionary/ObservationHistoryList.java
+++ b/src/main/java/org/openelisglobal/dictionary/ObservationHistoryList.java
@@ -23,6 +23,7 @@
import java.util.List;
import java.util.Map;
+import org.apache.commons.lang3.ObjectUtils;
import org.openelisglobal.common.valueholder.BaseObject;
import org.openelisglobal.dictionary.service.DictionaryService;
import org.openelisglobal.dictionary.valueholder.Dictionary;
@@ -81,7 +82,9 @@ private static List copyListAndDeleteEntry(List oldList,
private static List copyListAndAddEntry(List oldList, Dictionary entryToAdd) {
List newList = new ArrayList<>(oldList);
- newList.add(entryToAdd);
+ if(ObjectUtils.isNotEmpty(entryToAdd)) {
+ newList.add(entryToAdd);
+ }
return newList;
}
@@ -92,7 +95,9 @@ private static List copyListAndAddEntry(List oldList, Di
public static final Map MAP = new HashMap<>();
static {
for (ObservationHistoryList ds : ObservationHistoryList.values()) {
- MAP.put(ds.name(), ds);
+ if(ObjectUtils.isNotEmpty(ds)) {
+ MAP.put(ds.name(), ds);
+ }
}
}
diff --git a/src/main/java/org/openelisglobal/observationhistory/daoimpl/ObservationHistoryDAOImpl.java b/src/main/java/org/openelisglobal/observationhistory/daoimpl/ObservationHistoryDAOImpl.java
index 5db54a593a..6593f6969c 100644
--- a/src/main/java/org/openelisglobal/observationhistory/daoimpl/ObservationHistoryDAOImpl.java
+++ b/src/main/java/org/openelisglobal/observationhistory/daoimpl/ObservationHistoryDAOImpl.java
@@ -224,6 +224,6 @@ protected LIMSRuntimeException createAndLogException(String methodName, Exceptio
@Override
@Transactional(readOnly = true)
public ObservationHistory getById(ObservationHistory observation) throws LIMSRuntimeException {
- return get(observation.getId()).get();
+ return get(observation.getId()).orElse(null);
}
}
diff --git a/src/main/java/org/openelisglobal/observationhistory/service/ObservationHistoryServiceImpl.java b/src/main/java/org/openelisglobal/observationhistory/service/ObservationHistoryServiceImpl.java
index 7b4017ac39..a88572caca 100644
--- a/src/main/java/org/openelisglobal/observationhistory/service/ObservationHistoryServiceImpl.java
+++ b/src/main/java/org/openelisglobal/observationhistory/service/ObservationHistoryServiceImpl.java
@@ -29,7 +29,10 @@ public enum ObservationType {
REQUEST_DATE("requestDate"), NEXT_VISIT_DATE("nextVisitDate"), REFERRING_SITE("referringSite"),
REFERRERS_PATIENT_ID("referrersPatientId"), BILLING_REFERENCE_NUMBER("billingRefNumber"),
TEST_LOCATION_CODE("testLocationCode"), TEST_LOCATION_CODE_OTHER("testLocationCodeOther"), PROGRAM("program"),
- HIV_STATUS("hivStatus"),VL_PREGNANCY("vlPregnancy"),VL_SUCKLE("vlSuckle");
+ HIV_STATUS("hivStatus"),VL_PREGNANCY("vlPregnancy"),VL_SUCKLE("vlSuckle"),
+ TB_ORDER_REASON("TbOrderReason"),TB_DIAGNOSTIC_REASON("TbDiagnosticReason"),TB_FOLLOWUP_REASON("TbFollowupReason"),
+ TB_FOLLOWUP_PERIOD_LINE1("TbFollowupReasonPeriodLine1"),TB_FOLLOWUP_PERIOD_LINE2("TbFollowupReasonPeriodLine2"),TB_ANALYSIS_METHOD("TbAnalysisMethod"),
+ TB_SAMPLE_ASPECT("TbSampleAspects");
private String dbName;
diff --git a/src/main/java/org/openelisglobal/organization/util/OrganizationTypeList.java b/src/main/java/org/openelisglobal/organization/util/OrganizationTypeList.java
index 1b75425b40..f5a2c67ed2 100644
--- a/src/main/java/org/openelisglobal/organization/util/OrganizationTypeList.java
+++ b/src/main/java/org/openelisglobal/organization/util/OrganizationTypeList.java
@@ -91,15 +91,14 @@ private OrganizationTypeList(String orderBy, Comparator comparator
* or an empty list.
*/
public final List getList() {
- List all;
+ List all = SpringContext.getBean(OrganizationService.class).getOrganizationsByTypeName(orderBy, name);
try {
- all = SpringContext.getBean(OrganizationService.class).getOrganizationsByTypeName(orderBy, name);
if (comparator != null) {
Collections.sort(all, comparator);
}
} catch (RuntimeException e) {
LogEvent.logError(e);
- all = new ArrayList<>();
+ //all = new ArrayList<>(); must not return empty List if sorting fails
}
return all;
}
diff --git a/src/main/java/org/openelisglobal/patient/controller/BasePatientEntryByProject.java b/src/main/java/org/openelisglobal/patient/controller/BasePatientEntryByProject.java
index de0b4b81f8..b11c65abbc 100644
--- a/src/main/java/org/openelisglobal/patient/controller/BasePatientEntryByProject.java
+++ b/src/main/java/org/openelisglobal/patient/controller/BasePatientEntryByProject.java
@@ -30,7 +30,7 @@ public abstract class BasePatientEntryByProject extends BaseController {
private static final String[] BASE_ALLOWED_FIELDS = new String[] { "patientUpdateStatus", "patientPK", "samplePK",
"receivedDateForDisplay", "receivedTimeForDisplay", "interviewDate", "interviewTime", "subjectNumber",
- "siteSubjectNumber", "labNo", "centerName", "centerCode", "lastName", "firstName", "gender",
+ "siteSubjectNumber", "labNo", "centerName", "centerCode", "lastName", "firstName", "gender","upidCode",
"birthDateForDisplay", "observations.projectFormName", "observations.hivStatus",
"observations.educationLevel", "observations.maritalStatus", "observations.nationality",
"observations.nationalityOther", "observations.legalResidence", "observations.nameOfDoctor",
@@ -38,7 +38,7 @@ public abstract class BasePatientEntryByProject extends BaseController {
"observations.arvProphylaxisBenefit", "observations.arvProphylaxis", "observations.currentARVTreatment",
"observations.priorARVTreatment", "observations.priorARVTreatmentINNsList*",
"observations.cotrimoxazoleTreatment", "observations.aidsStage", "observations.anyCurrentDiseases",
- "ProjectData.dbsTaken","ProjectData.dbsvlTaken", "ProjectData.pscvlTaken","ProjectData.viralLoadTest",
+ "ProjectData.dbsTaken","ProjectData.dbsvlTaken", "ProjectData.pscvlTaken","ProjectData.edtaTubeTaken","ProjectData.viralLoadTest",
"observations.currentDiseases", "observations.currentDiseasesValue", "observations.currentOITreatment",
"observations.patientWeight", "observations.karnofskyScore", "observations.underInvestigation",
"projectData.underInvestigationNote",
@@ -67,7 +67,8 @@ public abstract class BasePatientEntryByProject extends BaseController {
"observations.demandcd4Date", "observations.vlBenefit", "observations.priorVLLab",
"observations.priorVLValue", "observations.priorVLDate",
//
- "observations.service", "observations.hospitalPatient", "observations.reason" };
+ "observations.service", "observations.hospitalPatient", "observations.reason", "ProjectData.asanteTest",
+ "ProjectData.plasmaTaken", "ProjectData.serumTaken" };
protected List getBasePatientEntryByProjectFields() {
List allowedFields = new ArrayList<>();
diff --git a/src/main/java/org/openelisglobal/patient/controller/PatientEditByProjectController.java b/src/main/java/org/openelisglobal/patient/controller/PatientEditByProjectController.java
index f3af47a090..3996be2eae 100644
--- a/src/main/java/org/openelisglobal/patient/controller/PatientEditByProjectController.java
+++ b/src/main/java/org/openelisglobal/patient/controller/PatientEditByProjectController.java
@@ -115,7 +115,7 @@ protected String findLocalForward(String forward) {
} else if (FWD_FAIL.equals(forward)) {
return "redirect:/Dashboard";
} else if (FWD_SUCCESS_INSERT.equals(forward)) {
- return "redirect:/PatientEditByProject";
+ return "redirect:/PatientEditByProject?type=readwrite";
} else if (FWD_FAIL_INSERT.equals(forward)) {
return "patientEditByProjectDefinition";
} else {
diff --git a/src/main/java/org/openelisglobal/patient/form/PatientEntryByProjectForm.java b/src/main/java/org/openelisglobal/patient/form/PatientEntryByProjectForm.java
index 4bd5b1142d..3139ce5e4c 100644
--- a/src/main/java/org/openelisglobal/patient/form/PatientEntryByProjectForm.java
+++ b/src/main/java/org/openelisglobal/patient/form/PatientEntryByProjectForm.java
@@ -10,6 +10,7 @@
import org.openelisglobal.common.provider.validation.AccessionNumberValidatorFactory.AccessionFormat;
import org.openelisglobal.common.util.validator.CustomDateValidator.DateRelation;
import org.openelisglobal.common.validator.ValidationHelper;
+import org.openelisglobal.dataexchange.order.valueholder.ElectronicOrder;
import org.openelisglobal.dictionary.ObservationHistoryList;
import org.openelisglobal.organization.util.OrganizationTypeList;
import org.openelisglobal.patient.action.IPatientUpdate.PatientUpdateStatus;
@@ -23,252 +24,290 @@
import org.openelisglobal.validation.constraintvalidator.NameValidator.NameType;
public class PatientEntryByProjectForm extends BaseForm implements IAccessionerForm {
- // for display
- private Map formLists;
+ // for display
+ private Map formLists;
- // for display
- private Map dictionaryLists;
+ // for display
+ private Map dictionaryLists;
- // for display
- private Map organizationTypeLists;
+ // for display
+ private Map organizationTypeLists;
- @Pattern(regexp = ValidationHelper.ID_REGEX)
- private String patientPK = "";
+ @Pattern(regexp = ValidationHelper.ID_REGEX)
+ private String patientPK = "";
- @Pattern(regexp = ValidationHelper.ID_REGEX)
- private String samplePK = "";
+ @Pattern(regexp = ValidationHelper.ID_REGEX)
+ private String samplePK = "";
- @ValidDate(relative = DateRelation.PAST)
- private String interviewDate = "";
+ @ValidDate(relative = DateRelation.PAST)
+ private String interviewDate = "";
- @ValidTime
- private String interviewTime = "";
+ @ValidTime
+ private String interviewTime = "";
- @ValidDate(relative = DateRelation.PAST)
- private String receivedDateForDisplay = "";
+ @ValidDate(relative = DateRelation.PAST)
+ private String receivedDateForDisplay = "";
- @ValidTime
- private String receivedTimeForDisplay = "";
+ @ValidTime
+ private String receivedTimeForDisplay = "";
- @ValidDate(relative = DateRelation.TODAY)
- private String currentDate = "";
+ @ValidDate(relative = DateRelation.TODAY)
+ private String currentDate = "";
- private PatientUpdateStatus patientUpdateStatus = PatientUpdateStatus.ADD;
+ private PatientUpdateStatus patientUpdateStatus = PatientUpdateStatus.ADD;
- @Pattern(regexp = ValidationHelper.PATIENT_ID_REGEX)
- private String subjectNumber = "";
+ @Pattern(regexp = ValidationHelper.PATIENT_ID_REGEX)
+ private String subjectNumber = "";
- @Pattern(regexp = ValidationHelper.PATIENT_ID_REGEX)
- private String siteSubjectNumber = "";
+ @Pattern(regexp = ValidationHelper.PATIENT_ID_REGEX)
+ private String siteSubjectNumber = "";
+
+ @Pattern(regexp = ValidationHelper.PATIENT_ID_REGEX)
+ private String upidCode = "";
@ValidAccessionNumber(format = AccessionFormat.PROGRAMNUM)
private String labNo = "";
- @Pattern(regexp = ValidationHelper.ID_REGEX)
- private String centerName = "";
+ @Pattern(regexp = ValidationHelper.ID_REGEX)
+ private String centerName = "";
- @Min(0)
- private Integer centerCode;
+ @Min(0)
+ private Integer centerCode;
- @ValidName(nameType = NameType.FIRST_NAME)
- private String firstName = "";
+ @ValidName(nameType = NameType.FIRST_NAME)
+ private String firstName = "";
- @ValidName(nameType = NameType.LAST_NAME)
- private String lastName = "";
+ @ValidName(nameType = NameType.LAST_NAME)
+ private String lastName = "";
- @Pattern(regexp = ValidationHelper.GENDER_REGEX)
- private String gender = "";
+ @Pattern(regexp = ValidationHelper.GENDER_REGEX)
+ private String gender = "";
- @ValidDate(relative = DateRelation.PAST)
- private String birthDateForDisplay = "";
+ @ValidDate(relative = DateRelation.PAST)
+ private String birthDateForDisplay = "";
- @Valid
- private ObservationData observations;
+ @Valid
+ private ObservationData observations;
- @Valid
- private ProjectData projectData;
+ @Valid
+ private ProjectData projectData;
- public PatientEntryByProjectForm() {
- setFormName("patientEntryByProjectForm");
- }
+ @Valid
+ private ElectronicOrder electronicOrder;
- public Map getFormLists() {
- return formLists;
- }
+ @Pattern(regexp = ValidationHelper.PATIENT_ID_REGEX)
+ private String patientFhirUuid;
- public void setFormLists(Map formLists) {
- this.formLists = formLists;
- }
+ public PatientEntryByProjectForm() {
+ setFormName("patientEntryByProjectForm");
+ }
- public Map getDictionaryLists() {
- return dictionaryLists;
- }
+ public Map getFormLists() {
+ return formLists;
+ }
- public void setDictionaryLists(Map dictionaryLists) {
- this.dictionaryLists = dictionaryLists;
- }
+ public void setFormLists(Map formLists) {
+ this.formLists = formLists;
+ }
- public Map getOrganizationTypeLists() {
- return organizationTypeLists;
- }
+ public Map getDictionaryLists() {
+ return dictionaryLists;
+ }
- public void setOrganizationTypeLists(Map organizationTypeLists) {
- this.organizationTypeLists = organizationTypeLists;
- }
+ public void setDictionaryLists(Map dictionaryLists) {
+ this.dictionaryLists = dictionaryLists;
+ }
- public String getPatientPK() {
- return patientPK;
- }
+ public Map getOrganizationTypeLists() {
+ return organizationTypeLists;
+ }
- public void setPatientPK(String patientPK) {
- this.patientPK = patientPK;
- }
+ public void setOrganizationTypeLists(Map organizationTypeLists) {
+ this.organizationTypeLists = organizationTypeLists;
+ }
- public String getSamplePK() {
- return samplePK;
- }
+ public String getPatientPK() {
+ return patientPK;
+ }
- public void setSamplePK(String samplePK) {
- this.samplePK = samplePK;
- }
+ public void setPatientPK(String patientPK) {
+ this.patientPK = patientPK;
+ }
- public String getInterviewDate() {
- return interviewDate;
- }
+ public String getSamplePK() {
+ return samplePK;
+ }
- public void setInterviewDate(String interviewDate) {
- this.interviewDate = interviewDate;
- }
+ public void setSamplePK(String samplePK) {
+ this.samplePK = samplePK;
+ }
- public String getInterviewTime() {
- return interviewTime;
- }
+ public String getInterviewDate() {
+ return interviewDate;
+ }
- public void setInterviewTime(String interviewTime) {
- this.interviewTime = interviewTime;
- }
+ public void setInterviewDate(String interviewDate) {
+ this.interviewDate = interviewDate;
+ }
- public String getReceivedDateForDisplay() {
- return receivedDateForDisplay;
- }
+ public String getInterviewTime() {
+ return interviewTime;
+ }
- public void setReceivedDateForDisplay(String receivedDateForDisplay) {
- this.receivedDateForDisplay = receivedDateForDisplay;
- }
+ public void setInterviewTime(String interviewTime) {
+ this.interviewTime = interviewTime;
+ }
- public String getReceivedTimeForDisplay() {
- return receivedTimeForDisplay;
- }
+ public String getReceivedDateForDisplay() {
+ return receivedDateForDisplay;
+ }
- public void setReceivedTimeForDisplay(String receivedTimeForDisplay) {
- this.receivedTimeForDisplay = receivedTimeForDisplay;
- }
+ public void setReceivedDateForDisplay(String receivedDateForDisplay) {
+ this.receivedDateForDisplay = receivedDateForDisplay;
+ }
- public String getCurrentDate() {
- return currentDate;
- }
+ public String getReceivedTimeForDisplay() {
+ return receivedTimeForDisplay;
+ }
- public void setCurrentDate(String currentDate) {
- this.currentDate = currentDate;
- }
+ public void setReceivedTimeForDisplay(String receivedTimeForDisplay) {
+ this.receivedTimeForDisplay = receivedTimeForDisplay;
+ }
- public PatientUpdateStatus getPatientUpdateStatus() {
- return patientUpdateStatus;
- }
+ public String getCurrentDate() {
+ return currentDate;
+ }
- public void setPatientUpdateStatus(PatientUpdateStatus patientUpdateStatus) {
- this.patientUpdateStatus = patientUpdateStatus;
- }
-
- public String getSubjectNumber() {
- return subjectNumber;
- }
-
- public void setSubjectNumber(String subjectNumber) {
- this.subjectNumber = subjectNumber;
- }
-
- public String getSiteSubjectNumber() {
- return siteSubjectNumber;
- }
-
- public void setSiteSubjectNumber(String siteSubjectNumber) {
- this.siteSubjectNumber = siteSubjectNumber;
- }
-
- public String getLabNo() {
- return labNo;
- }
-
- public void setLabNo(String labNo) {
- this.labNo = labNo;
- }
-
- public String getCenterName() {
- return centerName;
- }
-
- public void setCenterName(String centerName) {
- this.centerName = centerName;
- }
-
- public Integer getCenterCode() {
- return centerCode;
- }
-
- public void setCenterCode(Integer centerCode) {
- this.centerCode = centerCode;
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public String getGender() {
- return gender;
- }
-
- public void setGender(String gender) {
- this.gender = gender;
- }
-
- public String getBirthDateForDisplay() {
- return birthDateForDisplay;
- }
-
- public void setBirthDateForDisplay(String birthDateForDisplay) {
- this.birthDateForDisplay = birthDateForDisplay;
- }
-
- @Override
- public ObservationData getObservations() {
- return observations;
- }
-
- @Override
- public void setObservations(ObservationData observations) {
- this.observations = observations;
- }
-
- @Override
- public ProjectData getProjectData() {
- return projectData;
- }
-
- @Override
- public void setProjectData(ProjectData projectData) {
- this.projectData = projectData;
- }
+ public void setCurrentDate(String currentDate) {
+ this.currentDate = currentDate;
+ }
+
+ public PatientUpdateStatus getPatientUpdateStatus() {
+ return patientUpdateStatus;
+ }
+
+ public void setPatientUpdateStatus(PatientUpdateStatus patientUpdateStatus) {
+ this.patientUpdateStatus = patientUpdateStatus;
+ }
+
+ public String getSubjectNumber() {
+ return subjectNumber;
+ }
+
+ public void setSubjectNumber(String subjectNumber) {
+ this.subjectNumber = subjectNumber;
+ }
+
+ public String getSiteSubjectNumber() {
+ return siteSubjectNumber;
+ }
+
+ public void setSiteSubjectNumber(String siteSubjectNumber) {
+ this.siteSubjectNumber = siteSubjectNumber;
+ }
+
+ public String getLabNo() {
+ return labNo;
+ }
+
+ public void setLabNo(String labNo) {
+ this.labNo = labNo;
+ }
+
+ public String getCenterName() {
+ return centerName;
+ }
+
+ public void setCenterName(String centerName) {
+ this.centerName = centerName;
+ }
+
+ public Integer getCenterCode() {
+ return centerCode;
+ }
+
+ public void setCenterCode(Integer centerCode) {
+ this.centerCode = centerCode;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public String getGender() {
+ return gender;
+ }
+
+ public void setGender(String gender) {
+ this.gender = gender;
+ }
+
+ public String getBirthDateForDisplay() {
+ return birthDateForDisplay;
+ }
+
+ public void setBirthDateForDisplay(String birthDateForDisplay) {
+ this.birthDateForDisplay = birthDateForDisplay;
+ }
+
+ @Override
+ public ObservationData getObservations() {
+ return observations;
+ }
+
+ @Override
+ public void setObservations(ObservationData observations) {
+ this.observations = observations;
+ }
+
+ @Override
+ public ProjectData getProjectData() {
+ return projectData;
+ }
+
+ @Override
+ public void setProjectData(ProjectData projectData) {
+ this.projectData = projectData;
+ }
+
+ @Override
+ public ElectronicOrder getElectronicOrder() {
+ return electronicOrder;
+ }
+
+ @Override
+ public void setElectronicOrder(ElectronicOrder electronicOrder) {
+ this.electronicOrder = electronicOrder;
+ }
+
+ @Override
+ public String getPatientFhirUuid() {
+ return patientFhirUuid;
+ }
+
+ @Override
+ public void setPatientFhirUuid(String patientFhirUuid) {
+ this.patientFhirUuid = patientFhirUuid;
+ }
+
+ public String getUpidCode() {
+ return upidCode;
+ }
+
+ public void setUpidCode(String upidCode) {
+ this.upidCode = upidCode;
+ }
+
}
diff --git a/src/main/java/org/openelisglobal/patient/saving/Accessioner.java b/src/main/java/org/openelisglobal/patient/saving/Accessioner.java
index 7e861c86cf..297e931d74 100644
--- a/src/main/java/org/openelisglobal/patient/saving/Accessioner.java
+++ b/src/main/java/org/openelisglobal/patient/saving/Accessioner.java
@@ -36,8 +36,10 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.UUID;
import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.validator.GenericValidator;
import org.openelisglobal.analysis.service.AnalysisService;
import org.openelisglobal.analysis.valueholder.Analysis;
@@ -331,6 +333,7 @@ public String save() throws IllegalAccessException, LIMSRuntimeException, Invoca
populateSampleData();
populateSampleHuman();
populateObservationHistory();
+ updateSampleWithElectronicEOrders();
// all of the following methods are assumed to only write when
// necessary
@@ -818,6 +821,9 @@ protected void populatePatientData()
patientInDB.setNationalId(convertEmptyToNull(form.getSubjectNumber()));
patientInDB.setExternalId(convertEmptyToNull(form.getSiteSubjectNumber()));
+ if (ObjectUtils.isNotEmpty(form.getPatientFhirUuid())) {
+ patientInDB.setFhirUuid(UUID.fromString(form.getPatientFhirUuid()));
+ }
populatePatientBirthDate(form.getBirthDateForDisplay());
projectData = form.getProjectData();
@@ -1002,6 +1008,7 @@ private Map findExistingSampleTypeItems() {
*
* @
*/
+ @Transactional
public void completeSample() {
if (isAllAnalysisDone() && !SpringContext.getBean(IStatusService.class)
.getStatusID(OrderStatus.NonConforming_depricated).equals(sample.getStatus())) {
@@ -1104,6 +1111,10 @@ protected void persistSampleProject() throws LIMSRuntimeException {
*/
protected void persistSampleHuman() {
if (sampleHuman != null) {
+ SampleHuman otherSampleHuman = sampleHumanService.getMatch("sampleId", sample.getId()).orElse(null);
+ if (ObjectUtils.isNotEmpty(otherSampleHuman)) {
+ sampleHuman = otherSampleHuman;
+ }
sampleHuman.setPatientId(patientInDB.getId());
sampleHuman.setSampleId(sample.getId());
// we do not store any doctor name as a provider in SampleHuman
@@ -1254,19 +1265,25 @@ protected void persistRecordStatus() {
}
protected void deleteOldPatient() {
- if (patientToDelete != null) {
- List oldIdentities = identityService
- .getPatientIdentitiesForPatient(patientToDelete.getId());
- for (PatientIdentity listIdentity : oldIdentities) {
- identityService.delete(listIdentity.getId(), sysUserId);
- }
- Person personToDelete = patientToDelete.getPerson();
- patientToDelete.setSysUserId(sysUserId);
- patientService.deleteAll(Arrays.asList(patientToDelete));
- personToDelete.setSysUserId(sysUserId);
- personService.deleteAll(Arrays.asList(personToDelete));
- }
- }
+ if (patientToDelete != null) {
+ try {
+
+ List oldIdentities = identityService
+ .getPatientIdentitiesForPatient(patientToDelete.getId());
+ for (PatientIdentity listIdentity : oldIdentities) {
+ identityService.delete(listIdentity.getId(), sysUserId);
+ }
+ Person personToDelete = patientToDelete.getPerson();
+ patientToDelete.setSysUserId(sysUserId);
+ patientService.deleteAll(Arrays.asList(patientToDelete));
+ personToDelete.setSysUserId(sysUserId);
+ personService.deleteAll(Arrays.asList(personToDelete));
+
+ } catch (Exception e) {
+ LogEvent.logError(e);
+ }
+ }
+ }
protected List getObservationHistories() {
return observationHistories;
@@ -1343,13 +1360,24 @@ public void logAndAddMessage(String methodName, String messageKey, Exception e)
//
// }
- private static String getObservationHistoryTypeId(ObservationHistoryTypeService ohtService, String name) {
- ObservationHistoryType oht;
- oht = ohtService.getByName(name);
- if (oht != null) {
- return oht.getId();
- }
-
- return null;
- }
+ private static String getObservationHistoryTypeId(ObservationHistoryTypeService ohtService, String name) {
+ ObservationHistoryType oht;
+ oht = ohtService.getByName(name);
+ if (oht != null) {
+ return oht.getId();
+ }
+
+ return null;
+ }
+
+ private void updateSampleWithElectronicEOrders() {
+ try {
+ if (ObjectUtils.isNotEmpty(projectFormMapper.getForm().getElectronicOrder())) {
+ sample.setReferringId(projectFormMapper.getForm().getElectronicOrder().getExternalId());
+ sample.setClinicalOrderId(projectFormMapper.getForm().getElectronicOrder().getId());
+ }
+ } catch (Exception e) {
+ LogEvent.logError(e);
+ }
+ }
}
diff --git a/src/main/java/org/openelisglobal/patient/validator/PatientEntryByProjectFormValidator.java b/src/main/java/org/openelisglobal/patient/validator/PatientEntryByProjectFormValidator.java
index 1e340517b0..18ce985e4e 100644
--- a/src/main/java/org/openelisglobal/patient/validator/PatientEntryByProjectFormValidator.java
+++ b/src/main/java/org/openelisglobal/patient/validator/PatientEntryByProjectFormValidator.java
@@ -9,152 +9,175 @@
@Component
public class PatientEntryByProjectFormValidator implements Validator {
- @Override
- public boolean supports(Class> clazz) {
- return PatientEntryByProjectForm.class.isAssignableFrom(clazz);
- }
+ @Override
+ public boolean supports(Class> clazz) {
+ return PatientEntryByProjectForm.class.isAssignableFrom(clazz);
+ }
- @Override
- public void validate(Object target, Errors errors) {
- PatientEntryByProjectForm form = (PatientEntryByProjectForm) target;
+ @Override
+ public void validate(Object target, Errors errors) {
+ PatientEntryByProjectForm form = (PatientEntryByProjectForm) target;
- if ("InitialARV_Id".equals(form.getObservations().getProjectFormName())) {
- validateInitialARVForm(form, errors);
- } else if ("FollowUpARV_Id".equals(form.getObservations().getProjectFormName())) {
- validateFollowUpARVForm(form, errors);
- } else if ("RTN_Id".equals(form.getObservations().getProjectFormName())) {
- validateRTNForm(form, errors);
- } else if ("VL_Id".equals(form.getObservations().getProjectFormName())) {
- validateVLForm(form, errors);
- } else if ("EID_Id".equals(form.getObservations().getProjectFormName())) {
- validateEIDForm(form, errors);
- } else {
- errors.reject("error.formname.unrecognized", "The provided form name is unrecognized");
- }
- }
+ if ("InitialARV_Id".equals(form.getObservations().getProjectFormName())) {
+ validateInitialARVForm(form, errors);
+ } else if ("FollowUpARV_Id".equals(form.getObservations().getProjectFormName())) {
+ validateFollowUpARVForm(form, errors);
+ } else if ("RTN_Id".equals(form.getObservations().getProjectFormName())) {
+ validateRTNForm(form, errors);
+ } else if ("VL_Id".equals(form.getObservations().getProjectFormName())) {
+ validateVLForm(form, errors);
+ } else if ("EID_Id".equals(form.getObservations().getProjectFormName())) {
+ validateEIDForm(form, errors);
+ } else if ("Recency_Id".equals(form.getObservations().getProjectFormName())) {
+ validateRecencyForm(form, errors);
+ } else {
+ errors.reject("error.formname.unrecognized", "The provided form name is unrecognized");
+ }
+ }
- private void validateEIDForm(PatientEntryByProjectForm form, Errors errors) {
- ValidationHelper.validateFieldRequired(form.getReceivedDateForDisplay(), "receivedDateForDisplay", errors);
+ private void validateEIDForm(PatientEntryByProjectForm form, Errors errors) {
+ ValidationHelper.validateFieldRequired(form.getReceivedDateForDisplay(), "receivedDateForDisplay", errors);
- ValidationHelper.validateFieldRequired(form.getInterviewDate(), "interviewDate", errors);
+ ValidationHelper.validateFieldRequired(form.getInterviewDate(), "interviewDate", errors);
- ValidationHelper.validateFieldRequired(form.getProjectData().getEIDSiteName(), "ProjectData.EIDSiteName",
- errors);
+ ValidationHelper.validateFieldRequired(form.getProjectData().getEIDSiteName(), "ProjectData.EIDSiteName",
+ errors);
- ValidationHelper.validateFieldRequired(form.getProjectData().getEIDsiteCode(), "ProjectData.EIDSiteCode",
- errors);
+ ValidationHelper.validateFieldRequired(form.getProjectData().getEIDsiteCode(), "ProjectData.EIDSiteCode",
+ errors);
- if (org.apache.commons.validator.GenericValidator.isBlankOrNull(form.getSubjectNumber())
- && org.apache.commons.validator.GenericValidator.isBlankOrNull(form.getSiteSubjectNumber())) {
- ValidationHelper.validateFieldRequired(form.getSubjectNumber(), "subjectNumber", errors);
+ if (org.apache.commons.validator.GenericValidator.isBlankOrNull(form.getSubjectNumber())
+ && org.apache.commons.validator.GenericValidator.isBlankOrNull(form.getSiteSubjectNumber())) {
+ ValidationHelper.validateFieldRequired(form.getSubjectNumber(), "subjectNumber", errors);
- ValidationHelper.validateFieldRequired(form.getSiteSubjectNumber(), "siteSubjectNumber", errors);
- }
+ ValidationHelper.validateFieldRequired(form.getSiteSubjectNumber(), "siteSubjectNumber", errors);
+ }
- ValidationHelper.validateFieldRequired(form.getLabNo(), "labNo", errors);
+ ValidationHelper.validateFieldRequired(form.getLabNo(), "labNo", errors);
- ValidationHelper.validateFieldRequired(form.getGender(), "gender", errors);
+ ValidationHelper.validateFieldRequired(form.getGender(), "gender", errors);
- ValidationHelper.validateFieldRequired(form.getBirthDateForDisplay(), "birthDateForDisplay", errors);
+ ValidationHelper.validateFieldRequired(form.getBirthDateForDisplay(), "birthDateForDisplay", errors);
- }
+ }
- private void validateVLForm(PatientEntryByProjectForm form, Errors errors) {
+ private void validateVLForm(PatientEntryByProjectForm form, Errors errors) {
// ValidationHelper.validateFieldRequired(form.getCenterName(), "centerName", errors);
//
// if (form.getCenterCode() == null) {
// errors.rejectValue("centerCode", "field.error.required");
// }
- ValidationHelper.validateFieldRequired(form.getReceivedDateForDisplay(), "receivedDateForDisplay", errors);
+ ValidationHelper.validateFieldRequired(form.getReceivedDateForDisplay(), "receivedDateForDisplay", errors);
- ValidationHelper.validateFieldRequired(form.getInterviewDate(), "interviewDate", errors);
+ ValidationHelper.validateFieldRequired(form.getInterviewDate(), "interviewDate", errors);
- if (org.apache.commons.validator.GenericValidator.isBlankOrNull(form.getSubjectNumber())
- && org.apache.commons.validator.GenericValidator.isBlankOrNull(form.getSiteSubjectNumber())) {
- ValidationHelper.validateFieldRequired(form.getSubjectNumber(), "subjectNumber", errors);
+ if (org.apache.commons.validator.GenericValidator.isBlankOrNull(form.getSubjectNumber())
+ && org.apache.commons.validator.GenericValidator.isBlankOrNull(form.getSiteSubjectNumber())) {
+ ValidationHelper.validateFieldRequired(form.getSubjectNumber(), "subjectNumber", errors);
- ValidationHelper.validateFieldRequired(form.getSiteSubjectNumber(), "siteSubjectNumber", errors);
- }
+ ValidationHelper.validateFieldRequired(form.getSiteSubjectNumber(), "siteSubjectNumber", errors);
+ }
- ValidationHelper.validateFieldRequired(form.getLabNo(), "labNo", errors);
+ ValidationHelper.validateFieldRequired(form.getLabNo(), "labNo", errors);
- ValidationHelper.validateFieldRequired(form.getBirthDateForDisplay(), "birthDateForDisplay", errors);
+ ValidationHelper.validateFieldRequired(form.getBirthDateForDisplay(), "birthDateForDisplay", errors);
- ValidationHelper.validateFieldRequired(form.getGender(), "gender", errors);
+ ValidationHelper.validateFieldRequired(form.getGender(), "gender", errors);
- }
+ }
- private void validateRTNForm(PatientEntryByProjectForm form, Errors errors) {
- ValidationHelper.validateFieldRequired(form.getReceivedDateForDisplay(), "receivedDateForDisplay", errors);
+ private void validateRecencyForm(PatientEntryByProjectForm form, Errors errors) {
+// ValidationHelper.validateFieldRequired(form.getCenterName(), "centerName", errors);
+//
+// if (form.getCenterCode() == null) {
+// errors.rejectValue("centerCode", "field.error.required");
+// }
+
+ ValidationHelper.validateFieldRequired(form.getReceivedDateForDisplay(), "receivedDateForDisplay", errors);
+
+ ValidationHelper.validateFieldRequired(form.getInterviewDate(), "interviewDate", errors);
+
+ ValidationHelper.validateFieldRequired(form.getSiteSubjectNumber(), "siteSubjectNumber", errors);
+
+ ValidationHelper.validateFieldRequired(form.getLabNo(), "labNo", errors);
+
+ ValidationHelper.validateFieldRequired(form.getBirthDateForDisplay(), "birthDateForDisplay", errors);
+
+ ValidationHelper.validateFieldRequired(form.getGender(), "gender", errors);
+
+ }
+
+ private void validateRTNForm(PatientEntryByProjectForm form, Errors errors) {
+ ValidationHelper.validateFieldRequired(form.getReceivedDateForDisplay(), "receivedDateForDisplay", errors);
- ValidationHelper.validateFieldRequired(form.getInterviewDate(), "interviewDate", errors);
+ ValidationHelper.validateFieldRequired(form.getInterviewDate(), "interviewDate", errors);
- ValidationHelper.validateFieldRequired(form.getObservations().getNameOfDoctor(), "observations.nameOfDoctor",
- errors);
+ ValidationHelper.validateFieldRequired(form.getObservations().getNameOfDoctor(), "observations.nameOfDoctor",
+ errors);
- if (form.getCenterCode() == null) {
- errors.rejectValue("centerCode", "field.error.required");
- }
+ if (form.getCenterCode() == null) {
+ errors.rejectValue("centerCode", "field.error.required");
+ }
- ValidationHelper.validateFieldRequired(form.getObservations().getService(), "observations.service", errors);
+ ValidationHelper.validateFieldRequired(form.getObservations().getService(), "observations.service", errors);
- ValidationHelper.validateFieldRequired(form.getGender(), "gender", errors);
+ ValidationHelper.validateFieldRequired(form.getGender(), "gender", errors);
- ValidationHelper.validateFieldRequired(form.getBirthDateForDisplay(), "birthDateForDisplay", errors);
+ ValidationHelper.validateFieldRequired(form.getBirthDateForDisplay(), "birthDateForDisplay", errors);
- ValidationHelper.validateFieldRequired(form.getLabNo(), "labNo", errors);
+ ValidationHelper.validateFieldRequired(form.getLabNo(), "labNo", errors);
- }
+ }
- private void validateFollowUpARVForm(PatientEntryByProjectForm form, Errors errors) {
- ValidationHelper.validateFieldRequired(form.getReceivedDateForDisplay(), "receivedDateForDisplay", errors);
+ private void validateFollowUpARVForm(PatientEntryByProjectForm form, Errors errors) {
+ ValidationHelper.validateFieldRequired(form.getReceivedDateForDisplay(), "receivedDateForDisplay", errors);
- ValidationHelper.validateFieldRequired(form.getInterviewDate(), "interviewDate", errors);
+ ValidationHelper.validateFieldRequired(form.getInterviewDate(), "interviewDate", errors);
- if (org.apache.commons.validator.GenericValidator.isBlankOrNull(form.getSubjectNumber())
- && org.apache.commons.validator.GenericValidator.isBlankOrNull(form.getSiteSubjectNumber())) {
- ValidationHelper.validateFieldRequired(form.getSubjectNumber(), "subjectNumber", errors);
+ if (org.apache.commons.validator.GenericValidator.isBlankOrNull(form.getSubjectNumber())
+ && org.apache.commons.validator.GenericValidator.isBlankOrNull(form.getSiteSubjectNumber())) {
+ ValidationHelper.validateFieldRequired(form.getSubjectNumber(), "subjectNumber", errors);
- ValidationHelper.validateFieldRequired(form.getSiteSubjectNumber(), "siteSubjectNumber", errors);
- }
+ ValidationHelper.validateFieldRequired(form.getSiteSubjectNumber(), "siteSubjectNumber", errors);
+ }
- ValidationHelper.validateFieldRequired(form.getLabNo(), "labNo", errors);
+ ValidationHelper.validateFieldRequired(form.getLabNo(), "labNo", errors);
- if (form.getCenterCode() == null) {
- errors.rejectValue("centerCode", "field.error.required");
- }
+ if (form.getCenterCode() == null) {
+ errors.rejectValue("centerCode", "field.error.required");
+ }
- ValidationHelper.validateFieldRequired(form.getGender(), "gender", errors);
+ ValidationHelper.validateFieldRequired(form.getGender(), "gender", errors);
- ValidationHelper.validateFieldRequired(form.getBirthDateForDisplay(), "birthDateForDisplay", errors);
+ ValidationHelper.validateFieldRequired(form.getBirthDateForDisplay(), "birthDateForDisplay", errors);
- }
+ }
- private void validateInitialARVForm(PatientEntryByProjectForm form, Errors errors) {
- ValidationHelper.validateFieldRequired(form.getReceivedDateForDisplay(), "receivedDateForDisplay", errors);
+ private void validateInitialARVForm(PatientEntryByProjectForm form, Errors errors) {
+ ValidationHelper.validateFieldRequired(form.getReceivedDateForDisplay(), "receivedDateForDisplay", errors);
- ValidationHelper.validateFieldRequired(form.getInterviewDate(), "interviewDate", errors);
+ ValidationHelper.validateFieldRequired(form.getInterviewDate(), "interviewDate", errors);
- if (org.apache.commons.validator.GenericValidator.isBlankOrNull(form.getSubjectNumber())
- && org.apache.commons.validator.GenericValidator.isBlankOrNull(form.getSiteSubjectNumber())) {
- ValidationHelper.validateFieldRequired(form.getSubjectNumber(), "subjectNumber", errors);
+ if (org.apache.commons.validator.GenericValidator.isBlankOrNull(form.getSubjectNumber())
+ && org.apache.commons.validator.GenericValidator.isBlankOrNull(form.getSiteSubjectNumber())) {
+ ValidationHelper.validateFieldRequired(form.getSubjectNumber(), "subjectNumber", errors);
- ValidationHelper.validateFieldRequired(form.getSiteSubjectNumber(), "siteSubjectNumber", errors);
- }
+ ValidationHelper.validateFieldRequired(form.getSiteSubjectNumber(), "siteSubjectNumber", errors);
+ }
- ValidationHelper.validateFieldRequired(form.getLabNo(), "labNo", errors);
+ ValidationHelper.validateFieldRequired(form.getLabNo(), "labNo", errors);
- ValidationHelper.validateFieldRequired(form.getCenterName(), "centerName", errors);
+ ValidationHelper.validateFieldRequired(form.getCenterName(), "centerName", errors);
- if (form.getCenterCode() == null) {
- errors.rejectValue("centerCode", "field.error.required");
- }
+ if (form.getCenterCode() == null) {
+ errors.rejectValue("centerCode", "field.error.required");
+ }
- ValidationHelper.validateFieldRequired(form.getGender(), "gender", errors);
+ ValidationHelper.validateFieldRequired(form.getGender(), "gender", errors);
- ValidationHelper.validateFieldRequired(form.getBirthDateForDisplay(), "birthDateForDisplay", errors);
+ ValidationHelper.validateFieldRequired(form.getBirthDateForDisplay(), "birthDateForDisplay", errors);
- }
+ }
}
diff --git a/src/main/java/org/openelisglobal/patient/valueholder/ObservationData.java b/src/main/java/org/openelisglobal/patient/valueholder/ObservationData.java
index 8bc9d05368..a43feb7db8 100644
--- a/src/main/java/org/openelisglobal/patient/valueholder/ObservationData.java
+++ b/src/main/java/org/openelisglobal/patient/valueholder/ObservationData.java
@@ -28,6 +28,7 @@
import org.openelisglobal.common.validator.ValidationHelper;
import org.openelisglobal.dictionary.ObservationHistoryList;
import org.openelisglobal.dictionary.valueholder.Dictionary;
+import org.openelisglobal.resultvalidation.form.ResultValidationForm;
import org.openelisglobal.validation.annotations.SafeHtml;
import org.openelisglobal.validation.annotations.ValidDate;
import org.openelisglobal.validation.annotations.ValidName;
@@ -211,7 +212,7 @@ public ObservationData() {
private String vlSuckle;
@SafeHtml(level = SafeHtml.SafeListLevel.NONE)
private String priorVLLab;
- @Pattern(regexp = "^[0-9]*$")
+ @SafeHtml(level = SafeHtml.SafeListLevel.NONE, groups = { ResultValidationForm.ResultValidation.class })
private String priorVLValue;
@ValidDate
private String priorVLDate;
diff --git a/src/main/java/org/openelisglobal/patient/valueholder/Patient.java b/src/main/java/org/openelisglobal/patient/valueholder/Patient.java
index 5f2313e8fe..a26b2ef751 100644
--- a/src/main/java/org/openelisglobal/patient/valueholder/Patient.java
+++ b/src/main/java/org/openelisglobal/patient/valueholder/Patient.java
@@ -68,6 +68,8 @@ public class Patient extends BaseObject {
private ValueHolderInterface person;
private String externalId;
+
+ private String upidCode;
private String selectedPersonId;
@@ -287,4 +289,13 @@ public String getFhirUuidAsString() {
public void setFhirUuid(UUID fhirUuid) {
this.fhirUuid = fhirUuid;
}
+
+ public String getUpidCode() {
+ return upidCode;
+ }
+
+ public void setUpidCode(String upidCode) {
+ this.upidCode = upidCode;
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/org/openelisglobal/program/service/ProgramAutocreateService.java b/src/main/java/org/openelisglobal/program/service/ProgramAutocreateService.java
index a6021ba2af..d7c62c1e94 100644
--- a/src/main/java/org/openelisglobal/program/service/ProgramAutocreateService.java
+++ b/src/main/java/org/openelisglobal/program/service/ProgramAutocreateService.java
@@ -56,6 +56,60 @@ public void autocreateProgram() {
if (autocreateOn) {
for (Resource programResource : programResources) {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(programResource.getInputStream()))) {
+ reader.mark(100);
+ String linee = reader.readLine();
+ if (linee.startsWith("Test")) {
+ while ((linee = reader.readLine()) != null) {
+ String[] lines = linee.split(" ");
+ UUID uuid = UUID.randomUUID();
+ System.out.println(
+ "\t\t\n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t \n" + //
+ "\t\t\n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t \n" + //
+ "\t\t\n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t \n" + //
+ "\t\t\n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t\t\n" + //
+ "\t\t\t\n" + //
+ "\t\t\t \n" + //
+ "\t\t \n" + //
+ "\t\t\n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t\t \n" + //
+ "\t\t "
+ );
+ }
+ continue;
+ } else {
+ reader.reset();
+ }
+
String contents = reader.lines().map(line -> line + "\n").collect(Collectors.joining());
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new Hibernate5Module());
@@ -98,6 +152,8 @@ public void autocreateProgram() {
questionnaire.setId(program.getQuestionnaireUUID().toString());
fhirPersistanceService.updateFhirResourceInFhirStore(questionnaire);
DisplayListService.getInstance().refreshList(ListType.PROGRAM);
+
+ // }
} catch (IOException | FhirLocalPersistingException e) {
LogEvent.logError(e);
diff --git a/src/main/java/org/openelisglobal/program/service/cytology/CytologyDisplayServiceImpl.java b/src/main/java/org/openelisglobal/program/service/cytology/CytologyDisplayServiceImpl.java
index 1085906ff8..c8a04a5198 100644
--- a/src/main/java/org/openelisglobal/program/service/cytology/CytologyDisplayServiceImpl.java
+++ b/src/main/java/org/openelisglobal/program/service/cytology/CytologyDisplayServiceImpl.java
@@ -151,7 +151,9 @@ public CytologyDisplayItem convertToDisplayItem(Integer cytologySampleId) {
@Transactional
public CytologySample getCytologySampleWithLoadedAttributes(Integer cytologySampleId) {
CytologySample cytologySample = cytologySampleService.get(cytologySampleId);
- cytologySample.getDiagnosis().getDiagnosisResultsMaps().size();
+ if(cytologySample.getDiagnosis() != null){
+ cytologySample.getDiagnosis().getDiagnosisResultsMaps().size();
+ }
return cytologySample;
}
diff --git a/src/main/java/org/openelisglobal/reports/action/implementation/ActivityReport.java b/src/main/java/org/openelisglobal/reports/action/implementation/ActivityReport.java
index 97c21dfb12..9746bda6bb 100644
--- a/src/main/java/org/openelisglobal/reports/action/implementation/ActivityReport.java
+++ b/src/main/java/org/openelisglobal/reports/action/implementation/ActivityReport.java
@@ -22,6 +22,8 @@
import java.util.List;
import org.apache.commons.validator.GenericValidator;
+import org.openelisglobal.common.provider.validation.AlphanumAccessionValidator;
+import org.openelisglobal.common.provider.validation.AccessionNumberValidatorFactory.AccessionFormat;
import org.openelisglobal.common.util.ConfigurationProperties;
import org.openelisglobal.common.util.ConfigurationProperties.Property;
import org.openelisglobal.common.util.DateUtil;
@@ -127,7 +129,11 @@ protected ActivityReportBean createActivityReportBean(Result result, boolean use
item.setTechnician(resultService.getSignature(result));
// item.setAccessionNumber(sampleService.getAccessionNumber(sample).substring(PREFIX_LENGTH));
- item.setAccessionNumber(sampleService.getAccessionNumber(sample));
+ if (AccessionFormat.ALPHANUM.toString().equals(ConfigurationProperties.getInstance().getPropertyValue(Property.AccessionFormat))) {
+ item.setAccessionNumber(AlphanumAccessionValidator.convertAlphaNumLabNumForDisplay(sampleService.getAccessionNumber(sample)));
+ }else {
+ item.setAccessionNumber(sampleService.getAccessionNumber(sample));
+ }
item.setReceivedDate(sampleService.getReceivedDateWithTwoYearDisplay(sample));
Timestamp start = sample.getReceivedTimestamp();
diff --git a/src/main/java/org/openelisglobal/reports/action/implementation/ExportStudyProjectByDate.java b/src/main/java/org/openelisglobal/reports/action/implementation/ExportStudyProjectByDate.java
index 9be5499354..bb5fa5e131 100644
--- a/src/main/java/org/openelisglobal/reports/action/implementation/ExportStudyProjectByDate.java
+++ b/src/main/java/org/openelisglobal/reports/action/implementation/ExportStudyProjectByDate.java
@@ -25,14 +25,19 @@
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import org.apache.commons.validator.GenericValidator;
import org.jfree.util.Log;
import org.openelisglobal.internationalization.MessageUtil;
import org.openelisglobal.project.service.ProjectService;
import org.openelisglobal.project.valueholder.Project;
+import org.openelisglobal.reports.action.implementation.reportBeans.ARVFollowupColumnBuilder;
+import org.openelisglobal.reports.action.implementation.reportBeans.ARVInitialColumnBuilder;
import org.openelisglobal.reports.action.implementation.reportBeans.CIColumnBuilder;
import org.openelisglobal.reports.action.implementation.reportBeans.CSVColumnBuilder;
+import org.openelisglobal.reports.action.implementation.reportBeans.RTNColumnBuilder;
+import org.openelisglobal.reports.action.implementation.reportBeans.RTRIColumnBuilder;
import org.openelisglobal.reports.action.implementation.reportBeans.StudyEIDColumnBuilder;
import org.openelisglobal.reports.action.implementation.reportBeans.StudyVLColumnBuilder;
import org.openelisglobal.reports.form.ReportForm;
@@ -180,10 +185,20 @@ protected void writeConsolidatedBaseToBuffer(ByteArrayOutputStream buffer, Strin
private CSVColumnBuilder getColumnBuilder(String projectId) {
String projectTag = CIColumnBuilder.translateProjectId(projectId);
- if (projectTag.equalsIgnoreCase("DBS")) {
+ if (projectTag.equals("ARVB")) {
+ return new ARVInitialColumnBuilder(dateRange, projectStr);
+ } else if (projectTag.equals("ARVS")) {
+ return new ARVFollowupColumnBuilder(dateRange, projectStr);
+ } else if (projectTag.equalsIgnoreCase("DBS")) {
return new StudyEIDColumnBuilder(dateRange, projectStr, dateType);
} else if (projectTag.equalsIgnoreCase("VLS")) {
return new StudyVLColumnBuilder(dateRange, projectStr, dateType);
+ }else if (projectTag.equalsIgnoreCase("RTN")) {
+ return new RTNColumnBuilder(dateRange, projectStr);
+ } else if (projectTag.equalsIgnoreCase("IND")) {
+ return new RTNColumnBuilder(dateRange, projectStr);
+ }else if (projectTag.equalsIgnoreCase("RTRI")) {
+ return new RTRIColumnBuilder(dateRange, projectStr, dateType);
}
throw new IllegalArgumentException();
}
@@ -194,10 +209,20 @@ private CSVColumnBuilder getColumnBuilder(String projectId) {
protected List getProjectList() {
List projects = new ArrayList<>();
Project project = new Project();
+ project.setProjectName("Antiretroviral Study");
+ projects.add(SpringContext.getBean(ProjectService.class).getProjectByName(project, false, false));
+ project.setProjectName("Antiretroviral Followup Study");
+ projects.add(SpringContext.getBean(ProjectService.class).getProjectByName(project, false, false));
+ project.setProjectName("Routine HIV Testing");
project.setProjectName("Early Infant Diagnosis for HIV Study");
projects.add(SpringContext.getBean(ProjectService.class).getProjectByName(project, false, false));
project.setProjectName("Viral Load Results");
projects.add(SpringContext.getBean(ProjectService.class).getProjectByName(project, false, false));
+ project.setProjectName("Indeterminate Results");
+ projects.add(SpringContext.getBean(ProjectService.class).getProjectByName(project, false, false));
+ project.setProjectName("Recency Testing");
+ projects.add(SpringContext.getBean(ProjectService.class).getProjectByName(project, false, false));
+ projects.removeIf(Objects::isNull);
return projects;
}
diff --git a/src/main/java/org/openelisglobal/reports/action/implementation/ExportTBOrdersByDate.java b/src/main/java/org/openelisglobal/reports/action/implementation/ExportTBOrdersByDate.java
new file mode 100644
index 0000000000..916462bc24
--- /dev/null
+++ b/src/main/java/org/openelisglobal/reports/action/implementation/ExportTBOrdersByDate.java
@@ -0,0 +1,157 @@
+/**
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations under
+ * the License.
+ *
+ * The Original Code is OpenELIS code.
+ *
+ * Copyright (C) CIRG, University of Washington, Seattle WA. All Rights Reserved.
+ *
+ */
+package org.openelisglobal.reports.action.implementation;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.sql.SQLException;
+import java.text.ParseException;
+
+import org.apache.commons.validator.GenericValidator;
+import org.jfree.util.Log;
+import org.openelisglobal.common.util.StringUtil;
+import org.openelisglobal.internationalization.MessageUtil;
+import org.openelisglobal.project.service.ProjectService;
+import org.openelisglobal.reports.action.implementation.reportBeans.RoutineColumnBuilder;
+import org.openelisglobal.reports.action.implementation.reportBeans.TBColumnBuilder;
+import org.openelisglobal.reports.form.ReportForm;
+import org.openelisglobal.spring.util.SpringContext;
+
+/**
+ * @author Paul A. Hill (pahill@uw.edu)
+ * @since Jan 26, 2011
+ */
+public class ExportTBOrdersByDate extends CSVRoutineSampleExportReport
+ implements IReportParameterSetter, IReportCreator {
+ protected final ProjectService projectService = SpringContext.getBean(ProjectService.class);
+
+ @Override
+ protected String reportFileName() {
+ return "ExportTBOrdersByDate";
+ }
+
+ @Override
+ public void setRequestParameters(ReportForm form) {
+ try {
+ form.setReportName(getReportNameForParameterPage());
+ form.setUseLowerDateRange(Boolean.TRUE);
+ form.setUseUpperDateRange(Boolean.TRUE);
+ } catch (RuntimeException e) {
+ Log.error("Error in ExportTBOrdersByDate.setRequestParemeters: ", e);
+ }
+ }
+
+ protected String getReportNameForParameterPage() {
+ return MessageUtil.getMessage("reports.label.project.export") + " "
+ + MessageUtil.getContextualMessage("sample.collectionDate");
+ }
+
+ @Override
+ public void initializeReport(ReportForm form) {
+ super.initializeReport();
+ errorFound = false;
+
+ lowDateStr = form.getLowerDateRange();
+ highDateStr = form.getUpperDateRange();
+ dateRange = new DateRange(lowDateStr, highDateStr);
+
+ createReportParameters();
+
+ errorFound = !validateSubmitParameters();
+ if (errorFound) {
+ return;
+ }
+
+ createReportItems();
+ }
+
+ /**
+ * check everything
+ */
+//-----------------------------------
+ private boolean validateSubmitParameters() {
+ return dateRange.validateHighLowDate("report.error.message.date.received.missing");
+ }
+
+
+ /**
+ * creating the list for generation to the report
+ */
+ private void createReportItems() {
+ try {
+ csvRoutineColumnBuilder = getColumnBuilder();
+ csvRoutineColumnBuilder.buildDataSource();
+ } catch (SQLException e) {
+ Log.error("Error in " + this.getClass().getSimpleName() + ".createReportItems: ", e);
+ add1LineErrorMessage("report.error.message.general.error");
+ }
+ }
+
+ @Override
+ protected void writeResultsToBuffer(ByteArrayOutputStream buffer)
+ throws IOException, UnsupportedEncodingException, SQLException, ParseException {
+
+ String currentAccessionNumber = null;
+ String[] splitBase = null;
+ while (csvRoutineColumnBuilder.next()) {
+ String line = csvRoutineColumnBuilder.nextLine();
+ String[] splitLine = StringUtil.separateCSVWithMixedEmbededQuotes(line);
+
+ if (splitLine[0].equals(currentAccessionNumber)) {
+ merge(splitBase, splitLine);
+ } else {
+ if (currentAccessionNumber != null) {
+ writeConsolidatedBaseToBuffer(buffer, splitBase);
+ }
+ splitBase = splitLine;
+ currentAccessionNumber = splitBase[0];
+ }
+ }
+
+ writeConsolidatedBaseToBuffer(buffer, splitBase);
+ }
+
+ private void merge(String[] base, String[] line) {
+ for (int i = 0; i < base.length; ++i) {
+ if (GenericValidator.isBlankOrNull(base[i])) {
+ base[i] = line[i];
+ }
+ }
+ }
+
+ protected void writeConsolidatedBaseToBuffer(ByteArrayOutputStream buffer, String[] splitBase)
+ throws IOException, UnsupportedEncodingException {
+
+ if (splitBase != null) {
+ StringBuffer consolidatedLine = new StringBuffer();
+ for (String value : splitBase) {
+ consolidatedLine.append(value);
+ consolidatedLine.append(",");
+ }
+
+ consolidatedLine.deleteCharAt(consolidatedLine.lastIndexOf(","));
+ buffer.write(consolidatedLine.toString().getBytes("windows-1252"));
+ }
+ }
+
+ private RoutineColumnBuilder getColumnBuilder() {
+ return new TBColumnBuilder(dateRange);
+
+ }
+
+}
diff --git a/src/main/java/org/openelisglobal/reports/action/implementation/ExportTrendsByDate.java b/src/main/java/org/openelisglobal/reports/action/implementation/ExportTrendsByDate.java
index ec6ecf6336..e5628b4936 100644
--- a/src/main/java/org/openelisglobal/reports/action/implementation/ExportTrendsByDate.java
+++ b/src/main/java/org/openelisglobal/reports/action/implementation/ExportTrendsByDate.java
@@ -173,13 +173,13 @@ private boolean writeAble(String result) throws ParseException {
String indic = splitLine[1];
if (indic.equals("Unsuppressed VL")) {
return workingResult.contains("Log7") || !workingResult.contains("L") && !workingResult.contains("X")
- && !workingResult.contains("<") && !workingResult.contains(">") && workingResult.length() > 0
- && Double.parseDouble(workingResult) >= 1000;
+ && !workingResult.contains("<") && workingResult.length() > 0
+ && Double.parseDouble(workingResult.replaceAll("[^0-9]", "")) >= 1000;
} else if (indic.equals("Suppressed VL")) {
return workingResult.contains("L") || workingResult.contains("<")
|| (workingResult.length() > 0 && !workingResult.toUpperCase().contains("X")
&& !workingResult.toLowerCase().contains("invalid")
- && Double.parseDouble(workingResult) < 1000);
+ && Double.parseDouble(workingResult.replaceAll("[^0-9]", "")) < 1000);
}
return false;
diff --git a/src/main/java/org/openelisglobal/reports/action/implementation/HaitiLNSPExportReport.java b/src/main/java/org/openelisglobal/reports/action/implementation/HaitiLNSPExportReport.java
index 4786327b22..c7fbda4477 100644
--- a/src/main/java/org/openelisglobal/reports/action/implementation/HaitiLNSPExportReport.java
+++ b/src/main/java/org/openelisglobal/reports/action/implementation/HaitiLNSPExportReport.java
@@ -251,7 +251,7 @@ private void setAppropriateResults(List resultList, Analysis analysis, T
String reportResult = resultResultService.getResultValue(result, true);
Result quantifiableResult = analysisService.getQuantifiedResult(analysis);
if (quantifiableResult != null) {
- reportResult += ":" + quantifiableResult.getValue(true);
+ reportResult += ":" + quantifiableResult.getValue();
}
data.setResult(reportResult.replace(",", ";"));
diff --git a/src/main/java/org/openelisglobal/reports/action/implementation/NonConformityByDate.java b/src/main/java/org/openelisglobal/reports/action/implementation/NonConformityByDate.java
index 2dc13f9459..30d1039a9d 100644
--- a/src/main/java/org/openelisglobal/reports/action/implementation/NonConformityByDate.java
+++ b/src/main/java/org/openelisglobal/reports/action/implementation/NonConformityByDate.java
@@ -21,6 +21,8 @@
import java.util.Comparator;
import java.util.List;
+import org.openelisglobal.common.provider.validation.AccessionNumberValidatorFactory.AccessionFormat;
+import org.openelisglobal.common.provider.validation.AlphanumAccessionValidator;
import org.openelisglobal.common.services.QAService;
import org.openelisglobal.common.services.QAService.QAObservationType;
import org.openelisglobal.common.services.TableIdService;
@@ -121,7 +123,13 @@ private void createReportItems() {
String noteForSample = NonConformityHelper.getNoteForSample(sample);
NonConformityReportData data = new NonConformityReportData();
- data.setAccessionNumber(sample.getAccessionNumber());
+ if (AccessionFormat.ALPHANUM.toString()
+ .equals(ConfigurationProperties.getInstance().getPropertyValue(Property.AccessionFormat))) {
+ data.setAccessionNumber(
+ AlphanumAccessionValidator.convertAlphaNumLabNumForDisplay(sample.getAccessionNumber()));
+ } else {
+ data.setAccessionNumber(sample.getAccessionNumber());
+ }
data.setSubjectNumber(patient.getNationalId());
data.setSiteSubjectNumber(patient.getExternalId());
data.setStudy((project != null) ? project.getLocalizedName() : "");
diff --git a/src/main/java/org/openelisglobal/reports/action/implementation/PatientARVReport.java b/src/main/java/org/openelisglobal/reports/action/implementation/PatientARVReport.java
index 13573c9908..ae394e872c 100644
--- a/src/main/java/org/openelisglobal/reports/action/implementation/PatientARVReport.java
+++ b/src/main/java/org/openelisglobal/reports/action/implementation/PatientARVReport.java
@@ -144,16 +144,16 @@ protected void setTestInfo(ARVReportData data) {
data.setShowSerologie(Boolean.TRUE);
} else if (result.getAnalyte() != null
&& result.getAnalyte().getId().equals(CD4_CNT_CONCLUSION)) {
- data.setCd4(valid ? result.getValue(true) : invalidValue);
+ data.setCd4(valid ? result.getValue() : invalidValue);
} else {
- resultValue = result.getValue(true);
+ resultValue = result.getValue();
}
}
}
if (resultList.size() > 0) {
if (resultValue == null) {
- resultValue = resultList.get(resultList.size() - 1).getValue(true);
+ resultValue = resultList.get(resultList.size() - 1).getValue();
}
}
diff --git a/src/main/java/org/openelisglobal/reports/action/implementation/PatientCILNSPClinical_vreduit.java b/src/main/java/org/openelisglobal/reports/action/implementation/PatientCILNSPClinical_vreduit.java
index b16af89a7b..eff72f3e44 100644
--- a/src/main/java/org/openelisglobal/reports/action/implementation/PatientCILNSPClinical_vreduit.java
+++ b/src/main/java/org/openelisglobal/reports/action/implementation/PatientCILNSPClinical_vreduit.java
@@ -28,6 +28,8 @@
import org.apache.commons.validator.GenericValidator;
import org.openelisglobal.analysis.valueholder.Analysis;
import org.openelisglobal.common.constants.Constants;
+import org.openelisglobal.common.provider.validation.AccessionNumberValidatorFactory.AccessionFormat;
+import org.openelisglobal.common.provider.validation.AlphanumAccessionValidator;
import org.openelisglobal.common.services.IStatusService;
import org.openelisglobal.common.services.StatusService.AnalysisStatus;
import org.openelisglobal.common.util.ConfigurationProperties;
@@ -129,8 +131,9 @@ protected void createReportItems() {
boolean isConfirmationSample = sampleService.isConfirmationSample(currentSample);
List analysisList = analysisService
.getAnalysesBySampleIdAndStatusId(sampleService.getId(currentSample), analysisStatusIds);
-
- List filteredAnalysisList = userService.filterAnalysesByLabUnitRoles(systemUserId, analysisList, Constants.ROLE_REPORTS);
+
+ List filteredAnalysisList = userService.filterAnalysesByLabUnitRoles(systemUserId, analysisList,
+ Constants.ROLE_REPORTS);
List currentSampleReportItems = new ArrayList<>(filteredAnalysisList.size());
currentConclusion = null;
for (Analysis analysis : filteredAnalysisList) {
@@ -270,8 +273,14 @@ private void copyParentData(ClinicalPatientData data, ClinicalPatientData parent
data.setDept(parentData.getDept());
data.setCommune(parentData.getCommune());
data.setStNumber(parentData.getStNumber());
- data.setAccessionNumber(parentData.getAccessionNumber());
data.setLabOrderType(parentData.getLabOrderType());
+ if (AccessionFormat.ALPHANUM.toString()
+ .equals(ConfigurationProperties.getInstance().getPropertyValue(Property.AccessionFormat))) {
+ data.setAccessionNumber(
+ AlphanumAccessionValidator.convertAlphaNumLabNumForDisplay(parentData.getAccessionNumber()));
+ } else {
+ data.setAccessionNumber(parentData.getAccessionNumber());
+ }
}
@Override
@@ -329,25 +338,28 @@ public int compare(ClinicalPatientData o1, ClinicalPatientData o2) {
}
});
-// ArrayList augmentedList = new ArrayList<>(reportItems.size());
-// HashSet parentResults = new HashSet<>();
-// for (ClinicalPatientData data : reportItems) {
-// if (data.getParentResult() != null && !parentResults.contains(data.getParentResult().getId())) {
-// parentResults.add(data.getParentResult().getId());
-// ClinicalPatientData marker = new ClinicalPatientData(data);
-// ResultService resultResultService = SpringContext.getBean(ResultService.class);
-// Result result = (data.getParentResult());
-// marker.setTestName(resultResultService.getSimpleResultValue(result));
-// marker.setResult(null);
-// marker.setTestRefRange(null);
-// marker.setParentMarker(true);
-// augmentedList.add(marker);
-// }
-//
-// augmentedList.add(data);
-// }
-//
-// reportItems = augmentedList;
+ // ArrayList augmentedList = new
+ // ArrayList<>(reportItems.size());
+ // HashSet parentResults = new HashSet<>();
+ // for (ClinicalPatientData data : reportItems) {
+ // if (data.getParentResult() != null &&
+ // !parentResults.contains(data.getParentResult().getId())) {
+ // parentResults.add(data.getParentResult().getId());
+ // ClinicalPatientData marker = new ClinicalPatientData(data);
+ // ResultService resultResultService =
+ // SpringContext.getBean(ResultService.class);
+ // Result result = (data.getParentResult());
+ // marker.setTestName(resultResultService.getSimpleResultValue(result));
+ // marker.setResult(null);
+ // marker.setTestRefRange(null);
+ // marker.setParentMarker(true);
+ // augmentedList.add(marker);
+ // }
+ //
+ // augmentedList.add(data);
+ // }
+ //
+ // reportItems = augmentedList;
String currentPanelId = null;
for (ClinicalPatientData reportItem : reportItems) {
diff --git a/src/main/java/org/openelisglobal/reports/action/implementation/PatientClinicalReport.java b/src/main/java/org/openelisglobal/reports/action/implementation/PatientClinicalReport.java
index 554e19e4f1..506b34f617 100644
--- a/src/main/java/org/openelisglobal/reports/action/implementation/PatientClinicalReport.java
+++ b/src/main/java/org/openelisglobal/reports/action/implementation/PatientClinicalReport.java
@@ -26,8 +26,12 @@
import org.apache.commons.validator.GenericValidator;
import org.openelisglobal.analysis.valueholder.Analysis;
import org.openelisglobal.common.constants.Constants;
+import org.openelisglobal.common.provider.validation.AccessionNumberValidatorFactory.AccessionFormat;
+import org.openelisglobal.common.provider.validation.AlphanumAccessionValidator;
import org.openelisglobal.common.services.IStatusService;
import org.openelisglobal.common.services.StatusService.AnalysisStatus;
+import org.openelisglobal.common.util.ConfigurationProperties;
+import org.openelisglobal.common.util.ConfigurationProperties.Property;
import org.openelisglobal.internationalization.MessageUtil;
import org.openelisglobal.note.service.NoteService;
import org.openelisglobal.referral.valueholder.Referral;
@@ -88,7 +92,8 @@ protected void createReportItems() {
List analysisList = analysisService
.getAnalysesBySampleIdAndStatusId(sampleService.getId(currentSample), analysisStatusIds);
- List filteredAnalysisList = userService.filterAnalysesByLabUnitRoles(systemUserId, analysisList, Constants.ROLE_REPORTS);
+ List filteredAnalysisList = userService.filterAnalysesByLabUnitRoles(systemUserId, analysisList,
+ Constants.ROLE_REPORTS);
currentConclusion = null;
Set sampleSet = new HashSet<>();
List currentSampleReportItems = new ArrayList<>(filteredAnalysisList.size());
@@ -298,7 +303,14 @@ public int compare(ClinicalPatientData o1, ClinicalPatientData o2) {
reportItem.setSeparator(true);
}
- reportItem.setAccessionNumber(reportItem.getAccessionNumber().split("-")[0]);
+ if (AccessionFormat.ALPHANUM.toString()
+ .equals(ConfigurationProperties.getInstance().getPropertyValue(Property.AccessionFormat))) {
+ reportItem.setAccessionNumber(
+ AlphanumAccessionValidator
+ .convertAlphaNumLabNumForDisplay(reportItem.getAccessionNumber().split("-")[0]));
+ } else {
+ reportItem.setAccessionNumber(reportItem.getAccessionNumber().split("-")[0]);
+ }
reportItem.setCompleteFlag(MessageUtil
.getMessage(sampleCompleteMap.get(reportItem.getAccessionNumber()) ? "report.status.complete"
: "report.status.partial"));
diff --git a/src/main/java/org/openelisglobal/reports/action/implementation/PatientEIDReport.java b/src/main/java/org/openelisglobal/reports/action/implementation/PatientEIDReport.java
index 5d05a2554a..ebbcb807d1 100644
--- a/src/main/java/org/openelisglobal/reports/action/implementation/PatientEIDReport.java
+++ b/src/main/java/org/openelisglobal/reports/action/implementation/PatientEIDReport.java
@@ -8,10 +8,14 @@
import org.apache.commons.validator.GenericValidator;
import org.openelisglobal.analysis.service.AnalysisService;
import org.openelisglobal.analysis.valueholder.Analysis;
+import org.openelisglobal.common.provider.validation.AccessionNumberValidatorFactory.AccessionFormat;
+import org.openelisglobal.common.provider.validation.AlphanumAccessionValidator;
import org.openelisglobal.common.services.IReportTrackingService;
import org.openelisglobal.common.services.IStatusService;
import org.openelisglobal.common.services.ReportTrackingService;
import org.openelisglobal.common.services.StatusService.AnalysisStatus;
+import org.openelisglobal.common.util.ConfigurationProperties;
+import org.openelisglobal.common.util.ConfigurationProperties.Property;
import org.openelisglobal.common.util.DateUtil;
import org.openelisglobal.dictionary.service.DictionaryService;
import org.openelisglobal.dictionary.valueholder.Dictionary;
@@ -105,7 +109,7 @@ protected void setTestInfo(EIDReportData data) {
if (valid) {
String resultValue = "";
if (resultList.size() > 0) {
- resultValue = resultList.get(resultList.size() - 1).getValue(true);
+ resultValue = resultList.get(resultList.size() - 1).getValue();
}
Dictionary dictionary = new Dictionary();
dictionary.setId(resultValue);
@@ -151,7 +155,13 @@ protected void setPatientInfo(EIDReportData data) {
orgService.getDataBySample(sampleOrg);
data.setServicename(sampleOrg.getId() == null ? "" : sampleOrg.getOrganization().getOrganizationName());
data.setDoctor(getObservationValues(OBSERVATION_REQUESTOR_ID));
- data.setAccession_number(reportSample.getAccessionNumber());
+ if (AccessionFormat.ALPHANUM.toString()
+ .equals(ConfigurationProperties.getInstance().getPropertyValue(Property.AccessionFormat))) {
+ data.setAccessionNumber(
+ AlphanumAccessionValidator.convertAlphaNumLabNumForDisplay(reportSample.getAccessionNumber()));
+ } else {
+ data.setAccessionNumber(reportSample.getAccessionNumber());
+ }
data.setReceptiondate(DateUtil.convertTimestampToStringDateAndTime(reportSample.getReceivedTimestamp()));
Timestamp collectionDate = reportSample.getCollectionDate();
diff --git a/src/main/java/org/openelisglobal/reports/action/implementation/PatientProgramReport.java b/src/main/java/org/openelisglobal/reports/action/implementation/PatientProgramReport.java
index c7d0c59de3..f7285956f5 100644
--- a/src/main/java/org/openelisglobal/reports/action/implementation/PatientProgramReport.java
+++ b/src/main/java/org/openelisglobal/reports/action/implementation/PatientProgramReport.java
@@ -22,6 +22,8 @@
import org.openelisglobal.analysis.valueholder.Analysis;
import org.openelisglobal.common.formfields.FormFields;
import org.openelisglobal.common.formfields.FormFields.Field;
+import org.openelisglobal.common.provider.validation.AccessionNumberValidatorFactory.AccessionFormat;
+import org.openelisglobal.common.provider.validation.AlphanumAccessionValidator;
import org.openelisglobal.common.services.IStatusService;
import org.openelisglobal.common.services.StatusService.AnalysisStatus;
import org.openelisglobal.common.services.TableIdService;
@@ -66,116 +68,123 @@
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
public abstract class PatientProgramReport extends Report implements IReportCreator {
-
+
private ImageService imageService = SpringContext.getBean(ImageService.class);
-
+
protected PathologySampleService pathologySerivice = SpringContext.getBean(PathologySampleService.class);
-
+
protected PatientService patientService = SpringContext.getBean(PatientService.class);
-
+
private static final String configName = ConfigurationProperties.getInstance()
.getPropertyValue(Property.configurationName);
-
+
protected SampleService sampleService = SpringContext.getBean(SampleService.class);
-
+
protected SampleHumanService sampleHumanService = SpringContext.getBean(SampleHumanService.class);
-
+
protected AddressPartService addressPartService = SpringContext.getBean(AddressPartService.class);
-
+
protected OrganizationService organizationService = SpringContext.getBean(OrganizationService.class);
-
+
protected DictionaryService dictionaryService = SpringContext.getBean(DictionaryService.class);
-
+
protected PersonAddressService addressService = SpringContext.getBean(PersonAddressService.class);
-
+
protected ProviderService providerService = SpringContext.getBean(ProviderService.class);
-
+
protected AnalysisService analysisService = SpringContext.getBean(AnalysisService.class);
-
+
protected TestService testService = SpringContext.getBean(TestService.class);
-
+
private static String ADDRESS_DEPT_ID;
-
+
private static String ADDRESS_COMMUNE_ID;
-
+
protected String currentContactInfo = "";
-
+
protected String currentSiteInfo = "";
-
+
protected String STNumber = null;
-
+
protected String subjectNumber = null;
-
+
protected String healthRegion = null;
-
+
protected String healthDistrict = null;
-
+
protected String patientName = null;
-
+
protected String patientDOB = null;
-
+
protected String currentConclusion = null;
-
+
protected String patientDept = null;
-
+
protected String patientCommune = null;
-
+
protected Provider currentProvider;
-
+
protected Analysis currentAnalysis = null;
-
+
protected String reportReferralResultValue;
-
+
protected String completionDate;
-
+
protected Patient patient;
-
+
protected Sample sample;
-
+
protected List reportItems;
-
+
protected List analyses;
-
+
protected ProgramSampleReportData data;
-
+
protected ReportForm form;
-
+
protected static Set analysisStatusIds;
-
+
static {
analysisStatusIds = new HashSet<>();
analysisStatusIds.add(
- Integer.parseInt(SpringContext.getBean(IStatusService.class).getStatusID(AnalysisStatus.BiologistRejected)));
+ Integer.parseInt(
+ SpringContext.getBean(IStatusService.class).getStatusID(AnalysisStatus.BiologistRejected)));
analysisStatusIds
- .add(Integer.parseInt(SpringContext.getBean(IStatusService.class).getStatusID(AnalysisStatus.Finalized)));
+ .add(Integer
+ .parseInt(SpringContext.getBean(IStatusService.class).getStatusID(AnalysisStatus.Finalized)));
analysisStatusIds.add(Integer
- .parseInt(SpringContext.getBean(IStatusService.class).getStatusID(AnalysisStatus.NonConforming_depricated)));
+ .parseInt(SpringContext.getBean(IStatusService.class)
+ .getStatusID(AnalysisStatus.NonConforming_depricated)));
analysisStatusIds
- .add(Integer.parseInt(SpringContext.getBean(IStatusService.class).getStatusID(AnalysisStatus.NotStarted)));
+ .add(Integer
+ .parseInt(SpringContext.getBean(IStatusService.class).getStatusID(AnalysisStatus.NotStarted)));
analysisStatusIds.add(
- Integer.parseInt(SpringContext.getBean(IStatusService.class).getStatusID(AnalysisStatus.TechnicalAcceptance)));
+ Integer.parseInt(
+ SpringContext.getBean(IStatusService.class).getStatusID(AnalysisStatus.TechnicalAcceptance)));
analysisStatusIds
- .add(Integer.parseInt(SpringContext.getBean(IStatusService.class).getStatusID(AnalysisStatus.Canceled)));
+ .add(Integer
+ .parseInt(SpringContext.getBean(IStatusService.class).getStatusID(AnalysisStatus.Canceled)));
analysisStatusIds.add(
- Integer.parseInt(SpringContext.getBean(IStatusService.class).getStatusID(AnalysisStatus.TechnicalRejected)));
-
+ Integer.parseInt(
+ SpringContext.getBean(IStatusService.class).getStatusID(AnalysisStatus.TechnicalRejected)));
+
}
-
+
abstract protected String getReportName();
-
+
abstract protected void setAdditionalReportItems();
-
+
abstract protected void innitializeSample(ReportForm form);
-
+
@Override
protected String reportFileName() {
return getReportName();
}
-
+
protected String getHeaderName() {
return "CDIHeader.jasper";
}
-
+
@PostConstruct
private void initialize() {
List partList = addressPartService.getAll();
@@ -187,7 +196,7 @@ private void initialize() {
}
}
}
-
+
@Override
public void initializeReport(ReportForm form) {
this.form = form;
@@ -208,46 +217,49 @@ public void initializeReport(ReportForm form) {
findPatientInfo();
createReportItems();
}
-
+
protected void createReportItems() {
reportItems.add(buildClinicalPatientData());
}
-
+
@Override
public JRDataSource getReportDataSource() throws IllegalStateException {
if (!initialized) {
throw new IllegalStateException("initializeReport not called first");
}
-
+
return errorFound ? new JRBeanCollectionDataSource(errorMsgs) : new JRBeanCollectionDataSource(reportItems);
}
-
+
@Override
protected void createReportParameters() {
super.createReportParameters();
reportParameters.put("siteId", ConfigurationProperties.getInstance().getPropertyValue(Property.SiteCode));
reportParameters.put("headerName", getHeaderName());
- reportParameters.put("billingNumberLabel", SpringContext.getBean(LocalizationService.class).getLocalizedValueById(
- ConfigurationProperties.getInstance().getPropertyValue(Property.BILLING_REFERENCE_NUMBER_LABEL)));
+ reportParameters.put("billingNumberLabel",
+ SpringContext.getBean(LocalizationService.class).getLocalizedValueById(
+ ConfigurationProperties.getInstance()
+ .getPropertyValue(Property.BILLING_REFERENCE_NUMBER_LABEL)));
reportParameters.put("footerName", getFooterName());
Optional labDirectorSignature = imageService.getImageBySiteInfoName("labDirectorSignature");
reportParameters.put("useLabDirectorSignature", labDirectorSignature.isPresent());
if (labDirectorSignature.isPresent()) {
- reportParameters.put("labDirectorSignature", new ByteArrayInputStream(labDirectorSignature.get().getImage()));
+ reportParameters.put("labDirectorSignature",
+ new ByteArrayInputStream(labDirectorSignature.get().getImage()));
}
-
+
reportParameters.put("labDirectorName",
- ConfigurationProperties.getInstance().getPropertyValue(Property.LAB_DIRECTOR_NAME));
+ ConfigurationProperties.getInstance().getPropertyValue(Property.LAB_DIRECTOR_NAME));
reportParameters.put("labDirectorTitle",
- ConfigurationProperties.getInstance().getPropertyValue(Property.LAB_DIRECTOR_TITLE));
+ ConfigurationProperties.getInstance().getPropertyValue(Property.LAB_DIRECTOR_TITLE));
createExtraReportParameters();
-
+
}
-
+
protected void createExtraReportParameters() {
-
+
}
-
+
private Object getFooterName() {
if (configName.equals("CI IPCI") || configName.equals("CI LNSP")) {
return "CILNSPFooter.jasper";
@@ -255,70 +267,70 @@ private Object getFooterName() {
return "";
}
}
-
+
protected void initializeReportItems() {
reportItems = new ArrayList<>();
}
-
+
private void findCompletionDate() {
Date date = sampleService.getCompletedDate(sample);
completionDate = date == null ? null : DateUtil.convertSqlDateToStringDate(date);
}
-
+
protected void findPatientFromSample() {
patient = sampleHumanService.getPatientForSample(sample);
}
-
+
private void findPatientInfo() {
if (patientService.getPerson(patient) == null) {
return;
}
-
+
patientDept = "";
patientCommune = "";
if (ADDRESS_DEPT_ID != null) {
PersonAddress deptAddress = addressService.getByPersonIdAndPartId(patientService.getPerson(patient).getId(),
- ADDRESS_DEPT_ID);
-
+ ADDRESS_DEPT_ID);
+
if (deptAddress != null && !GenericValidator.isBlankOrNull(deptAddress.getValue())) {
patientDept = dictionaryService.getDictionaryById(deptAddress.getValue()).getDictEntry();
}
}
-
+
if (ADDRESS_COMMUNE_ID != null) {
PersonAddress deptAddress = addressService.getByPersonIdAndPartId(patientService.getPerson(patient).getId(),
- ADDRESS_COMMUNE_ID);
-
+ ADDRESS_COMMUNE_ID);
+
if (deptAddress != null) {
patientCommune = deptAddress.getValue();
}
}
-
+
}
-
+
private void findContactInfo() {
currentContactInfo = "";
currentSiteInfo = "";
currentProvider = null;
-
- // sampleService.getOrganizationRequester(currentSample);
+
+ // sampleService.getOrganizationRequester(currentSample);
Organization referringOrg = sampleService.getOrganizationRequester(sample,
- TableIdService.getInstance().REFERRING_ORG_TYPE_ID);
+ TableIdService.getInstance().REFERRING_ORG_TYPE_ID);
Organization referringDepartmentOrg = sampleService.getOrganizationRequester(sample,
- TableIdService.getInstance().REFERRING_ORG_DEPARTMENT_TYPE_ID);
-
+ TableIdService.getInstance().REFERRING_ORG_DEPARTMENT_TYPE_ID);
+
currentSiteInfo += referringOrg == null ? "" : referringOrg.getOrganizationName();
currentSiteInfo += "|" + (referringDepartmentOrg == null ? "" : referringDepartmentOrg.getOrganizationName());
-
+
Person person = sampleService.getPersonRequester(sample);
if (person != null) {
PersonService personService = SpringContext.getBean(PersonService.class);
currentContactInfo = personService.getLastFirstName(person);
currentProvider = providerService.getProviderByPerson(person);
}
-
+
}
-
+
protected ProgramSampleReportData buildClinicalPatientData() {
data = new ProgramSampleReportData();
String testName = currentAnalysis != null
@@ -330,13 +342,13 @@ protected ProgramSampleReportData buildClinicalPatientData() {
String orderDateForDisplay = orderDate != null
? DateUtil.convertTimestampToStringDateAndConfiguredHourTime(orderDate)
: "";
-
+
if (FormFields.getInstance().useField(Field.SampleEntryUseReceptionHour)) {
receivedDate += " " + sampleService.getReceivedTimeForDisplay(sample);
}
ObservationHistoryService observationHistoryService = SpringContext.getBean(ObservationHistoryService.class);
data.setSampleType(
- currentAnalysis != null ? analysisService.getTypeOfSample(currentAnalysis).getLocalizedName() : "");
+ currentAnalysis != null ? analysisService.getTypeOfSample(currentAnalysis).getLocalizedName() : "");
Set