Compare commits

..
72 Commits
Author SHA1 Message Date
admin 119908dfec - review cleanups 2026-08-28 13:04:44 +03:00
adminandGitLab Duo d2a4558a39 Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: GitLab Duo <gitlab-duo@gitlab.com>
2026-08-28 09:48:30 +00:00
adminandGitLab Duo 605702f19f Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: GitLab Duo <gitlab-duo@gitlab.com>
2026-08-28 09:45:55 +00:00
adminandGitLab Duo d04fd97791 Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: GitLab Duo <gitlab-duo@gitlab.com>
2026-08-28 09:45:28 +00:00
adminandGitLab Duo d8da3f11eb Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: GitLab Duo <gitlab-duo@gitlab.com>
2026-08-28 09:42:19 +00:00
admin 9f5573b5c9 Merge branch 'ft-3.4' into 'develop'
StreamlinEMR v3.4

See merge request signalytic/client-external/streamline/streamline-emr!27
2026-08-28 09:12:43 +00:00
admin b9c59fede7 - streamline-emr printing bugfixes
- updated version
2026-08-28 11:34:11 +03:00
admin ae235109ab - updated streamline-image tag
- updated package version
- edit source image tags
2026-05-22 10:44:14 +03:00
alec.turner 207bc3a600 Merge branch 'vm-3.2-updates' into 'develop'
Vm 3.2 updates

See merge request signalytic/client-external/streamline/streamline-emr!24
2026-05-08 18:31:05 +00:00
root 28fb0e5c53 bump image and version to 3.2; use latest hosted-app-utils 2026-05-07 16:46:56 +00:00
adminandroot fde938dc9d updated package script 2026-05-07 16:46:56 +00:00
adminandroot 52d336ae20 added clientappctl for app-dev-updates 2026-05-07 16:46:56 +00:00
admin 9010781c60 Merge branch 'ft-streamline-updates' into 'develop'
release-3.1

See merge request signalytic/client-external/streamline/streamline-emr!23
2026-05-06 09:33:26 +00:00
conrad96 40bff8a89d - updated v3.1 image tags
- removed residual scripts
- updated gitignore
2026-04-29 12:39:06 +03:00
alec.turner 0c22190528 Merge branch 'update-3' into 'main'
update image to v3

See merge request signalytic/client-external/streamline/streamline-emr!22
2026-04-17 19:51:38 +00:00
root ad69af376f update image to v3
streamline-emr v3 -> streamlinehealth/streamline:signalytic (79c61263b626)
statistics v3 -> streamlinehealth/streamline:statistics (c4ae505ffef0)
2026-04-17 18:51:42 +00:00
alec.turner 088687ba73 Merge branch 'update-2.7' into 'main'
Release 2.7

See merge request signalytic/client-external/streamline/streamline-emr!20
2025-04-28 20:29:56 +00:00
root 75183da725 update version to 2.7
- streamline image updated to include minor bug fixes
2025-04-28 15:39:01 +00:00
alec.turner 3d2844a59b Merge branch 'update-2.6' into 'main'
Release 2.6

See merge request signalytic/client-external/streamline/streamline-emr!19
2025-04-25 14:41:33 +00:00
root 2c1067c1ae update to version v2.6
- updated streamline image to fix issue with missing database migrations
2025-04-24 21:59:11 +00:00
alec.turner 113d8ba7a8 Merge branch 'develop' into 'main'
Release 2.5

See merge request signalytic/client-external/streamline/streamline-emr!18
2025-04-23 15:05:00 +00:00
alec.turner 9857664bfd Merge branch 'update_statistics_image' into 'develop'
update statistics image and bump version to 2.5

See merge request signalytic/client-external/streamline/streamline-emr!17
2025-04-23 14:04:05 +00:00
root 375bad1f1a update streamline and statistics images
The previous statistics image (2.5-rc1) was replaced with a new version 2.5-rc2.
Version 2.5 is specified in the compose file and currently matches 2.5-rc2. The
streamline-emr image is also updated, now specifying version 2.5. For
consistency, the redis image is re-tagged with 2.5 as well, but the image itself
has not been changed.
2025-04-22 18:13:09 +00:00
root a738c4bb37 update statistics image and bump version to 2.5
The statistics image is updated to the latest available as of 2025-04-22, image
ID e0705e6cb218. This image was retagged with v2.5. The version is also updated
in the config file, now 2.5.
2025-04-22 16:07:39 +00:00
alec.turner 6084f7d6cb Merge branch 'develop' into 'main'
Release 2.4

See merge request signalytic/client-external/streamline/streamline-emr!16
2025-04-11 18:52:49 +00:00
alec.turner 0b68ff9e15 Merge branch '5-statistics-service-overwrites-script-used-for-updates' into 'develop'
Resolve "statistics service overwrites script used for updates"

Closes #5

See merge request signalytic/client-external/streamline/streamline-emr!15
2025-04-11 18:46:18 +00:00
root 77bbb74ebd add helper script build-install-local.sh
This helper script is used to build and install an 'app-only' version of the
package onto the local system. This is intendend to be used on the VM as a way
to quickly test new updates to the configuration files using images already
available on the system. This is MUCH faster than packaging with images.
2025-04-11 17:54:39 +00:00
root bd0919a538 update statistics image to v2.4 and bump config version to v2.4
The updated statistics image now pulls data from the database once per day, but
attempts to upload hourly to prevent large delays due to poor network
connectivity.
2025-04-11 17:53:07 +00:00
alec.turner aa7b64e0b9 remove volumes from statistics service and move environment variables to compose
Previously, two volumes were bound to the statistics service. Both are removed
here. The first volume was a .env file, whose contents are now moved to the
compose file under the 'environment' keyword. The second, enabling persistent
storage for the /app folder, also caused the crucial 'fetch_and_update.php' to
be overwritten. Persistent storage is not currently necessary within this
service.
2025-04-09 16:09:46 -07:00
alec.turner 7e40668ec2 Merge branch 'release-2.3' into 'main'
Release 2.3

See merge request signalytic/client-external/streamline/streamline-emr!14
2025-04-04 15:02:00 +00:00
alec.turner d6ef28f7b1 Merge branch 'streamline-v2.3' into 'develop'
Streamline v2.3

See merge request signalytic/client-external/streamline/streamline-emr!13
2025-04-03 22:44:08 +00:00
alec.turner d647ac5d6f remove unused and outdated app.conf.dbsync
This file is not currently used and doesn't need to be in the repo. The DB
access info also did not match the current implementation.
2025-04-03 12:18:53 -07:00
alec.turner 15ef569fbc remove unnecessary entries from compose file
- Named volumes were still present (but unused) from a previous commit.
- A network was explicitly defined, but was not necessary as all services are
  added to a default bridge network already.
- Remove host port mapping for redis container as the statistics service
  accesses it directly (not through the host). This is also improves security.
2025-04-03 12:14:14 -07:00
Patrick Gregorio b33a17b3b5 Changed named volumes to bind mounted volumes for consistency 2025-04-03 12:45:04 -06:00
Patrick Gregorio 5d5f430a2d Removed image mapping in the config.json file 2025-04-03 12:32:35 -06:00
alec.turner 886b364b55 add updated 'start_up.sh' script for streamline-emr docker image
This modified script replaces adds a wait condition on startup before attempting
to interact with the database. This is done with 'mariadb-admin ping' run in a
loop at 1s intervals, ultimately timing out after 30s if unsuccessful. Other
minor updates to the script print additional info the docker logs during
startup.
2025-04-02 15:44:52 -07:00
admin 72d3c83455 updated .gitignore 2025-04-01 16:22:08 +03:00
admin 91a4b10a5a removed streamline-src dir, modified compose file, updated Dockerfile.* files 2025-04-01 15:37:46 +03:00
admin fd783b5003 edit corntab to run every hour 2025-03-31 17:03:17 +03:00
admin aa42e72127 move Dockerfile 2025-03-31 16:36:26 +03:00
admin ce3c354927 cleanup compose file 2025-03-31 16:35:47 +03:00
admin 7c00fb0171 remove forward slashes 2025-03-31 16:35:10 +03:00
admin b1d2cbbcbf decode json string from cache to request body 2025-03-31 16:34:43 +03:00
admin 9f7196d146 statistics docker dir cleanup 2025-03-31 16:04:19 +03:00
admin 2dc2287379 resolved conflicts 2025-03-31 03:46:05 +03:00
admin b0a69145d7 cleanups 2025-03-30 14:37:01 +03:00
admin 6557a951ba statistics docker setup, cleanup on sync script, added supervisord 2025-03-30 14:36:20 +03:00
admin b0c09ade50 streamline-emr v2.3 custom sync service scripts, docker-compose updates 2025-03-26 19:18:23 +03:00
admin 22473c8f3f cleanup & setting up sync update 2025-03-24 17:19:51 +03:00
admin c7fdd2968a Merge branch 'develop' into 'main'
Release 2.1

See merge request signalytic/client-external/streamline/streamline-emr!11
2025-01-23 08:41:47 +00:00
alec.turner 1348cc95ae Merge branch 'drop-demo-data-from-v2' into 'develop'
drop demo data from v2

See merge request signalytic/client-external/streamline/streamline-emr!9
2025-01-22 16:13:41 +00:00
alec.turner 4e9b4e9331 bump image to v2.1
A new v2.1 image is available in the gitlab registry - the config file is
updated accordingly.
2025-01-22 08:11:18 -08:00
alec.turner 733b01c244 update version to 2.1 and add reset condition for v2.0
v2.0 was built using a demo database that should not have been present. v2.1
uses the same application, but should start with a clean database. This change
bumps the version to 2.1 and resets the database if the currently installed
version is 1.* or 2.0.
2025-01-22 08:09:49 -08:00
admin ea343e472e Merge branch 'app-version-2' into 'main'
Release 2

See merge request signalytic/client-external/streamline/streamline-emr!8
2025-01-16 15:53:06 +00:00
alec.turner 9f733bb6c9 add custom install script to clear v1 data
The script `install.sh` largely copies the template from the hosted-app-utils
project, with some key changes:
1. replace template parameters (`{{VAR}}`) with hard-coded values
2. define variables for org, app, install root, etc
3. if old version detected, remove data folder before installing update

The modified script will:
1. delete v1 data
2. update normally when v2 or newer installations are present
2025-01-15 09:13:49 -08:00
alec.turner 5390207ec1 revert org name and update image url
org name is reverted to 'streamline' from 'streamlinehealth'
2025-01-15 08:54:13 -08:00
adminandalec.turner 4b569f81b0 updated streamline-setup v2 2025-01-15 08:53:49 -08:00
alec.turner a2ce9248f0 Merge branch 'develop' into 'main'
Release 1

See merge request signalytic/client-external/streamline/streamline-emr!6
2024-12-14 00:37:02 +00:00
alec.turner bf78a493bd Merge branch 'simplified-app-mgmt' into 'develop'
reorganize app packaging and prep for production

See merge request signalytic/client-external/streamline/streamline-emr!5
2024-12-14 00:11:42 +00:00
alec.turner c8c4ac7298 disable dbsync and prep for production
- bump version to 1.0
- disable dbsync
- add reference app.conf file to aid in quickly re-enabling dbsync
- upgrade hosted-app-utils to develop
2024-12-13 16:01:08 -08:00
alec.turner d60c85fa14 updated readme to match latest usage 2024-10-28 15:17:52 -07:00
alec.turner abf1c11d47 update hosted-app-utils to use simplified package management 2024-10-18 14:42:40 -07:00
admin 49f4681a74 Merge branch 'hosted-app-utils' into 'develop'
Update docker images to modify mysql configuration

See merge request signalytic/client-external/streamline/streamline-emr!3
2024-07-30 16:00:39 +00:00
alec.turner 5222a67855 Integrate with hosted-app-utils
Strip down this repo and allow the hosted-app-utils `package` script to
auto-generate the package.
2024-07-30 08:48:18 -07:00
alec.turner a47c7b3d98 Fix wkhtmltopdf bugs
The wkhtmltopdf library does not work with the latest version of alpine. To
workaround this, a known working image based on an older alpine image is pulled
in and relevant libraries copied to the target image.

The `snappy` package required a few updates to support this, including setting
the wkhtmltopdf binary path explicitly and to enable access to local files
(disabled by default).
2024-05-01 17:03:14 -07:00
alec.turner 5e1cb0d8b4 update db init data to fix triage bug
The table `gender_based_violences` was missing a `triage_id` field, causing an
exception to occur in some cases when selecting the triage button. This change
alters the schema of the table to ensure the column is always present.
2024-04-25 15:12:52 -07:00
alec.turner d26252fc11 update dockerfiles based on latest streamline image
The latest images incorporate all changes previously added by the dockerfiles.
The arm image however is still missing/unreliable from the registry and must be
built independently.
2024-04-25 10:04:06 -07:00
alec.turner 6896f639bd bugfix to monitor script to correct resource usage queries
Two bugs are fixed by this commit. First, a typo in the format string used write
resource usage data to the systemlog caused the systemlog to (correctly) reject
the string as invalid json. The second fix is to handle a case where a .env file
is present, but does not define the APP_CONTAINER variable. In this case the
container name is left empty. This is not an immediate issue, but would become
problematic in the future if additional containers were to be added.
2024-04-11 11:46:23 -07:00
alec.turner e35fc56163 Explicitly set version hash to use 7 characters
While 7 is the default number of characters used to abbreviate a commit hash,
this is not (by default) constant and different instances of the same repo may
generate different version strings as a result. This commit sets this length
explicitly to 7 in both package.sh and build-image scripts.
2024-04-11 11:43:26 -07:00
alec.turner 4a89356390 Import latest app updates from streamline
An updated set of source files and initialization was provided by streamline to
address issues observed during initial testing. These files have been updated in
order to generate a new set of app images.
2024-04-11 11:16:51 -07:00
alec.turner cb4c6b4c1a remove unnecessary check for setup process
autoheal was copied from kenya-emr and was still checking for a setup.pid file
and process. This won't do any harm but also does not add value.
2024-04-03 16:28:04 -07:00
alec.turner 9cbefc841f Simplify application management and align with other docker applications
The notion of application "instances" is dropped in favor of a simpler,
single-instance approach. Default values are provided for all configuration
variables so allow the app to run without additional manual configuration.

A health check and auto-heal script are added to automatically restart the
application in case it becomes unavailable during operation.
2024-03-25 09:34:34 -07:00
13533 changed files with 324 additions and 1860896 deletions
+3
View File
@@ -1 +1,4 @@
build-packages
.local
vendor/
.vscode/
+3
View File
@@ -0,0 +1,3 @@
[submodule "hosted-app-utils"]
path = hosted-app-utils
url = git@gitlab.com:signalytic/client-external/hosted-app-utils.git
+60 -102
View File
@@ -1,116 +1,74 @@
# Streamline EMR
Packaging and installation tools for Streamline's "Streamline EMR" application.
Packaging and installation tools for the Streamline EMR web app.
## Building
1. ensure you have docker access to this project's container registry on GitLab
2. run `package.sh` to generate a new application package
3. package will be stored to `build-packages/`
## Setup
1. login to the gitlab docker registry: `docker login registry.gitlab.com`
2. update submodules: `git submodule update --init --recursive`
Several defaults can be overridden with command line options or by setting appropriate environment variables. A help prompt can be accessed using `package.sh -h`. For example, `package.sh -t latest -p linux/arm64` will build only the `linux/arm64` platform and use the `latest` tag instead of the current repo version.
## Installing
1. extract the generated archive file in a temporary folder on the target system
2. run `<package-name>/install.sh`
3. add a `instance.conf` file at the root of the install directory (see notes below)
4. (optional) restart the systemd service if running on a system with systemd installed: `systemctl restart streamline-emr`
5. (optional) configure an `app.conf` file for integration with Signalytic services (e.g. dbsync)
## Running
### Production (systemd)
On a production system, `systemd` will manage the lifecycle of the application, e.g.
```
# enable and start the the application service
systemctl daemon-reload
systemctl enable streamline-emr
systemctl start streamline-emr
# stop the application service
systemctl stop streamline-emr
# restart the application service
systemctl restart streamline-emr
```
## Monitoring
The script `monitor` can be used at any time to query the current status of all instances. If the `bgsystemlog` program is found, status data will be written to the Signalytic system log under the `streamline_emr` location (json format).
### Docker
In a docker environment, the application must be started manually. This is done by running the `entry` script, for example:
```
/var/signalytic/clientapps/streamline/streamline-emr/entry
```
Note that the entry script will block until the first service stops or until interrupted.
If multiple instances are run from the same machine, additional configuration may be required to differentiate the instances. This is generally the case when using the "sibling container" method for running docker from within a docker container. See the `Configuration` section for more details.
## Configuration
Certain configuration options can be adjusted by setting environment variables or by defining these variables in a `.env` file stored in the same directory as the `docker-compose.yml` file. These variables are:
`APP_PORT`: port mapping for the web app server
`CONTAINER_NAME`: name of the application container
`DATA_DIR`: directory to be mounted for peristant data
`COMPOSE_PROJECT_NAME`: assign the project name associate with the compose file - this avoids conflicts when the "same" compose file is used to manage multiple instances (e.g. when using docker sibling containers)
`IMAGE`: optional, overrides the default `streamline-emr:2.0` image
Each instance of the app uses its own `.env` file to specify its configuration. This is automated through the `start` script using information stored in a file `instances.conf`. This file defines two lists:
`INSTANCES`: a list of unique instance names
`APP_PORTS`: a corresponding list of port numbers to map to the local host
Important note when using "sibling containers": the sibling container method uses the host docker socket to provide containers with access to docker. As a result, port mappings and volume mount points all refer to the host system rather than the container from which the docker command originates.
### Example Configuration Files
The following snippet shows an `instances.conf` file with 3 instances defined. Instance `test0001-_default` will use port `3001`, `test0002-_default` will use `3002`, etc.
```
INSTANCES="test0001-_default" "test0002-_default" "test0003-_default"
APP_PORTS=3001 3002 3003
```
### App Configuration
An `app.conf` file is required for integration with other Signalytic services. A template is provided which demonstrates integration with the `dbsync` service.
## Scripts
Several scripts are used to manage app instances, including:
`entry`: main entry script used to start all configured instances - does not return until a service stops or the process is interrupted.
`start`: loads configuration details from `instances.conf`, then configures and starts each application instance in a dedicated subfolder
`stop`: locates and stops all instances, even if no longer defined in `instances.conf`
`monitor`: checks the status of each instance service and sends data to `bgsystemlog` if possible (loc: `streamline_emr`)
## Docker Images
We want to use our own copy of the Docker images hosted on our GitLab Registry. The `docker` folder contains a set of Dockerfiles that should be used for generating images.
### Automated
The script `build-image` can be used to automatically build, tag, and push images with standard naming conventions. To build and push all images, simple run `build-image -p`. To simply build images and skip pushing to a registry, omit the `-p` flag.
If not already configured, ensure appropriate docker credentials are available:
```bash
# Login to the GitLab registry (Signalytic packages)
docker login registry.gitlab.com
# Login to an external Docker Hub registry
docker login -u <user> -p <credentials>
```
The script `docker/build-image` can be used to automatically build, tag, and push images with standard naming conventions. To build and push all images, simple run `build-image -p`. To simply build images and skip pushing to a registry, omit the `-p` flag.
Building for another platform (e.g. building arm64 from amd64 host) may fail if the Dockerfile requires running certain commands. To build only specific images, dockerfiles may be specified with `build-image -f <DOCKERFILE> [ -f <DOCKERFILE> ... ]`
Other options can be specified to override the image name or version. See the help menu for full details: `build-image -h`
#### Conventions
- We are building for two platforms: `linux/amd64` (x86_64) and `linux/arm64` (aarch64)
- One images is currently required: `streamline-emr`
- Images will be stored to GitLab with the name: `registry.gitlab.com/signalytic/client-external/streamline/streamline-emr/<image>/<arch>:<tag>`
- example: `registry.gitlab.com/signalytic/client-external/streamline/streamline-emr/streamline-emr/arm64:latest`
## Building
To build, simply run `./package` to generate a new application package.
The `package` script will assign a few variables by default, specifically:
```
CONFIG=${CONFIG:-${LOCATION}/config.json}
SRC=${SRC:-${LOCATION}/src}
BUILD_DIR=${BUILD_DIR:-${LOCATION}/build-packages}
```
If necessary, each of these may be overridden by running with `VAR=VALUE ./package`.
The `hosted-app-utils` project provides additional customization via command line arguments. This can be used to modify the package name, skip packaging of images, build for only one platform and more. For a list of options, run `./package -h`.
Helpful options during development:
- `--no-compression`: skip image compression to speed up packaging (packages will be much larger)
- `--app`: skip packaging of images altogether
## Installing
### Automated (Filetransfer)
1. Copy package to the management node (e.g. `scp build-packages/<package> <user>@<mgmt-node-url>:`)
2. SSH into the management node and become root (e.g. `ssh <user>@<mgmt-node-url>`, `sudo su`)
3. (optional) Prepare a filetransfer channel (e.g. `mkdir -p /var/signalytic/filetransfer/<app-name>-<arch>`)
4. Prepare a filetransfer update:
```bash
mkdir -p tmp/<update-number>
mv <package> tmp/<update-number>/
openssl sha256 -binary tmp/<update-number>/<package> | base64 - > tmp/<update-number>/_hash_
```
5. Copy the filetransfer update to the appropriate channel (e.g. `mv tmp/1 /var/signalytic/filetransfer/<app-name>-<arch>/`)
6. (optional) Restart filetransfer: `systemctl restart filetransfer`
7. If necessary, add the package to the target nodes' selective sync lists
```
bgkvs --cred admin:<pass> -B _conf -N _shared_ -d <node> -k filetransfer.selective_sync_packages.[0=<pkg1>
bgkvs --cred admin:<pass> -B _conf -N _shared_ -d <node> -k filetransfer.selective_sync_packages.[1=<pkg2>
bgkvs --cred admin:<pass> -B _conf -N _shared_ -d <node> -k filetransfer.selective_sync_packages.[2=<pkg3>
```
### Manual
1. Make sure you are logged in to the Signalytic GitLab Registry:
```bash
# Login to the registry
docker login registry.gitlab.com
```
2. Build an image (note: we're using platforms `linux/amd64` and `linux/arm64`)
```bash
# Build an image
docker build -f ${DOCKERFILE} --platform ${PLATFORM} -t ${IMAGE_TAG} .
```
3. Make a copy of an existing image:
```bash
# Create a tag
docker tag ${IMAGE_ID} registry.gitlab.com/signalytic/client-external/streamline/streamline-emr/${NAME}:${TAG}
```
3. Push the image to our GitLab Registry:
```bash
# Push the image
docker push registry.gitlab.com/signalytic/client-external/streamline/streamline-emr/${NAME}:${TAG}
```
1. extract the generated archive file in a temporary folder on the target system
2. run `<package-name>/install.sh`
+8
View File
@@ -0,0 +1,8 @@
{
"name": "streamline-emr",
"org": "streamline",
"version": "3.4",
"platforms": [
"linux/arm64"
]
}
+1
View File
@@ -0,0 +1 @@
FROM streamline-emr-redis:latest
+1
View File
@@ -0,0 +1 @@
FROM streamlinehealth/streamline:statistics
-52
View File
@@ -1,52 +0,0 @@
# FROM streamlinehealth/streamline:signalytic
# COPY my.cnf /etc/mysql/my.cnf
# COPY mysql-init.sh /var/www/html/.docker/mysql/mysql-init.sh
FROM php:8.2-fpm-alpine
# Install necessary packages and cleanup
RUN set -ex; \
apk update && \
apk add --no-cache curl gnupg mysql mysql-client pwgen && \
docker-php-ext-install pdo pdo_mysql && \
rm -rf /var/cache/apk/*
# Install Composer
RUN curl -sS https://getcomposer.org/installer | \
php -- --install-dir=/usr/bin/ --filename=composer
# Set the working directory and copy the application code
COPY streamline-src /var/www/html
COPY my.cnf /etc/mysql/my.cnf
WORKDIR /var/www/html
# Create the 'streamline' user and adjust permissions
RUN addgroup -g 1000 streamline && adduser -G streamline -g streamline -s /bin/sh -D streamline && \
composer install && \
chmod -R 777 /var/www/html/storage/ && \
chown -R streamline:streamline /var/www/html && \
mkdir -p /docker-entrypoint-initdb.d/
# Initialize MySQL
COPY streamline_initial.sql /docker-entrypoint-initdb.d/
COPY mysql-init.sh /var/www/html/.docker/mysql/mysql-init.sh
RUN mkdir /scripts && \
mkdir /scripts/pre-exec.d && \
mkdir /scripts/pre-init.d && \
chmod -R 755 /scripts
VOLUME ["/var/lib/mysql"]
# Set the startup script as executable
RUN chmod +x /var/www/html/start_up.sh
# Define the entry point and expose port 80, 3306
ENTRYPOINT ["/bin/sh", "/var/www/html/start_up.sh"]
EXPOSE 80 3306
+1 -51
View File
@@ -1,51 +1 @@
# FROM streamlinehealth/streamline:signalytic
# COPY my.cnf /etc/mysql/my.cnf
# COPY mysql-init.sh /var/www/html/.docker/mysql/mysql-init.sh
FROM php:8.2-fpm-alpine
# Install necessary packages and cleanup
RUN set -ex; \
apk update && \
apk add --no-cache curl gnupg mysql mysql-client pwgen && \
docker-php-ext-install pdo pdo_mysql && \
rm -rf /var/cache/apk/*
# Install Composer
RUN curl -sS https://getcomposer.org/installer | \
php -- --install-dir=/usr/bin/ --filename=composer
# Set the working directory and copy the application code
COPY streamline-src /var/www/html
COPY my.cnf /etc/mysql/my.cnf
WORKDIR /var/www/html
# Create the 'streamline' user and adjust permissions
RUN addgroup -g 1000 streamline && adduser -G streamline -g streamline -s /bin/sh -D streamline && \
composer install && \
chmod -R 777 /var/www/html/storage/ && \
chown -R streamline:streamline /var/www/html && \
mkdir -p /docker-entrypoint-initdb.d/
# Initialize MySQL
COPY streamline_initial.sql /docker-entrypoint-initdb.d/
COPY mysql-init.sh /var/www/html/.docker/mysql/mysql-init.sh
RUN mkdir /scripts && \
mkdir /scripts/pre-exec.d && \
mkdir /scripts/pre-init.d && \
chmod -R 755 /scripts
VOLUME ["/var/lib/mysql"]
# Set the startup script as executable
RUN chmod +x /var/www/html/start_up.sh
# Define the entry point and expose port 80, 3306
ENTRYPOINT ["/bin/sh", "/var/www/html/start_up.sh"]
EXPOSE 80 3306
FROM streamline:signalytic_latest
-52
View File
@@ -1,52 +0,0 @@
# Image Notes
The base images used have a few issues that should be addressed, specifically:
- the `linux/arm64` variant does not work (appears to built for a different platform)
- quite a few files seem to be unused, taking up space unnecessarily and making it difficult to follow
- services should ideally be run in separate docker containers - this looks to have been at least partially implemented, but is not currently used
- mysql configuration is managed in several places, in particular with respect to binary logging
- binary logging needs to be configured slightly differently to work reliably with Signalytic tools (in their current state)
## Changes
### Required Changes
A minimal set of required changes includes:
- modify `/etc/mysql/my.cnf`
- limit binary logging to the `streamline` database only (`binlog-do-db=streamline`)
- remove binary log size limit (`max_binlog_size`)
- modify `/var/www/html/.docker/mysql/mysql-init.sh`
- remove binary log configuration from `mysqld` commands, using `my.cnf` as the sole configuration source (`--log-basename=bin --log-bin=/var/lib/mysql/logs/bin`)
- replace the arm64 base image with a known working image
#### Reasoning
The reason for these changes is that the Signalytic database sync tools currently work with only a single database at a time. When using MariaDB, several system databases are generated automatically, generating additional binary logs that we are not interested in. When attempting to later apply the binary logs to a database server, conflicts may arise. An alternative approach would be to drop all databases instead, this is worth investigating in the future.
### Additional Changes
A temporary solution to the failing arm64 image, is to rebuild the image based on the files already available within the official images. Some additional changes are made here to further reduce the image size. Changes include:
- remove unused dockerfiles from the image
- remove duplicate initialization data
- remove unused git files
## Background
### Streamline Startup Process
```
-- /var/www/html/start_up.sh (entrypoint, called with /bin/sh)
|-- set env vars (app, db, user, pass, root, rootpass)
|-- .docker/mysql/mysql-init.sh
| |-- exec scripts from /scripts/pre-init.d/ (none)
| |-- create binlogs folder if needed: /var/lib/mysql/logs/
| |-- create other mysql folders if needed
| |-- if no /var/lib/mysql yet, create then:
| | |-- install db with "mysql_install_db ..."
| | |-- generate db init script: create db, set permissions, etc
| | |-- run mysqld with init script as input (binlogs set in options)
| | `-- if /docker-entrypoint-initdb.d/ exists:
| | |-- start mysqld (same options)
| | |-- apply all *.sql[.gz] files in dir
| | `-- stop mysqld
| |-- exec scripts from /scripts/post-init.d/ (none)
| `-- start mysqld in background
|-- mysql query: "use streamline" ("streamline" hardcoded)
|-- mysql query: "create database streamline" (uses db name variable)
|-- mysql: ./.docker/mysql/scripts/streamline_initial.sql
`- start php app
```
+1 -1
View File
@@ -60,7 +60,7 @@ if [ -z $VERSION_NAME ];then
VERSION_NAME="$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA"
# if not ci, try to use git
elif command -v git &> /dev/null; then
VERSION_NAME=$(git describe --always --tags --dirty)
VERSION_NAME=$(git describe --always --tags --abbrev=7 --dirty)
# fallback
else
VERSION_NAME="latest"
-4
View File
@@ -1,4 +0,0 @@
[mysqld]
log-basename=bin
log-bin=/var/lib/mysql/logs/bin
binlog-do-db=streamline
-135
View File
@@ -1,135 +0,0 @@
#!/bin/sh
# This script helps to initialise MariaDB and setup fresh database instance
# execute any pre-init scripts
for i in /scripts/pre-init.d/*sh
do
if [ -e "${i}" ]; then
echo "[i] pre-init.d - processing $i"
. "${i}"
fi
done
# create bin-logs folder
if [ ! -d "/var/lib/mysql/logs" ]; then
echo "[i] created logs folder."
mkdir -p /var/lib/mysql/logs/
fi
if [ -d "/run/mysqld" ]; then
echo "[i] mysqld already present, skipping creation"
chown -R mysql:mysql /run/mysqld
else
echo "[i] mysqld not found, creating...."
mkdir -p /run/mysqld
chown -R mysql:mysql /run/mysqld
fi
if [ -d /var/lib/mysql/mysql ]; then
echo "[i] MySQL directory already present, skipping creation"
chown -R mysql:mysql /var/lib/mysql
else
echo "[i] MySQL data directory not found, creating initial DBs"
chown -R mysql:mysql /var/lib/mysql
mysql_install_db --user=mysql --data=/var/lib/mysql > /dev/null
tfile=`mktemp`
if [ ! -f "$tfile" ]; then
return 1
fi
cat << EOF > $tfile
USE mysql;
FLUSH PRIVILEGES ;
GRANT ALL ON *.* TO 'root'@'%' identified by '$MYSQL_ROOT_PASSWORD' WITH GRANT OPTION ;
GRANT ALL ON *.* TO 'root'@'localhost' identified by '$MYSQL_ROOT_PASSWORD' WITH GRANT OPTION ;
SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ;
DROP DATABASE IF EXISTS test ;
FLUSH PRIVILEGES ;
EOF
if [[ "$MYSQL_DATABASE" != "" ]]; then
echo "[i] Creating database: $MYSQL_DATABASE"
if [ "$MYSQL_CHARSET" != "" ] && [ "$MYSQL_COLLATION" != "" ]; then
echo "[i] with character set [$MYSQL_CHARSET] and collation [$MYSQL_COLLATION]"
echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` CHARACTER SET $MYSQL_CHARSET COLLATE $MYSQL_COLLATION;" >> $tfile
else
echo "[i] with character set: 'utf8' and collation: 'utf8_general_ci'"
echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` CHARACTER SET utf8 COLLATE utf8_general_ci;" >> $tfile
fi
if [ "$MYSQL_USER" != "" ]; then
echo "[i] Creating user: $MYSQL_USER with password $MYSQL_PASSWORD"
echo "GRANT ALL ON `$MYSQL_DATABASE`.* TO '$MYSQL_USER'@'127.0.0.1' IDENTIFIED BY '$MYSQL_PASSWORD';" >> $tfile;
echo "GRANT ALL ON \`$MYSQL_DATABASE\`.* to '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD';" >> $tfile
fi
fi
/usr/bin/mysqld --user=mysql --bootstrap --verbose=0 --skip-name-resolve --skip-networking=0 < $tfile
# /usr/bin/mysqld --user=mysql --bootstrap --verbose=0 --skip-name-resolve --skip-networking=0 --log-basename=bin --log-bin=/var/lib/mysql/logs/bin < $tfile
rm -f $tfile
# only run if we have a starting MYSQL_DATABASE env variable AND
# the /docker-entrypoint-initdb.d/ file is not empty
if [ "$MYSQL_DATABASE" != "" ] && [ "$(ls -A /docker-entrypoint-initdb.d 2>/dev/null)" ]; then
# start the server temporarily so that we can import seed files
echo
echo "Preparing to process the contents of /docker-entrypoint-initdb.d/"
echo
TEMP_OUTPUT_LOG=/tmp/mysqld_output
/usr/bin/mysqld --user=mysql --skip-name-resolve --skip-networking=0 --silent-startup > "${TEMP_OUTPUT_LOG}" 2>&1 &
# /usr/bin/mysqld --user=mysql --skip-name-resolve --skip-networking=0 --log-basename=bin --log-bin=/var/lib/mysql/logs/bin --silent-startup > "${TEMP_OUTPUT_LOG}" 2>&1 &
PID="$!"
# watch the output log until the server is running
until tail "${TEMP_OUTPUT_LOG}" | grep -q "Version:"; do
sleep 0.2
done
# use mysql client to import seed files while temp db is running
# use the starting MYSQL_DATABASE so mysql knows where to import
MYSQL_CLIENT="/usr/bin/mysql -u root -p$MYSQL_ROOT_PASSWORD"
# loop through all the files in the seed directory
# redirect input (<) from .sql files into the mysql client command line
# pipe (|) the output of using `gunzip -c` on .sql.gz files
for f in /docker-entrypoint-initdb.d/*; do
case "$f" in
*.sql) echo " $0: running $f"; eval "${MYSQL_CLIENT} ${MYSQL_DATABASE} < $f"; echo ;;
*.sql.gz) echo " $0: running $f"; gunzip -c "$f" | eval "${MYSQL_CLIENT} ${MYSQL_DATABASE}"; echo ;;
esac
done
# send the temporary mysqld server a shutdown signal
# and wait till it's done before completeing the init process
kill -s TERM "${PID}"
wait "${PID}"
rm -f TEMP_OUTPUT_LOG
echo "Completed processing seed files."
fi;
echo
echo 'MySQL init process done. Ready for start up.'
echo
echo "exec /usr/bin/mysqld --user=mysql --console --skip-name-resolve --skip-networking=0" "$@"
# echo "exec /usr/bin/mysqld --user=mysql --console --skip-name-resolve --skip-networking=0 --log-basename=bin --log-bin=/var/lib/mysql/logs/bin " "$@"
fi
# execute any pre-exec scripts
for i in /scripts/pre-exec.d/*sh
do
if [ -e "${i}" ]; then
echo "[i] pre-exec.d - processing $i"
. ${i}
fi
done
exec /usr/bin/mysqld --user=mysql --console --skip-name-resolve --skip-networking=0 &
return $?
BIN
View File
Binary file not shown.
@@ -1,45 +0,0 @@
worker_processes 1;
error_log stderr warn;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main_timed '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'$request_time $upstream_response_time $pipe $upstream_cache_status';
access_log /dev/stdout main_timed;
error_log /dev/stderr notice;
keepalive_timeout 65;
server {
listen 80;
index index.php index.html;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
server_name localhost;
root /var/www/html/public;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
}
@@ -1,58 +0,0 @@
[global]
; Log to stderr
error_log = /dev/stderr
[www]
user = streamline
group = streamline
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
; a specific port;
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = 127.0.0.1:9000
; Enable status page
pm.status_path = /fpm-status
; Ondemand process manager
pm = ondemand
; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI. The below defaults are based on a server without much resources. Don't
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
pm.max_children = 100
; The number of seconds after which an idle process will be killed.
; Note: Used only when pm is set to 'ondemand'
; Default Value: 10s
pm.process_idle_timeout = 10s;
; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries. For
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default Value: 0
pm.max_requests = 1000
; Make sure the FPM workers can reach the environment variables for configuration
clear_env = no
; Catch output from PHP
catch_workers_output = yes
; Remove the 'child 10 said into stderr' prefix in the log and only show the actual message
decorate_workers_output = no
; Enable ping page to use in healthcheck
ping.path = /fpm-ping
@@ -1,5 +0,0 @@
[supervisord]
nodaemon=false
[program:mariadb]
command=/usr/bin/mysqld_safe --datadir='/var/lib/mysql' --port=3306 --skip-networking=0
@@ -1,4 +0,0 @@
[mysqld]
max_binlog_size=3M
log-basename=bin
log-bin=/var/lib/mysql/logs/bin
@@ -1,132 +0,0 @@
#!/bin/sh
# This script helps to initialise MariaDB and setup fresh database instance
# execute any pre-init scripts
for i in /scripts/pre-init.d/*sh
do
if [ -e "${i}" ]; then
echo "[i] pre-init.d - processing $i"
. "${i}"
fi
done
# create bin-logs folder
if [ ! -d "/var/lib/mysql/logs" ]; then
echo "[i] created logs folder."
mkdir -p /var/lib/mysql/logs/
fi
if [ -d "/run/mysqld" ]; then
echo "[i] mysqld already present, skipping creation"
chown -R mysql:mysql /run/mysqld
else
echo "[i] mysqld not found, creating...."
mkdir -p /run/mysqld
chown -R mysql:mysql /run/mysqld
fi
if [ -d /var/lib/mysql/mysql ]; then
echo "[i] MySQL directory already present, skipping creation"
chown -R mysql:mysql /var/lib/mysql
else
echo "[i] MySQL data directory not found, creating initial DBs"
chown -R mysql:mysql /var/lib/mysql
mysql_install_db --user=mysql --data=/var/lib/mysql > /dev/null
tfile=`mktemp`
if [ ! -f "$tfile" ]; then
return 1
fi
cat << EOF > $tfile
USE mysql;
FLUSH PRIVILEGES ;
GRANT ALL ON *.* TO 'root'@'%' identified by '$MYSQL_ROOT_PASSWORD' WITH GRANT OPTION ;
GRANT ALL ON *.* TO 'root'@'localhost' identified by '$MYSQL_ROOT_PASSWORD' WITH GRANT OPTION ;
SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ;
DROP DATABASE IF EXISTS test ;
FLUSH PRIVILEGES ;
EOF
if [[ "$MYSQL_DATABASE" != "" ]]; then
echo "[i] Creating database: $MYSQL_DATABASE"
if [ "$MYSQL_CHARSET" != "" ] && [ "$MYSQL_COLLATION" != "" ]; then
echo "[i] with character set [$MYSQL_CHARSET] and collation [$MYSQL_COLLATION]"
echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` CHARACTER SET $MYSQL_CHARSET COLLATE $MYSQL_COLLATION;" >> $tfile
else
echo "[i] with character set: 'utf8' and collation: 'utf8_general_ci'"
echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` CHARACTER SET utf8 COLLATE utf8_general_ci;" >> $tfile
fi
if [ "$MYSQL_USER" != "" ]; then
echo "[i] Creating user: $MYSQL_USER with password $MYSQL_PASSWORD"
echo "GRANT ALL ON `$MYSQL_DATABASE`.* TO '$MYSQL_USER'@'127.0.0.1' IDENTIFIED BY '$MYSQL_PASSWORD';" >> $tfile;
echo "GRANT ALL ON \`$MYSQL_DATABASE\`.* to '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD';" >> $tfile
fi
fi
/usr/bin/mysqld --user=mysql --bootstrap --verbose=0 --skip-name-resolve --skip-networking=0 --log-basename=bin --log-bin=/var/lib/mysql/logs/bin < $tfile
rm -f $tfile
# only run if we have a starting MYSQL_DATABASE env variable AND
# the /docker-entrypoint-initdb.d/ file is not empty
if [ "$MYSQL_DATABASE" != "" ] && [ "$(ls -A /docker-entrypoint-initdb.d 2>/dev/null)" ]; then
# start the server temporarily so that we can import seed files
echo
echo "Preparing to process the contents of /docker-entrypoint-initdb.d/"
echo
TEMP_OUTPUT_LOG=/tmp/mysqld_output
/usr/bin/mysqld --user=mysql --skip-name-resolve --skip-networking=0 --log-basename=bin --log-bin=/var/lib/mysql/logs/bin --silent-startup > "${TEMP_OUTPUT_LOG}" 2>&1 &
PID="$!"
# watch the output log until the server is running
until tail "${TEMP_OUTPUT_LOG}" | grep -q "Version:"; do
sleep 0.2
done
# use mysql client to import seed files while temp db is running
# use the starting MYSQL_DATABASE so mysql knows where to import
MYSQL_CLIENT="/usr/bin/mysql -u root -p$MYSQL_ROOT_PASSWORD"
# loop through all the files in the seed directory
# redirect input (<) from .sql files into the mysql client command line
# pipe (|) the output of using `gunzip -c` on .sql.gz files
for f in /docker-entrypoint-initdb.d/*; do
case "$f" in
*.sql) echo " $0: running $f"; eval "${MYSQL_CLIENT} ${MYSQL_DATABASE} < $f"; echo ;;
*.sql.gz) echo " $0: running $f"; gunzip -c "$f" | eval "${MYSQL_CLIENT} ${MYSQL_DATABASE}"; echo ;;
esac
done
# send the temporary mysqld server a shutdown signal
# and wait till it's done before completeing the init process
kill -s TERM "${PID}"
wait "${PID}"
rm -f TEMP_OUTPUT_LOG
echo "Completed processing seed files."
fi;
echo
echo 'MySQL init process done. Ready for start up.'
echo
echo "exec /usr/bin/mysqld --user=mysql --console --skip-name-resolve --skip-networking=0 --log-basename=bin --log-bin=/var/lib/mysql/logs/bin " "$@"
fi
# execute any pre-exec scripts
for i in /scripts/pre-exec.d/*sh
do
if [ -e "${i}" ]; then
echo "[i] pre-exec.d - processing $i"
. ${i}
fi
done
exec /usr/bin/mysqld --user=mysql --console --skip-name-resolve --skip-networking=0 --log-basename=bin --log-bin=/var/lib/mysql/logs/bin &
return $?
@@ -1,11 +0,0 @@
FROM nginx:alpine3.18-slim
ENV NGINXUSER=streamline
ENV NGINXGROUP=streamline
RUN set -eux; \
mkdir -p /var/www/html/public; \
adduser -g ${NGINXGROUP} -s /bin/sh -D ${NGINXUSER}; \
sed -i "s/user www-data/user ${NGINXUSER}/g" /etc/nginx/nginx.conf
ADD .docker/nginx/default.conf /etc/nginx/conf.d/default.conf
@@ -1,22 +0,0 @@
server {
listen 80;
index index.php index.html;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
server_name _;
root /var/www/html/public;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
@@ -1,26 +0,0 @@
FROM php:8.2-fpm-alpine
ENV PHPGROUP=streamline
ENV PHPUSER=streamline
RUN set -eux; \
adduser -g ${PHPGROUP} -s /bin/sh -D ${PHPUSER}; \
sed -i "s/user = www-data/user = ${PHPUSER}/g" /usr/local/etc/php-fpm.d/www.conf; \
sed -i "s/group = www-data/group = ${PHPGROUP}/g" /usr/local/etc/php-fpm.d/www.conf; \
mkdir -p /var/www/html/public; \
docker-php-ext-install pdo pdo_mysql opcache
COPY .docker/php/opcache.ini /usr/local/etc/php/conf.d/opcache.ini
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
COPY ./ /var/www/html
WORKDIR /var/www/html
RUN set -eux; \
composer install; \
chmod 777 -R /var/www/html/storage; \
chown -R www-data:www-data /var/www/html
CMD ["php-fpm", "-y", "/usr/local/etc/php-fpm.conf", "-R"]
@@ -1,11 +0,0 @@
[opcache]
opcache.enable=1
; 0 means it will check on every request
; 0 is irrelevant if opcache.validate_timestamps=0 which is desirable in production
opcache.revalidate_freq=0
opcache.validate_timestamps=1
opcache.max_accelerated_files=10000
opcache.memory_consumption=192
opcache.max_wasted_percentage=10
opcache.interned_strings_buffer=16
opcache.fast_shutdown=1
-35
View File
@@ -1,35 +0,0 @@
APP_NAME=Streamline
APP_ENV=local
APP_KEY=base64:ptK2XJR/wv0lMqYfMGc12gU63xQNretDwt5spqF6Gf4=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_LOG=daily
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=streamline
DB_USERNAME=root
DB_PASSWORD=streamline
DB_ROOT_PASSWORD=streamline
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
-34
View File
@@ -1,34 +0,0 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_LOG=daily
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
@@ -1,5 +0,0 @@
<?php
return [
'name' => 'Patients'
];
@@ -1,54 +0,0 @@
<?php
namespace Modules\Patients\Http\Controllers;
use Illuminate\Http\Request;
use Streamline\Models\Alert;
use Streamline\Models\Patient;
class AlertsController extends Controller {
public function __construct() {
$this->middleware('auth');
}
/* Add a new patient alert i.e used by the alerts modal in the header */
public function store_patient_alerts(Request $request) {
$alert = new Alert;
$alert->patient_id = $request->alert_patient_id;
$alert->alerts = $request->patient_alerts;
$alert->created_by = auth()->user()->id;
$alert->save();
return $alert;
}
public function view_alerts() {
$patient_id = session()->get('patient_id');
$patient = Patient::find($patient_id);
$alerts = Alert::where('patient_id', $patient_id)->get();
return view('patients::alerts.view_alerts', compact('alerts', 'patient'));
}
public function edit_alert($id) {
$alert = Alert::where(['id' => $id])->first();
return view('patients::alerts.edit_alert', compact('alert'));
}
public function save_edit_alert(Request $request) {
$alert = Alert::find($request->id);
$alert->alerts = $request->name;
$alert->save();
flash("Alert has been saved")->success();
return redirect('/alerts/view_alerts/');
}
public function delete_alert($id) {
$alert = Alert::find($id);
$alert->delete();
flash("Alert has been deleted.")->success();
return redirect('/alerts/view_alerts/');
}
}
@@ -1,127 +0,0 @@
<?php
namespace Modules\Patients\Http\Controllers;
use Illuminate\Http\Request;
use Streamline\Models\Allergy;
use Streamline\Models\Patient;
use Streamline\Models\DrugCategory;
use Streamline\Models\PatientDocument;
use Streamline\Models\Alert;
use Illuminate\Support\Facades\DB;
class AllergiesController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$patient_id = session()->get('patient_id');
$patient = Patient::find($patient_id);
$categories = DB::table('patient_categories')->where('available', 1)->pluck("name", "id");
$marital_statuses = DB::table('marital_statuses')->pluck("name", "id");
$diagnoses = DB::table('diagnoses')->where('available', 1)->pluck("name", "id");
$clinics = DB::table('clinics')->pluck("name", "id");
$relationships = DB::table('family_relations')->pluck('name', 'id');
$occupations = DB::table('occupations')->pluck('name', 'id');
$patient_categories = DB::table('patient_categories')->where('available', 1)->pluck('name', 'id');
$districts = DB::table('districts')->pluck('name', 'id');
$counties = DB::table('counties')->pluck('name', 'id');
$subcounties = DB::table('subcounties')->pluck('name', 'id');
$parishes = DB::table('parishes')->pluck('name', 'id');
$villages = DB::table('villages')->pluck('name', 'id');
$drug_categories = DrugCategory::orderBy('name', 'asc')->get();
$documents = PatientDocument::where('patient_id', $patient_id)->orderBy('created_at', 'desc')->take(2)->get();
$known_patient_alerts = Alert::where('patient_id', $patient_id)->orderBy('created_at', 'desc')->take(2)->get();
$known_patient_allergies = Allergy::where('patient_id', $patient_id)->orderBy('created_at', 'desc')->get();
$drug_categories_array = DB::table('drug_categories')->pluck('name', 'id');
$drug_categories = DrugCategory::orderBy('name', 'asc')->get();
return view('patients::allergies.index',compact('patient','known_patient_allergies','drug_categories_array','categories','drug_categories','relationships', 'occupations', 'patient_categories', 'diagnoses', 'categories', 'marital_statuses', 'districts', 'counties', 'subcounties', 'parishes', 'villages', 'drug_categories', 'documents', 'known_patient_alerts'));
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
/*
* Add allergic drugs to a particular patient
*/
public function store_patient_allergies(Request $request)
{
$patient_id = $request->allergy_patient_id;
$patient_allergies_array = $request->patient_allergies;
$allergies_string = implode(',', $patient_allergies_array);
$existing_allergy = Allergy::where(['patient_id' => $patient_id])->first();
$allergy = is_null($existing_allergy) ? new Allergy : $existing_allergy;
$allergy->patient_id = $patient_id;
$allergy->names = $allergies_string;
$save_allergy = is_null($existing_allergy) ? $allergy->save() : $allergy->update(); /* if new patient allergy then insert else update the db table*/
return $request->all();
}
}
@@ -1,13 +0,0 @@
<?php
namespace Modules\Patients\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}
@@ -1,245 +0,0 @@
<?php
namespace Modules\Patients\Http\Controllers;
use Illuminate\Http\Request;
use Streamline\Models\TriageNutrition;
class NutritionController extends Controller {
public function get_nutrition_status(Request $request): string {
$age_diff_months = round($request->age_diff_months);
$weight = $request->weight;
$height = $request->height * 100;
$bmi = $request->bmi;
$gender = $request->gender;
$patient_id = $request->patient_id;
$episode_id = $request->episode_id;
$muac = $request->muac;
$oedema = $request->oedema;
$reference_age = NULL;
$reference_bmi = NULL;
$reference_height = NULL;
$reference_weight = NULL;
$texts_array = ["Normal" => 1, "Risk of overweight" => 2, "MAM" => 3,
"SAM without oedema" => 4, "SAM with oedema" => 5];
if (!is_null($request->weight) && !is_null($request->height) && !is_null($request->bmi)) {
if ($age_diff_months > 5 && $age_diff_months < 60) {
if ($gender == 2){
$data = file(base_path('public/uploads/nutrition_csv_lookup/female_6_60.csv'));
} else {
$data = file(base_path('public/uploads/nutrition_csv_lookup/male_6_60.csv'));
}
$formatted_data = [];
$lengths = [];
foreach($data as $item) {
$split_item = explode(',', $item);
$lengths[] = +$split_item[0];
$formatted_data[+$split_item[0]] = [+$split_item[1], +$split_item[2], +$split_item[3], +$split_item[4], +str_replace(["\r", "\n"], "", $split_item[5])];
}
$reference_height = get_closest_element_in_array($lengths, $height);
$reference_weight = get_closest_element_in_array($formatted_data[$reference_height], $weight);
$weight_key = array_search($reference_weight, $formatted_data[$reference_height]);
if ($weight_key == 0) {
$text = "SAM without oedema";
$reason = "Weight for height < -3 SD";
$text_color = "red";
} elseif ($weight_key == 1) {
$text = "MAM";
$reason = "Weight for height between -3 SD and -2 SD";
$text_color = "darkorange";
} elseif ($weight_key == 2 || $weight_key == 3) {
$text = "Normal";
$reason = "Weight for height between -2 SD and 2 SD";
$text_color = "black";
} else {
$text = "Risk of overweight";
$reason = "Weight for height > 2 SD";
$text_color = "black";
}
} elseif ($age_diff_months > 59 && $age_diff_months < 228) {
if ($age_diff_months < 120) {
if ($gender == 2){
$data = file(base_path('public/uploads/nutrition_csv_lookup/female_60_120.csv'));
} else {
$data = file(base_path('public/uploads/nutrition_csv_lookup/male_60_120.csv'));
}
} else {
if ($gender == 2){
$data = file(base_path('public/uploads/nutrition_csv_lookup/female_120_228.csv'));
} else {
$data = file(base_path('public/uploads/nutrition_csv_lookup/male_120_228.csv'));
}
}
$formatted_data = [];
$ages_in_months = [];
foreach($data as $item) {
$split_item = explode(',', $item);
$ages_in_months[] = +$split_item[0];
$formatted_data[+$split_item[0]] = [+$split_item[1], +$split_item[2], +$split_item[3], +$split_item[4], +str_replace(["\r", "\n"], "", $split_item[5])];
}
$reference_age = get_closest_element_in_array($ages_in_months, $age_diff_months);
$reference_bmi = get_closest_element_in_array($formatted_data[$reference_age], $bmi);
$bmi_key = array_search($reference_bmi, $formatted_data[$reference_age]);
if ($bmi_key == 0) {
$text = "SAM without oedema";
$reason = "BMI < -3 SD";
$text_color = "red";
} elseif ($bmi_key == 1) {
$text = "MAM";
$reason = "BMI between -3 SD and -2 SD";
$text_color = "darkorange";
} elseif ($bmi_key == 2 || $bmi_key == 3) {
$text = "Normal";
$reason = "BMI between -2 SD and 1 SD";
$text_color = "black";
} else {
$text = "Risk of overweight";
$reason = "BMI > 1 SD";
$text_color = "black";
}
} elseif ($age_diff_months > 227 && $age_diff_months < 1200) {
if ($bmi < 16) {
$text = "SAM without oedema";
$reason = "BMI < 16";
$text_color = "red";
} elseif ($bmi > 15.9 && $bmi < 17) {
$text = "MAM";
$reason = "BMI between 16 and 17";
$text_color = "darkorange";
} elseif ($bmi > 16.9 && $bmi < 25) {
$text = "Normal";
$reason = "BMI between 17 and 25";
$text_color = "black";
} else {
$text = "Risk of overweight";
$reason = "BMI ≥ 25";
$text_color = "black";
}
} else {
return "0";
}
} else {
$text = "Normal";
$reason = "Normal";
$text_color = 'black';
}
// check for oedema status
if ($oedema == 1) {
$oedema = "Yes";
$oedema_text = "SAM with oedema";
$oedema_reason = "Oedema of both feet";
$oedema_text_color = "red";
} else {
$oedema = "No";
$oedema_text = "Normal";
$oedema_reason = "";
$oedema_text_color = "black";
}
// check if oedema has a higher category
if (($texts_array[$oedema_text] > $texts_array[$text])) {
$text = $oedema_text;
$reason = $oedema_reason;
$text_color = $oedema_text_color;
}
if ($age_diff_months < 1.59 && $muac < 11.0) {
$muac_text = "SAM without oedema";
$muac_reason = "MUAC below 11.0";
$muac_text_color = 'red';
} else if(between($age_diff_months, 1.6, 5) && $muac < 11.5) {
$muac_text = "SAM without oedema";
$muac_reason = "MUAC below 11.5";
$muac_text_color = 'red';
} else if(between($age_diff_months, 6, 59) && between($muac, 11.5, 12.4)) {
$muac_text = "MAM";
$muac_reason = "MUAC between 11.5 and 12.4";
$muac_text_color = 'darkorange';
} else if(between($age_diff_months, 6, 59) && $muac < 11.5) {
$muac_text = "SAM without oedema";
$muac_reason = "MUAC below 11.5";
$muac_text_color = 'red';
} else if(between($age_diff_months, 60, 119) && between($muac, 13.5, 14.4)) {
$muac_text = "MAM";
$muac_reason = "MUAC between 13.5 and 14.4";
$muac_text_color = 'darkorange';
} else if(between($age_diff_months, 60, 119) && $muac < 13.5) {
$muac_text = "SAM without oedema";
$muac_reason = "MUAC below 13.5";
$muac_text_color = 'red';
} else if(between($age_diff_months, 120, 179) && between($muac, 16.0, 18.4)) {
$muac_text = "MAM";
$muac_reason = "MUAC between 16.0 and 18.4";
$muac_text_color = 'darkorange';
} else if(between($age_diff_months, 120, 179) && $muac < 16.0) {
$muac_text = "SAM without oedema";
$muac_reason = "MUAC below 16.0";
$muac_text_color = 'red';
} else if(between($age_diff_months, 180, 215) && between($muac, 18.5, 20.9)) {
$muac_text = "MAM";
$muac_reason = "MUAC between 18.5 and 21.0";
$muac_text_color = 'darkorange';
} else if(between($age_diff_months, 180, 215) && $muac < 18.5) {
$muac_text = "SAM without oedema";
$muac_reason = "MUAC below 18.5";
$muac_text_color = 'red';
} else if($age_diff_months > 215 && between($muac, 19.0, 21.9)) {
$muac_text = "MAM";
$muac_reason = "MUAC between 19.0 and 21.9";
$muac_text_color = 'darkorange';
} else if($age_diff_months > 215 && $muac < 19.0) {
$muac_text = "SAM without oedema";
$muac_reason = "MUAC below 19.0";
$muac_text_color = 'red';
} else {
$muac_text = "Normal";
$muac_reason = "Normal";
$muac_text_color = 'black';
}
if (($texts_array[$muac_text] > $texts_array[$text])) {
$text = $muac_text;
$reason = $muac_reason;
$text_color = $muac_text_color;
}
// save data to the nutrition table
$nutrition = TriageNutrition::where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->first();
if (!$nutrition) {
$nutrition = new TriageNutrition();
}
$nutrition->patient_id = $patient_id;
$nutrition->episode_id = $episode_id;
$nutrition->age_diff_months = $age_diff_months;
$nutrition->weight = $weight;
$nutrition->height = $height;
$nutrition->bmi = $bmi;
$nutrition->muac = $muac;
$nutrition->oedema = $oedema;
$nutrition->gender = $gender;
$nutrition->reference_height = $reference_height;
$nutrition->reference_weight = $reference_weight;
$nutrition->text = $text;
$nutrition->reason = $reason;
$nutrition->reference_age = $reference_age;
$nutrition->reference_bmi = $reference_bmi;
$nutrition->updated_at = now();
$nutrition->save();
return $text . "&&&&" . $reason . "&&&&" . $text_color;
}
}
File diff suppressed because it is too large Load Diff
@@ -1,242 +0,0 @@
<?php
namespace Modules\Patients\Http\Controllers;
use Illuminate\Http\Request;
use Streamline\Models\Alert;
use Streamline\Models\Allergy;
use Streamline\Models\DrugCategory;
use Streamline\Models\PatientDocument;
use Streamline\Models\Patient;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
class PatientDocumentController extends Controller {
public function __construct() {
$this->middleware('auth');
}
public function index() {
$patient_id = session()->get('patient_id');
$patient_episodes = \Illuminate\Support\Facades\DB::table('patient_episodes')
->where(['patient_id' => $patient_id])
->orderBy('id', 'desc')
->get();
$patient = Patient::where(['id' => $patient_id])->first();
$categories = DB::table('patient_categories')->where('available', 1)->pluck("name", "id");
$marital_statuses = DB::table('marital_statuses')->pluck("name", "id");
$diagnoses = DB::table('diagnoses')->where('available', 1)->pluck("name", "id");
$clinics = DB::table('clinics')->pluck("name", "id");
$relationships = DB::table('family_relations')->pluck('name', 'id');
$occupations = DB::table('occupations')->pluck('name', 'id');
$patient_categories = DB::table('patient_categories')->where('available', 1)->pluck('name', 'id');
$districts = DB::table('districts')->pluck('name', 'id');
$counties = DB::table('counties')->pluck('name', 'id');
$subcounties = DB::table('subcounties')->pluck('name', 'id');
$parishes = DB::table('parishes')->pluck('name', 'id');
$villages = DB::table('villages')->pluck('name', 'id');
$drug_categories = DrugCategory::orderBy('name', 'asc')->get();
$documents = PatientDocument::where('patient_id', $patient_id)->orderBy('created_at', 'desc')->get();
$known_patient_allergies = Allergy::where('patient_id', $patient_id)->orderBy('created_at', 'desc')->take(2)->get();
$known_patient_alerts = Alert::where('patient_id', $patient_id)->orderBy('created_at', 'desc')->take(2)->get();
$drug_categories_array = DB::table('drug_categories')->pluck('name', 'id');
return view('patients::patient_documents.index', compact('patient', 'clinics', 'relationships', 'occupations', 'patient_categories', 'diagnoses', 'patient_episodes', 'categories', 'marital_statuses', 'districts', 'counties', 'subcounties', 'parishes', 'villages', 'drug_categories', 'documents', 'known_patient_allergies', 'known_patient_alerts', 'drug_categories_array'));
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create() {
$patient_id = session()->get('patient_id');
$episode_id = session()->get('episode_id');
$patient = Patient::find($patient_id);
$categories = DB::table('patient_categories')->where('available', 1)->pluck("name", "id");
$drug_categories = DB::table('drug_categories')->get();
$marital_statuses = DB::table('marital_statuses')->pluck("name", "id");
$diagnoses = DB::table('diagnoses')->where('available', 1)->pluck("name", "id");
$clinics = DB::table('clinics')->pluck("name", "id");
$relationships = DB::table('family_relations')->pluck('name', 'id');
$occupations = DB::table('occupations')->pluck('name', 'id');
$patient_categories = DB::table('patient_categories')->where('available', 1)->pluck('name', 'id');
$districts = DB::table('districts')->pluck('name', 'id');
$counties = DB::table('counties')->pluck('name', 'id');
$subcounties = DB::table('subcounties')->pluck('name', 'id');
$parishes = DB::table('parishes')->pluck('name', 'id');
$villages = DB::table('villages')->pluck('name', 'id');
$documents = PatientDocument::where('patient_id', $patient_id)->orderBy('created_at', 'desc')->get();
$drug_categories = DB::table('drug_categories')->orderBy('name', 'asc')->get();
//allergies and alerts
$known_patient_allergies = \Streamline\Models\Allergy::where('patient_id', $patient_id)->orderBy('created_at', 'desc')->take(2)->get();
$known_patient_alerts = \Streamline\Models\Alert::where('patient_id', $patient_id)->orderBy('created_at', 'desc')->take(2)->get();
$drug_categories_array = DB::table('drug_categories')->pluck('name', 'id');
return view('patients::patient_documents.create', compact('patient', 'clinics', 'relationships', 'occupations', 'patient_categories', 'diagnoses', 'categories', 'marital_statuses', 'districts', 'counties', 'subcounties', 'parishes', 'villages', 'drug_categories', 'episode_id', 'documents', 'drug_categories_array', 'drug_categories', 'known_patient_allergies', 'known_patient_alerts'));
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request) {
$validator = Validator::make($request->all(), [
'documenttitle' => 'required',
]);
if ($validator->fails()) {
$string = "";
foreach ($validator->errors()->getMessages() as $item) {
$string .= "{$item[0]}<br>";
}
return back()->withErrors($validator)->withInput();
} else {
$patient_document = new PatientDocument;
$patient_document->patient_id = session()->get('patient_id');
$patient_document->episode_id = session()->get('episode_id');
$patient_document->title = $request->documenttitle;
$patient_document->description = $request->description;
if ($request->file('document')->isValid()) {
$file = $request->file('document');
$store = public_path() . '/uploads/patient-documents/';
$file_name = $file->getClientOriginalName();
$file->move($store, $file_name);
$patient_document->path = public_path() . '/uploads/patient-documents/' . $file_name;
}
$patient_document->date_taken = \Carbon\Carbon::createFromFormat('d/m/Y', $request->documentdate)->toDateString();
$patient_document->created_by = auth()->user()->id;
$patient_document->úpdated_by = auth()->user()->id;
$patient_document->save();
flash("document has been added.")->success();
return redirect('/patient_episodes');
}
}
public function modal_store(Request $request) {
$validator = Validator::make($request->all(), [
'documenttitle' => 'required',
]);
if ($validator->fails()) {
$string = "";
foreach ($validator->errors()->getMessages() as $item) {
$string .= "{$item[0]}<br>";
}
return back()->withErrors($validator)->withInput();
} else {
$patient_document = new PatientDocument;
$patient_document->patient_id = session()->get('patient_id');
$patient_document->episode_id = session()->get('episode_id');
$patient_document->title = $request->documenttitle;
$patient_document->description = $request->description;
if ($request->file('document')->isValid()) {
$file = $request->file('document');
$store = public_path() . '/uploads/patient-documents/';
$file_name = $file->getClientOriginalName();
$file->move($store, $file_name);
$patient_document->path = public_path() . '/uploads/patient-documents/' . $file_name;
}
$patient_document->date_taken = \Carbon\Carbon::createFromFormat('d/m/Y', $request->documentdate)->toDateString();
$patient_document->created_by = auth()->user()->id;
$patient_document->úpdated_by = auth()->user()->id;
$patient_document->save();
flash("document has been added.")->success();
return redirect('/consultation/route');
}
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id) {
$document = PatientDocument::find($id);
if (substr($document->path, 0, 25) === "../uploads/patient_upload") {
$document_path_cleaned = str_replace("../uploads/patient_uploads", "/var/www/html/uploads/patient-documents", $document->path);
} else {
$document_path_cleaned = $document->path;
}
$ext = pathinfo($document->path, PATHINFO_EXTENSION);
if ($ext == "pdf") {
return response()->file($document_path_cleaned, ['Content-Type' => 'application/pdf']);
} elseif ($ext == 'doc') {
return response()->file($document_path_cleaned, [
'Content-Type' => 'application/msword'
]);
} elseif ($ext == 'docx') {
return response()->file($document_path_cleaned, [
'Content-Type' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
]);
} elseif ($ext == 'xls') {
return response()->file($document_path_cleaned, [
'Content-Type' => 'application/vnd.ms-excel'
]);
} elseif ($ext == 'xlsx') {
return response()->file($document_path_cleaned, [
'Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
]);
} elseif ($ext == 'txt') {
return response()->file($document_path_cleaned, [
'Content-Type' => 'application/octet-stream'
]);
} elseif ($ext == 'png' || $ext == 'jpg' || $ext == 'JPG' || $ext == 'jpeg') {
return response()->file($document_path_cleaned, [
'Content-Type' => 'image/jpeg'
]);
}
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id) {
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id) {
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id) {
$document = PatientDocument::find($id);
if ($document->delete()):
flash("document has been deleted.")->error();
return redirect('/patient_documents/');
endif;
}
/*
* put the episode id in the session before creating the document
*/
public function set_episode_id($id) {
session()->put(['episode_id' => $id]);
}
}
@@ -1,229 +0,0 @@
<?php
namespace Modules\Patients\Http\Controllers;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Streamline\Models\Clinic;
use Streamline\Models\PatientEpisode;
use Streamline\Models\InpatientInfo;
use Illuminate\Database\QueryException;
use Streamline\Models\Consultation;
class PatientFlowMonitoringController extends Controller {
public function __construct() {
$this->middleware('auth');
$this->middleware('permission:patient-flow-monitoring');
}
public function index(Request $request){
$clinic_id = $request->clinic_id;
$search_by = $request->search_by;
$reg_date = $request->reg_date;
$start_date = $request->start_date;
$end_date = $request->end_date;
$order_by = $request->order_by ?? 1;
if (!isset($clinic_id) && !isset($search_by)){
$clinic_id = session()->get('clinic_id');
$search_by = session()->get('search_by');
$reg_date = session()->get('reg_date');
$start_date = session()->get('start_date');
$end_date = session()->get('end_date');
$order_by = session()->get('order_by');
} else {
session()->put('clinic_id', $clinic_id);
session()->put('search_by', $search_by);
session()->put('reg_date', $reg_date);
session()->put('start_date', $start_date);
session()->put('end_date', $end_date);
session()->put('order_by', $order_by);
}
$filters = [];
if($search_by === 0){
// last 24 hours
$last_day = Carbon::now()->subDay();
array_push($filters, ['patient_episodes.created_at', '>', $last_day]);
$date_search = "Last 24 hours";
} elseif($search_by == 1){
// custom date
$start_date_search = Carbon::parse($reg_date)->startOfDay()->toDateTimeString();;
$end_date_search = Carbon::parse($reg_date)->endOfDay()->toDateTimeString();;
array_push($filters, ['patient_episodes.created_at', '>', $start_date_search]);
array_push($filters, ['patient_episodes.created_at', '<', $end_date_search]);
$date_search = streamline_date($start_date_search);
} elseif($search_by == 2){
// custom date range
$start_date_search = Carbon::parse($start_date)->startOfDay()->toDateTimeString();;
$end_date_search = Carbon::parse($end_date)->endOfDay()->toDateTimeString();;
array_push($filters, ['patient_episodes.created_at', '>', $start_date_search]);
array_push($filters, ['patient_episodes.created_at', '<', $end_date_search]);
$date_search = streamline_date($start_date_search) . " to " . streamline_date($end_date_search);
} else {
// Today
$today = Carbon::today()->toDateTimeString();
array_push($filters, ['patient_episodes.created_at', '>=', $today]);
$date_search = "Today";
}
switch (get_select_clinic_order_type()) {
case 0:
if ($order_by == 0) {
$order_by_text = "patient_episodes.id";
} else {
$order_by_text = "triage.severe_grade desc, patient_episodes.id";
}
break;
case 1:
if ($order_by == 0) {
$order_by_text = "patient_episodes.id desc";
} else {
$order_by_text = "triage.severe_grade desc, patient_episodes.id desc";
}
break;
case 2:
default:
if ($order_by == 0) {
$order_by_text = "consultations.completed, patient_episodes.id";
} else {
$order_by_text = "consultations.completed, triage.severe_grade desc, patient_episodes.id";
}
break;
}
if($clinic_id == 0){
$patient_episodes = DB::table('patient_episodes')
->whereNull('patient_episodes.deleted_at')
->leftJoin('consultations', 'patient_episodes.id', '=', 'consultations.episode_id')
->leftJoin('ante_natal_clinic_followups as a', 'patient_episodes.id', '=', 'a.episode_id')
->leftJoin('triage', 'patient_episodes.id', '=', 'triage.episode_id')
->select('patient_episodes.*', 'consultations.primary_diagnosis','consultations.outcome_id','consultations.completed','consultations.created_by as consultation_created_by','consultations.updated_by as consultation_updated_by','consultations.consultation_done_by', 'a.primary_diagnosis as antenatal_primary_diagnosis','a.outcome_id as antenatal_outcome_id','a.completion_status as antenatal_completed','a.created_by as antenatal_created_by','a.updated_by as antenatal_updated_by', 'triage.id as episode_triage_id', 'triage.severe_grade', 'triage.clinic_allocation')
->where($filters)
->orderByRaw($order_by_text)
->paginate(200);
$clinic_name = "OPD";
} else {
$patient_episodes = DB::table('patient_episodes')
->whereNull('patient_episodes.deleted_at')
->leftJoin('consultations', 'patient_episodes.id', '=', 'consultations.episode_id')
->leftJoin('ante_natal_clinic_followups as a', 'patient_episodes.id', '=', 'a.episode_id')
->leftJoin('triage', 'patient_episodes.id', '=', 'triage.episode_id')
->where(['patient_episodes.clinic_id' => $clinic_id])->where($filters)
->orderByRaw($order_by_text)
->select('patient_episodes.*', 'consultations.primary_diagnosis','consultations.outcome_id','consultations.completed','consultations.created_by as consultation_created_by','consultations.updated_by as consultation_updated_by','consultations.consultation_done_by', 'a.primary_diagnosis as antenatal_primary_diagnosis','a.outcome_id as antenatal_outcome_id','a.completion_status as antenatal_completed','a.created_by as antenatal_created_by','a.updated_by as antenatal_updated_by','triage.id as episode_triage_id', 'triage.severe_grade', 'triage.clinic_allocation')
->paginate(200);
$clinic_name = get_name($clinic_id, 'id', 'name', 'clinics');
}
$patient_categories = DB::table("patient_categories")->whereNull('deleted_at')->pluck("name", "id");
$clinics = DB::table("clinics")->whereNull("deleted_at")->orderBy("name")->pluck("name", "id")->toArray();
$clinics = [0 => 'OPD'] + $clinics;
$clinics = ['' => '- select -'] + $clinics;
$wards = DB::table('wards')->where('available', 1)->whereNull('deleted_at')->pluck("name", "id")->prepend('- select -', '');
return view('patients::patient_flow_monitoring.index', compact('patient_episodes', 'clinics', 'patient_categories','clinic_name','search_by', 'date_search', 'wards'));
}
public function patient_route($episode_id, $route){
$episode = PatientEpisode::find($episode_id);
$patient_id = $episode->patient_id;
// set up session
session()->put(['patient_id' => $patient_id]);
session()->put(['episode_id' => $episode_id]);
if($route == 'triage'){
$url = '/triage';
} elseif ($route == 'consultation'){
$url = '/consultation/route';
} elseif ($route == 'create_anaesthetics'){
$url = '/anaesthetics/create';
} elseif ($route == 'create_surgery'){
$url = '/theatre_surgery/create';
} elseif ($route == 'anaesthetics_history'){
$url = '/anaesthetics/history';
} elseif ($route == 'surgery_index'){
$url = '/theatre_surgery';
} elseif ($route == 'treatment') {
$url = '/prescriptions/create';
} elseif ($route == 'anc_registration_button'){
$url = '/ante_natal_clinic/create';
} elseif ($route == 'anc_followup_button'){
$url = '/ante_natal_clinic_follow_up/create';
} elseif ($route == 'investigation') {
$url = '/investigations/investigations_review';
} elseif ($route == 'triage_without_etat') {
$url = '/triage/create_without_etat';
} elseif ($route == 'consultation_with_notes') {
$url = '/consultation/create_with_notes';
} elseif ($route == 'view_patient_history') {
$url = '/patient_episodes/';
}
return response()->json($url);
}
public function inpatient_admission(Request $request)
{
$episode = PatientEpisode::find($request->admission_episode_id);
$patient_id = $episode->patient_id;
$ward_id = $request->admission_ward_id;
$admitted_on = $request->ward_admission_date;
try {
$episode_id = $episode->id;
session()->put(['episode_id' => $episode_id]);
session()->put(['patient_id' => $patient_id]);
$consultation = Consultation::where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->first();
if ($consultation) {
$consultation->outcome_id = get_name("Admitted", "name", "id", "outcomes");
$consultation->ward_id = $ward_id;
$consultation->admitted_on = $admitted_on;
$consultation->save();
}
// Admit patient in ward
$existing_inpatient = InpatientInfo::where(['episode_id' => $episode_id])->first();
if ($existing_inpatient) {
$ward_id = $existing_inpatient->ward_id;
$ward_name = get_name($ward_id, "id", "name", "wards");
flash("Patient ".get_name($patient_id, "id", "number", "patients")." already admitted for in admitted in ".$ward_name. ". You can use the ward transfer option incase you want to transfer to another ward")->error();
} else {
$inpatient = is_null($existing_inpatient) ? new InpatientInfo : $existing_inpatient;
$inpatient = new InpatientInfo;
$inpatient->patient_id = $patient_id;
$inpatient->episode_id = $episode_id;
$inpatient->admitted_on = $admitted_on;
$inpatient->ward_id = $ward_id;
$inpatient->created_by = auth()->user()->id;
$inpatient->created_at = Carbon::now();
$inpatient->save();
$ward_name = get_name($ward_id, "id", "name", "wards");
flash("Patient ".get_name($patient_id, "id", "number", "patients")." admitted in ".$ward_name)->success();
}
return redirect('/patient_episodes/');
} catch (QueryException $e) {
$errorCode = $e->errorInfo[1];
if ($errorCode == 1062) { //error code for duplicate entry to a unique field
flash("This episode already exists!")->error();
return back()->withInput();
}
}
}
}
@@ -1,309 +0,0 @@
<?php
namespace Modules\Patients\Http\Controllers;
use Barryvdh\Snappy\Facades\SnappyPdf;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Streamline\Models\HospitalInformation;
use Streamline\Models\VhtContact;
class PostDischargeRiskController extends Controller {
public function view_scores(Request $request) {
if (isset($request->start_date)){
$start_date = Carbon::parse($request->start_date)->startOfDay();
$end_date = Carbon::parse($request->end_date)->endOfDay();
} else {
$start_date = Carbon::now()->startOfDay();
$end_date = Carbon::now()->endOfDay();
}
$risk_scores = DB::table('discharge_mortality_risk')
->whereNotNull('post_discharge_mortality_risk')
->whereNotNull('inpatient_id')
->where('child_with_proven_infection', 1)
->whereBetween('created_at', [$start_date, $end_date])
->get(['id', 'patient_id', 'gender', 'date_of_birth', 'post_discharge_mortality_risk',
'updated_at', 'is_vht_alerted', 'inpatient_id', 'child_with_proven_infection']);
$search_text = "From " . streamline_date($start_date) . " to " . streamline_date($end_date);
return view('patients::post_discharge_risk.view_scores', compact('risk_scores', 'search_text'));
}
public function vht_discharge_forms(Request $request) {
//
}
public function print_vht_discharge_forms($discharge_risk_score_id) {
$hospital_info = HospitalInformation::find(1);
$discharge_risk_score = DB::table('discharge_mortality_risk')
->where('id', $discharge_risk_score_id)
->first();
$patient_id = $discharge_risk_score->patient_id;
if ($discharge_risk_score->inpatient_id) {
$admission_date = streamline_date(get_name($discharge_risk_score->inpatient_id, 'id', 'admitted_on', 'inpatient_info'));
$discharge_date = streamline_date(get_name($discharge_risk_score->inpatient_id, 'id', 'discharged_on', 'inpatient_info'));
$diagnosis_id = get_name($discharge_risk_score->inpatient_id, 'id', 'primary_diagnosis', 'inpatient_info');
$discharge_diagnosis = get_name($diagnosis_id, 'id', 'name', 'diagnoses');
$main_symptom = explode(",", get_name($discharge_risk_score->episode_id, 'episode_id', 'symptoms', 'triage'))[0] ?? "";
} else {
$admission_date = "";
$discharge_date = "";
$discharge_diagnosis = "";
$main_symptom = "";
}
// get the dates for when the follow ups where scheduled
$scheduled_followups = DB::table('phone_followup_patients')
->where('discharge_mortality_risk_id', $discharge_risk_score_id)
->get();
$vht_name = "";
$vht_contact = "";
if (count($scheduled_followups) > 0) {
$first_followup_date = streamline_date($scheduled_followups[0]->follow_up_date);
$second_followup_date = streamline_date($scheduled_followups[1]->follow_up_date);
$third_followup_date = streamline_date($scheduled_followups[2]->follow_up_date);
$vht_name = get_name($scheduled_followups[2]->vht_id, 'id', 'name', 'vht_contacts');
$vht_contact = get_name($scheduled_followups[2]->vht_id, 'id', 'contact', 'vht_contacts');
} else {
$first_followup_date = "";
$second_followup_date = "";
$third_followup_date = "";
}
$data = [
'hospital_info' => $hospital_info,
'admission_date' => $admission_date,
'discharge_date' => $discharge_date,
'patient_id' => $patient_id,
'discharge_risk_score' => $discharge_risk_score,
'first_followup_date' => $first_followup_date,
'second_followup_date' => $second_followup_date,
'third_followup_date' => $third_followup_date,
'vht_name' => $vht_name,
'vht_contact' => $vht_contact,
'discharge_diagnosis' => $discharge_diagnosis,
'main_symptom' => $main_symptom,
];
$pdf = SnappyPDF::loadView('patients::post_discharge_risk/print_vht_discharge_forms', $data)
->setPaper('a4')
->setOption('margin-bottom', 10)
->setOption('footer-html', '<i>Stre@mline</i>');
return $pdf->inline('VHT Discharge Form' . date(" d-m-y h:ia") . '.pdf');
}
public function assign_vht($discharge_id) {
//$vhts = DB::table('vht_contacts')->get();
$post_discharge = DB::table('discharge_mortality_risk')->find($discharge_id);
$patient = DB::table('patients')->find($post_discharge->patient_id);
return view('patients::post_discharge_risk.assign_vht', compact('patient', 'discharge_id'));
}
public function search_vht_by_name_village(Request $request) {
$data = [];
if ($request->has('q')) {
$search = $request->q;
$data = DB::table('vht_contacts')->select("id", "parish_name", "village_name", "name")
->orWhere('village_name', 'LIKE', "%$search%")
->orWhere('name', 'LIKE', "%$search%")
->get();
}
return response()->json($data);
}
public function get_info_about_vht($vht_id) {
$data = DB::table('vht_contacts')->find($vht_id);
return $data->name . " (" . $data->contact . ")" . "&&" . $data->facility . "&&" . $data->parish_name . "&&" . $data->village_name;
}
public function save_assign_vht(Request $request) {
$discharge_id = $request->discharge_id;
// get the discharge info
$post_discharge = DB::table('discharge_mortality_risk')->find($request->discharge_id);
$patient_id = $post_discharge->patient_id;
$inpatient_id = get_name($request->discharge_id, 'id', 'inpatient_id', 'discharge_mortality_risk');
$inpatient_info = DB::table('inpatient_info')
->where('id', $inpatient_id)
->first();
// vht contact info
$vht = DB::table('vht_contacts')->find($request->vht_id);
$discharge_date = new Carbon(get_patient_discharge_date($inpatient_id));
$first_followup_date = $discharge_date->copy()->addDays(2);
$second_followup_date = $discharge_date->copy()->addDays(7);
$third_followup_date = $discharge_date->copy()->addDays(14);
if ($vht) {
// send the message
DB::table('phone_followup_patients')
->insert(['patient_id' => $patient_id, 'created_at' => date('Y-m-d H:i:s'), 'vht_id' => $vht->id,
'episode_id' => $inpatient_info->episode_id, 'inpatient_id' => $inpatient_info->id, 'discharge_mortality_risk_id' => $discharge_id,
'follow_up_date' => $first_followup_date, 'discharge_date' => get_patient_discharge_date($inpatient_id)]);
DB::table('phone_followup_patients')
->insert(['patient_id' => $patient_id, 'created_at' => date('Y-m-d H:i:s'), 'vht_id' => $vht->id,
'episode_id' => $inpatient_info->episode_id, 'inpatient_id' => $inpatient_info->id, 'discharge_mortality_risk_id' => $discharge_id,
'follow_up_date' => $second_followup_date, 'discharge_date' => get_patient_discharge_date($inpatient_id)]);
DB::table('phone_followup_patients')
->insert(['patient_id' => $patient_id, 'created_at' => date('Y-m-d H:i:s'), 'vht_id' => $vht->id,
'episode_id' => $inpatient_info->episode_id, 'inpatient_id' => $inpatient_info->id, 'discharge_mortality_risk_id' => $discharge_id,
'follow_up_date' => $third_followup_date, 'discharge_date' => get_patient_discharge_date($inpatient_id)]);
$patient = DB::table('patients')->where('id', $patient_id)->first();
$message = "Dear VHT,\nA child from your area was discharged today. Please complete 3 follow-up visits to assess recovery.\n\nDetails:\n";
$message .= "Child: " . $patient->first_name . " " . $patient->last_name . ",";
$message .= " " . ($patient->gender == 1) ? "Boy" : "Girl" . ",";
$message .= " " . get_patients_age($patient->date_of_birth) . " years,";
$message .= " " . get_name($patient->village_id, 'id', 'name', 'villages') . "\n";
$message .= "From: Kisiizi Hospital\n";
if ($patient->parent_id) {
$message .= "Parent: " . get_full_name($patient->parent_id, 'id', 'first_name', 'last_name', 'patients') . ", " . get_name($patient->parent_id, 'id', 'phone', 'patients') . "\n";
} elseif ($patient->hospital_contact) {
$message .= "Parent: " . $patient->hospital_contact_name . ", " . $patient->hospital_contact . "\n";
} elseif ($patient->next_of_kin) {
$message .= "Parent: " . $patient->next_of_kin . ", " . $patient->phone_of_next_of_kin . "\n";
}
$number = "+256" . $vht->contact;
$message .= "Follow-ups: " . $first_followup_date->format('D j M') . ", " . $second_followup_date->format('D j M') . ", " . $third_followup_date->format('D j M') . "";
send_sms($number, $message);
DB::table('discharge_mortality_risk')
->where('id', $discharge_id)
->update(['is_vht_alerted' => 1]);
send_data_to_redcap($discharge_id);
flash("VHT has been assigned and an SMS message has been sent to them")->success();
return redirect('/post_discharge_risk/view_scores');
} else {
flash("No VHT was found for the patient")->error();
return redirect('/post_discharge_risk/view_scores');
}
}
public function retry_sending_message($discharge_risk_score_id) {
$discharge_id = $discharge_risk_score_id;
// get the discharge info
$post_discharge = DB::table('discharge_mortality_risk')->find($discharge_id);
$patient_id = $post_discharge->patient_id;
$inpatient_id = get_name($discharge_id, 'id', 'inpatient_id', 'discharge_mortality_risk');
$inpatient_info = DB::table('inpatient_info')
->where('id', $inpatient_id)
->first();
$vht = DB::table('vht_contacts')
->where('village', get_name($patient_id, 'id', 'village_id', 'patients'))
->orWhere('village', get_name(get_name($patient_id, 'id', 'village_id', 'patients'), 'id', 'name', 'villages'))
->first();
$discharge_date = new Carbon(get_patient_discharge_date($inpatient_id));
$first_followup_date = $discharge_date->copy()->addDays(2);
$second_followup_date = $discharge_date->copy()->addDays(7);
$third_followup_date = $discharge_date->copy()->addDays(14);
if ($vht) {
// send the message
DB::table('phone_followup_patients')
->insert(['patient_id' => $patient_id, 'created_at' => date('Y-m-d H:i:s'), 'vht_id' => $vht->id,
'episode_id' => $inpatient_info->episode_id, 'inpatient_id' => $inpatient_info->id, 'discharge_mortality_risk_id' => $discharge_id,
'follow_up_date' => $first_followup_date, 'discharge_date' => get_patient_discharge_date($inpatient_id)]);
DB::table('phone_followup_patients')
->insert(['patient_id' => $patient_id, 'created_at' => date('Y-m-d H:i:s'), 'vht_id' => $vht->id,
'episode_id' => $inpatient_info->episode_id, 'inpatient_id' => $inpatient_info->id, 'discharge_mortality_risk_id' => $discharge_id,
'follow_up_date' => $second_followup_date, 'discharge_date' => get_patient_discharge_date($inpatient_id)]);
DB::table('phone_followup_patients')
->insert(['patient_id' => $patient_id, 'created_at' => date('Y-m-d H:i:s'), 'vht_id' => $vht->id,
'episode_id' => $inpatient_info->episode_id, 'inpatient_id' => $inpatient_info->id, 'discharge_mortality_risk_id' => $discharge_id,
'follow_up_date' => $third_followup_date, 'discharge_date' => get_patient_discharge_date($inpatient_id)]);
$patient = DB::table('patients')->where('id', $patient_id)->first();
$message = "Dear VHT,\nA child from your area was discharged today. Please complete 3 follow-up visits to assess recovery.\n\nDetails:\n";
$message .= "Child: " . $patient->first_name . " " . $patient->last_name . ",";
$message .= " " . ($patient->gender == 1) ? "Boy" : "Girl" . ",";
$message .= " " . get_patients_age($patient->date_of_birth) . " years,";
$message .= " " . get_name($patient->village_id, 'id', 'name', 'villages') . "\n";
$message .= "From: Kisiizi Hospital\n";
if ($patient->parent_id) {
$message .= "Parent: " . get_full_name($patient->parent_id, 'id', 'first_name', 'last_name', 'patients') . ", " . get_name($patient->parent_id, 'id', 'phone', 'patients') . "\n";
} elseif ($patient->hospital_contact) {
$message .= "Parent: " . $patient->hospital_contact_name . ", " . $patient->hospital_contact . "\n";
} elseif ($patient->next_of_kin) {
$message .= "Parent: " . $patient->next_of_kin . ", " . $patient->phone_of_next_of_kin . "\n";
}
$number = "+256" . $vht->contact;
$message .= "Follow-ups: " . $first_followup_date->format('D j M') . ", " . $second_followup_date->format('D j M') . ", " . $third_followup_date->format('D j M') . "";
send_sms($number, $message);
DB::table('discharge_mortality_risk')
->where('id', $discharge_id)
->update(['is_vht_alerted' => 1]);
send_data_to_redcap($discharge_risk_score_id);
return 1;
} else {
return 0;
}
}
public function view_follow_up_patients(Request $request) {
if (isset($request->start_date)){
$start_date = Carbon::parse($request->start_date)->startOfDay();
$end_date = Carbon::parse($request->end_date)->endOfDay();
} else {
$start_date = Carbon::now()->startOfDay();
$end_date = Carbon::now()->endOfDay();
}
$risk_scores = DB::table('discharge_mortality_risk')
->whereNotNull('post_discharge_mortality_risk')
->whereNotNull('inpatient_id')
->where('child_with_proven_infection', 1)
->whereBetween('created_at', [$start_date, $end_date])
->get();
$search_text = "From " . streamline_date($start_date) . " to " . streamline_date($end_date);
return view('patients::post_discharge_risk.view_follow_up_patients', compact('risk_scores', 'search_text'));
}
}
@@ -1,113 +0,0 @@
<?php
namespace Modules\Patients\Providers;
use Illuminate\Support\ServiceProvider;
use Modules\Patients\Providers\RouteServiceProvider;
class PatientsServiceProvider extends ServiceProvider {
/**
* @var string $moduleName
*/
protected $moduleName = 'Patients';
/**
* @var string $moduleNameLower
*/
protected $moduleNameLower = 'patients';
/**
* Boot the application events.
*
* @return void
*/
public function boot()
{
$this->registerTranslations();
$this->registerConfig();
$this->registerViews();
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations'));
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->register(RouteServiceProvider::class);
}
/**
* Register config.
*
* @return void
*/
protected function registerConfig()
{
$this->publishes([
module_path($this->moduleName, 'Config/config.php') => config_path($this->moduleNameLower . '.php'),
], 'config');
$this->mergeConfigFrom(
module_path($this->moduleName, 'Config/config.php'), $this->moduleNameLower
);
}
/**
* Register views.
*
* @return void
*/
public function registerViews()
{
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
$sourcePath = module_path($this->moduleName, 'Resources/views');
$this->publishes([
$sourcePath => $viewPath
], ['views', $this->moduleNameLower . '-module-views']);
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
}
/**
* Register translations.
*
* @return void
*/
public function registerTranslations()
{
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
if (is_dir($langPath)) {
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
$this->loadJsonTranslationsFrom($langPath);
} else {
$this->loadTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower);
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'Resources/lang'));
}
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return [];
}
private function getPublishableViewPaths(): array
{
$paths = [];
foreach (\Config::get('view.paths') as $path) {
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
$paths[] = $path . '/modules/' . $this->moduleNameLower;
}
}
return $paths;
}
}
@@ -1,68 +0,0 @@
<?php
namespace Modules\Patients\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to your controller routes.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'Modules\Patients\Http\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
parent::boot();
}
/**
* Define the routes for the application.
*
* @return void
*/
public function map()
{
$this->mapApiRoutes();
$this->mapWebRoutes();
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->namespace)
->group(module_path('Patients', '/Routes/web.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapApiRoutes()
{
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(module_path('Patients', '/Routes/api.php'));
}
}
@@ -1,41 +0,0 @@
@extends('layouts.main')
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('alerts.edit_alert') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('alerts.dashboard') }}</a></li>
<li><a href="alerts/view_alerts">{{ __('alerts.alerts') }}</a></li>
<li class="active">{{ __('alerts.edit') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('flash::message')
<div class="white-box">
{{ Form::open(['route' => 'alerts.save_edit_alert']) }}
{{ Form::hidden('id', $alert->id) }}
<div class="form-group">
{{ Form::label('name', __('alerts.alert')) }}
{{ Form::text('name', $alert->alerts, ['class' => 'form-control compulsory', 'required']) }}
</div>
{{ Form::button(__('alerts.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
{{ Form::button(__('alerts.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
{{ Form::close() }}
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/js/validator.js') }}"></script>
@endpush
@@ -1,76 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('alerts.alerts_for') }} <font color="blue">{{ $patient->first_name }} {{ $patient->last_name }}</font></h4>
</div>
<div class="col-lg-8 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('alerts.dashboard') }}</a></li>
<li class="active">{{ __('alerts.view') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
<div class="white-box">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{{ __('alerts.date') }}</th>
<th>{{ __('alerts.alert') }}</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($alerts as $alert)
<tr>
<td>{{ streamline_date($alert->created_at) }}</td>
<td>{{ $alert->alerts }}</td>
<td>
<a class="btn btn-warning btn-rounded" href="/alerts/edit_alert/{{ $alert->id }}">{{ __('alerts.edit_alert') }}</a>
</td>
<td>
<a class="btn btn-danger btn-rounded" href="/alerts/delete_alert/{{ $alert->id }}">{{ __('alerts.delete_alert') }}</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script>
$('.table').DataTable({
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
});
</script>
@endpush
@@ -1,421 +0,0 @@
@if (session()->has('patient_id') || session()->has('patients_id'))
@endif
@push('scripts')
<script src="{{ asset('js/allergies/scripts.js') }}"></script>
@endpush
@push('styles')
<style type="text/css">
/* Important part used by allergies */
.allergy-modal-dialog{
overflow-y: initial !important
}
.allergy-modal-body{
height: 250px;
overflow-y: auto;
}
@media (min-width: 768px) {
.allergy-modal-dialog {
width: 90%;
max-width:1200px;
}
}
</style>
@endpush
<div class="row">
<div @if(is_smart_discharge_enabled()) class="col-sm-6" @else class="col-sm-8" @endif>
<div>
@php
$known_patient_allergies = \Streamline\Models\Allergy::where('patient_id' , $patient->id)->orderBy('created_at','desc')->take(2)->get();
$known_patient_alerts = \Streamline\Models\Alert::where('patient_id' , $patient->id)->orderBy('created_at','desc')->take(2)->get();
$categories = \Streamline\Models\PatientCategory::pluck("name", "id");
$drug_categories_array = DB::table('drug_categories')->pluck('name', 'id');
$drug_categories = \Streamline\Models\DrugCategory::orderBy('name', 'asc')->get();
@endphp
<!-- <a href="#" class="btn-action fa fa-plus-square"><i></i></a> --><span class="count label label-inverse"><strong>{{ __('allergies.category') }} :</strong>
{{ isset($categories[$patient->category_id]) ? $categories[$patient->category_id] : "N/A" }}
</span>
<div class="row">
<div class="col-sm-10">
<table class="table-bordered table-condensed table-striped">
<tbody>
<tr>
<th style="color: black">{{ __('allergies.patient_number') }}</th>
<th style="color: black">{{ __('allergies.full_names') }}</th>
<th style="color: black">{{ __('allergies.gender') }}</th>
<th class="hidden-phone" style="color: black">{{ __('allergies.age') }}</th>
<th style="color: black">{{ __('allergies.national_id') }}</th>
</tr>
</tbody>
<tbody>
<tr>
<td>{{ $patient->number }}</td>
<td>
{!! insurance_flag($patient->id) !!}
@if(patient_insurance_status($patient->id) == 1)
<small style="color:#069">({{ __('patients.joined_chi_scheme') }} {{patient_duration_on_chi_sheme($patient->id)}})</small>
@endif
</td>
<td>{{ $patient->gender == 1 ? __('allergies.male') : __('allergies.female') }}</td>
<td>{{ get_patients_age($patient->date_of_birth) }}</td>
<td>{!! ($patient->national_id == null || $patient->national_id == "") ? "<span class='label label-info'>National ID Missing</span>" : strtoupper($patient->national_id) !!}</td>
</tr>
</tbody>
</table>
</div>
<div class="col-sm-2">
<div class="button-box">
<a class="img" href="#modal-photo" data-toggle="modal" style="color: whitesmoke">
@if(!is_null($patient->photo) && $patient->photo != "")
<img src='{{ asset($patient->photo) }}' class="img-rounded center" style='height: 59px; width: 100%' />
@else
<img src="/uploads/streamline_images/person-place-holder.jpg" class="img-rounded center" style='height: 100%; width: 100%' />
@endif
</a>
</div>
<div class="modal fade" id="modal-photo" tabindex="-1" role="dialog" aria-labelledby="modal-photoLabel1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modal-photoLabel1">{{ __('allergies.insured_patient_photo') }}</h4>
</div>
<div class="modal-body">
<div class="col-sm-12">
<img src='{{ asset($patient->photo) }}' class="img-rounded center" style="margin: auto" />
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">{{ __('allergies.close') }}</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-2">
<div class="row">
<div class="col-sm-12">
<div>
<div class="button-box">
<button type="button" class="btn btn-danger btn-rounded btn-sm" data-toggle="modal" data-target="#modal-allergies" style="line-height: 10px; font-size: 11px;">{{ __('allergies.allergies') }} <i class="fa fa-plus-circle"></i></a></button>
</div>
<div class="modal fade" id="modal-allergies" tabindex="-1" role="dialog" aria-labelledby="modal-allergiesLabel1">
<div class="modal-dialog modal-lg allergy-modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modal-allergiesLabel1">{{ __('allergies.add_allergies_patient') }}</h4>
</div>
<div class="modal-body allergy-modal-body">
<div class="container-fluid">
<h4>{{ __('allergies.currently_known') }}</h4>
<div class="row">
@php $allergic_drugs_ids_array = []; @endphp
@if(count($known_patient_allergies) > 0 )
@foreach($known_patient_allergies as $allergy)
@php $allergic_drugs_ids_array = explode(',' , $allergy->names); @endphp
@endforeach
@php $chunked_allergy_array = array_chunk($allergic_drugs_ids_array, 1, true) @endphp
@foreach($chunked_allergy_array as $items)
<div class="col-md-4">
@foreach($items as $item)
@if(isset($drug_categories_array[$item]))
&#8226 {{ $drug_categories_array[$item] }} <br>
@endif
@endforeach
</div>
@endforeach
@endif
</div>
<br>
<div class="row">
<form>
<h4>{{ __('allergies.allergic_reactions') }}</h4>
@foreach($drug_categories->chunk(9) as $chunk)
@foreach($chunk as $drug_category)
<div class="col-md-4">
<!-- if it is a known allergy then check the checkbox -->
@if(in_array($drug_category->id,$allergic_drugs_ids_array))
<input class='patient_allergies' name='allergies[]' type='checkbox' checked="true" value='{{ $drug_category->id }}'/> {{ $drug_category->name }}
@else
<input class='patient_allergies' name='allergies[]' type='checkbox' value='{{ $drug_category->id }}'/> {{ $drug_category->name }}
@endif
<br/>
</div>
@endforeach
@endforeach
<!-- <hr> -->
<input type="hidden" id="allergy_patient_id" name="allergy_patient_id" value="<?php echo $patient->id; ?>">
<!-- <button type="button" id="submit_allergies" class="btn btn-success btn-sm">Submit Allergies</button>
<div class="separator bottom"></div>
<form> -->
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" id="submit_allergies" class="btn btn-success btn-sm">{{ __('allergies.submit_allergies') }}</button>
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">{{ __('allergies.close') }}</button>
</form>
</div>
</div>
</div>
</div>
<table class="table-bordered table-condensed table-striped" id="allergies_drugs_table">
<tbody>
<td style="font-weight: normal;">
<div id="patient_allergies_tab">
@if(count($allergic_drugs_ids_array) > 0)
@if(isset($allergic_drugs_ids_array[0]) && isset($drug_categories_array[$allergic_drugs_ids_array[0]]))
&#8226 <small style="color: red;">{{ $drug_categories_array[$allergic_drugs_ids_array[0]] }}</small><br>
@endif
@if(isset($allergic_drugs_ids_array[1]) && isset($drug_categories_array[$allergic_drugs_ids_array[1]]))
&#8226 <small style="color: red;">{{ $drug_categories_array[$allergic_drugs_ids_array[1]] }}</small><br>
@endif
@else
<small style="color: blue;">{{ __('allergies.no_recorded_allergies') }}</small>
@endif
</div>
@if(count($allergic_drugs_ids_array) > 0) <a href="/allergies">{{ __('allergies.view_all') }}</a> @endif
</td>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="col-sm-2">
<div class="row">
<div class="col-sm-12">
<div>
<div class="button-box">
<button type="button" class="btn btn-danger btn-rounded btn-sm" data-toggle="modal" data-target="#modal-alerts" style="line-height: 10px; font-size: 11px;">{{ __('allergies.alerts') }} <i class="fa fa-plus-circle"></i></button>
</div>
<div class="modal fade" id="modal-alerts" tabindex="-1" role="dialog" aria-labelledby="modal-alertsLabel1">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modal-alertsLabel1">{{ __('allergies.alerts_for_patient') }}</h4>
</div>
<div class="modal-body">
<div class="container-fluid">
<form>
<input type="hidden" id="alert_patient_id" name="alert_patient_id" value="{{ $patient->id }}">
<div class="control-group">
<label for="alerts">{{ __('allergies.enter_alert') }}</label>
<div class="controls">
<textarea name="alerts" id="alerts" maxlength="150" class="form-control col-md-12"></textarea>
</div>
</div><br>
<div class="separator bottom"></div>
</form>
</div>
</div>
<div class="modal-footer">
<input type="submit" id="submit_alerts" class = "btn btn-success btn-sm" value="{{ __('allergies.submit_alert') }}" />
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">{{ __('allergies.close') }}</button>
</div>
</div>
</div>
</div>
<table class="table-bordered table-condensed table-striped">
<tbody>
<td style="font-weight: normal">
<div id="patient_alerts_tab">
@if(isset($known_patient_alerts) && count($known_patient_alerts) > 0)
@if(isset($known_patient_alerts[0]))
&#8226 <small style="color: red;">{{ $known_patient_alerts[0]->alerts }}</small><br>
@endif
@if(isset($known_patient_alerts[1]))
&#8226 <small style="color: red;">{{ $known_patient_alerts[1]->alerts }}</small><br>
@endif
@else
<small style="color: blue;">{{ __('allergies.no_recorded_alerts') }}</small>
@endif
</div>
@if(isset($known_patient_alerts) && count($known_patient_alerts) > 0) <a href="/alerts/view_alerts">View All</a> @endif
</td>
</tbody>
</table>
</div>
</div>
</div>
</div>
@php
$date_of_birth = get_name($patient->id, 'id', 'date_of_birth', 'patients');
$dob = new Carbon\Carbon($date_of_birth);
$age_diff_months = $dob->diffInMonths(Carbon\Carbon::now());
@endphp
@if($age_diff_months < 61 && is_smart_discharge_enabled())
<div class="col-sm-2">
<div class="button-box">
<a class="btn btn-danger btn-rounded btn-sm" style="line-height: 10px; font-size: 11px;">Post Discharge Risk of Mortality</a>
</div>
<table class="table-bordered table-condensed table-striped">
<tbody>
<tr>
<td>
@if(is_patient_currently_admitted($patient->id))
{!! get_post_discharge_mortality_risk($patient->id) !!}
@else
@php
// just generate the row without displaying anything
$disregard_this = get_post_discharge_mortality_risk($patient->id);
@endphp
Patient is not admitted
@endif
</td>
</tr>
</tbody>
</table>
</div>
@endif
</div>
<div id="saved_allergies_alert" class="myadmin-alert alert-success myadmin-alert-top-right"><a href="#" class="closed">&times;</a>
<h4>{{ __('allergies.allergies_updated') }}</h4>
</div>
<div id="saved_alerts_alert" class="myadmin-alert alert-success myadmin-alert-top-right"><a href="#" class="closed">&times;</a>
<h4>{{ __('allergies.alerts_updated') }}</h4>
</div>
<div class="modal fade" id="all_allergies_modal" tabindex="-1" role="dialog" aria-labelledby="modal-successLabel1">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<ul class="row">
@php
$allergy_count = count($allergic_drugs_ids_array);
@endphp
@for($i=0 ; $i < $allergy_count ; $i++)
<li class="col-sm-3">
<small>{{ isset($drug_categories_array[$allergic_drugs_ids_array[$i]]) ? $drug_categories_array[$allergic_drugs_ids_array[$i]] : "" }}</small>
</li>
@endfor
</ul>
</div>
</div>
<div class="modal-footer">
<div class="control-group" style="vertical-align: center;">
<div class="controls">
<button type="button" class="btn btn-success" data-dismiss="modal">{{ __('allergies.ok') }}</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
@push('scripts')
<script type="text/javascript">
$(".myadmin-alert .closed").click(function(event) {
$(this).parents(".myadmin-alert").fadeToggle(350);
return false;
});
$('#submit_allergies').click(function(e) {
e.preventDefault();
$('#modal-allergies').modal('hide');
var patient_allergies = new Array();
//loop thru the checked allergies and push them into an array
$('input[name="allergies[]"]:checked').each(function() {
patient_allergies.push(this.value);
});
var allergy_patient_id = $('#allergy_patient_id').val();
$.ajax({
type: 'POST',
url: '/store_patient_allergies',
data: {patient_allergies:patient_allergies, allergy_patient_id:allergy_patient_id},
cache: false,
success: function (response) {
//display success notification modal
$("#saved_allergies_alert").fadeToggle(350);
// update the view
let drug_categories_array = {!! json_encode($drug_categories_array) !!};
let patientAllergiesTabHtml = "";
if (typeof patient_allergies[0] !== 'undefined'){
patientAllergiesTabHtml += "&#8226 <small style=\"color: red;\">" + drug_categories_array[patient_allergies[0]] + "</small><br>";
}
if (typeof patient_allergies[1] !== 'undefined'){
patientAllergiesTabHtml += "&#8226 <small style=\"color: red;\">" + drug_categories_array[patient_allergies[1]] + "</small><br>";
}
$("#patient_allergies_tab").html(patientAllergiesTabHtml);
$('input[name="allergies[]"]').each(function() {
// loop through allergies and recheck values
if(jQuery.inArray(this.value, patient_allergies) !== -1){
$(this).prop('checked', true);
} else {
$(this).prop('checked', false);
}
});
}
});
});
/* submit alert */
$('#submit_alerts').click(function(e) {
e.preventDefault();
$('#modal-alerts').modal('hide');
var alert_patient_id = $('#alert_patient_id').val();
var patient_alerts = $('#alerts').val();//
$.ajax({
type: 'POST',
url: '/store_patient_alerts',
data: {patient_alerts:patient_alerts, alert_patient_id:alert_patient_id},
cache: false,
success: function (response) {
//display success notification modal
$("#saved_alerts_alert").fadeToggle(350);
}
});
});
</script>
@endpush
@@ -1,395 +0,0 @@
@if (session()->has('patient_id') || session()->has('patients_id'))
@endif
@push('scripts')
<script src="{{ asset('js/allergies/scripts.js') }}"></script>
@endpush
@push('styles')
<style type="text/css">
/* Important part used by allergies */
.allergy-modal-dialog{
overflow-y: initial !important
}
.allergy-modal-body{
height: 250px;
overflow-y: auto;
}
@media (min-width: 768px) {
.allergy-modal-dialog {
width: 90%;
max-width:1200px;
}
}
</style>
@endpush
@php
$known_patient_allergies = \Streamline\Models\Allergy::where('patient_id' , $patient->id)->orderBy('created_at','desc')->take(2)->get();
$known_patient_alerts = \Streamline\Models\Alert::where('patient_id' , $patient->id)->orderBy('created_at','desc')->take(2)->get();
$categories = \Streamline\Models\PatientCategory::pluck("name", "id");
$drug_categories_array = DB::table('drug_categories')->pluck('name', 'id');
$drug_categories = \Streamline\Models\DrugCategory::orderBy('name', 'asc')->get();
@endphp
<div class="row">
<div class="col-sm-4">
<div class="modal fade" id="modal-allergies" tabindex="-1" role="dialog" aria-labelledby="modal-allergiesLabel1">
<div class="modal-dialog modal-lg allergy-modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modal-allergiesLabel1">{{ __('allergies.add_allergies_patient') }}</h4>
</div>
<div class="modal-body allergy-modal-body">
<div class="container-fluid">
<div class="row">
<div class="col-md-4">
<h5>{{ __('allergies.currently_known') }}</h5>
<div id="known_allergies" style="background-color: #e4e7ea">
<ul class="row">
@php $allergic_drugs_ids_array = []; @endphp
@if(count($known_patient_allergies) > 0 )
@foreach($known_patient_allergies as $allergy)
@php
$allergic_drugs_ids_array = explode(',' , $allergy->names);
@endphp
@for($i=0 ; $i < count($allergic_drugs_ids_array) ; $i++)
{{-- @if($i == 0 || $i == 1 || $i == 2)--}}
<li>
{{ isset($drug_categories_array[$allergic_drugs_ids_array[$i]]) ? $drug_categories_array[$allergic_drugs_ids_array[$i]] : 'N/A' }}
</li>
{{-- @endif--}}
@endfor
@endforeach
@endif
</ul>
</div>
</div>
</div>
<div class="row">
<form>
<h5>{{ __('allergies.allergic_reactions') }}</h5>
@foreach($drug_categories->chunk(9) as $chunk)
@foreach($chunk as $drug_category)
<div class="col-md-4">
<!-- if it is a known allergy then check the checkbox -->
@if(in_array($drug_category->id,$allergic_drugs_ids_array))
<input class='patient_allergies' name='allergies[]' type='checkbox' checked="true" value='{{ $drug_category->id }}'/> {{ $drug_category->name }}
@else
<input class='patient_allergies' name='allergies[]' type='checkbox' value='{{ $drug_category->id }}'/> {{ $drug_category->name }}
@endif
<br/>
</div>
@endforeach
@endforeach
<!-- <hr> -->
<input type="hidden" id="allergy_patient_id" name="allergy_patient_id" value="<?php echo $patient->id; ?>">
<!-- <button type="button" id="submit_allergies" class="btn btn-success btn-sm">Submit Allergies</button>
<div class="separator bottom"></div>
<form> -->
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" id="submit_allergies" class="btn btn-success btn-sm">{{ __('allergies.submit_allergies') }}</button>
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">{{ __('allergies.close') }}</button>
</form>
</div>
</div>
</div>
</div>
<div class="panel" style="border-radius: 5px; height: 155px;">
<div class="panel-body">
<div class="row">
<div class="col-sm-6 text-left">
<span style="line-height: 10px; font-size: 14px; margin-top: -10px; margin-right: -10px;">
<strong>{{ __('allergies.allergies') }}</strong> <label class="label label-danger" style="color: white; background-color: red">({{ $allergic_drugs_ids_array?count($allergic_drugs_ids_array):"0"}})</label>
</span>
</div>
<div class="col-sm-6 text-right">
<div class="button-box">
<button type="button" class="btn btn-success btn-rounded btn-sm" data-toggle="modal"
data-target="#modal-allergies" style="line-height: 10px; font-size: 11px; margin-right: -10px;">
{{ __('allergies.add') }} <i class="fa fa-plus-circle"></i>
</button>
</div>
</div>
</div>
<br/>
<div class="row">
<div class="col-sm-12">
@if(count($allergic_drugs_ids_array) > 0)
@php $count = (count($allergic_drugs_ids_array) > 2) ? 2 : count($allergic_drugs_ids_array); @endphp
@for($i=0 ; $i < $count ; $i++)
<label class="label label-danger" style="margin: 5px;">
{{ isset($drug_categories_array[$allergic_drugs_ids_array[$i]]) ? $drug_categories_array[$allergic_drugs_ids_array[$i]] : "" }}
</label>
@endfor
<br/>
{!! count($allergic_drugs_ids_array) > 2 ? '<br/><a href="/allergies"><label class="label label-info pull-right"><i class="fa fa-eye"></i> view all</label></a>' : '' !!}
@else
<div class="label label-danger">{{ __('allergies.no_allergy_added') }}</div>
@endif
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="panel" style="border-radius: 5px; height: 155px;">
<div class="panel-body">
<div class="row">
<div class="col-sm-6 text-left">
<span style="line-height: 10px; font-size: 14px; margin-top: -10px; margin-right: -10px;">
<strong>{{ __('allergies.alerts') }}</strong> <label class="label label-info" style="color: white; background-color: red;">({{ $known_patient_alerts?count($known_patient_alerts):""}})</label>
</span>
</div>
<div class="col-sm-6 text-right">
<div class="button-box">
<button type="button" class="btn btn-success btn-rounded btn-sm" data-toggle="modal" data-target="#modal-alerts"
style="line-height: 10px; font-size: 11px; margin-right: -10px;">
{{ __('allergies.add') }} <i class="fa fa-plus-circle"></i>
</button>
</div>
</div>
</div>
<div class="modal fade" id="modal-alerts" tabindex="-1" role="dialog" aria-labelledby="modal-alertsLabel1">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modal-alertsLabel1">{{ __('allergies.alerts_for_patient') }}</h4>
</div>
<div class="modal-body">
<form>
<input type="hidden" id="alert_patient_id" name="alert_patient_id" value="{{ $patient->id }}">
<div class="control-group">
<label for="alerts">{{ __('allergies.enter_alert') }}</label>
<div class="controls">
<textarea name="alerts" id="alerts" maxlength="150" class="form-control col-sm-12"></textarea>
</div>
</div><br>
<input type="submit" id="submit_alerts" class = "btn btn-success btn-sm" value="{{ __('allergies.submit_alert') }}" />
<div class="separator bottom"></div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">{{ __('allergies.close') }}</button>
</div>
</div>
</div>
</div>
<br/>
<div class="row">
<div class="col-sm-12">
@if(isset($known_patient_alerts) && count($known_patient_alerts) > 0)
@foreach($known_patient_alerts as $alert)
<label class="label label-danger" style="margin: 5px;">
{{ $alert->alerts }}
</label>
@endforeach
@else
<div class="label label-sm label-danger btn-rounded">{{ __('allergies.no_recorded_alerts') }}</div>
@endif
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="panel" style="border-radius: 5px; height: 155px;">
<div class="panel-body">
<div class="row">
<div class="col-sm-6 text-left">
<span style="line-height: 10px; font-size: 14px; margin-top: -10px; margin-right: -10px;">
<strong>{{ __('allergies.documents') }}</strong> <label class="label label-info" style="color: white; background-color: red;">({{ $documents?count($documents):""}})</label>
</span>
</div>
<div class="col-sm-6 text-right">
<div class="button-box">
<a type="button" class="btn btn-success btn-rounded btn-sm" href="{{ route('patient_documents.index') }}"
style="line-height: 10px; font-size: 11px; margin-top: -10px; margin-right: -10px;">
{{ __('allergies.add') }} <i class="fa fa-plus-circle"></i>
</a>
</div>
</div>
</div>
<br/>
<div class="row">
<div class="col-sm-12">
@if(count($documents) > 0)
<label class="label label-danger" style="margin: 5px;">{{ count($documents) }} {{ __('allergies.documents_attached') }}.</label>
<br/>
<br/>
<a href="#" onclick="go()" style="font: blue; cursor: pointer; font-weight: bold;">
<label class="label label-info pull-right"><i class="fa fa-eye"></i> {{ __('allergies.view_all') }}</label>
</a>
@else
<div class="label label-danger">{{ __('allergies.no_document_added') }}</div>
@endif
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal-success-save1" tabindex="-1" role="dialog" aria-labelledby="modal-successLabel1">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-body">
{{ __('allergies.allergies_for_patient') }}<br>
<div class="control-group" style="vertical-align: center;">
<div class="controls">
<button type="button" class="btn btn-success" data-dismiss="modal">{{ __('allergies.ok') }}</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal-success-save2" tabindex="-1" role="dialog" aria-labelledby="modal-successLabel1">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-body">
{{ __('allergies.alerts_for_patient') }}<br>
<div class="control-group" style="vertical-align: center;">
<div class="controls">
<button type="button" class="btn btn-success" data-dismiss="modal">{{ __('allergies.ok') }}</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="all_allergies_modal" tabindex="-1" role="dialog" aria-labelledby="modal-successLabel1">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<ul class="row">
@php
$allergy_count = count($allergic_drugs_ids_array);
@endphp
@for($i=0 ; $i < $allergy_count ; $i++)
<li class="col-sm-3">
<small>{{ isset($drug_categories_array[$allergic_drugs_ids_array[$i]]) ? $drug_categories_array[$allergic_drugs_ids_array[$i]] : "" }}</small>
</li>
@endfor
</ul>
</div>
</div>
<div class="modal-footer">
<div class="control-group" style="vertical-align: center;">
<div class="controls">
<button type="button" class="btn btn-success" data-dismiss="modal">{{ __('allergies.ok') }}</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@push('scripts')
<script type="text/javascript">
$('#submit_allergies').click(function(e) {
e.preventDefault();
$('#modal-allergies').modal('hide');
var patient_allergies = new Array();
//loop thru the checked allergies and push them into an array
$('input[name="allergies[]"]:checked').each(function() {
patient_allergies.push(this.value);
});
var allergy_patient_id = $('#allergy_patient_id').val();
$.ajax({
type: 'POST',
url: '/store_patient_allergies',
data: {patient_allergies:patient_allergies, allergy_patient_id:allergy_patient_id},
cache: false,
success: function (response) {
//display success notification modal
$('#modal-success-save1').modal('show');
var allergic_drugs_ids_array = {!! json_encode($allergic_drugs_ids_array) !!};
var drug_categories_array = {!! json_encode($drug_categories_array) !!}
var listElements = "";
for(var i=0 ; i < patient_allergies.length ; i++){
listElements += "<li>"+drug_categories_array[patient_allergies[i]]+"</li>";
}
$('#allergies_drugs_list').html(listElements);//list theh checked items after selecting
$('#known_allergies').html(listElements);
$('input[name="allergies[]"]').each(function() {//loop through allergies and recheck values
if(jQuery.inArray(this.value, patient_allergies) !== -1){
$(this).prop('checked', true);
} else {
$(this).prop('checked', false);
}
});
}
});
});
/* submit alert */
$('#submit_alerts').click(function(e) {
e.preventDefault();
$('#modal-alerts').modal('hide');
var alertListElements = "";
var alert_patient_id = $('#alert_patient_id').val();
var patient_alerts = $('#alerts').val();
alertListElements += "<small><li>"+ patient_alerts +"</li></small>";
$.ajax({
type: 'POST',
url: '/store_patient_alerts',
data: {patient_alerts:patient_alerts, alert_patient_id:alert_patient_id},
cache: false,
success: function (response) {
//display success notification modal
$('#modal-success-save2').modal('show');
var known_patient_alerts = {!! json_encode($known_patient_alerts) !!};
for(var alert in known_patient_alerts){
var patient_alert_object = known_patient_alerts[alert];
for (var key in patient_alert_object) {
if (patient_alert_object.hasOwnProperty(key)) {
if (key === "alerts") {
alertListElements += "<small><li>"+ patient_alert_object[key] +"</li></small>";
}
}
}
}
console.log(alertListElements);
$('#known_alerts_list').html(alertListElements);
}
});
});
</script>
@endpush
@@ -1,141 +0,0 @@
@if (session()->has('patient_id'))
@php
$real_patients_id = session('patient_id'); @endphp
@php $patient = get_all_first(['id' => session('patient_id')], 'patients'); @endphp
@endif
<script src="pages/allergies/scripts.js"></script>
<div class="row-fluid">
<div class="col-sm-6">
<a href="#" class="btn-action glyphicons hospital"><i></i></a><span class="count label label-inverse">{{ $patient_categories[$patient->category_id] }}</span>
<div class="widget-stats small">
<div class="widget-body">
<table class="table table-condensed table-striped ">
<!-- Table heading -->
<thead>
<tr>
<th class="center"><font color="black">{{ __('allergies.patient_number') }}</th>
<th class="center"><font color="black">{{ __('allergies.full_names') }}</th>
<th class="center"><font color="black">{{ __('allergies.gender') }}</th>
<th class="center"><font color="black">{{ __('allergies.date_of_birth') }}</font></th>
</tr>
</thead>
<!-- // Table heading END -->
<!-- Table body -->
<tbody>
<?php
if (count($patient) > 0) {
//<!-- Table pricing row -->
echo '<tr class="pricing">';
?>
<td class="center">{{ $patient->number }}</td>
<td class="center">{{ insurance_flag($patient->id) }}</td>
<td class="center">{{ $patient->gender == 1 ? __('allergies.male') : __('allergies.female') }}</td>
<td class="center">
<?php echo streamline_date_plain($patient->date_of_birth); ?>
</td>
<?php echo '</tr>';
?>
<?php
} else {
echo "<tr><td colspan='4' class='center'><blink><font color='maroon' size='3'>" . __('allergies.no_patient_selected') . "</font></blink></tr></tr>";
}
?>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-sm-3">
<!-- Allergies Widget -->
<span class="count label label-important">{{ __('allergies.allergies') }}</span><a href="#" data-toggle="modal" class="btn-action glyphicons glyphicons circle_plus btn-action"><i></i></a>
<div style="color: red;" class="widget-stats small">
<strong><?php genAllergiesOne($patient_number); ?></strong>
</div>
<!-- //Allergies Widget END -->
</div>
<div class="col-sm-3">
<!-- Alerts Widget -->
<span class="count label label-important">{{ __('allergies.alerts') }}</span><a href="#" class="btn-action glyphicons "><i></i></a>
<a href="" class="widget-stats small">
<span class="txt">{{ __('allergies.none') }}</span>
</a>
<!-- // Alerts Widget END -->
</div>
</div>
<?php
$drug_category_query = "SELECT * FROM drug_category";
$result_drugs = dbQuery($drug_category_query);
// dropdown options for symptoms
//while ($row = mysql_fetch_assoc($result_drugs)) {
// $drug_dropdown .= "\r\n<option value=" . $row['Category_Id'] . ">" . $row['Category_Name'] . "</option>";
//}
while ($row = mysql_fetch_assoc($result_drugs)) {
$drug_checkbox .= "<input id='allergies' name='allergies[]' type='checkbox' value=" . $row['Category_Id'] . " />" . " " . $row['Category_Name'] . "<br />";
}
?>
<!-- Modal -->
<div class="modal hide fade" id="modal-allergies">
<!-- Modal heading -->
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>{{ __('allergies.add_allergies_patient') }}</h3>
</div>
<!-- // Modal heading END -->
<!-- Modal body -->
<div class="modal-body">
<div class="row">
<div class="col-sm-4">
<form action="pages/allergies/submit_allergies.php" method="POST">
<h4>{{ __('allergies.allergic_reactions') }}</h4>
<!-- <div class="control-group">
<label>Allergic Reactions</label>
<div class="controls">
<select name = "allergies[]" id="select2_6_2" multiple>
<option selected value=''>None</option>
<?php // echo $drug_dropdown; ?>
</select>
</div>
</div>-->
<?php
echo $drug_checkbox;
?>
<hr />
<input type="hidden" id="allergy_patient_id" name="allergy_patient_id" value="<?php echo $row_patient['Patient_Id']; ?>">
<input type="submit" id="submit_allergies" class = "btn btn-primary btn-mini" value="{{ __('allergies.submit_allergies') }}" />
<div class="separator bottom"></div>
</form>
</div>
<div class="col-sm-2">
<h4>{{ __('allergies.currently_known') }}</h4>
<div id="known_allergies">
<?php genAllergiesTwo($patient_number); ?>
</div>
</div>
</div>
</div>
<!-- // Modal body END -->
<!-- Modal footer -->
<div class="modal-footer">
<a href="#" class="btn btn-danger" data-dismiss="modal">{{ __('allergies.close') }}</a>
</div>
<!-- // Modal footer END -->
</div>
<!-- // Modal END -->
@@ -1,79 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('allergies.allergies_for') }} <font color="blue">{{ $patient->first_name }} {{ $patient->last_name }}</font></h4>
</div>
<div class="col-lg-8 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('allergies.dashboard') }}</a></li>
<li class="active">{{ __('allergies.view') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
<div class="white-box">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>{{ __('allergies.allergy') }}</th>
</tr>
</thead>
<tbody>
@php $allergic_drugs_ids_array = []; @endphp
@if(count($known_patient_allergies) > 0 )
@foreach($known_patient_allergies as $allergy)
@php
$allergic_drugs_ids_array = explode(',' , $allergy->names);
$count = 1;
@endphp
@for($i=0 ; $i < count($allergic_drugs_ids_array) ; $i++)
<tr>
<td>{{ $count }}.</td>
<td>{{ $drug_categories_array[$allergic_drugs_ids_array[$i]] }}</td>
</tr>
@php $count++; @endphp
@endfor
@endforeach
@endif
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script>
$('.table').DataTable({
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
});
</script>
@endpush
@@ -1,56 +0,0 @@
<div class="white-box" style="border-radius: 5px;">
<div class="row">
<div class="col-md-8 offset-2">
<img class="img-rounded img-responsive" alt="user" src="/uploads/streamline_images/person-place-holder.jpg">
</div>
</div>
<div class="user-btm-box">
<!-- .row -->
<div class="row text-center m-t-10">
<div class="col-md-6 b-r"><strong>{{ __('patient_file.patient_number') }}</strong>
<p>{{ $patient->number }}</p>
</div>
<div class="col-md-6"><strong>{{ __('patient_file.patient_names') }}</strong>
<p>{{ $patient->first_name }} {{ $patient->last_name }}</p>
</div>
</div>
<!-- /.row -->
<hr/>
<!-- .row -->
<div class="row text-center m-t-10">
<div class="col-md-6 b-r"><strong>{{ __('patient_file.gender') }}</strong>
<p>{{ $patient->gender == 1 ? __('patient_file.male') : __('patient_file.female') }}</p>
</div>
<div class="col-md-6"><strong>{{ __('patient_file.age') }}</strong>
@php
$dob = new Carbon\Carbon($patient->date_of_birth);
$age = $dob->diffInYears(Carbon\Carbon::now());
@endphp
<p>{{ $age }} {{ __('patient_file.years') }}</p>
</div>
</div>
<hr/>
<div class="row">
<div class="col-sm-6 text-center">
@if (session()->has('patient_id'))
<a style="background: yellow" class="btn btn-rounded btn-block" href="/patient_episodes/">{{ __('patient_file.patient_home') }}</a>
@endif
</div>
<div class="col-sm-6 text-center">
@if (session()->has('patient_id'))
<a style="background: #b6895e; color: white; text-shadow: none;" class="btn btn-rounded btn-block" href="/patient_finance/home">{{ __('patient_file.finance_home') }}</a>
@endif
</div>
</div>
<hr/>
<div class="row">
<div class="col-sm-12 text-center">
<button class="btn btn-primary btn-block btn-rounded waves-effect waves-light" type="button" data-toggle="modal" data-target="#demographicsModal">
{{ __('patient_file.patient_demographic') }}
</button>
</div>
</div>
</div>
</div>
@@ -1,132 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patient_documents.upload') }} <strong>@if(isset($patient->last_name)){{$patient->last_name}}'s @endif</strong> {{ __('patient_documents.document') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_documents.dashboard') }}</a></li>
<li><a href="{{ route('patients.index') }}">{{ __('patient_documents.patient') }}</a></li>
<li class="active">{{ __('patient_documents.document') }}</li>
</ol>
</div>
<!-- /.col-lg-12 -->
</div>
<div class="row">
<div class="col-sm-12">
@include('patients::allergies.header')
</div>
</div>
<!-- .row -->
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
@foreach ($errors->all() as $error)
<div>{{ $error }}</div>
@endforeach
<div class="white-box">
{{ Form::open(['route' => 'patient_documents.store','data-toggle'=>'validator','files'=>'true']) }}
<div class="row">
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('patientnumber',__('patient_documents.patient_number')) }}
{{ Form::text('patientnumber',$patient->number,['class' => 'form-control compulsory', 'required', 'data-error'=>'','readonly'=>'true']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('documenttitle',__('patient_documents.document_title')) }}
{{ Form::text('documenttitle','',['class' => 'form-control compulsory', 'required', 'data-error'=>'']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('description',__('patient_documents.description')) }}
{{ Form::textArea('description','',['class' => 'form-control']) }}
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('documentdate',__('patient_documents.date_of_document')) }}
<div class="input-group">
{{ Form::text('documentdate',date('d/m/Y'),['class' => 'form-control compulsory', 'required','readonly','id'=>'datepicker-autoclose']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('document',__('patient_documents.document')) }}
{{ Form::file('document',['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-6"><hr></div>
<div class="col-md-4">
{{ Form::button(__('patient_documents.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
{{ Form::button(__('patient_documents.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
</div>
</div>
{{ Form::close() }}
</div>
</div>
</div>
<!-- /.row -->
@endsection
@push('scripts')
<script src="{{ asset('elite/js/validator.js') }}"></script>
<!-- Date Picker Plugin JavaScript -->
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('js/patients/create.js') }}"></script>
<script src="{{ asset('elite/js/mask.js') }}"></script>
<script type="text/javascript">
jQuery('#datepicker-autoclose').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd/mm/yyyy',
});
$("#datepicker-autoclose").on('change', function () {
var today = new Date();
var documentDate = $(this).val();
var temp_date = documentDate.split("/");
documentDate = new Date(temp_date[2], (temp_date[1] - 1), temp_date[0]);
//calculate years
var age = today.getFullYear() - documentDate.getFullYear();
age = parseInt(age);
var m = today.getMonth() - documentDate.getMonth();
if (m < 0 || (m === 0 && today.getDate() < documentDate.getDate())) {
age--;
}
//calculate months
var monthDocument = documentDate.getMonth() + 1;
var monthToday = today.getMonth() + 1;
if (monthToday > monthDocument) {
var months = monthToday - monthDocument;
} else if (monthToday == monthDocument) {
var months = 0;
} else if (monthToday < monthDocument) {
var months = monthToday - monthDocument;
months = months + 12;
}
if (months < 10) {
months = '0' + months;
}
//set the values
$('#age_in_years').val(age);
$('#age_in_months').val(months);
});
</script>
@endpush
@@ -1,105 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patient_documents.patient_documents_for') }} {{ $patient->first_name }} {{ $patient->last_name }}</h4>
</div>
<div class="col-lg-8 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_documents.dashboard') }}</a></li>
<li><a href="/patient_documents/">{{ __('patient_documents.patient_documents') }}</a></li>
<li class="active">{{ __('patient_documents.view') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('patients::allergies.header')
</div>
</div>
<div class="row">
<div class="col-sm-12">
<button class="btn btn-info btn-sm pull-right" onclick="window.location.href='patient_documents/create'">{{ __('patient_documents.add_new_document') }}</button>
</div>
</div><br>
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
<div class="white-box">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{{ __('patient_documents.date') }}</th>
<th>{{ __('patient_documents.patient_number') }}</th>
<th>{{ __('patient_documents.patient') }}</th>
<th>{{ __('patient_documents.title') }}</th>
<th>{{ __('patient_documents.description') }}</th>
<th>{{ __('patient_documents.uploaded_by') }}</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
@foreach($documents as $document)
<tr>
<td>{{ Carbon\Carbon::parse($document->created_at)->format('d, M Y') }}</td>
<td>{{ $patient->number }}</td>
<td>{{ $patient->first_name }} {{ $patient->last_name}}</td>
<td>{{ $document->title }}</td>
<td>{{ $document->description }}</td>
@php
$uploaded_by = \Streamline\Models\User::find($document->created_by);
@endphp
<td>{{ $uploaded_by->first_name }} {{ $uploaded_by->last_name }}</td>
<td><a href="/patient_documents/{{ $document->id }}" target="_blank">{{ __('patient_documents.preview') }}</a></td>
<td>
{{ Form::model($document->id ,['method' => 'DELETE', 'route' => ['patient_documents.destroy', $document->id]]) }}
<button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure?')"><i class="fa fa-trash"></i> {{ __('patient_documents.delete') }}</button>
{{ Form::close() }}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script>
$('.table').DataTable({
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
});
</script>
@endpush
@@ -1,52 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/html5-editor/bootstrap-wysihtml5.css') }}" rel="stylesheet">
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patient_episode.edit_claim_number') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('resources.dashboard') }}</a></li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('flash::message')
<div class="white-box">
{{ Form::model($episode, ['method' => 'PUT', 'route' => ['patient_episodes.update',$episode], 'data-toggle' => 'validator']) }}
<div class="form-group">
{{ Form::label('claim_number', __('finance.claim_number')) }}
{{ Form::text('claim_number', $episode->claim_number, ['class' => 'form-control compulsory', 'required']) }}
{{ Form::hidden('episode_id', $episode_id) }}
<div class="help-block with-errors"></div>
</div>
{{ Form::button(__('resources.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
{{ Form::button(__('resources.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
{{ Form::close() }}
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/js/validator.js') }}"></script>
<script type="text/javascript" src="{{ asset('elite/bower_components/html5-editor/wysihtml5-0.3.0.js') }}"></script>
<script type="text/javascript" src="{{ asset('elite/bower_components/html5-editor/bootstrap-wysihtml5.js') }}"></script>
<script>
$(document).ready(function () {
$('.textarea_editor').wysihtml5();
});
</script>
@endpush
@@ -1,443 +0,0 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Inpatient Bill - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
body{
font-size: 0.8em;
}
/*thead, tfoot { display: table-row-group }*/
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-before: always;
page-break-after: always;
page-break-inside: avoid !important;
}
</style>
</head>
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h5 class="heading" style="text-align: center;">{{ __('patient_file.patient_episode_summary') }}</h5>
<table class="table table-light table-sm table-borderless">
<tr>
<th width="20%">{{ __('patient_file.patient_number') }}</th>
<td width="30%">{{ $patient->number}}</td>
<th width="15%" scope="row">{{ __('patient_file.category') }}</th>
<td>
{{ get_name($patient->category_id, 'id', 'name', 'patient_categories') }}
</td>
</tr>
<tr>
<th scope="row">{{ __('patient_file.patient_names') }}</th>
<td>{{ $patient->first_name}} {{ $patient->last_name}}</td>
<th scope="row">{{ __('patient_file.residence') }}</th>
<td>{{ patient_residence($patient->id) }}</td>
</tr>
<tr>
<th scope="row">{{ __('patient_file.age') }}</th>
<td><?php echo \Carbon\Carbon::parse($patient->date_of_birth)->age; ?> {{ __('patient_file.years') }}</td>
<th scope="row">{{ __('patient_file.gender') }}</th>
<td><?php echo $patient->gender == 1 ? __('patient_file.male') : __('patient_file.female') ?></td>
</tr>
<tr>
<th>{{ __('patient_file.episode_date') }}</th>
<td><?php echo \Carbon\Carbon::parse($episode->created_at)->format('d M Y h:i a'); ?></td>
<th scope="row">{{ __('patient_file.outcome') }}</th>
<td>
@if($consultation && !is_null($consultation->outcome_id))
@if($consultation->outcome_id == 3)
{{ $outcomes[$consultation->outcome_id] . ' on (' . streamline_date($consultation->followup_when) . ')' }}
@elseif($consultation->outcome_id == 5)
<code> {{ $outcomes[$consultation->outcome_id] . ' on (' . streamline_date($consultation->died_on) . ')' }} </code>
@else
{{ $outcomes[$consultation->outcome_id] ?? "" }}
@endif
@elseif (!empty($antenatal_data->outcome_id))
@if($antenatal_data->outcome_id == 3)
{{ $outcomes[$antenatal_data->outcome_id] . ' on (' . streamline_date($antenatal_data->followup_when) . ')' }}
@elseif($antenatal_data->outcome_id == 5)
<code> {{ $outcomes[$antenatal_data->outcome_id] . ' on (' . streamline_date($antenatal_data->died_on) . ')' }} </code>
@else
{{ $outcomes[$antenatal_data->outcome_id] ?? "" }}
@endif
@endif
</td>
</tr>
</table>
@if($consultation)
<table class="table table-sm table-bordered">
<thead class="thead-light">
<tr>
<th>{{ __('patient_file.diagnosis') }}</th>
<th>{{ __('patient_file.diagnosis_by') }}</th>
</tr>
</thead>
<?php
$primary_diagnosis = $consultation->primary_diagnosis;
$other_diagnoses_string = $consultation->other_diagnoses;
$other_diagnoses_array = unserialize($other_diagnoses_string);
?>
<tbody>
<tr>
<td>{{ $diagnoses[$primary_diagnosis] ?? "" }}</td>
<td>
@if (!is_null($consultation->consultation_done_by))
{{ get_full_name($consultation->consultation_done_by, 'id', 'first_name', 'last_name', 'users')}}
@elseif(!is_null($consultation->updated_by))
{{ get_full_name($consultation->updated_by, 'id', 'first_name', 'last_name', 'users')}}
@else
{{ get_full_name($consultation->created_by, 'id', 'first_name', 'last_name', 'users')}}
@endif
</td>
</tr>
@if(is_array($other_diagnoses_array))
@for($i = 0; $i < count($other_diagnoses_array); $i++)
@if($other_diagnoses_array[$i] != "")
<tr>
<td>{{ $diagnoses[$other_diagnoses_array[$i]] ?? "" }}</td>
<td></td>
</tr>
@endif
@endfor
@endif
</tbody>
</table>
@if(!is_null($consultation->comments))
<table class="table table-sm table-bordered">
<thead class="thead-light">
<tr><th>{{ __('patient_episode.comments') }}</th></tr>
</thead>
<tbody>
<tr><td>{!! nl2br(e($consultation->comments)) !!}</td></tr>
</tbody>
</table>
@endif
@if(!is_null($consultation->history_comments))
<table class="table table-sm table-bordered">
<thead class="thead-light">
<tr><th>{{ __('patient_episode.history_comments') }}</th></tr>
</thead>
<tbody>
<tr><td>{!! nl2br(e($consultation->history_comments)) !!}</td></tr>
</tbody>
</table>
@endif
@if(!is_null($consultation->clinic_examination_comments))
<table class="table table-sm table-bordered">
<thead class="thead-light">
<tr><th>{{ __('patient_episode.clinic_examination_comments') }}</th></tr>
</thead>
<tbody>
<tr><td>{!! nl2br(e($consultation->clinic_examination_comments)) !!}</td></tr>
</tbody>
</table>
@endif
@if(!is_null($consultation->investigation_and_management_plan_comments))
<table class="table table-sm table-bordered">
<thead class="thead-light">
<tr><th>{{ __('patient_episode.inv_manage_plan_comment') }}</th></tr>
</thead>
<tbody>
<tr><td>{!! nl2br(e($consultation->investigation_and_management_plan_comments)) !!}</td></tr>
</tbody>
</table>
@endif
@endif
@if($antenatal_data)
<table class="table table-sm table-bordered">
<thead class="thead-light">
<tr>
<th>{{ __('patient_file.diagnosis') }}</th>
{{-- <th>{{ __('patient_file.diagnosis_by') }}</th> --}}
</tr>
</thead>
<?php
$primary_diagnosis = $antenatal_data->primary_diagnosis;
$other_diagnoses_array = explode(',', $antenatal_data->other_diagnoses);
?>
<tbody>
<tr>
<td>{{ $diagnoses[$primary_diagnosis] ?? "" }}</td>
{{-- <td>
@if (!is_null($antenatal_data->consultation_done_by))
{{ get_full_name($antenatal_data->consultation_done_by, 'id', 'first_name', 'last_name', 'users')}}
@elseif(!is_null($antenatal_data->updated_by))
{{ get_full_name($antenatal_data->updated_by, 'id', 'first_name', 'last_name', 'users')}}
@else
{{ get_full_name($antenatal_data->created_by, 'id', 'first_name', 'last_name', 'users')}}
@endif
</td> --}}
</tr>
@if(is_array($other_diagnoses_array))
@for($i = 0; $i < count($other_diagnoses_array); $i++)
@if($other_diagnoses_array[$i] != "")
<tr>
<td>{{ $diagnoses[$other_diagnoses_array[$i]] ?? "" }}</td>
<td></td>
</tr>
@endif
@endfor
@endif
</tbody>
</table>
@if(!is_null($antenatal_data->comments))
<table class="table table-sm table-bordered">
<thead class="thead-light">
<tr><th>{{ __('patient_episode.comments') }}</th></tr>
</thead>
<tbody>
<tr><td>{!! nl2br(e($antenatal_data->comments)) !!}</td></tr>
</tbody>
</table>
@endif
@if(!is_null($antenatal_data->history_comments))
<table class="table table-sm table-bordered">
<thead class="thead-light">
<tr><th>{{ __('patient_episode.history_comments') }}</th></tr>
</thead>
<tbody>
<tr><td>{!! nl2br(e($antenatal_data->history_comments)) !!}</td></tr>
</tbody>
</table>
@endif
@if(!is_null($antenatal_data->clinic_examination_comments))
<table class="table table-sm table-bordered">
<thead class="thead-light">
<tr><th>{{ __('patient_episode.clinic_examination_comments') }}</th></tr>
</thead>
<tbody>
<tr><td>{!! nl2br(e($antenatal_data->clinic_examination_comments)) !!}</td></tr>
</tbody>
</table>
@endif
@if(!is_null($antenatal_data->investigation_and_management_plan_comments))
<table class="table table-sm table-bordered">
<thead class="thead-light">
<tr><th>{{ __('patient_episode.inv_manage_plan_comment') }}</th></tr>
</thead>
<tbody>
<tr><td>{!! nl2br(e($antenatal_data->investigation_and_management_plan_comments)) !!}</td></tr>
</tbody>
</table>
@endif
@endif
<div class="row">
@if(count($opd_investigations) > 0)
<div class="col">
<table class="table table-sm table-bordered">
<thead class="thead-light">
<tr>
<th>{{ __('patient_file.investigation') }}</th>
<th>{{ __('patient_file.result') }}</th>
<th>{{ __('patient_file.comment') }}</th>
</tr>
</thead>
<tbody>
@if(count($opd_investigations) > 0)
@for($i = 0; $i < count($opd_investigations['name']); $i++)
@if(isset($opd_investigations['name'][$i]))
<tr>
<td>{{ $opd_investigations['name'][$i] }}</td>
<td>
@if (!empty($opd_investigations['type'][$i]))
<strong><code>See attached</code></strong>
@else
{{ $opd_investigations['value'][$i] }}
@endif
</td>
<td>{{ $opd_investigations['comment'][$i] }}</td>
</tr>
@endif
@endfor
@endif
</tbody>
</table>
</div>
@endif
@if(count($ordered_procedures) > 0)
<div class="col">
<table class="table table-sm table-bordered">
<thead class="thead-light">
<tr><th>{{ __('patient_episode.procedure_name') }}</th></tr>
</thead>
<tbody>
@foreach($ordered_procedures as $procedure)
@php
$procedure_ids = explode(',', $procedure->procedure_id);
@endphp
@foreach ($procedure_ids as $id)
<tr>
<td>{{ $procedures[$id] ?? "" }}</td>
</tr>
@endforeach
@endforeach
</tbody>
</table>
</div>
@endif
</div>
<br>
<div class="row">
@if(count($ordered_sundries) > 0)
<div class="col">
<table class="table table-sm table-bordered">
<thead class="thead-light">
<tr>
<th>{{ __('insurance_reports.sundry_name') }}</th>
<th>{{ __('patient_episode.quantity') }}</th>
</tr>
</thead>
<tbody>
@foreach($ordered_sundries as $sundry)
@php
$sundry_ids = explode(',', $sundry->sundries_id);
$sundry_amounts = explode(',', $sundry->quantity);
@endphp
@for($i = 0; $i < count($sundry_ids); $i++)
<tr>
<td>{{ $sundries[$sundry_ids[$i]] ?? "" }}</td>
<td>{{ $sundry_amounts[$i] ?? "" }}</td>
</tr>
@endfor
@endforeach
</tbody>
</table>
</div>
@endif
@if(count($ordered_services) > 0)
<div class="col">
<table class="table table-sm table-bordered">
<thead class="thead-light">
<tr>
<th>{{ __('patient_episode.services') }}</th>
<th>{{ __('patient_episode.quantity') }}</th>
</tr>
</thead>
<tbody>
@foreach($ordered_services as $ordered_service)
@php
$service_ids = explode(',', $ordered_service->service_id);
$service_amounts = explode(',', $ordered_service->quantity);
@endphp
@for($i = 0; $i < count($service_ids); $i++)
<tr>
<td>{{ $services[$service_ids[$i]] ?? "" }}</td>
<td>{{ $service_amounts[$i] ?? "" }}</td>
</tr>
@endfor
@endforeach
</tbody>
</table>
</div>
@endif
</div>
<br>
<div class="row">
@if(count($treatments) > 0)
<div class="col">
<table class="table table-bordered table-sm">
<thead class="thead-light">
<tr>
<th>{{ __('patient_file.treatment') }}</th>
<th>{{ __('patient_file.dosage_freq') }}</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($treatments as $treatment)
<?php
$drugs_array = explode(",", $treatment->drugs);
$dosage_array = explode(",", $treatment->doses);
$dosage2_array = explode(",", $treatment->dose2);
$frequencies_array = explode(",", $treatment->frequencies);
$duration_array = explode(",", $treatment->durations);
$quantity_dispensed_array = explode(",", $treatment->quantities_dispensed);
$total_drug_price = 0;
$instructions_array = explode(",", $treatment->instruction);
?>
@for ($x = 0; $x < count($drugs_array); $x++)
<?php
$drug_details = \Streamline\Models\Drug::find($drugs_array[$x]);
if (!$drug_details) {
continue;
}
$drug_form_name = get_name($drug_details->form_id, "id", "name", "unit_of_measure");
$drug_unit = get_name($drug_details->unit_id, "id", "name", "drug_units");
$drug_strength = $drug_details->strength;
$treatment_dosage = $dosage_array[$x] ?? "";
$treatment_strength = $drug_strength ?? "";
?>
<tr>
<td>
{{ get_name($drugs_array[$x], 'id', 'name', 'drugs') }}
</td>
<td>
({{ $dosage_array[$x] }} {!! $drug_unit !!} &nbsp;&nbsp; {{ get_name($frequencies_array[$x], 'id', 'name', 'dosage_frequencies') }})
</td>
<td>
{{ $duration_array[$x] }}
</td>
</tr>
@endfor
@endforeach
</tbody>
</table>
</div>
@endif
</div>
@if (is_add_stamp_feature_enabled() && !empty($hospitalInfo->stamp))
<table class="table table-borderless">
<tbody>
<tr>
<td style="text-align: center">
<img style="max-width: 300px; max-height: 150px;" src="{{ asset($hospitalInfo->stamp) }}" class="img-fluid mx-auto d-block mx-3" alt="{{ $hospitalInfo->name}} stamp">
</td>
</tr>
</tbody>
</table>
@endif
</div>
</body>
</html>
@@ -1,940 +0,0 @@
@extends('layouts.main')
@push('styles')
<style type="text/css">
#t_header th {
background-color: #708090;
color: #000;
}
.color-tr{
background: #FFFF99;
}
.admitted_row_color{
background: #d9edf7;
}
.theatre_row_color{
background: #f2e6ff;
}
.appointment_row_color{
background: #e4e0a8;
}
.aTable tr {
background-color: #DDD;
}
.table_no_padding td{
padding: 4px;
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patient_episode.patient_episodes') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_episode.dashboard') }}</a></li>
<li><a href="{{ route('patients.index') }}">{{ __('patient_episode.patients') }}</a></li>
<li class="active">{{ __('patient_episode.episodes') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="row">
<div class="col-sm-12">
@include('patients::allergies.header')
</div>
</div>
<br/>
<div class="row">
<div class="col-sm-12">
@include('patients::patient_episodes.menu')
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
{{ Form::open(['route' => 'patient_episodes.route_patient_episode', 'id' => 'episodesForm']) }}
{{ Form::hidden('patient_id', $patient->id, ['id' => 'patient_id']) }}
<div class="white-box">
@include('flash::message')
@if(Auth::user()->can('merge-patient-episodes'))
<p>
<a class="btn btn-warning btn-sm btn-rounded" style="background-color: #d4984a; float:right" target="_blank" href="{{ url('episode_merge_preview') }}"><strong>{{ __('patient_episode.merge_episodes') }}</strong></a><br>
</p>
@endif
<div class="table-responsive">
<table class="table color-table success-table">
<thead>
<tr>
<th>{{ __('patient_episode.episode_date') }}</th>
<th>{{ __('patient_episode.clinic') }}</th>
<th>{{ __('patient_episode.primary_diagnosis') }}</th>
<th>{{ __('patient_episode.other_diagnosis') }}</th>
<th>{{ __('patient_episode.consultation_by') }}</th>
<th>{{ __('patient_episode.comments') }}</th>
<th>{{ __('patient_episode.select') }}</th>
</tr>
</thead>
<tbody>
@foreach($patient_episodes as $patient_episode)
@php
$episode_id = $patient_episode->id;
$created_at = Carbon\Carbon::parse($patient_episode->created_at);
$triage_id = $patient_episode->triage_id;
$anc = \DB::table('ante_natal_clinic_followups')->where([['episode_id', $episode_id],['patient_id', $patient_episode->patient_id]])->first();
$consultation_id = !empty($anc->primary_diagnosis)? $anc->primary_diagnosis:$patient_episode->consultation_id;
$primary_diagnosis_id = '';
$other_diagnoses_ids = '';
$triage_comment = '';$other_diagnoses_explode =[];
$consultation_comment = '';
$clinic = (isset($clinics[$patient_episode->clinic_id]) && !is_null($patient_episode->clinic_id)) ? $clinics[$patient_episode->clinic_id] : '';
$primary_diagnosis = '';
$other_diagnoses = '';
$triage_and_consultation_comments = '';
@endphp
@if (!empty($consultation_id))
@php
$primary_diagnosis_id = !empty($anc->primary_diagnosis)? $anc->primary_diagnosis: get_name($consultation_id, 'id', 'primary_diagnosis', 'consultations');
$other_diagnoses_ids = !empty($anc->other_diagnoses)? explode(',',$anc->other_diagnoses): trim(get_name($consultation_id, 'id', 'other_diagnoses', 'consultations'));
$consultation_comment = !empty($anc->comments)? trim($anc->comments): trim(get_name($consultation_id, 'id', 'comments', 'consultations'));
$consultation_comment = clean_streamline_database_output($consultation_comment);
$triage_comment = !is_null($triage_id) ? trim(get_name($triage_id, 'id', 'comments', 'triage')) : '';
$triage_and_consultation_comments = '<b>Triage: </b>'.$triage_comment.' '.'<br><b>Consultation: </b>'.$consultation_comment;
@endphp
@else
@php
$temporary_consultation_id = get_name($patient_episode->id, 'episode_id', 'id', 'temporary_consultations');
@endphp
@if ($temporary_consultation_id != 'N/A')
@php
$primary_diagnosis_id = get_name($temporary_consultation_id, 'id', "primary_diagnosis", 'temporary_consultations');
$other_diagnoses_ids = trim(get_name($temporary_consultation_id, 'id', 'other_diagnoses', 'temporary_consultations'));
$consultation_comment = trim(get_name($temporary_consultation_id, 'id', 'comments', 'temporary_consultations'));
@endphp
@endif
@endif
@php
$primary_diagnosis = isset($diagnoses[$primary_diagnosis_id]) ? $diagnoses[$primary_diagnosis_id] : '';
if($other_diagnoses_ids != 'N/A' && $other_diagnoses_ids != '') $other_diagnoses_explode = (!is_array($other_diagnoses_ids))? unserialize($other_diagnoses_ids) : $other_diagnoses_ids;
$other_diagnoses = "";
for($s = 0; $s < count($other_diagnoses_explode); $s++) $other_diagnoses .= isset($diagnoses[$other_diagnoses_explode[$s]]) ? $diagnoses[$other_diagnoses_explode[$s]] . ", " : '';
@endphp
<tr id='my_row{{ $episode_id }}'>
<td>
<a href="#" style="color: #0099CC">{{ streamline_date_time($patient_episode->created_at) }} </a>
<br>
<small>{{ __('patient_episode.started_by') }}</small>
<small style="color: blue">{{ get_full_name($patient_episode->created_by, "id", "first_name", "last_name", "users") }}</small>
@if(check_if_episode_is_a_followup($patient_episode->id))
@php
$original_episode = \Streamline\Models\PatientEpisode::find($patient_episode->parent_episode_id);
@endphp
<small style="color: green"><br>({{ __('patient_episode.review_from') }} {{ $original_episode ? streamline_date($original_episode->created_at) : '' }})</small>
@endif
@if(Auth::user()->can('delete-empty-episode') && is_episode_safe_to_delete($patient_episode->id))
<br>
<br>
<a class="btn btn-danger btn-sm" href="/patient_episodes/delete_episode/{{ $patient_episode->id }}" onclick="return confirm('Are you sure you want to delete this episode?')">{{ __('patient_episode.remove_episode') }}</a>
@endif
</td>
<td>
@if( Auth::user()->can('view-patient-episode-clinic-from-patient-home'))
{{ $clinic }}
@endif
</td>
<td>
@if( Auth::user()->can('view-patient-episode-primary-diagnoses'))
{{ $primary_diagnosis }}
@endif
</td>
<td class="hidden-phone">
@if( Auth::user()->can('view-patient-episode-other-diagnoses'))
{!! read_more($other_diagnoses, 'other_diagnoses_short' . $patient_episode->id, 'other_diagnoses_long' . $patient_episode->id) !!}
<div id="other_diagnoses_long{{ $patient_episode->id }}" style="display: none;">
{!! $other_diagnoses !!}<br/>
<a class="read_more" style="color : #0099CC;" onclick= "hide('other_diagnoses_long{{ $patient_episode->id }}');show('other_diagnoses_short{{ $patient_episode->id }}');">{{ __('patient_episode.read_less') }}</a>
</div>
@endif
</td>
<td class="hidden-phone">
@php
$consultation_done_by = !empty($anc->created_by)? $anc->created_by :get_doctor_who_completed_episode_consultation($patient_episode->id);
@endphp
@if(!is_null($consultation_done_by))
{{ get_full_name($consultation_done_by, "id", "first_name", "last_name", "users") }}
@endif
@if($patient_episode->episode_type == 1)
<span>{{ __('patient_flow_monitoring.lab_self_request') }}</span>
@endif
</td>
<td class="hidden-phone">
{!! read_more($triage_and_consultation_comments, 'short_comment' . $patient_episode->id, 'long_comment' . $patient_episode->id) !!}
<div id="long_comment{{ $patient_episode->id }}" style="display: none;">
{!! $triage_and_consultation_comments !!}<br/>
<a class="read_more" style="color : #0099CC;" onclick= "hide('long_comment{{ $patient_episode->id }}');show('short_comment{{ $patient_episode->id }}');">{{ __('patient_episode.read_less') }}</a>
</div>
</td>
<td>
<input type="radio" onchange="show('menu1'), hide('theatre_menu'), hide('menu2'), hide('pic1'), hide('menu_maternity')" class="radio-option center" name="episode_id" id="episode_id_{{ $patient_episode->id }}" value="{{ $patient_episode->id }}" />
</td>
</tr>
@php
$inpatient_info = get_all_first(['episode_id' => $patient_episode->id, 'patient_id' => $patient->id], 'inpatient_info');
$maternity_ward_id = get_name("maternity", "slug", "id", "wards");
@endphp
@if ($inpatient_info != 'N/A')
<tr id='my_row2{{ $inpatient_info->episode_id }}' class="admitted_row_color">
<td style='background-color: white; font-size: smaller;'>
@if($inpatient_info->discharged)
<a style="color: #0099CC">{{ __('patient_episode.discharged') }} on {{ streamline_date($inpatient_info->discharged_on) }}</a>
<br><small style="color: blue">By {{ get_full_name($inpatient_info->discharged_by, "id", "first_name", "last_name", "users") }}</small>
@else
<a style="color: #0099CC">{{ __('patient_episode.admitted') }} on {{ streamline_date($inpatient_info->admitted_on) }}</a>
<br><small style="color: blue">By {{ get_full_name($inpatient_info->created_by, "id", "first_name", "last_name", "users") }}</small>
@endif
</td>
<td> {{ get_name($inpatient_info->ward_id, "id", "name", "wards") }} </td>
@php
$sec_diagnoses = (!is_null($inpatient_info->other_diagnoses) && !is_null(unserialize($inpatient_info->other_diagnoses))) ? array_values(unserialize($inpatient_info->other_diagnoses)) : [] ;
$sec_diagnosis = "";
for ($s = 0; $s < count($sec_diagnoses); $s++) $sec_diagnosis .= get_name($sec_diagnoses[$s], "id", "name", "diagnoses") . ", ";
@endphp
<td>
@if( Auth::user()->can('view-patient-episode-primary-diagnoses'))
{{ get_name($inpatient_info->primary_diagnosis, "id", "name", "diagnoses") }}
@endif
</td>
<td class="hidden-phone">
@if( Auth::user()->can('view-patient-episode-other-diagnoses'))
{!! read_more($sec_diagnosis, 'sec_diagnosis_short' . $episode_id, 'sec_diagnosis_long' . $episode_id) !!}
<div id="sec_diagnosis_long{{ $episode_id }}" style="display: none;">
{!! $sec_diagnosis !!}<br/>
<a class="read_more" style="color : #0099CC;" onclick= "hide('sec_diagnosis_long{{ $episode_id }}');show('sec_diagnosis_short{{ $episode_id }}');">{{ __('patient_episode.read_less') }}</a>
</div>
@endif
</td>
<td class="hidden-phone">
@php
$consultation_done_by = !empty($anc->created_by)? $anc->created_by :get_doctor_who_has_done_episode_consultation($patient_episode->patient_id, $patient_episode->id);
@endphp
@if(!is_null($consultation_done_by))
{{ get_full_name($consultation_done_by, "id", "first_name", "last_name", "users") }}
@endif
</td>
<td> {{ $inpatient_info->comments }}</td>
<td>
@if(get_name($inpatient_info->ward_id, "id", "slug", "wards") == "maternity")
<input type="radio" onchange="show('menu_maternity'), hide('theatre_menu'), hide('menu1'), hide('menu2'), hide('pic1')" class="radio-option-inpatient center" name="episode_id" id="episode_id" value="{{ $patient_episode->id }}"/>
@else
<input type="radio" onchange="show('menu2'), hide('theatre_menu'), hide('menu_maternity'), hide('menu1'), hide('pic1')" class="radio-option-inpatient center" name="episode_id" id="episode_id" value="{{ $patient_episode->id }}"/>
@endif
</td>
</tr>
@endif
@php
$theatre_information = does_episode_have_theatre_information($patient_episode->id);
@endphp
@if ($theatre_information)
<tr id='my_row3' class="theatre_row_color">
<td style='background-color: white; font-size: smaller;'>
@if($theatre_information['surgery_completed'])
<span style="color: green">{{ __('patient_episode.surgery_complete') }}</span>
@else
<span style="color: red">{{ __('patient_episode.surgery_not_complete') }}</span>
@endif
<br>
@if($theatre_information['anaesthesia_completed'])
<span style="color: green">{{ __('patient_episode.anaesthesia_complete') }}</span>
@else
<span style="color: red">{{ __('patient_episode.anaesthesia_not_complete') }}</span>
@endif
</td>
<td>{{ __('patient_episode.procedure') }}: {{ $theatre_information['procedure_name'] }}</td>
<td>{{ __('patient_episode.surgery_type') }}: {{ $theatre_information['surgery_type'] }}</td>
<td>{{ __('patient_episode.outcome') }}: {{ $theatre_information['outcome'] }}</td>
<td class="hidden-phone">
@php
$consultation_done_by = !empty($anc->created_by)? $anc->created_by :get_doctor_who_has_done_episode_consultation($patient_episode->patient_id, $patient_episode->id);
@endphp
@if(!is_null($consultation_done_by))
{{ get_full_name($consultation_done_by, "id", "first_name", "last_name", "users") }}
@endif
</td>
<td>{{ $theatre_information['comments'] }}</td>
<td>
<input type="radio" onchange="show('theatre_menu'), hide('menu_maternity'), hide('menu1'), hide('menu2'), hide('pic1')" class="radio-option-inpatient center" name="episode_id" id="episode_id" value="{{ $patient_episode->id }}"/>
</td>
</tr>
@endif
@php
$episode_appointment = get_all_first(['episode_id' => $patient_episode->id, 'patient_id' => $patient->id], 'patient_appointments');
@endphp
@if($episode_appointment != 'N/A' && $episode_appointment->appointment_fulfilled == 1)
<tr id='my_row4' class="appointment_row_color">
<td style='background-color: white; font-size: small;'>
@if($episode_appointment->appointment_fulfilled == 1)
<span style="color: red">{{ __('patient_episode.follow_up') }}</span>
@else
<span style="color: red">{{ __('patient_episode.follow_up_complete') }}</span>
@endif
</td>
<td><b>{{ __('patient_episode.clinic') }}:</b> {{ get_name($episode_appointment->clinic_allocation, 'id', 'name', 'clinics') }}</td>
<td><b>{{ __('patient_episode.appointment_date') }}:</b> {{ is_null($episode_appointment->appointment_date) ? '' : streamline_date($episode_appointment->appointment_date) }}</td>
<td><b>{{ __('patient_episode.in_charge') }}:</b> {{ get_full_name($episode_appointment->incharge_id, 'id', 'first_name', 'last_name', 'users') != "ALL STAFF" ? get_full_name($episode_appointment->incharge_id, 'id', 'first_name', 'last_name', 'users') : "N/A" }}</td>
<td class="hidden-phone">
@php
$consultation_done_by = !empty($anc->created_by)? $anc->created_by : get_doctor_who_has_done_episode_consultation($patient_episode->patient_id, $patient_episode->id);
@endphp
@if(!is_null($consultation_done_by))
{{ get_full_name($consultation_done_by, "id", "first_name", "last_name", "users") }}
@endif
</td>
<td>{{ $episode_appointment->comments }}</td>
<td>
<input type="radio" onchange="show('menu1'), hide('theatre_menu'), hide('menu2'), hide('pic1'), hide('menu_maternity')" class="radio-option center" name="episode_id" id="episode_id_{{ $patient_episode->id }}" value="{{ $patient_episode->id }}" />
</td>
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
</div>
<div class="" id="menu1" style="display: none;">
<div class="row">
<div class="col-sm-2">
@if(Auth::user()->can('perform-triage'))
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12" value="triage">{{ __('patient_episode.triage') }}</button>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('create-consultation'))
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12" value="consultation" id="consultation_button">{{ __('patient_episode.consultation') }}</button>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('create-prescription'))
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12" value="prescription">{{ __('patient_episode.prescriptions') }}</button>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('order-for-investigations'))
<div class="btn-group dropup m-r-10 col-sm-12">
<button aria-expanded="false" data-toggle="dropdown" class="btn btn-sm btn-success dropdown-toggle waves-effect waves-light btn-block" type="button">{{ __('patient_episode.investigations') }} <span class="caret"></span></button>
<ul role="menu" class="dropdown-menu">
<li><button type="submit" name="submit" class="btn btn-link w-100 h-100" value="investigations" >{{ __('patient_episode.investigations') }}</button></li>
<li class="divider"></li>
<li><a href="/investigations/view_historical_results_labs/{{ $patient->id }}" style="text-align:center; color:black" class="btn btn-default btn-sm btn-link">{{ __('patient_episode.historical_investigations') }}</a></li>
</ul>
</div>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('order-for-procedures'))
<button type="submit" name="submit" class="btn btn-success btn-sm btn-block" value="procedure">{{ __('patient_episode.procedures') }}</button>
@endif
</div>
<div class="col-sm-2">
<button class="btn btn-success btn-sm btn-block" type="submit" name="submit" value="patient_document">{{ __('patient_episode.add_document') }}</button>
</div>
</div>
<br>
<div class="row">
<div class="col-sm-2">
@if(Auth::user()->can('order-for-sundries'))
<button type="submit" name="submit" class="btn btn-success btn-sm btn-block" value="sundries">{{ __('patient_episode.sundries') }}</button>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('view-eye-clinic'))
<button type="submit" name="submit" class="btn btn-success btn-sm btn-block" value="eye_clinic">{{ __('patient_episode.eye_clinic') }}</button>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('view-episode-summary'))
<button type="button" class="btn btn-primary btn-sm btn-block" id="patient_file">{{ __('patient_episode.episode_summary') }}</button>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('transfer-patient-internally'))
<div class="btn-group dropup m-r-10 col-sm-12">
<button aria-expanded="false" data-toggle="dropdown" class="btn btn-primary dropdown-toggle btn-block" type="button">{{ __('patient_episode.internal_transfer') }} <span class="caret"></span></button>
<ul role="menu" class="dropdown-menu">
<li><button type="button" class="btn btn-primary btn-sm btn-block" id="internal_transfer">{{ __('patient_episode.clinic_transfer') }}</button></li>
<li><button type="button" class="btn btn-info btn-sm btn-block" id="doctor_transfer">{{ __('patient_episode.doctor_transfer') }}</button></li>
</ul>
</div>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('view-death-report'))
<button type="submit" name="submit" id="death_report_btn" value="death_report_btn" class="btn btn-sm btn-block btn-inverse" >NIRA {{ __('patient_episode.death_report') }}</button>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('create-theatre-surgery') || Auth::user()->can('create-theatre-anaesthesia'))
<div class="btn-group dropup m-r-10 col-sm-12">
<button aria-expanded="false" data-toggle="dropdown" class="btn btn-info dropdown-toggle waves-effect waves-light col-sm-12" type="button">{{ __('patient_episode.theatre') }} <span class="caret"></span></button>
<ul role="menu" class="dropdown-menu">
<li><button type="submit" name="submit" value="create_anaesthetics" class="btn btn-default btn-sm btn-link">{{ __('patient_episode.theatre_anaesthetics') }}</button></li>
<li><button type="submit" name="submit" value="anaesthetics_history" class="btn btn-default btn-sm btn-link">{{ __('patient_episode.historical_anaesthetics') }}</button></li>
<li><button type="submit" name="submit" value="create_surgery" class="btn btn-default btn-sm btn-link">{{ __('patient_episode.theatre_surgery') }}</button></li>
<li><button type="submit" name="submit" value="surgery_index" class="btn btn-default btn-sm btn-link">{{ __('patient_episode.historical_surgeries') }}</button></li>
</ul>
</div>
@endif
</div>
</div>
<br>
<div class="row">
<div class="col-sm-2">
@if(Auth::user()->can('perform-triage-without-etat'))
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12" value="triage_without_etat">{{ __('patient_episode.triage_without') }} ETAT</button>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('create-consultation-with-notes'))
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12" value="consultation_with_notes">{{ __('patient_episode.consultation_with_notes') }}</button>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('drug-refill'))
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12" value="drug_refill">{{ __('patient_episode.drug_refill') }}</button>
@endif
</div>
@if(Auth::user()->can('drug-refill') && is_patient_category_pay_later($patient->category_id))
<div class="col-sm-2">
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12" value="edit_claim_number">{{ __('patient_episode.edit_claim_number') }}</button>
</div>
@endif
<div class="col-sm-2">
@if(Auth::user()->can('order-for-services-from-patient-home'))
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12" value="services">{{ __('patient_episode.services') }}</button>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('record-staff-service-performance'))
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12" value="record_all_items">{{ __('patient_episode.order_multiple_items') }}</button>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('admit-patient-from-patient-home'))
<button type="button" name="admit_patient" class="btn btn-success btn-sm col-sm-12" id="admit_patient">{{ __('patient_episode.admit_patient') }}</button>
@endif
</div>
</div>
</div>
<!-- maternity menu at the shown at the bottom -->
<div class="white-box" id="menu_maternity" style="display: none;">
<div class="row">
@if(Auth::user()->can('view-maternity-admission'))
<div class="col-sm-2">
<button name="submit" value="maternity_admission" class="btn btn-success btn-sm btn-block">{{ __('patient_episode.maternity_admission') }}</button>
</div>
@endif
@if(Auth::user()->can('view-delivery-record'))
<div class="col-sm-2">
<button name="submit" value="delivery_record" class="btn btn-success btn-sm btn-block" >{{ __('patient_episode.delivery_record') }}</button>
</div>
@endif
@if(Auth::user()->can('view-inpatient-sheet'))
<div class="col-sm-2">
<button name="submit" value="maternity_summary" class="btn btn-success btn-sm btn-block" >{{ __('patient_episode.inpatient_sheet') }}</button>
</div>
@endif
@if(Auth::user()->can('view-birth-report'))
<div class="col-sm-2">
<button name="submit" value="birth_report" class="btn btn-sm btn-inverse btn-block" >NIRA {{ __('patient_episode.birth_report') }}</button>
</div>
@endif
<div class="col-sm-2"></div>
<div class="col-sm-2">
<div class="btn-group dropup m-r-10 col-sm-12">
<button aria-expanded="false" data-toggle="dropdown" class="btn btn-sm btn-info dropdown-toggle waves-effect waves-light btn-block" type="button">{{ __('patient_episode.theatre') }} <span class="caret"></span></button>
<ul role="menu" class="dropdown-menu">
@if(Auth::user()->can('create-anaesthetics'))
<li><button type="submit" name="submit" value="create_anaesthetics" class="btn btn-default btn-sm btn-link">{{ __('patient_episode.theatre_anaesthetics') }}</button></li>
@endif
@if(Auth::user()->can('view-anaesthetics-history'))
<li><button type="submit" name="submit" value="anaesthetics_history" class="btn btn-default btn-sm btn-link">{{ __('patient_episode.historical_anaesthetics') }}</button></li>
@endif
@if(Auth::user()->can('create-surgery'))
<li><button type="submit" name="submit" value="create_surgery" class="btn btn-default btn-sm btn-link">{{ __('patient_episode.theatre_surgery') }}</button></li>
@endif
@if(Auth::user()->can('view-surgery'))
<li><button type="submit" name="submit" value="surgery_index" class="btn btn-default btn-sm btn-link">{{ __('patient_episode.historical_surgeries') }}</button></li>
@endif
</ul>
</div>
</div>
</div>
</div>
<div id="menu2" style="display: none;">
<div class="row">
@if(Auth::user()->can('view-inpatient-sheet'))
<div class="col-sm-2">
<button type="submit" name="submit" class="btn btn-success btn-block btn-sm" value="inpatient-sheet-button">{{ __('patient_episode.inpatient_sheet') }}</button>
</div>
@endif
@if(Auth::user()->can('view-inpatient-billing'))
<div class="col-sm-2">
<button type="submit" name="submit" class="btn btn-success btn-block btn-sm" value="inpatient_billing">{{ __('patient_episode.inpatient_billing') }}</button>
</div>
@endif
@if(Auth::user()->can('issue-inpatient-attendant-pass'))
<div class="col-sm-2">
<button type="submit" name="submit" class="btn btn-default btn-block btn-sm" value="inpatient_attendant_pass">{{ __('patient_episode.inpatient_attendant_pass') }}</button>
</div>
@endif
@if(Auth::user()->can('view-patient-file'))
<div class="col-sm-2">
<button type="submit" name="submit" class="btn btn-primary btn-block btn-sm" value="patient_file">{{ __('patient_episode.episode_summary') }}</button>
</div>
@endif
<div class="col-sm-2"></div>
<div class="col-sm-2">
<div class="btn-group dropup m-r-10 col-sm-12">
<button aria-expanded="false" data-toggle="dropdown" class="btn btn-info dropdown-toggle waves-effect waves-light btn-sm btn-block " type="button">{{ __('patient_episode.theatre') }} <span class="caret"></span></button>
<ul role="menu" class="dropdown-menu">
<li><button type="submit" name="submit" value="create_anaesthetics" class="btn btn-default btn-sm btn-link">{{ __('patient_episode.theatre_anaesthetics') }}</button></li>
<li><button type="submit" name="submit" value="anaesthetics_history" class="btn btn-default btn-sm btn-link">{{ __('patient_episode.historical_anaesthetics') }}</button></li>
<li><button type="submit" name="submit" value="create_surgery" class="btn btn-default btn-sm btn-link">{{ __('patient_episode.theatre_surgery') }}</button></li>
<li><button type="submit" name="submit" value="surgery_index" class="btn btn-default btn-sm btn-link">{{ __('patient_episode.historical_surgeries') }}</button></li>
</ul>
</div>
</div>
</div>
</div>
<div id="theatre_menu" style="display: none;">
<div class="row">
@if(Auth::user()->can('create-anaesthetics'))
<div class="col-md-3">
<button type="submit" name="submit" class="btn btn-success btn-block" value="create_anaesthetics">{{ __('patient_episode.theatre_anaesthetics') }}</button>
</div>
@endif
@if(Auth::user()->can('view-anaesthetics-history'))
<div class="col-md-3">
<button type="submit" name="submit" class="btn btn-success btn-block" value="anaesthetics_history">{{ __('patient_episode.historical_anaesthetics') }}</button>
</div>
@endif
@if(Auth::user()->can('create-surgery'))
<div class="col-md-3">
<button type="submit" name="submit" class="btn btn-success btn-block" value="create_surgery">{{ __('patient_episode.theatre_surgery') }}</button>
</div>
@endif
@if(Auth::user()->can('view-surgery'))
<div class="col-md-3">
<button type="submit" name="submit" class="btn btn-success btn-block" value="surgery_index">{{ __('patient_episode.historical_surgeries') }}</button>
</div>
@endif
</div>
</div>
</div>
</div>
<div class="white-box" id="pic1" style="display: none;">
<div class="row">
<div class="col-sm-8"></div>
<div class="col-sm-4">
<img src="KH_photos/Picture3.jpg" style="max-height: 250px; margin: auto;" class="image-preview" alt="child" />
</div>
</div>
</div>
{{ Form::close() }}
<div class="modal hide fade" id="modal-age">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>{{ __('patient_episode.select_a_patient') }}</h3>
</div>
<div class="modal-body">
<p>
{{ __('patient_episode.select_patient_warning') }}
</p>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-danger" data-dismiss="modal">{{ __('patient_episode.close') }}</a>
</div>
</div>
<div class="modal fade" id="internal_transfer_dialog" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">{{ __('patient_episode.internal_transfer') }}</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<div class="form-group">
{{ Form::label('current_clinic', __('patient_episode.current_clinic')) }}
{{ Form::hidden('current_clinic_id', 0, ['id' => 'current_clinic_id']) }}
{{ Form::hidden('current_triage_id', 0, ['id' => 'current_triage_id']) }}
{{ Form::hidden('current_episode_id', 0, ['id' => 'current_episode_id']) }}
{{ Form::text('current_clinic', '', ['class' => 'form-control compulsory', 'readonly', 'id' => 'current_clinic_transfer']) }}
</div>
<div class="form-group">
{{ Form::label('transfered_from_doctor', __('patient_episode.transfer_from_doctor')) }}
{{ Form::select('transfered_from_doctor', $users_array, '', ['class' => 'form-control transferedToDoctor', 'id' => 'transfer_from_doctor']) }}
</div>
<div class="form-group">
{{ Form::label('transfer_to', __('patient_episode.transfer_to')) }}
{{ Form::select('transfer_to', $clinics, null, ['class' => 'form-control compulsory', 'required', 'id' => 'transfer_to']) }}
</div>
<div class="form-group">
{{ Form::label('transfered_to_doctor', __('patient_episode.transfer_to_doctor')) }}
{{ Form::select('transfered_to_doctor', $users_array, '', ['class' => 'form-control transferedToDoctor', 'id' => 'transfer_to_doctor']) }}
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('patient_episode.close') }}</button>
<button type="button" class="btn btn-success" id="submit_clinic_transfer" >{{ __('patient_episode.transfer_patient') }}</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="doctor_transfer_dialog" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">{{ __('patient_episode.transfer_doctor') }}</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<div class="form-group">
{{ Form::hidden('dt_episode_id', 0, ['id' => 'dt_episode_id']) }}
{{ Form::label('transfered_from_doctor', __('patient_episode.transfer_from_doctor')) }}
{{ Form::text('dt_from_doctor', '', ['class' => 'form-control', 'readonly', 'id' => 'dt_doctor_from']) }}
</div>
<div class="form-group">
{{ Form::label('transfered_to_doctor', __('patient_episode.transfer_to_doctor')) }}
@php $users_array = ['remove_from_doctor' => 'Remove from assigned doctor'] + $users_array; @endphp
{{ Form::select('dt_doctor_to', $users_array, '', ['class' => 'form-control transferedDtToDoctor', 'id' => 'dt_doctor_to']) }}
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('patient_episode.close') }}</button>
<button type="button" class="btn btn-success" id="submit_doctor_transfer" >{{ __('patient_episode.transfer_patient') }}</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="ward_admission_episode" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">{{ __('layout.ward_admission') }}</h4>
</div>
<div class="modal-body">
{{ Form::open(['route' => 'patient_episodes.admit_patient_with_episode']) }}
{{ Form::hidden('patient_id', $patient->id, ['id' => 'patient_id']) }}
{{ Form::hidden('episode_admission_episode_id', 0, ['id' => 'episode_admission_episode_id']) }}
{{ Form::label('admission_ward_id', __('layout.select_ward')) }}
{{ Form::select('admission_ward_id', $wards, '', ['class' => 'form-control', 'required' => 'true']) }}
<br>
{{ Form::label('ward_admission_date', __('layout.admission_date')) }}
<input type="date" class="form-control" name="ward_admission_date" id="ward_admission_date" value="{{ date('Y-m-d') }}" required="true">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success btn-sm" onclick="return confirm('<?php echo __('layout.are_you_sure_admit'); ?>');">{{ __('layout.continue_ward_admission') }}</button>
{{ Form::close() }}
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">{{ __('layout.close') }}</button>
</div>
</div>
</div>
</div>
@if(session()->has('consultation_not_paid'))
<div class="modal fade" id="unpaid_consultation_warning" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<h4 style="color: red">{{ __('patient_episode.patient_not_paid_consultation') }}</h4>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('patient_episode.okay') }}</button>
</div>
</div>
</div>
</div>
@php session()->forget('consultation_not_paid'); @endphp
@endif
@endsection
@push('scripts')
<script src="{{ asset('js/streamline_plugins/jquery.session.js') }}"></script>
<script type="text/javascript">
$("#admit_patient").click(function () {
$.ajax({
url: '/inpatient/check_for_open_admissions/' + $('#patient_id').val(),
type: 'get',
success: function (response) {
if (response > 0) {
$("#modal_patient_already_admitted").modal("show");
} else {
let current_episode_id = $('input[name=episode_id]:checked').val();
$("#episode_admission_episode_id").val(current_episode_id);
$("#ward_admission_episode").modal("show");
}
},
error: function (response) {
}
});
});
$("#patient_file").click(function () {
let current_episode_id = $('input[name=episode_id]:checked').val();
let win = window.open('/patients/episode_summary/' + current_episode_id, '_blank');
if (win) {
win.focus();
} else {
alert("Please allow pop-ups for this system")
}
});
$("#internal_transfer").click(function () {
let current_episode_id = $('input[name=episode_id]:checked').val();
$.ajax({
type: "GET",
url: "/patient_episodes/internal_clinic_transfer/" + current_episode_id,
success: function (result) {
if (result != 0) {
let arr = result.split(',');
$('#current_clinic_transfer').val(arr[2]);
$('#current_clinic_id').val(arr[1]);
$('#current_triage_id').val(arr[0]);
$('#current_episode_id').val(current_episode_id);
$('#internal_transfer_dialog').modal('show');
} else {
alert("<?php echo __('patient_episode.triage_not_performed') ?>");
}
}
});
});
$("#submit_clinic_transfer").click(function () {
let transfer_clinic = $("#transfer_to").val();
let clinic = $("#current_clinic_id").val();
let triage_id = $("#current_triage_id").val();
let episode_id = $("#current_episode_id").val();
let patient_id = $('#patient_id').val();
let transfer_to_doctor = $('#transfer_to_doctor').val();
let transfer_from_doctor = $('#transfer_from_doctor').val();
if (transfer_clinic == 0) {
alert("<?php echo __('patient_episode.select_new_clinic') ?>");
} else {
$.ajax({
type: "POST",
url: "/patient_episodes/save_internal_clinic_transfer",
data: {new_clinic: transfer_clinic, old_clinic: clinic, triage_id: triage_id, episode_id: episode_id, patient_id: patient_id, transfer_from_doctor: transfer_from_doctor, transfer_to_doctor: transfer_to_doctor},
cache: false,
success: function (result) {
if (result == 1) {
alert("<?php echo __('patient_episode.patient_transfer_successful') ?>");
location.reload();
} else {
alert("<?php echo __('patient_episode.patient_transfer_failed') ?>");
}
}
});
}
});
$("#doctor_transfer").click(function (e) {
e.preventDefault();
let episode_id = $('input[name=episode_id]:checked').val();
$.ajax({
type: "GET",
url: "/patient_episodes/get_assigned_doctor/" + episode_id,
success: function (result) {
console.log(result);
if (result != 0) {
$("#dt_doctor_from").val(result);
$("#doctor_transfer_dialog").modal('show');
} else {
//alert("No assigned doctor");
$("#doctor_transfer_dialog").modal('show');
}
}
});
});
$("#submit_doctor_transfer").click(function () {
let episode_id = $('input[name=episode_id]:checked').val();
let dt_doctor_to = $('#dt_doctor_to').val();
console.log('episode_id = ' + episode_id);
console.log('doctor_id = ' + dt_doctor_to);
$.ajax({
type: "POST",
url: "/patient_episodes/save_doctor_transfer",
data: {episode_id: episode_id, dt_doctor_to: dt_doctor_to},
cache: false,
success: function (result) {
if (result == 1) {
alert("<?php echo __('patient_episode.patient_transfer_successful') ?>");
location.reload();
} else {
alert("<?php echo __('patient_episode.patient_transfer_failed') ?>");
}
}
});
});
function show(id) {
if (document.getElementById(id).style.display === 'none') {
document.getElementById(id).style.display = '';
}
}
function hide(id) {
document.getElementById(id).style.display = 'none';
}
$(document).ready(function () {
$(".to_hide").each(function () {
$(this).hide();
});
$("#edit").click(function () {
$(this).hide();
$("#submit_edit").show();
$(".to_show").each(function () {
$(this).hide();
});
$(".to_hide").each(function () {
$(this).show();
});
});
$("#close_modal").click(function () {
$("#submit_edit").hide();
$(".to_show").each(function () {
$(this).show();
});
$(".to_hide").each(function () {
$(this).hide();
});
$("#edit").show();
});
$('.transferedToDoctor').select2({
placeholder: "Select",
width: "100%",
dropdownParent: $('#internal_transfer_dialog')
});
$('.transferedDtToDoctor').select2({
placeholder: "Select",
width: "100%",
dropdownParent: $('#doctor_transfer_dialog')
});
$("#unpaid_consultation_warning").modal("show");
});
/*$("#consultation_button").click(function(e){
let episode_to_check_for_payment = $('input[name=episode_id]:checked').val();
let unpaid = false;
e.preventDefault();
$.ajax({
method: 'POST',
url: '/check_clinical_consultation_payment',
data: {'episode_id' : episode_to_check_for_payment},
success: function(response){
if (response == "paid") {
console.log("man of valor with armour");
$("#episodesForm").submit();
console.log("submit the form please");
} else {
console.log("regular man");
$("#unpaid_consultation_warning").modal("show");
}
},
error:function(error){
console.log(error);
}
});
});*/
</script>
@endpush
@push('styles')
<style type="text/css">
.btn-default.btn-sm.btn-link{
width: 100%;
}
</style>
@endpush
@@ -1,804 +0,0 @@
@push('styles')
<style>
.episode-menu li {
display: inline-block;
}
.highlight {
font-weight: bold;
}
.modal-dialog {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%) !important;
}
</style>
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
@endpush
<div class="row">
<div class="col-sm-9">
<div class="" style='height: 80px;background-color: #f7f7f9; padding-top: 10px; padding-left: 10px;'>
<ul class='episode-menu' style="padding-left: 0px;">
<div class="row">
<div class="col-sm-2">
<li>
<button type="button" class="btn btn-success btn-sm" data-toggle="modal" data-target="#demographicsModal">{{ __('layout.demographics') }}</button>
</li>
</div>
<div class="col-sm-3">
<div class="form-group">
<select class="form-control" name="new_episode_option" id="new_episode_options">
<option value="" selected disabled>{{ __('layout.create_new_episode') }}</option>
@if (Auth::user()->can('create-patient-episode'))
<option value="1">{{ __('layout.new_episode') }}</option>
@endif
@if (Auth::user()->can('create-patient-episode-with-clinic'))
<option value="2"> {{ __('layout.new_episode_with_clinic') }}</option>
@endif
@if (Auth::user()->can('create-patient-episode-with-doctor'))
<option value="3">{{ __('layout.new_episode_with_doctor') }}</option>
@endif
@if (Auth::user()->can('create-patient-episode-with-doctor-and-clinic'))
<option value="4"> {{ __('layout.new_episode_with_doctor_and_clinic') }}</option>
@endif
@if (Auth::user()->can('create-patient-episode-with-admission'))
<option value="5"> {{ __('layout.new_episode_with_admission') }}</option>
@endif
@if (Auth::user()->can('create-patient-episode-with-self-lab-request'))
<option value="6"> {{ __('layout.new_episode_with_inv_self_request') }}</option>
@endif
</select>
</div>
<div class="modal fade" id="newEpisodeModal" tabindex="-1" role="dialog" aria-labelledby="modalNewEpisodeModelLabel1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modalNewEpisodeModelLabel1">{{ __('patient_episode.new_episode_option') }}</h4>
</div>
<div class="modal-body">
{{ Form::open(['route' => 'patient_episodes.create_special_clinic_episode']) }}
{{ Form::hidden('patient_id', $patient->id) }}
{{ Form::label('new_episode_option', __('patient_episode.new_episode_option')) }}
{{ Form::select('new_episode_option', [], '', ['class' => 'form-control', 'required' => 'true'])}}
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success btn-sm" onclick="return confirm('<?php echo __('layout.are_you_sure_clinic'); ?>');">{{ __('layout.continue_clinic_allocation') }}</button>
{{ Form::close() }}
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">{{ __('layout.close') }}</button>
</div>
</div>
</div>
</div>
@if( Auth::user()->can('create-patient-episode'))
<li>
<!-- <button type="submit" class="btn btn-success btn-sm show-episode-modal" data-backdrop="static" data-keyboard="false" data-toggle="modal" data-target="#episodeModal">{{ __('layout.new_episode') }}</button> -->
</li>
@endif
@if( Auth::user()->can('create-patient-episode-with-clinic'))
<li>
<!-- <a class="btn btn-success btn-sm" data-toggle="modal" data-target="#newEpisodeAndClinicModal">{{ __('layout.new_episode_clinic') }}</a> -->
<div class="modal fade" id="newEpisodeAndClinicModal" tabindex="-1" role="dialog" aria-labelledby="modalSpecialLabel1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modalSpecialLabel1">{{ __('layout.clinic_allocation') }}</h4>
</div>
<div class="modal-body">
{{ Form::open(['route' => 'patient_episodes.create_special_clinic_episode']) }}
{{ Form::hidden('patient_id', $patient->id) }}
{{ Form::label('special_clinic_id', __('layout.select_clinic')) }}
{{ Form::select('special_clinic_id', $special_clinics, '', ['class' => 'form-control', 'required' => 'true'])}}
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success btn-sm" onclick="return confirm('<?php echo __('layout.are_you_sure_clinic'); ?>');">{{ __('layout.continue_clinic_allocation') }}</button>
{{ Form::close() }}
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">{{ __('layout.close') }}</button>
</div>
</div>
</div>
</div>
</li>
@endif
@if( Auth::user()->can('create-patient-episode-with-doctor-and-clinic'))
<li>
<!-- <a class="btn btn-success btn-sm" data-toggle="modal" data-target="#episodeWithDoctorAndClinicModal">{{ __('patient_episode.new_episode_with_doctor_and_clinic') }}</a> -->
<div class="modal fade" id="episodeWithDoctorAndClinicModal" tabindex="-1" role="dialog" aria-labelledby="episodeWithDoctorAndClinicLabel1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="episodeWithDoctorAndClinicLabel1">{{ __('patient_episode.doctor_and_clinic_allocation') }}</h4>
</div>
<div class="modal-body">
{{ Form::open(['route' => 'patient_episodes.create_episode_with_doctor_and_clinic']) }}
{{ Form::hidden('patient_id', $patient->id) }}
<div class="form-group">
{{ Form::label('special_clinic_id', __('layout.select_clinic')) }}
{{ Form::select('special_clinic_id', $special_clinics, '', ['class' => 'form-control', 'required' => 'true'])}}
</div>
<div class="form-group">
{{ Form::label('allocated_services_id_with_doctor_id', __('patient_episode.doctor_allocation')) }}
{{ Form::select('allocated_services_id_with_doctor_id', $users_array, '', ['class' => 'form-control doctorWithClinicDoctorDropDown', 'required' => 'true'])}}
</div>
@if(is_patient_category_pay_later($patient->category_id))
<div class="form-group">
{{ Form::label('claim_number', __('patient_episode.claim_number')) }}
{{ Form::text('claim_number', '', ['class' => 'form-control', 'required' => 'true', 'id'=>'claim_number'])}}
</div>
@endif
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success btn-sm" onclick="return confirm('<?php echo __('patient_episode.are_you_sure_doctor_and_clinic'); ?>');">{{ __('patient_episode.continue_allocation') }}</button>
{{ Form::close() }}
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">{{ __('layout.close') }}</button>
</div>
</div>
</div>
</div>
</li>
@endif
@if( Auth::user()->can('create-patient-episode-with-doctor'))
<li>
<!-- <a class="btn btn-success btn-sm" data-toggle="modal" data-target="#episodeWithDoctorModal">{{ __('patient_episode.new_episode_with_doctor') }}</a> -->
<div class="modal fade" id="episodeWithDoctorModal" tabindex="-1" role="dialog" aria-labelledby="episodeWithDoctorLabel1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="episodeWithDoctorLabel1">{{ __('patient_episode.doctor_allocation') }}</h4>
</div>
<div class="modal-body">
{{ Form::open(['route' => 'patient_episodes.create_episode_with_doctor']) }}
{{ Form::hidden('patient_id', $patient->id) }}
{{ Form::label('allocated_services_id_with_doctor_id', __('patient_episode.doctor_allocation')) }}
{{ Form::select('allocated_services_id_with_doctor_id', $users_array, '', ['class' => 'form-control doctorDropDown', 'required' => 'true'])}}
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success btn-sm" onclick="return confirm('<?php echo __('patient_episode.are_you_sure_doctor'); ?>');">{{ __('patient_episode.continue_doctor_allocation') }}</button>
{{ Form::close() }}
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">{{ __('layout.close') }}</button>
</div>
</div>
</div>
</div>
</li>
@endif
@if( Auth::user()->can('create-patient-episode-with-self-lab-request'))
<li>
<div class="modal fade" id="episodeWithSelfLabRequestModal" tabindex="-1" role="dialog" aria-labelledby="episodeWithSelfLabRequestLabel1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="episodeWithSelfLabRequestLabel1">{{ __('patient_episode.new_episode_with_self_lab_request') }}</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-9" style="margin-top: 5px;">{{ __('layout.are_you_sure_inv_self_request') }}</div>
<div class="col-sm-3">
{{ Form::open(['route' => 'patient_episodes.create_episode_with_lab_self_request']) }}
{{ Form::hidden('patient_id', $patient->id) }}
<button type="submit" class="btn btn-success btn-sm" name="createNewEpisode">{{ __('layout.yes') }}</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('layout.cancel') }}</button>
{{ Form::close() }}
</div>
</div>
</div>
</div>
</div>
</div>
</li>
@endif
</div>
<div class="col-sm-4">
<li>
<a class="btn btn-info btn-small" onclick="return popitup('https://primaryreporting.who-umc.org/Reporting/Reporter?OrganizationID=UG')">
{{ __('layout.sadr_report') }}
</a>
</li>
</div>
<div class="col-sm-3">
@if($patient->gender == 2)
<li>
@if( Auth::user()->can('create-maternity-admission'))
<a class="btn btn-default" id="maternityAdmissionBtn"><i class="fa fa-plus-square"></i> {{ __('layout.maternity_admission') }}</a>
@endif
@if(Module::has('Maternity') && Module::isEnabled('Maternity'))
<!-- materninty modal -->
<div class="modal fade" id="maternityModal" tabindex="-1" role="dialog" aria-labelledby="modalMaternityLabel1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modalMaternityLabel1">{{ __('layout.date_of_maternity_admission') }}</h4>
</div>
<div class="modal-body">
{{ Form::open(['route' => 'maternity.create_episode']) }}
{{ Form::hidden('patient_id', $patient->id) }}
<input type="date" class="form-control" name="maternity_date" id="maternity_date_field" value="{{ date('Y-m-d') }}">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success btn-sm" onclick="return confirm('<?php echo __('layout.are_you_sure_admit_maternity'); ?>');">{{ __('layout.continue_maternity_admission') }}</button>
{{ Form::close() }}
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">{{ __('layout.close') }}</button>
</div>
</div>
</div>
</div>
<!-- end maternity modal -->
@endif
</li>
@endif
<li>
@if( Auth::user()->can('create-ward-admission'))
<!-- <a class="btn btn-success btn-sm" data-toggle="modal" data-target="#wardAdmissionModal">{{ __('layout.ward_admission') }}</a> -->
@endif
<div class="modal fade" id="wardAdmissionModal" tabindex="-1" role="dialog" aria-labelledby="modalWardAdmissionLabel1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modalWardAdmissionLabel1">{{ __('layout.ward_admission') }}</h4>
</div>
<div class="modal-body">
{{ Form::open(['route' => 'patient_episodes.create_episode_with_ward']) }}
{{ Form::hidden('patient_id', $patient->id, ['id' => 'patient_id']) }}
{{ Form::label('admission_ward_id', __('layout.select_ward')) }}
{{ Form::select('admission_ward_id', $wards, '', ['class' => 'form-control', 'required' => 'true']) }}
<br>
{{ Form::label('ward_admission_date', __('layout.admission_date')) }}
<input type="date" class="form-control" name="ward_admission_date" id="ward_admission_date" value="{{ date('Y-m-d') }}" required="true">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success btn-sm" onclick="return confirm('<?php echo __('layout.are_you_sure_admit'); ?>');">{{ __('layout.continue_ward_admission') }}</button>
{{ Form::close() }}
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">{{ __('layout.close') }}</button>
</div>
</div>
</div>
</div>
</li>
</div>
</div>
</ul>
</div>
</div>
<div class="col-sm-3 pull-right">
<div class="white-box" style='height: 80px; padding-top: 5px;'>
<div class="row">
<a data-toggle="collapse" data-target="#collapseDiv" class="white-link">
<b>{{ __('layout.patient_documents') }} </b><small style="color: blue;">({{ $documents?count($documents):""}})</small>
<span class="fa fa-angle-down">
</span>
</a>
<a href="#" style="color: #003399" class="details pull-right">
</a>
</div>
<div id="collapseDiv" class="">
<div class="row">
<div class="col-sm-8">
@if(!is_null($documents))
<ul>
<!-- @foreach($documents as $document)
<li><a href="/patient_documents/{{$document->id}}" target="_blank">{{ $document->title }}</a></li>
@endforeach -->
<li><div class="label label-danger">{{ count($documents) }} {{ __('layout.documents_attached') }}</div></li>
<small><a href="#" onclick="go()" style="font: blue; cursor: pointer; font-weight: bold;"> {{ __('layout.view_all') }}</a></small>
<ul>
@endif
</div>
<div class="col-sm-4">
<!-- <a class="btn btn-warning btn-sm" href="">Add New</a> -->
</div>
</div>
</div>
</div>
</div>
<!-- patient appointments not attached to any episode -->
@php
$un_fullfilled_appointments = un_fullfilled_patient_appointments($patient->id);
@endphp
@if(count($un_fullfilled_appointments) > 0)
<div class="col-sm-12">
<div class="white-box" style="padding: 10px;">
<strong>{{ __('layout.patient_appointments') }}</strong>
<div class="table-responsive">
<table class="table color-bordered-table warning-bordered-table">
<thead>
<tr>
<th>{{ __('layout.appointment_date') }}</th>
<th>{{ __('layout.appointment_time') }}</th>
<th>{{ __('layout.episode_started_on') }}</th>
<th>{{ __('layout.clinic') }}</th>
<th>{{ __('layout.in_charge') }}</th>
<th>{{ __('layout.comments') }}</th>
<th style="width: 5%"></th>
</tr>
</thead>
<tbody>
@foreach($un_fullfilled_appointments as $appointment)
<tr>
<td>
{{ is_null($appointment->appointment_date) ? '' : streamline_date($appointment->appointment_date) }}
</td>
<td>
{{ $appointment->appointment_time }}
</td>
<td>
{{ $appointment->episode_id == 0 ? "" : streamline_date_time(get_name($appointment->episode_id, 'id', 'created_at', 'patient_episodes')) }}
</td>
<td>
{{ get_name($appointment->clinic_allocation, 'id', 'name', 'clinics') }}
</td>
<td>
{{ get_full_name($appointment->incharge_id, 'id', 'first_name', 'last_name', 'users') != "ALL STAFF" ? get_full_name($appointment->incharge_id, 'id', 'first_name', 'last_name', 'users') : "N/A" }}
</td>
<td>
{{ $appointment->comments }}
</td>
<td class="text-center">
<a class="btn btn-success btn-rounded btn-xs" onclick="displayAppointmentActions({{ $appointment->patient_id}},{{ $appointment->id}})">{{ __('layout.appointment_actions') }}</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endif
</div>
@php $dob = new Carbon\Carbon($patient->date_of_birth); @endphp
<div class="modal fade" id="demographicsModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="exampleModalLabel1">{{ __('layout.patient_details') }}</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-6">
<table class="table table-bordered">
<tbody>
<tr>
<th class="highlight">{{ __('layout.patient_number') }}</th>
<td>{{ $patient->number }}</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.patient_names') }}</th>
<td>{{ $patient->first_name }} {{ $patient->last_name }}</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.gender') }}</th>
<td>{{ $patient->gender == 1 ? __('layout.male') : __('layout.female') }}</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.date_of_birth') }}</th>
<td>{{ streamline_date($patient->date_of_birth) }}</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.age') }}</th>
<td>{{ $dob->diffInYears(Carbon\Carbon::now()) }} {{ __('layout.years') }}</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.residence') }}</th>
<td>
{{ patient_residence($patient->id) }}
</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.marital_status') }}</th>
<td>
{{ isset($marital_statuses[$patient->marital_status]) ? $marital_statuses[$patient->marital_status] : "N/A" }}
</td>
</tr>
<tr>
<th class="highlight">National ID</th>
<td>
{{ strtoupper($patient->national_id) }}
</td>
</tr>
@if (mother_of_patient($patient->id))
@php
$mother_id = mother_of_patient($patient->id);
@endphp
<tr>
<th class="highlight"><font color="black">{{ __('patients.mother_name') }}:</font></th>
<td>
<a href="/patients/{{ $mother_id }}">
{{ get_full_name($mother_id, "id", "first_name", "last_name", "patients") }} ({{ get_name($mother_id, "id", "number", "patients") }})
</a>
</td>
</tr>
@endif
@if (children_of_patient($patient->id))
@php
$children_ids_array = children_of_patient($patient->id);
@endphp
<tr>
<th class="highlight"><font color="black">{{ __('patients.children') }}:</font></th>
<td>
<ol>
@for ($i = 0; $i < count($children_ids_array); $i++)
<li>
<a href="/patients/{{ $children_ids_array[$i] }}">
{{ get_full_name($children_ids_array[$i], "id", "first_name", "last_name", "patients") }} ({{ get_name($children_ids_array[$i], "id", "number", "patients") }})
</a>
</li>
@endfor
</ol>
</td>
</tr>
@endif
</tbody>
</table>
</div>
<div class="col-sm-6">
<table class="table table-bordered">
<tbody>
<tr>
<th class="highlight">{{ __('layout.next_of_kin') }}</th>
<td>{{ $patient->next_of_kin }}</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.relationship') }}</th>
<td>
{{ isset($relationships[$patient->next_of_kin_relationship]) ? $relationships[$patient->next_of_kin_relationship] : "N/A" }}
</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.mobile_number') }}</th>
<td>{{ $patient->phone }}</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.phone_name') }}</th>
<td>{{ $patient->phone_owner }}</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.insurance_status') }}</th>
<td>
@if($patient->insurance_status == 1)
{{ __('layout.insured') }}
@else
{{ __('layout.not_insured') }}
@endif
</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.occupation') }}</th>
<td>
{{ isset($occupations[$patient->occupation_id]) ? $occupations[$patient->occupation_id] : "N/A" }}
</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.patient_category') }}</th>
<td>
{{ isset($patient_categories[$patient->category_id]) ? $patient_categories[$patient->category_id] : "N/A" }}
</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.registered_by') }}</th>
<td>{{ get_full_name($patient->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
</tr>
<tr>
<th class="highlight">{{ __('layout.registered_on') }}</th>
<td>
{{ streamline_date($patient->created_at) }}
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('layout.close') }}</button>
<button type="button" class="btn btn-primary" id="edit_patient" onclick="window.location.href='/patients/{{ $patient->id }}/edit'">{{ __('layout.edit_patient') }}</button>
</div>
</div>
</div>
</div>
<!-- modal that pops up when a new episode is clicked -->
@if( Auth::user()->can('create-patient-episode'))
<div class="modal fade" id="episodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="row">
<div class="col-sm-9" style="margin-top: 5px;">{{ __('layout.begin_episode_for_patient') }}</div>
<div class="col-sm-3">
{{ Form::open(['route' => 'patient_episodes.create_episode', 'onsubmit' => 'createNewEpisode.disabled = true; return true;']) }}
{{ Form::hidden('patient_id', $patient->id) }}
<button type="submit" class="btn btn-success btn-sm" name="createNewEpisode">{{ __('layout.yes') }}</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('layout.cancel') }}</button>
{{ Form::close() }}
</div>
</div>
</div>
</div>
</div>
</div>
@endif
<!-- modal that pops up when its an action on an appointment -->
<div class="modal" id="modal_select_actions" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">{{ __('layout.select_actions') }}</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-3">
<button class="btn btn-success btn-rounded" data-toggle="modal" id="startAppWithClinicBtn">{{ __('layout.start_appointment_with_clinic') }}</button>
</div>
<div class="col-md-3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="btn btn-success btn-rounded" onclick="displayActivationModel()">{{ __('layout.start_appointment') }}</a>
</div>
<div class="col-md-3">
<a class="btn btn-warning btn-rounded" onclick="reschedule_appointment()">{{ __('layout.reschedule_appointment') }}</a>
</div>
<div class="col-md-3">
<a class="btn btn-danger btn-rounded" onclick="cancel_appointment()">{{ __('layout.cancel_appointment') }}</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal" id="modal_patient_already_admitted" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">{{ __('layout.patient_alert') }}</h4>
</div>
<div class="modal-body">
<h5>{{ __('layout.pat_still_admitted_discharge') }}</h5>
<div class="row">
<div class="col-md-6">
<a class="btn btn-info btn-rounded" data-dismiss="modal">{{ __('layout.cancel') }}</a>
</div>
<div class="col-md-6">
<a class="btn btn-info btn-rounded pull-right" id="discharge_patient_button">{{ __('layout.discharge_pat_continue') }}</a>&nbsp;&nbsp;&nbsp;
</div>
</div>
</div>
</div>
</div>
</div>
<!-- start an appointment with a clinic and a doctor option -->
<div class="modal fade" id="startAppointmentWithClinicModal" tabindex="-1" role="dialog" aria-labelledby="appointmentWithDoctorAndClinicLabel1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="appointmentWithDoctorAndClinicLabel1">{{ __('patient_episode.doctor_and_clinic_allocation') }}</h4>
</div>
<div class="modal-body">
{{ Form::open(['route' => 'patient_episodes.start_appointment_with_doctor_and_clinic']) }}
{{ Form::hidden('patient_id', $patient->id) }}
{{ Form::hidden('selected_appointment_id', 0, ['id' => 'selected_appointment_id']) }}
<div class="form-group">
{{ Form::label('special_clinic_id', __('layout.select_clinic')) }}
{{ Form::select('special_clinic_id', $special_clinics, '', ['class' => 'form-control', 'required' => 'true'])}}
</div>
<div class="form-group">
{{ Form::label('allocated_services_id_with_doctor_id', __('patient_episode.doctor_allocation')) }}
{{ Form::select('allocated_services_id_with_doctor_id', $users_array, '', ['class' => 'form-control appWithClinicDoctorDropDown'])}}
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success btn-sm" onclick="return confirm('<?php echo __('patient_episode.are_you_sure_doctor_and_clinic'); ?>');">{{ __('patient_episode.continue_allocation') }}</button>
{{ Form::close() }}
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">{{ __('layout.close') }}</button>
</div>
</div>
</div>
</div>
@push('scripts')
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script type="text/javascript">
$("#new_episode_options").change(function(){
var clicked_episode_option = $(this).val();
if (clicked_episode_option == 1) {
$("#episodeModal").modal("show");
} else if(clicked_episode_option == 2){
$("#newEpisodeAndClinicModal").modal("show");
} else if(clicked_episode_option == 3){
$("#episodeWithDoctorModal").modal("show");
} else if(clicked_episode_option == 4){
$("#episodeWithDoctorAndClinicModal").modal("show");
} else if(clicked_episode_option == 5){
$.ajax({
url: '/inpatient/check_for_open_admissions/' + $('#patient_id').val(),
type: 'get',
success: function (response) {
if (response > 0) {
$("#modal_patient_already_admitted").modal("show");
} else {
$("#wardAdmissionModal").modal("show");
}
},
error: function (response) {
}
});
} else if(clicked_episode_option == 6){
$("#episodeWithSelfLabRequestModal").modal("show");
}
});
$("#discharge_patient_button").click(function (){
$.ajax({
url: '/inpatient/discharge_patient_past_admissions/' + $('#patient_id').val(),
type: 'get',
success: function (response) {
$("#modal_patient_already_admitted").modal("hide");
$("#wardAdmissionModal").modal("show");
},
error: function (response) {
}
});
});
$("#maternityAdmissionBtn").click(function (e){
e.preventDefault();
$.ajax({
url: '/inpatient/check_for_open_admissions/' + $('#patient_id').val(),
type: 'get',
success: function (response) {
if (response > 0) {
$("#modal_patient_already_admitted").modal("show");
} else {
$("#maternityModal").modal("show");
}
},
error: function (response) {
}
});
});
$('.doctorDropDown').select2({
placeholder: "Select",
width: "100%",
dropdownParent: $('#episodeWithDoctorModal')
});
$('.doctorWithClinicDoctorDropDown').select2({
placeholder: "Select",
width: "100%",
dropdownParent: $('#episodeWithDoctorAndClinicModal')
});
$('#startAppWithClinicBtn').click(function(e) {
$('#modal_select_actions').modal('hide');
$('#selected_appointment_id').val(appointmentId);
$('#startAppointmentWithClinicModal').modal('show');
});
$('.appWithClinicDoctorDropDown').select2({
placeholder: "Select",
width: "100%",
dropdownParent: $('#startAppointmentWithClinicModal')
});
function popitup(url) {
newwindow = window.open(url, 'name', 'height=700,width=850, top=50, left=300');
if (window.focus) {
newwindow.focus();
}
return false;
}
function go(url) {
event.preventDefault();
let options = document.getElementsByName('episode_id');
let episodeId = 0;
if (options) {
for (let i = 0; i < options.length; i++) {
if (options[i].checked){
episodeId = options[i].value;
}
}
}
$.ajax({
url: 'set_episode_id/'+episodeId+'/patient_documents',
type: 'get',
success: function(response){
window.location.href = '/patient_documents';
},
error: function(response){
}
});
}
/* stuff for patient appointments */
let selectedPatientId = 0;
let appointmentId = 0;
function reschedule_appointment() {
if (confirm("<?php echo __('layout.reschedule_appointment_question') ?>")) {
window.location.href = "/patients/reschedule_appointment/" + appointmentId;
}
}
function cancel_appointment() {
if (confirm("<?php echo __('layout.cancel_appointment_cancel') ?>")){
$.ajax({
method: 'GET',
url: '/patients/cancel_patient_appointment/' + appointmentId,
success: function(response){
if(response == 1) {
alert("<?php echo __('layout.appointment_cancelled') ?>");
$("#modal_select_actions").modal("hide");
fetch_patients();
} else {
alert("<?php echo __('layout.cancel_appointment_failed') ?>");
}
}
});
}
}
function displayAppointmentActions(patientId, appointment_id) {
selectedPatientId = patientId;
appointmentId = appointment_id;
$("#modal_select_actions").modal("show");
}
function displayActivationModel(){
window.location.href = "/patients/complete_appointment/" + appointmentId;
}
</script>
@endpush
@push('scripts')
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script type="text/javascript">
$('#new_episode_options').select2();
</script>
@endpush
@@ -1,277 +0,0 @@
@extends('layouts.main')
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patient_episode.merge_episodes') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patients.dashboard') }}</a></li>
<li><a href="{{ route('patients.index') }}">{{ __('patients.patients') }}</a></li>
<li class="active">{{ __('patient_episode.merge_episodes') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<div class="row">
<div class="col-sm-12">
<h2><strong style="color: red">{{ __('patient_episode.episode_records') }}</strong><small> ({{ __('patient_episode.select_records_merge') }}) &nbsp;&nbsp;</small><a class="btn btn-info merge-record" onclick="mergeRecord()" style="display: none;" id="mergeBtn">{{ __('patient_episode.merge_episodes') }}</a></h2>
</div>
</div>
<hr style="background-color: black;">
@foreach($episodes as $episode)
<div class="row">
<div class="col-sm-4">
<table class="table-bordered table-condensed table-striped col-sm-12">
<tbody>
<tr>
<th><font color="black">{{ __('patient_episode.episode_date') }}</font></th>
<td>
<input type="checkbox" name="checked_episode_id[]" value="{{ $episode->id}}" class="checkbox_control">
<a href="#" style="color: #0099CC">{{ streamline_date_time($episode->created_at) }}
</a>
<br>
<small>{{ __('patient_episode.started_by') }}: <font style="color: blue">{{ get_full_name($episode->created_by, "id", "first_name", "last_name", "users") }}</font></small>
@if(check_if_episode_is_a_followup($episode->id))
@php
$parent_episode = \Streamline\Models\PatientEpisode::find($episode->parent_episode_id);
@endphp
<small style="color: green"><br>({{ __('patient_episode.review_from') }}: {{ streamline_date($parent_episode->created_at) }})</small>
@endif
</td>
</tr>
<tr>
<th><font color="black">{{ __('patient_episode.clinic') }}</font></th>
<td>
@if( Auth::user()->can('view-patient-episode-clinic-from-patient-home'))
{{ get_name($episode->clinic_id, "id", "name", "clinics") }}
@endif
</td>
</tr>
</tbody>
</table>
</div>
<div class="col-sm-4">
<table class="table-bordered table-condensed table-striped col-sm-12">
<tbody>
<tr>
<th><font color="black">{{ __('patient_episode.primary_diagnosis') }}</font></th>
<td>
@if( Auth::user()->can('view-patient-episode-primary-diagnoses'))
{{ get_name(get_name($episode->consultation_id, "id", "primary_diagnosis", "consultations"), "id", "name", "diagnoses") }}
@endif
</td>
</tr>
<tr>
@php
$other_diagnoses_ids = '';
$other_diagnoses = '';
$triage_and_consultation_comments = '';
$triage_comment = get_name($episode->triage_id, "id", "comments", "triage");
if(!is_null($episode->consultation_id)){
$other_diagnoses_ids = trim(get_name($episode->consultation_id, 'id', 'other_diagnoses', 'consultations'));
$consultation_comment = get_name($episode->consultation_id, "id", "comments", "consultations");
$triage_and_consultation_comments = '<b>Triage: </b>'.$triage_comment.' '.'<br><b>Consultation: </b>'.$consultation_comment;
}
$other_diagnoses_explode = ($other_diagnoses_ids != 'N/A' && $other_diagnoses_ids != '') ? unserialize($other_diagnoses_ids) : [];
for($s = 0; $s < count($other_diagnoses_explode); $s++){
$other_diagnoses .= isset($diagnoses[$other_diagnoses_explode[$s]]) ? $diagnoses[$other_diagnoses_explode[$s]] . ", " : '';
}
@endphp
<th><font color="black">{{ __('patient_episode.other_diagnoses') }}</font></th>
<td class="hidden-phone">
@if( Auth::user()->can('view-patient-episode-other-diagnoses'))
{!! read_more($other_diagnoses, 'other_diagnoses_short' . $episode->id, 'other_diagnoses_long' . $episode->id) !!}
<div id="other_diagnoses_long{{ $episode->id }}" style="display: none;">
{!! $other_diagnoses !!}<br/>
<a class="read_more" style="color : #0099CC;" onclick= "hide('other_diagnoses_long{{ $episode->id }}');show('other_diagnoses_short{{ $episode->id }}');">{{ __('episode.read_less') }}</a>
</div>
@endif
</td>
</tr>
</tbody>
</table>
</div>
<div class="col-sm-3">
<table class="table-bordered table-condensed table-striped col-sm-12">
<tbody>
<tr>
<th><font color="black">{{ __('patient_episode.consultation_done_by') }}</font></th>
<td class="hidden-phone">
@php
$consultation_done_by = get_doctor_who_has_done_episode_consultation($episode->patient_id, $episode->id);
@endphp
@if(!is_null($consultation_done_by))
{{ get_full_name($consultation_done_by, "id", "first_name", "last_name", "users") }}
@endif
@if($episode->episode_type == 1)
<span>{{ __('patient_flow_monitoring.lab_self_request') }}</span>
@endif
</td>
</tr>
<tr>
<th><font color="black">{{ __('patient_episode.comments') }}</font></th>
<td class="hidden-phone">
{!! read_more($triage_and_consultation_comments, 'short_comment' . $episode->id, 'long_comment' . $episode->id) !!}
<div id="long_comment{{ $episode->id }}" style="display: none;">
{!! $triage_and_consultation_comments !!}<br/>
<a class="read_more" style="color : #0099CC;" onclick= "hide('long_comment{{ $episode->id }}');show('short_comment{{ $episode->id }}');">{{ __('patient_episode.read_less') }}</a>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="col-sm-1">
</div>
</div>
<hr style="background-color: black;">
@endforeach
<div class="row">
<a class="btn btn-info merge-record" onclick="mergeRecord()" style="display: none;" id="mergeBtnOther">{{ __('patient_episode.merge_episodes') }}</a>
</div>
</div>
</div>
</div>
<!-- merge dialog box to allow user select master field value -->
<div class="modal fade" id="selectMasterDialog" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document" style="margin-top: 15%;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="wardDispensationModalLabel1">{{ __('patient_episode.select_information_to_keep') }} </h4>
</div>
<div class="modal-body">
{{ Form::open(['route' => 'patient_episodes.complete_merge']) }}
<div class="row" id="mergingModalDiv">
<div class="col-sm-8" style="padding-right: 1px;">
<div class="table-responsive" id="modal_table_one"></div>
</div>
<div class="col-sm-4" style="padding-left: 1px;">
<div class="table-responsive" id="modal_table_two"></div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success" id="completeMerge">{{ __('patient_episode.complete') }}</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('layout.close') }}</button>
{{ Form::close() }}
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script type="text/javascript">
function mergeRecord() {
//console.log();
var selectedEpisodesArray = [];
$('input[name="checked_episode_id[]"]:checked').each(function () {
var checkedEp = $(this).val();
console.log("episodes ids ===" + checkedEp);
selectedEpisodesArray.push(checkedEp);
});
var episodeOne = selectedEpisodesArray[0];
var episodeTwo = selectedEpisodesArray[1];
$.ajax({
method: 'POST',
url: '/display_original_and_duplicate_episodes',
data: {'episode_id_one': episodeOne, 'episode_id_two': episodeTwo},
success: function(response){
let responseArray = JSON.parse(response);
$("#modal_table_one").html(responseArray["html_one"]);
$("#modal_table_two").html(responseArray["html_two"]);
$("#selectMasterDialog").modal("show");
}
});
}
function show(id) {
if (document.getElementById(id).style.display === 'none') {
document.getElementById(id).style.display = '';
}
}
function hide(id) {
document.getElementById(id).style.display = 'none';
}
$('input[name="checked_episode_id[]"]').click(function () {
//var pass = parseInt($('input[name="checked_episode_id"]:checked').val(), 10) //1,2,3
var checkedEpisodes = $('input[name="checked_episode_id[]"]:checked').length;
console.log("checked episodes ===" + checkedEpisodes);
if (checkedEpisodes == 2) {
//$('input[name="checked_episode_id[]"]:checked').not(':checked').prop('disabled', true);
$('input.checkbox_control:not(:checked)').attr('disabled', 'disabled');
$('#mergeBtn,#mergeBtnOther').show();
}
});
$("#mergingModalDiv").on("change", "#all_original_fields", function (e) {
if (this.checked === true) {
$(".original_radio").each(function() {
this.checked = true;
});
$(".duplicate_radio").each(function() {
this.checked = false;
});
$("#all_duplicate_fields").attr('checked', false);
} else {
$(".original_radio").each(function() {
this.checked = false;
});
}
});
$("#mergingModalDiv").on("change", "#all_duplicate_fields", function (e) {
if (this.checked === true) {
$(".duplicate_radio").each(function() {
this.checked = true;
});
$(".original_radio").each(function() {
this.checked = false;
});
$("#all_original_fields").attr('checked', false); //false for uncheck
} else {
$(".duplicate_radio").each(function() {
this.checked = false;
});
}
});
$("#selectMasterDialog").on("click", "#completeMerge", function (e) {
if(($("#all_original_fields").is(':checked') == false) && ($("#all_duplicate_fields").is(':checked') == false)){
alert("Please select which episode to keep");
e.preventDefault();
};
});
</script>
@endpush
@@ -1,755 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<style type="text/css">
.color-tr {
background: #FFFF99;
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patient_flow_monitoring.select_clinic') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patient_flow_monitoring.dashboard') }}</a></li>
<li class="active">{{ __('patient_flow_monitoring.select_clinic') }}</li>
</ol>
</div>
</div>
@include('flash::message')
@include ('errors.list')
<div class="row">
<div class="col-sm-12">
<div class="white-box">
{{ Form::open(['route' => 'patient_flow_monitoring.index', 'method' => 'ANY']) }}
<div class="row">
<div class="col-md-3">
<div class="form-group">
{{ Form::label('clinic_id', __('patient_flow_monitoring.clinics')) }}
{{ Form::select('clinic_id', $clinics, '', ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-2">
<div class="form-group" id="searchby">
{{ Form::label('search_by', __('patient_flow_monitoring.date')) }}
{{ Form::select('search_by', ['4'=>'Today', '0'=>'Last 24 hours','1'=>'Custom Date','2'=>'Custom Range'], '', ['class' => 'form-control','id'=>'search_by', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-3" style="display: none;" id="date_search">
<div class="form-group" id="reg_date" style="padding-top: 23px;">
<div class="input-group">
{{ Form::text('reg_date','',['class' => 'form-control compulsory', 'required','readonly','id'=>'datepicker-autoclose']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
<div class="col-md-3" style="display: none;" id="date_range_search">
<div class="row">
<div class="col-md-6">
<div class="form-group">
{{ Form::label('start_date', __('patient_flow_monitoring.from')) }}
<div class="input-group">
{{ Form::text('start_date','',['class' => 'form-control compulsory','readonly','id'=>'datepicker-autoclose-1']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group" id="reg_date">
{{ Form::label('end_date', __('patient_flow_monitoring.to')) }}
<div class="input-group">
{{ Form::text('end_date','',['class' => 'form-control compulsory','readonly','id'=>'datepicker-autoclose-2']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group" id="searchby">
{{ Form::label('order_by', __('patient_flow_monitoring.order_by')) }}
{{ Form::select('order_by', ['0'=>'Triage Grade', '1'=>'Time of Arrival'], 0, ['class' => 'form-control','required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-1">
<div class="form-group" style="padding-top: 5px;"><br>
{{ Form::button(__('patient_flow_monitoring.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10', 'id'=>'select_patient']) }}
</div>
</div>
</div>
{{ Form::close() }}
</div>
</div>
</div>
@php
$counter = 0;
$patients_array = [];
$new_patients = 0;
$returning_patients = 0;
$can_user_view_diagnosis = Auth::user()->can('view-patient-episode-primary-diagnoses');
@endphp
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<h3><label class="label label-info">{{ __('patient_flow_monitoring.clinics') }}: {{ $clinic_name }} - {{ __('patient_flow_monitoring.date') }}: {{ $date_search }}</label></h3>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th style="width: 3%">#</th>
<th>{{ __('patient_flow_monitoring.time') }}</th>
<th>{{ __('patient_flow_monitoring.patient_number') }}</th>
<th>{{ __('patient_flow_monitoring.name') }}</th>
<th>{{ __('patient_flow_monitoring.gender') }}</th>
<th>{{ __('patient_flow_monitoring.age') }}</th>
<th>{{ __('patient_flow_monitoring.triage') }}</th>
<th>{{ __('patient_flow_monitoring.clinic_allocation') }}</th>
<th>{{ __('patient_flow_monitoring.diagnosis') }}</th>
<th>{{ __('patient_flow_monitoring.investigations') }}</th>
<th>{{ __('patient_flow_monitoring.consultation') }}</th>
<th>{{ __('patient_flow_monitoring.treatment') }}</th>
<th>{{ __('patient_flow_monitoring.outcome') }}</th>
<th>{{ __('patient_flow_monitoring.select') }}</th>
</tr>
</thead>
<tbody>
@if (isset($patient_episodes))
@foreach($patient_episodes as $episode)
@php
$counter++;
$patient = \DB::table('patients')->where('id', $episode->patient_id)->first();
//$triage = \DB::table('triage')->where('episode_id', $episode->id)->first();
//$consultation = \DB::table('consultations')->where('episode_id', $episode->id)->first();
$investigation_results = \DB::table('investigation_results')->where('episode_id', $episode->id)->first();
$investigation_orders = \DB::table('ordered_investigations')->where('episode_id', $episode->id)->first();
$treatment_details = \DB::table('treatments')->where('episode_id', $episode->id)->orderBy('created_at', 'desc')->first();
@endphp
@if($episode->paid_over == "pos")
<tr id="row{{ $episode->id }}">
<td>{{ $counter }}</td>
<td>
{{ streamline_date_time($episode->created_at) }}
</td>
<td>
@if(is_object($patient))
{{ $patient->number }} <i style="font-size: smaller;">({{ $patient_categories[$patient->category_id] ?? "" }})</i>
@endif
</td>
<td>
{!! is_object($patient) ? insurance_flag($patient->id) : "" !!}
</td>
<td> <label class="label label-success">{{ __('patient_flow_monitoring.point_of_sale') }} </label></td>
<td> <label class="label label-success">{{ __('patient_flow_monitoring.point_of_sale') }} </label></td>
<td> <label class="label label-success">{{ __('patient_flow_monitoring.point_of_sale') }} </label></td>
<td> <label class="label label-success">{{ __('patient_flow_monitoring.point_of_sale') }} </label></td>
<td> <label class="label label-success"> - </label></td>
<td> <label class="label label-success"> - </label></td>
<td> <label class="label label-success"> - </label></td>
<td> <label class="label label-success"> - </label></td>
<td> <label class="label label-success"> - </label></td>
<td></td>
</tr>
@elseif($episode->episode_type == 1)
<tr id="row{{ $episode->id }}">
<td>{{ $counter }}</td>
<td>
{{ streamline_date_time($episode->created_at) }}
</td>
<td>
@if(is_object($patient))
{{ $patient->number }} <i style="font-size: smaller;">({{ isset($patient_categories[$patient->category_id]) ? $patient_categories[$patient->category_id] : "" }})</i>
@endif
</td>
<td>
{!! is_object($patient) ? insurance_flag($patient->id) : "" !!}
</td>
<td>
@if(is_object($patient))
{{ $patient->gender == 1 ? "Male" : "Female" }}
@endif
</td>
<td>
@if(is_object($patient))
{{ get_patients_age($patient->date_of_birth) }}
@endif
</td>
<td>
<span class="label label-info">{{ __('patient_flow_monitoring.lab_self_request') }}</span>
</td>
<td>
<span class="label label_info">{{ __('patient_flow_monitoring.lab_self_request') }}</span>
</td>
<td>
<span class="label label-info">{{ __('patient_flow_monitoring.lab_self_request') }}</span>
</td>
<td>
@if(isset($investigation_results))
@php $per_inv_explode = explode(",", $investigation_results->per_investigation); @endphp
@if ($investigation_results->all_authenticated == 1)
<span style = "color: #009900; font-weight: bold;">{{ __('patient_flow_monitoring.all_results_available') }}</span>
@elseif (in_array("1", $per_inv_explode) && in_array("0", $per_inv_explode))
<span style = "color: #33CC33; font-weight: bold;">{{ __('patient_flow_monitoring.some_results_available') }}<span>
@elseif (array_unique($per_inv_explode) == array("0"))
<span style = "color: #99CC00; font-weight: bold;">{{ __('patient_flow_monitoring.ordered') }}</span>
@endif
@elseif(isset($investigation_orders))
<span style="color: #99CC00">{{ __('patient_flow_monitoring.ordered') }}</span>
@else
N/A
@endif
</td>
<td>
<span class="label label-info">{{ __('patient_flow_monitoring.lab_self_request') }}</span>
</td>
<td>
<span class="label label-info">{{ __('patient_flow_monitoring.lab_self_request') }}</span>
</td>
<td>
<span class="label label-info">{{ __('patient_flow_monitoring.lab_self_request') }}</span>
</td>
<td>
@if(is_object($patient) && is_null($patient->deleted_at))
<input type="radio" onchange="show({{ $episode->id }})" class="radio-option centered" name="episode_id" value="{{ $episode->id }}" />
@else
<b style="color: red">Patient was deleted</b>
@endif
</td>
</tr>
@else
<tr id="row{{ $episode->id }}">
<td>{{ $counter }}</td>
<td>
{{ streamline_date_time($episode->created_at) }}
</td>
<td>
@if(is_object($patient))
{{ $patient->number }} <i style="font-size: smaller;">({{ $patient_categories[$patient->category_id] ?? "" }})</i>
@endif
</td>
<td>
{!! is_object($patient) ? insurance_flag($patient->id) : "" !!}
</td>
<td>
@if(is_object($patient))
{{ $patient->gender == 1 ? "Male" : "Female" }}
@endif
</td>
<td>
@if(is_object($patient))
{{ get_patients_age($patient->date_of_birth) }}
@endif
</td>
<td>
@if (!$episode->episode_triage_id)
N/A
@else
{!! severe_grade($episode->severe_grade) !!}
@endif
</td>
<td>
@php
$episode_clinic_name = get_name($episode->clinic_id, 'id', 'name', 'clinics');
$episode_transfer = \Streamline\Models\PatientClinicTransfers::where('episode_id', $episode->id)->orderBy('id', 'desc')->first();
@endphp
@if ($episode_transfer)
<span style="color: #1b81b5">{{ __('patient_flow_monitoring.transferred_from') }} <b>{{ get_name($episode_transfer->old_clinic, 'id', 'name', 'clinics') }}</b> {{ __('patient_flow_monitoring.to') }} <b>{{ get_name($episode_transfer->new_clinic, 'id', 'name', 'clinics') }}</b></span>
@else
@if($episode_clinic_name != "N/A")
{{ $episode_clinic_name }}
@elseif (!$episode->episode_triage_id)
<span style="background-color: #FFFF00; color: black" class="label">{{ __('patient_flow_monitoring.pending_triage') }}</span>
@else
{{ get_name($episode->clinic_allocation, 'id', 'name', 'clinics') }}
@endif
@endif
</td>
<td>
@php
$primary_diagnosis_id = empty($episode->consultation_id)? $episode->antenatal_primary_diagnosis :get_name($episode->consultation_id, 'id', 'primary_diagnosis', 'consultations');
@endphp
@if($can_user_view_diagnosis)
{{ get_name($primary_diagnosis_id, "id", "name", "diagnoses") }}
@endif
</td>
<td>
@if(isset($investigation_results))
@php $per_inv_explode = explode(",", $investigation_results->per_investigation); @endphp
@if ($investigation_results->all_authenticated == 1)
<span style = "color: #009900; font-weight: bold;">{{ __('patient_flow_monitoring.all_results_available') }}</span>
@elseif (in_array("1", $per_inv_explode) && in_array("0", $per_inv_explode))
<span style = "color: #33CC33; font-weight: bold;">{{ __('patient_flow_monitoring.some_results_available') }}<span>
@elseif (array_unique($per_inv_explode) == array("0"))
<span style = "color: #99CC00; font-weight: bold;">{{ __('patient_flow_monitoring.ordered') }}</span>
@endif
@elseif(isset($investigation_orders))
<span style="color: #99CC00">{{ __('patient_flow_monitoring.ordered') }}</span>
@else
N/A
@endif
</td>
<td>
@if($episode->consultation_id || $episode->antenatal_outcome_id)
@if(!is_null($episode->consultation_done_by))
{{ get_full_name($episode->consultation_done_by, "id", "first_name", "last_name","users") }}
@else
@php
$outcome_id = !empty($episode->antenatal_outcome_id)? $episode->antenatal_outcome_id:$episode->outcome_id;
$created_by = !empty($episode->consultation_created_by)? $episode->consultation_created_by:$episode->antenatal_created_by;
$updated_by = !empty($episode->consultation_updated_by)? $episode->consultation_updated_by:$episode->antenatal_updated_by;
$outcome = get_name($outcome_id, 'id', 'name', 'outcomes'); @endphp
@if(is_null($updated_by))
{{ get_full_name($created_by, "id", "first_name", "last_name","users") }}
@else
{{ get_full_name($updated_by, "id", "first_name", "last_name", "users") }}
@endif
@endif
@else
@php $outcome = "N/A"; @endphp
@endif
</td>
<td>
@if(is_null($treatment_details))
<span>N/A</span>
@elseif($treatment_details->dispense_status == 1)
<span style="color: #009900; font-weight: bold;">{{ __('patient_flow_monitoring.dispensed') }}</span>
@else
<span style="background-color: #FFFF00; color: black" class="label">
{{ __('patient_flow_monitoring.orderd_but_not_dispensed') }}
</span>
@endif
</td>
<td>
{{-- @if (get_name($episode->id, 'episode_id', 'id', 'ante_natal_clinic_registrations') != "N/A")
<span style="background-color: #FFFF00; color: black" class="label">Ongoing Consultation (ANC)</span> --}}
@if (is_null($episode->consultation_id) && empty($episode->antenatal_primary_diagnosis))
<span style="background-color: red" class="label">{{ __('patient_flow_monitoring.pending_consultation') }}</span>
@elseif($episode->consultation_id)
@if(!is_null($episode->consultation_done_by) && is_null($episode->primary_diagnosis))
<span style="background-color: red" class="label">{{ __('patient_flow_monitoring.pending_consultation') }}</span>
@elseif($episode->completed == 0)
<span style="background-color: #FFFF00; color: black" class="label">{{ __('patient_flow_monitoring.ongoing_consultation') }}</span>
@else
{{ get_name($episode->outcome_id, 'id', 'name', 'outcomes') }}
@endif
@elseif (!is_null($episode->consultation_id) && get_name($episode->consultation_id, 'id', 'completed', 'consultations') == 0)
<span style="background-color: #FFFF00; color: black" class="label">{{ __('patient_flow_monitoring.ongoing_consultation') }}</span>
@else
{{ $outcome }}
@endif
</td>
<td>
@if(is_object($patient) && is_null($patient->deleted_at))
<input type="radio" onchange="show({{ $episode->id }})" class="radio-option centered" name="episode_id" value="{{ $episode->id }}" />
@else
<b style="color: red">Patient was deleted</b>
@endif
</td>
</tr>
@endif
@endforeach
<tr>
<td colspan="14" id="menu_div">
<div class="white-box" id="menu1" style="display: none;">
<div class="row">
<div class="col-sm-2">
@if(Auth::user()->can('perform-triage'))
<button type="submit" name="triage" class="btn btn-success btn-sm col-sm-12" value="triage" id="triage">{{ __('patient_flow_monitoring.triage') }}</button>
@endif
</div>
&nbsp;
<div class="col-sm-2">
@if(Auth::user()->can('create-consultation'))
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12" value="consultation" id="consultation">{{ __('patient_flow_monitoring.consultation') }}</button>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('create-theatre-surgery') || Auth::user()->can('create-theatre-anaesthesia'))
<div class="btn-group dropup m-r-10 col-sm-12">
<button aria-expanded="false" data-toggle="dropdown" class="btn btn-info dropdown-toggle waves-effect waves-light col-sm-12" type="button">{{ __('patient_flow_monitoring.theatre') }} <span class="caret"></span></button>
<ul role="menu" class="dropdown-menu">
<li><button type="submit" name="submit" value="create_anaesthetics" class="btn btn-default btn-sm btn-link" id="create_anaesthetics">{{ __('patient_flow_monitoring.theatre_anaesthetics') }}</button></li>
<li><button type="submit" name="submit" value="anaesthetics_history" class="btn btn-default btn-sm btn-link" id="anaesthetics_history">{{ __('patient_flow_monitoring.historical_anaesthetics') }}</button></li>
<li><button type="submit" name="submit" value="create_surgery" class="btn btn-default btn-sm btn-link" id="create_surgery">{{ __('patient_flow_monitoring.theatre_surgery') }}</button></li>
<li><button type="submit" name="submit" value="surgery_index" class="btn btn-default btn-sm btn-link" id="surgery_index">{{ __('patient_flow_monitoring.historical_surgeries') }}</button></li>
</ul>
</div>
@endif
</div>
@if(Auth::user()->can('patient-flow-monitoring-inpatient-admission'))
<div class="col-sm-2">
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12" value="inpatient_admission" id="inpatient_admission2">{{ __('patient_flow_monitoring.admit_patient') }}</button>
</div>
@endif
<div class="col-sm-2"> {{-- middle menu --}}
<button type="button" class="btn btn-primary btn-sm btn-block" id="internal_transfer_middle">{{ __('patient_episode.clinic_transfer') }}</button>
</div>
@if ($clinic_name == "FAMILY PLANNING")
<div class="col-sm-2">
<button type="submit" name="fp_button" class="btn btn-success btn-sm col-sm-12" value="fp_button" id="fp_button">{{ __('patient_flow_monitoring.family_planning') }}</button>
</div>
@endif
@if ($clinic_name == "ANTE-NATAL")
<div class="col-sm-2">
<button type="submit" name="anc_registration_button" class="btn btn-success btn-sm col-sm-12" value="anc_registration_button" id="anc_registration_button">{{ __('patient_flow_monitoring.anc_registration') }}</button>
</div>
<div class="col-sm-1">
<button type="submit" name="anc_followup_button" class="btn btn-success btn-sm col-sm-12" value="anc_followup_button" id="anc_followup_button">{{ __('patient_flow_monitoring.anc_follow_up') }}</button>
</div>
<div class="col-sm-1">
<button type="submit" name="treatment" class="btn btn-success btn-sm col-sm-12" value="treatment" id="treatment">{{ __('patient_flow_monitoring.treatment') }}</button>
</div>
<div class="col-sm-1">
<button type="submit" name="investigation" class="btn btn-success btn-sm col-sm-12" value="investigation" id="investigation">{{ __('patient_flow_monitoring.investigations') }}</button>
</div>
@endif
</div>
<br>
<div class="row">
<div class="col-sm-3">
@if(Auth::user()->can('perform-triage-without-etat'))
<button type="submit" name="triage_without_etat" id="triage_without_etat" class="btn btn-success btn-sm col-sm-12" value="triage_without_etat">{{ __('patient_episode.triage_without') }} ETAT</button>
@endif
</div>
<div class="col-sm-3">
@if(Auth::user()->can('create-consultation-with-notes'))
<button type="submit" name="consultation_with_notes" id="consultation_with_notes" class="btn btn-success btn-sm col-sm-12" value="consultation_with_notes">{{ __('patient_episode.consultation_with_notes') }}</button>
@endif
</div>
<div class="col-sm-3">
<button type="submit" name="view_patient_history" id="view_patient_history" class="btn btn-success btn-sm col-sm-12" value="view_patient_history">{{ __('patient_episode.view_history') }}</button>
</div>
</div>
</div>
</td>
</tr>
@endif
</tbody>
</table>
{{ $patient_episodes->render() }}
</div>
</div>
<div class="white-box" id="menu2" style="display: none;">
<div class="row">
<div class="col-sm-2">
@if(Auth::user()->can('perform-triage'))
<button type="submit" name="triage" class="btn btn-success btn-sm col-sm-12" value="triage" id="triage">{{ __('patient_flow_monitoring.triage') }}</button>
@endif
</div>
&nbsp;
<div class="col-sm-2">
@if(Auth::user()->can('create-consultation'))
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12" value="consultation" id="consultation">{{ __('patient_flow_monitoring.consultation') }}</button>
@endif
</div>
<div class="col-sm-2">
@if(Auth::user()->can('create-theatre-surgery') || Auth::user()->can('create-theatre-anaesthesia'))
<div class="btn-group dropup m-r-10 col-sm-12">
<button aria-expanded="false" data-toggle="dropdown" class="btn btn-info dropdown-toggle waves-effect waves-light col-sm-12" type="button">{{ __('patient_flow_monitoring.theatre') }} <span class="caret"></span></button>
<ul role="menu" class="dropdown-menu">
<li><button type="submit" name="submit" value="create_anaesthetics" class="btn btn-default btn-sm btn-link" id="create_anaesthetics">{{ __('patient_flow_monitoring.theatre_anaesthetics') }}</button></li>
<li><button type="submit" name="submit" value="anaesthetics_history" class="btn btn-default btn-sm btn-link" id="anaesthetics_history">{{ __('patient_flow_monitoring.historical_anaesthetics') }}</button></li>
<li><button type="submit" name="submit" value="create_surgery" class="btn btn-default btn-sm btn-link" id="create_surgery">{{ __('patient_flow_monitoring.theatre_surgery') }}</button></li>
<li><button type="submit" name="submit" value="surgery_index" class="btn btn-default btn-sm btn-link" id="surgery_index">{{ __('patient_flow_monitoring.historical_surgeries') }}</button></li>
</ul>
</div>
@endif
</div>
@if(Auth::user()->can('patient-flow-monitoring-inpatient-admission'))
<div class="col-sm-2">
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12" value="inpatient_admission" id="inpatient_admission2">{{ __('patient_flow_monitoring.admit_patient') }}</button>
</div>
@endif
<div class="col-sm-2"> {{-- bottom menu --}}
<button type="button" class="btn btn-primary btn-sm btn-block" id="internal_transfer_bottom">{{ __('patient_episode.clinic_transfer') }}</button>
</div>
@if ($clinic_name == "FAMILY PLANNING")
<div class="col-sm-2">
<button type="submit" name="fp_button" class="btn btn-success btn-sm col-sm-12" value="fp_button" id="fp_button">{{ __('patient_flow_monitoring.family_planning') }}</button>
</div>
@endif
@if ($clinic_name == "ANTE-NATAL")
<div class="col-sm-2">
<button type="submit" name="anc_registration_button" class="btn btn-success btn-sm col-sm-12" value="anc_registration_button" id="anc_registration_button">{{ __('patient_flow_monitoring.anc_registration') }}</button>
</div>
<div class="col-sm-1">
<button type="submit" name="anc_followup_button" class="btn btn-success btn-sm col-sm-12" value="anc_followup_button" id="anc_followup_button">{{ __('patient_flow_monitoring.anc_follow_up') }}</button>
</div>
<div class="col-sm-1">
<button type="submit" name="treatment" class="btn btn-success btn-sm col-sm-12" value="treatment" id="treatment">{{ __('patient_flow_monitoring.treatment') }}</button>
</div>
<div class="col-sm-1">
<button type="submit" name="investigation" class="btn btn-success btn-sm col-sm-12" value="investigation" id="investigation">{{ __('patient_flow_monitoring.investigations') }}</button>
</div>
@endif
</div>
<br>
<div class="row">
<div class="col-sm-3">
@if(Auth::user()->can('perform-triage-without-etat'))
<button type="submit" name="triage_without_etat" id="triage_without_etat" class="btn btn-success btn-sm col-sm-12" value="triage_without_etat">{{ __('patient_episode.triage_without') }} ETAT</button>
@endif
</div>
<div class="col-sm-3">
@if(Auth::user()->can('create-consultation-with-notes'))
<button type="submit" name="consultation_with_notes" id="consultation_with_notes" class="btn btn-success btn-sm col-sm-12" value="consultation_with_notes">{{ __('patient_episode.consultation_with_notes') }}</button>
@endif
</div>
<div class="col-sm-3">
<button type="submit" name="view_patient_history" id="view_patient_history" class="btn btn-success btn-sm col-sm-12" value="view_patient_history">{{ __('patient_episode.view_history') }}</button>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="ward_admission_episode" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">{{ __('layout.ward_admission') }}</h4>
</div>
<div class="modal-body">
{{ Form::open(['route' => 'patient_flow_monitoring.inpatient_admission']) }}
{{ Form::hidden('admission_episode_id', 0, ['id' => 'admission_episode_id']) }}
{{ Form::label('admission_ward_id', __('layout.select_ward')) }}
{{ Form::select('admission_ward_id', $wards, '', ['class' => 'form-control', 'required' => 'true']) }}
<br>
{{ Form::label('ward_admission_date', __('layout.admission_date')) }}
<input type="date" class="form-control" name="ward_admission_date" id="ward_admission_date" value="{{ date('Y-m-d') }}" required="true">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success btn-sm" onclick="return confirm('<?php echo __('layout.are_you_sure_admit'); ?>');">{{ __('layout.continue_ward_admission') }}</button>
{{ Form::close() }}
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">{{ __('layout.close') }}</button>
</div>
</div>
</div>
</div>
{{-- clinic transfer modal --}}
<div class="modal fade" id="internal_transfer_dialog" tabindex="-1" role="dialog" style="padding-top: 50px;">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">{{ __('patient_episode.internal_transfer') }}</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<div class="form-group">
{{ Form::label('current_clinic', __('patient_episode.current_clinic')) }}
{{ Form::hidden('current_clinic_id', 0, ['id' => 'current_clinic_id']) }}
{{ Form::hidden('current_triage_id', 0, ['id' => 'current_triage_id']) }}
{{ Form::hidden('current_episode_id', 0, ['id' => 'current_episode_id']) }}
{{ Form::hidden('current_patient_id', 0, ['id' => 'current_patient_id']) }}
{{ Form::text('current_clinic', '', ['class' => 'form-control compulsory', 'readonly', 'id' => 'current_clinic_transfer']) }}
</div>
<div class="form-group">
{{ Form::label('transfer_to', __('patient_episode.transfer_to')) }}
{{ Form::select('transfer_to', $clinics, null, ['class' => 'form-control compulsory', 'required', 'id' => 'transfer_to']) }}
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('patient_episode.close') }}</button>
<button type="button" class="btn btn-success" id="submit_clinic_transfer" >{{ __('patient_episode.transfer_patient') }}</button>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<!-- Date Picker Plugin JavaScript -->
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script>
/*$('.table').DataTable({
dom: 'Bfrtip',
bInfo: false,
bPaginate: false,
buttons: [
{extend: 'pdf',
exportOptions: {
stripHtml: false,
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
}
},
{extend: 'print',
exportOptions: {
stripHtml: false,
columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
}
}
]
});*/
let selected_row = 0;
function show(episodeId) {
// remove previous coloring
$('#row'+selected_row).removeClass('color-tr');
selected_row = episodeId;
// add color to current selected
$('#row'+episodeId).addClass('color-tr');
// bring up the buttons
var row1 = $("#menu_div").closest("tr");
var row2 = $('#row'+episodeId).closest("tr");
row2.after(row1);
$('#menu1').show();
$('#menu2').show();
}
$('#datepicker-autoclose,#datepicker-autoclose-1,#datepicker-autoclose-2,#ward_admission_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
$('#search_by').change(function () {
if ($(this).val() == 1) {
$('#date_search').show();
$('#date_range_search').hide();
}
else if ($(this).val() == 2) {
$('#date_range_search').show();
$('#date_search').hide();
}
else {
$('#date_search,#date_range_search').hide();
}
});
$('#triage,#consultation,#create_anaesthetics,#anaesthetics_history,#create_surgery,#surgery_index,#treatment,#investigation,#anc_registration_button,#anc_followup_button,#view_patient_history,#consultation_with_notes,#triage_without_etat').click(function() {
event.preventDefault();
let options = document.getElementsByName('episode_id');
let episodeId = 0;
if (options) {
for (let i = 0; i < options.length; i++) {
if (options[i].checked){
episodeId = options[i].value;
}
}
}
let clicked_btn = $(this).val();
console.log("clicked and ready to submit to the flow monitoring route");
$.ajax({
url: '/patient_flow_monitoring/patient_route/'+episodeId+'/'+clicked_btn,
type: 'get',
success: function(response){
window.location.href = response;
},
error: function(xhr, status, error){
// alert(xhr.responseText);
}
});
});
$("#inpatient_admission1,#inpatient_admission2").click(function () {
let current_episode_id = $('input[name=episode_id]:checked').val();
$("#admission_episode_id").val(current_episode_id);
$("#ward_admission_episode").modal("show");
});
$("#internal_transfer_bottom,#internal_transfer_middle").click(function () {
let current_episode_id = $('input[name=episode_id]:checked').val();
$.ajax({
type: "GET",
url: "/patient_episodes/internal_clinic_transfer/" + current_episode_id,
success: function (result) {
if (result != 0) {
let arr = result.split(',');
console.log(arr);
$('#current_clinic_transfer').val(arr[2]);
$('#current_clinic_id').val(arr[1]);
$('#current_triage_id').val(arr[0]);
$('#current_episode_id').val(current_episode_id);
$('#current_patient_id').val(arr[4]);
$('#internal_transfer_dialog').modal('show');
} else {
alert("<?php echo __('patient_episode.triage_not_performed') ?>");
}
}
});
});
$("#submit_clinic_transfer").click(function () {
let transfer_clinic = $("#transfer_to").val();
let clinic = $("#current_clinic_id").val();
let triage_id = $("#current_triage_id").val();
let episode_id = $("#current_episode_id").val();
let patient_id = $('#current_patient_id').val();
if (transfer_clinic == 0) {
alert("<?php echo __('patient_episode.select_new_clinic') ?>");
} else {
$.ajax({
type: "POST",
url: "/patient_episodes/save_internal_clinic_transfer",
data: {new_clinic: transfer_clinic, old_clinic: clinic, triage_id: triage_id, episode_id: episode_id, patient_id: patient_id},
cache: false,
success: function (result) {
if (result == 1) {
alert("<?php echo __('patient_episode.patient_transfer_successful') ?>");
location.reload();
} else {
alert("<?php echo __('patient_episode.patient_transfer_failed') ?>");
}
}
});
}
});
</script>
@endpush
@@ -1,63 +0,0 @@
@extends('layouts.main')
@push('styles')
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patients.appointments') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patients.dashboard') }}</a></li>
<li><a href="{{ route('patients.index') }}">{{ __('patients.patients') }}</a></li>
<li class="active">{{ __('patients.appointments') }}</li>
</ol>
</div>
</div>
<div class="white-box">
@include('flash::message')
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>{{ __('patients.patient_name') }}</th>
<th>{{ __('patients.clinic') }}</th>
<th>{{ __('patients.incharge') }}</th>
<th>{{ __('patients.appointment_time') }}</th>
<th>{{ __('patients.patient_contact') }}</th>
<th>{{ __('patients.comments') }}</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($appointments as $appointment)
<tr>
<td>{{ get_full_name($appointment->patient_id, 'id', 'first_name', 'last_name', 'patients') }}</td>
<td>{{ get_name($appointment->clinic_allocation, 'id', 'name', 'clinics') }}</td>
<td>
@if($appointment->incharge_id != 0)
{{ get_full_name($appointment->incharge_id, 'id', 'first_name', 'last_name', 'users') }}
@else
N/A
@endif
</td>
<td>{{ $appointment->appointment_date }} at {{ $appointment->appointment_time }}</td>
<td>{{ get_name($appointment->patient_id, 'id', 'phone', 'patients') }}</td>
<td>{{ $appointment->comments }}</td>
<td><a href="/patients/confirm_appointment/{{ $appointment->id }}" class="btn btn-success">Select</a></td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endsection
@push('scripts')
<script type="text/javascript"></script>
@endpush
@@ -1,431 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patients.patient_appointments_report') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patients.dashboard') }}</a></li>
<li><a href="{{ route('patients.index') }}">{{ __('patients.patients') }}</a></li>
<li><a href="{{ url('patients/follow_up') }}">{{ __('patients.patient_appointments') }}</a></li>
<li class="active">{{ __('patients.patient_appointments_report') }}</li>
</ol>
</div>
</div>
<div class="white-box">
@include('flash::message')
{{ Form::open(['route' => 'patients.patient_appointments_report', 'method' => 'ANY', 'role' => 'search']) }}
<div class="row">
<div class="col-md-3">
<div class="form-group">
{{ Form::label('clinic_id', __('patients.clinics')) }}
{{ Form::select('clinic_id', $clinics, '', ['class' => 'form-control', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
{{ Form::label('appointment_outcome', __('patients.outcome')) }}
{{ Form::select('appointment_outcome', ['all' => 'All records', 0 => 'Pending', 1 => 'Complete', 2 => 'Cancelled', 3 => 'Reschedule'], '', ['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-3">
<div class="form-group" id="searchby">
{{ Form::label('search_by', 'Date') }}
{{ Form::select('search_by', ['0'=>'All Records','1'=>'Custom Date','2'=>'Custom Range'], '', ['class' => 'form-control','id'=>'search_by', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-3" style="display: none;" id="date_search">
<div class="form-group" id="reg_date" style="padding-top: 23px;">
<div class="input-group">
{{ Form::text('reg_date','',['class' => 'form-control compulsory', 'required','readonly','id'=>'datepicker-autoclose']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
<div class="col-md-3" style="display: none;" id="date_range_search">
<div class="row">
<div class="col-md-6">
<div class="form-group">
{{ Form::label('start_date', __('patients.from')) }}
<div class="input-group">
{{ Form::text('start_date','',['class' => 'form-control compulsory','readonly','id'=>'datepicker-autoclose-1']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group" id="reg_date">
{{ Form::label('end_date', __('patients.to')) }}
<div class="input-group">
{{ Form::text('end_date','',['class' => 'form-control compulsory','readonly','id'=>'datepicker-autoclose-2']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group" style="padding-top: 5px;"><br>
{{ Form::button(__('patients.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10', 'id'=>'select_patient']) }}
</div>
</div>
</div>
{{ Form::close() }}
<div class="table-responsive">
<table class="table success-table table-sm">
<thead >
<tr style="background-color: #00c292; color: white;">
<th>#</th>
<th>{{ __('patients.appointment_date') }}</th>
<th>{{ __('patients.name') }}</th>
<th>{{ __('patients.number') }}</th>
<th>{{ __('patients.clinic') }}</th>
<th>{{ __('patients.comment') }}</th>
<th>{{ __('patients.outcome') }}</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@php $counter = 1; @endphp
@if(count($patient_appointments) > 0)
@foreach($patient_appointments as $appointment)
<tr>
<td>{{ $counter }}</td>
<td>{{ streamline_date($appointment->appointment_date) }}</td>
<td>{!! insurance_flag($appointment->patient_id) !!}</td>
<td>{{ get_name($appointment->patient_id, 'id', 'number', 'patients') }}</td>
<td>{{ get_name($appointment->clinic_allocation, 'id', 'name', 'clinics') }}</td>
<td>
{{ $appointment->action_comment }}
@if(!is_null($appointment->action_comment))
<br><small>{{ __('patients.comment_by') }}: <b>{{ get_full_name($appointment->action_comment_by, "id", "first_name", "last_name", "users") }}</b></small>
@endif
</td>
<td>
@if($appointment->appointment_fulfilled == 0)
Pending
@elseif($appointment->appointment_fulfilled == 1)
Complete
@elseif($appointment->appointment_fulfilled == 2)
Cancelled
@elseif($appointment->appointment_fulfilled == 3)
Rescheduled
@endif
</td>
<td>
<button class="btn btn-primary btn-sm btn-rounded viewDemographic" value="{{ $appointment->patient_id }}">
{{ __('patients.demographics') }}
</button>
</td>
<td>
<a href="/patient_episodes/set_patient_id/{{ $appointment->patient_id }}" class="btn btn-default btn-rounded btn-sm">{{ __('patients.select') }}</a>
</td>
<td class="text-center">
<a class="btn btn-success btn-rounded btn-sm" onclick="displayAppointmentActions({{ $appointment->patient_id}},{{ $appointment->id}})">{{ __('patients.appointment_actions') }}</a>
</td>
</tr>
@php $counter++; @endphp
@endforeach
@endif
</tbody>
</table>
</div>
</div>
<!-- modal that pops up when its an action on an appointment -->
<div class="modal" id="modal_select_actions" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">{{ __('patients.select_actions') }}</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-4">
<a class="btn btn-warning btn-rounded" onclick="reschedule_appointment()">{{ __('patients.reschedule_appointment') }}</a>
</div>
<div class="col-md-4">
<a class="btn btn-danger btn-rounded" onclick="cancel_appointment()">{{ __('patients.cancel_appointment') }}</a>
&nbsp;&nbsp;&nbsp;
</div>
<div class="col-md-4">
<button type="button" class="btn btn-default btn-rounded" id="otherAppointmentAction">{{ __('patients.other') }}</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- other comments appointment action -->
<div class="modal" id="otherAppointmentActionModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="exampleModalLabel1">{{ __('patients.other_appointment_action') }}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label>{{ __('patients.comment') }}</label>
<textarea name="appointment_comment" class="form-control compulsory" id="appointment_comment" rows="10"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('patients.cancel') }}</button>
<input type="button" class="btn btn-success" id="submitAppointmentComment" value="Save"/>
</div>
</div>
</div>
</div>
<!-- patient demographics -->
<div class="modal" id="showPatientDemographicModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">{{ __('patients.patient_details') }}</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<table class="success-table table-striped table-hover">
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody id="show_patient_demographic">
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<!-- Data table javascript -->
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<!-- Date Picker Plugin JavaScript -->
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script type="text/javascript">
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 100,
buttons: [
'copy',
{ extend: 'csv',
message: 'LIST OF DID NOT ATTEND APPOINTMENT'
},
{ extend: 'excel',
message: 'LIST OF DID NOT ATTEND APPOINTMENT',
exportOptions: {
columns: [ 1, 2, 3, 4, 5 ]
},
sheetName: 'LIST OF DID NOT ATTEND APPOINTMENT ON STREAMLINE'
},
{ extend: 'pdf',
message: 'LIST OF DID NOT ATTEND APPOINTMENT',
orientation: 'landscape',
pageSize: 'LETTER',
exportOptions: {
columns: [ 1, 2, 3, 4, 5 ]
},
customize: function(doc) {
doc.defaultStyle.fontSize = 10;
// doc.styles.tableHeader.alignment = 'left';
}
},
{ extend: 'print',
message: 'LIST OF DID NOT ATTEND APPOINTMENT',
exportOptions: {
columns: [ 1, 2, 3, 4, 5 ]
},
customize: function (win) {
$(win.document.body)
.css('font-size', '10pt')
.css('background', '#fff')
.prepend(
'<img src="<?php echo asset('uploads/logo/logo-sm.png'); ?>" style="position:absolute; top:0; right:0;" />'
);
$(win.document.body).find('table')
.addClass('compact')
.css('font-size', 'inherit');
}
}
]
});
$('.sorting').removeClass('sorting');//remove the sorting class
$('.sorting_asc').removeClass('sorting_asc');//remove the sorting class
$('#datepicker-autoclose,#datepicker-autoclose-1,#datepicker-autoclose-2').datepicker({
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd'
});
$('#search_by').change(function () {
if ($(this).val() == 1) {
$('#date_search').show();
$('#date_range_search').hide();
}
else if ($(this).val() == 2) {
$('#date_range_search').show();
$('#date_search').hide();
}
else {
$('#date_search,#date_range_search').hide();
}
});
$("#otherAppointmentAction").click(function(e){
e.preventDefault();
$("#modal_select_actions").modal("hide");
$("#otherAppointmentActionModal").modal("show");
});
/* stuff for patient appointments */
let selectedPatientId = 0;
let appointmentId = 0;
function reschedule_appointment() {
if (confirm("Are you sure you want to reschedule the appointment? This action can not be reversed")) {
window.location.href = "/patients/reschedule_appointment/" + appointmentId;
}
}
function cancel_appointment() {
if (confirm("Are you sure you want to cancel the appointment? This action can not be reversed")){
$.ajax({
method: 'GET',
url: '/patients/cancel_patient_appointment/' + appointmentId,
success: function(response){
if(response == 1) {
alert("Appointment has been cancelled");
$("#modal_select_actions").modal("hide");
location.reload();
} else {
alert("Cancelling appointment failed. Please try again.");
}
}
});
}
}
function displayAppointmentActions(patientId, appointment_id) {
selectedPatientId = patientId;
appointmentId = appointment_id;
$("#modal_select_actions").modal("show");
}
function displayActivationModel(){
window.location.href = "/patients/complete_appointment/" + appointmentId;
}
/* end of appointment stuff */
$('.viewDemographic').click(function(e){
e.preventDefault();
var episodeId = "";
var patientId = $(this).val();
$("#showPatientDemographicModal").modal("show");
$.ajax({
type: "POST",
url: "/view_dna_patient_demographic",
data: {
patient_id: patientId,
},
cache: false,
success: function (response) {
$('#show_patient_demographic').html(response);
}
});
});
$('#submitAppointmentComment').click(function () {
var patient_id = selectedPatientId;
var set_appointment_id = appointmentId;
var appointment_comment = $('#appointment_comment').val();
console.log("patient_id " + patient_id);
console.log("appointment_id " + set_appointment_id);
if (appointment_comment === '') {
alert("Please fill out the comment");
} else {
$.ajax({
type: "post",
url: "/store_appointment_comment",
data: {patient_id: patient_id, appointment_comment: appointment_comment, set_appointment_id:set_appointment_id},
cache: false,
success: function (result) {
if (result == 1) {
$('#appointment_comment').text(''); //clear appointment comment
$('#appointment_comment').val(''); //clear appointment comment
$('#otherAppointmentActionModal').modal('hide'); //manually hide the modal
location.reload();
} else{
alert("Error occured. Kindly contact your IT Support");
}
},
error: function (error) {
console.log(error);
}
});
}
});
</script>
@endpush
@push('styles')
<style type="text/css">
.color-bordered-table.success-bordered-table {
border-top: 0px;
}
</style>
@endpush
@@ -1,426 +0,0 @@
@extends('layouts.main')
@section('content')
<div class="row bg-title">
<div class="col-md-6">
<h4 class="page-title">{{ __('patients.possible_patient_duplicates') }}</h4>
</div>
<div class="col-md-6">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patients.dashboard') }}</a></li>
<li><a href="{{ route('patients.index') }}">{{ __('patients.patients') }}</a></li>
<li class="active">{{ __('patients.patient_duplicates') }}</li>
</ol>
</div>
</div>
<div class="white-box">
<div class="row">
<div class="col-md-3">
<h4><strong>{{ __('patients.name') }}: </strong><font style="color: blue">{!! insurance_flag($original_patient->id) !!}</font></h4>
<a class="img" href="#modal-photo" data-toggle="modal" style="color: whitesmoke">
@if(!is_null($original_patient->photo) && $original_patient->photo != "")
<img src='{{ asset($original_patient->photo) }}' class="img-rounded center" alt='Photo not available' />
@else
<img src="/uploads/streamline_images/person-place-holder.jpg" class="img-rounded center" style='height: 120px; width: 50%' alt='Photo not available' />
@endif
</a>
<hr>
<a href="/patient_episodes/set_patient_id/{{ $original_patient->id }}" class="btn btn-success btn-sm">{{ __('patients.select_patient_history') }}</a>
</div>
<div class="col-md-4">
<table class="table-bordered table-condensed table-striped">
<tbody>
<tr>
<th><b>{{ __('patients.patient_number') }}</b></th>
<td>{{ $original_patient->number }}</td>
</tr>
<tr>
<th><b>{{ __('patients.full_names') }}</b></th>
<td>{{ $original_patient->first_name }} {{ $original_patient->last_name }}</td>
</tr>
<tr>
<th><b>{{ __('patients.gender') }}</b></th>
<td>{{ $original_patient->gender == 1 ? 'Male' : 'Female' }}</td>
</tr>
<tr>
<th class="hidden-phone"><b>{{ __('patients.age') }}</b></th>
<td>{{ get_patients_age($original_patient->date_of_birth) }}</td>
</tr>
<tr>
<th><b>{{ __('patients.district') }}</b></th>
<td>{{ isset($districts[$original_patient->district_id]) ? $districts[$original_patient->district_id] : '' }}</td>
</tr>
<tr>
<th><b>{{ __('patients.county') }}</b></th>
<td>{{ isset($counties[$original_patient->county_id]) ? $counties[$original_patient->county_id] : '' }}</td>
</tr>
<tr>
<th><b>{{ __('patients.sub_county') }}</b></th>
<td>{{ isset($subcounties[$original_patient->subcounty_id]) ? $subcounties[$original_patient->subcounty_id] : '' }}</td>
</tr>
<tr>
<th><b>{{ __('patients.parish') }}</b></th>
<td>{{ isset($parishes[$original_patient->parish_id]) ? $parishes[$original_patient->parish_id] : '' }}</td>
</tr>
<tr>
<th><b>{{ __('patients.village') }}</b></th>
<td>{{ isset($villages[$original_patient->village_id]) ? $villages[$original_patient->village_id] : '' }}</td>
</tr>
<tr>
<th><b>{{ __('patients.patient_record_created_on') }}</b></th>
<td>{{streamline_date($original_patient->created_at) }}</td>
</tr>
</tbody>
</table>
</div>
<div class="col-md-5">
<table class="table-bordered table-condensed table-striped">
<tr>
<th><b>{{ __('patients.phone') }}</b></th>
<td>{{ $original_patient->phone }}</td>
</tr>
<tr>
<th><b>{{ __('patients.occupation') }}</b></th>
<td>{{ isset($occupations[$original_patient->occupation_id]) ? $occupations[$original_patient->occupation_id] : '' }}</td>
</tr>
<tr>
<th><b>{{ __('patients.insurance') }}</b></th>
<td>{{ $original_patient->insurance_status == 1 ? __('patients.yes') : __('patients.no') }}</td>
</tr>
<tr>
<th><b>{{ __('patients.religion') }}</b></th>
<td>{{ !is_null($original_patient->religion_id) ? $religions[$original_patient->religion_id] : '' }}</td>
</tr>
<tr>
<th><b>{{__('patients.next_of_kin')}}</b></th>
<td>{{ $original_patient->next_of_kin }}</td>
</tr>
<tr>
<th><b>{{ __('patients.next_of_kin_relationship') }}</b></th>
<td>{{ isset($relationships[$original_patient->next_of_kin_relationship]) ? $relationships[$original_patient->next_of_kin_relationship] : '' }}</td>
</tr>
<tr>
<th><b>{{__('patients.phone_of_next_of_kin')}}</b></th>
<td>{{ $original_patient->phone_of_next_of_kin }}</td>
</tr>
<tr>
<th><b>{{ __('patients.last_patient_visit') }} : </b></th>
<td>
@if(!is_null($last_episode))
@php
$diagnosis = null;
$primary_diagnosis_id = get_name($last_episode->id, 'episode_id', 'primary_diagnosis', 'consultations');
if($primary_diagnosis_id != "N/A" && $primary_diagnosis_id != ""){
$diagnosis = \Streamline\Models\Diagnosis::withTrashed()->find($primary_diagnosis_id);
}
@endphp
<strong>{{ __('consultations.primary_diagnosis') }} : </strong>{{ !is_null($diagnosis) ? $diagnosis->name : '' }}<br>
<strong>{{ __('patients.comments') }} : </strong>{{ get_name($last_episode->id, 'episode_id', 'comments', 'consultations') }}<br>
@endif
<strong>{{ __('patients.date') }} : </strong> {{ !is_null($last_episode) ? streamline_date($last_episode->created_at) : __('patients.no_visit_yet') }}
</td>
</tr>
</table>
</div>
</div>
</div>
@if ($possible_duplicate_patients)
<div class="white-box">
<div class="row">
<div class="col-sm-12">
<h2><strong style="color: red">{{ __('patients.possible_duplicate_records') }}</strong></h2>
</div>
</div>
@foreach($possible_duplicate_patients as $patient)
<div class="row">
<div class="col-md-3">
<h4><strong>{{ __('patients.name') }}: </strong><font style="color: blue">{!! insurance_flag($patient->id) !!}</font></h4>
<a class="img" href="#modal-photo" data-toggle="modal" style="color: whitesmoke">
@if(!is_null($patient->photo) && $patient->photo != "")
<img src='{{ asset($patient->photo) }}' class="img-rounded center" alt='Photo not available' />
@else
<img src="/uploads/streamline_images/person-place-holder.jpg" class="img-rounded center" style='height: 120px; width: 50%' alt='Photo not available' />
@endif
</a>
<hr>
<a href="/patient_episodes/set_patient_id/{{ $patient->id }}" class="btn btn-success btn-sm" >{{ __('patients.select_patient_history') }}</a>
<br><br>
<a class="btn btn-info btn-sm merge-record" onclick="mergeRecord({{ $patient->id }})">{{ __('patients.merge_records') }}</a>
</div>
<div class="col-md-4">
<table class="table-bordered table-condensed table-striped">
<tbody>
<tr>
<th><b>{{ __('patients.patient_number') }}</b></th>
<td>{{ $patient->number }}</td>
</tr>
<tr>
<th><b>{{ __('patients.full_names') }}</b></th>
<td>{{ $patient->first_name }} {{ $patient->last_name }}</td>
</tr>
<tr>
<th><b>{{ __('patients.gender') }}</b></th>
<td>{{ $patient->gender == 1 ? 'Male' : 'Female' }}</td>
</tr>
<tr>
<th class="hidden-phone"><b>{{ __('patients.age') }}</b></th>
<td>{{ get_patients_age($patient->date_of_birth) }}</td>
</tr>
<tr>
<th><b>{{ __('patients.district') }}</b></th>
<td>{{ isset($districts[$patient->district_id]) ? $districts[$patient->district_id] : '' }}</td>
</tr>
<tr>
<th><b>{{ __('patients.county') }}</b></th>
<td>{{ isset($counties[$patient->county_id]) ? $counties[$patient->county_id] : '' }}</td>
</tr>
<tr>
<th><b>{{ __('patients.sub_county') }}</b></th>
<td>{{ isset($subcounties[$patient->subcounty_id]) ? $subcounties[$patient->subcounty_id] : '' }}</td>
</tr>
<tr>
<th><b>{{ __('patients.parish') }}</b></th>
<td>{{ isset($parishes[$patient->parish_id]) ? $parishes[$patient->parish_id] : '' }}</td>
</tr>
<tr>
<th><b>{{ __('patients.village') }}</b></th>
<td>{{ isset($villages[$patient->village_id]) ? $villages[$patient->village_id] : '' }}</td>
</tr>
<tr>
<th><b>{{ __('patients.date_registered') }} :</b></th>
<td>{{streamline_date($patient->created_at) }}</td>
</tr>
</tbody>
</table>
</div>
<div class="col-md-5">
<table class="table-bordered table-condensed table-striped">
<tr>
<th><b>{{ __('patients.phone') }}</b></th>
<td>{{ $patient->phone }}</td>
</tr>
<tr>
<th><b>{{ __('patients.occupation') }}</b></th>
<td>{{ isset($occupations[$patient->occupation_id]) ? $occupations[$patient->occupation_id] : '' }}</td>
</tr>
<tr>
<th><b>{{ __('patients.insurance') }}</b></th>
<td>{{ $patient->insurance_status == 1 ? __('patients.yes') : __('patients.no') }}</td>
</tr>
<tr>
<th><b>{{ __('patients.religion') }}</b></th>
<td>{{ !is_null($patient->religion_id) ? $religions[$patient->religion_id] : '' }}</td>
</tr>
<tr>
<th><b>{{__('patients.next_of_kin')}}</b></th>
<td>{{ $patient->next_of_kin }}</td>
</tr>
<tr>
<th><b>{{ __('patients.next_of_kin_relationship') }}</b></th>
<td>{{ isset($relationships[$patient->next_of_kin_relationship]) ? $relationships[$patient->next_of_kin_relationship] : '' }}</td>
</tr>
<tr>
<th><b>{{__('patients.phone_of_next_of_kin')}}</b></th>
<td>{{ $patient->phone_of_next_of_kin }}</td>
</tr>
<tr>
<th><b>{{ __('patients.last_patient_visit') }} : </b></th>
<td>
@php
$last_episode = \Streamline\Models\PatientEpisode::where('patient_id',$patient->id)->orderBy('created_at', 'desc')->first();
@endphp
@if(!is_null($last_episode))
@php
$diagnosis = null;
$primary_diagnosis_id = get_name($last_episode->id, 'episode_id', 'primary_diagnosis', 'consultations');
if($primary_diagnosis_id != "N/A" && $primary_diagnosis_id != ""){
$diagnosis = \Streamline\Models\Diagnosis::withTrashed()->find($primary_diagnosis_id);
}
@endphp
<strong>{{ __('patients.primary_diagnosis') }} : </strong>{{ !is_null($diagnosis) ? $diagnosis->name : '' }}<br>
<strong>{{ __('patients.comments') }} : </strong>{{ get_name($last_episode->id, 'episode_id', 'comments', 'consultations') }}<br>
@endif
<strong>{{ __('patients.date') }} : </strong> {{ !is_null($last_episode) ? streamline_date($last_episode->created_at) : __('patients.no_visit_yet') }}
</td>
</tr>
</table>
</div>
</div>
<hr>
@endforeach
</div>
@endif
<!-- merge dialog box to allow user select master field value -->
<div class="modal fade" id="selectMasterDialog" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document" style="margin-top: 15%;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="wardDispensationModalLabel1">{{ __('patients.select_master_record_or_fields_to_keep') }} </h4>
</div>
<div class="modal-body">
{{ Form::open(['route' => 'patients.merge_records']) }}
<div class="row">
<div class="col-sm-8" style="padding-right: 1px;">
{{ Form::hidden('original_id', $original_patient->id)}}
<table class="table table-bordered table-striped">
<tbody>
<tr>
<th><strong>{{ __('patients.select_which_values_to_keep') }}</strong></th>
<td><input type="checkbox" name="all_original_fields" id="all_original_fields">{{ __('patients.all_values_from') }} {!! insurance_flag($original_patient->id)!!}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.first_name') }}</font></th>
<td><input type="radio" class="original_radio" name="first_name" value="{{$original_patient->first_name}}"> {{ $original_patient->first_name }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.last_name') }}</font></th>
<td><input type="radio" class="original_radio" name="last_name" value="{{$original_patient->last_name}}"> {{ $original_patient->last_name }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.gender') }}</font></th>
<td><input type="radio" class="original_radio" name="gender" value="{{$original_patient->gender}}"> {{ $original_patient->gender == 1 ? 'Male' : 'Female' }}</td>
</tr>
<tr>
<th class="hidden-phone"><font color="black">{{ __('patients.age') }}</font></th>
<td><input type="radio" class="original_radio" name="dob" value="{{$original_patient->date_of_birth}}">{{ get_patients_age($original_patient->date_of_birth) }}</td>
</tr>
<tr>
<th class="hidden-phone"><font color="black">{{ __('patients.phone') }}</font></th>
<td><input type="radio" class="original_radio" name="phone" value="{{$original_patient->phone}}">{{ $original_patient->phone }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.category') }}</font></th>
<td><input type="radio" class="original_radio" name="category_id" value="{{$original_patient->category_id}}">{{ get_name($original_patient->category_id, "id", "name", "patient_categories") }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.district') }}</font></th>
<td><input type="radio" class="original_radio" name="district_id" value="{{$original_patient->district_id}}">{{ isset($districts[$original_patient->district_id]) ? $districts[$original_patient->district_id] : '' }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.county') }}</font></th>
<td><input type="radio" class="original_radio" name="county_id" value="{{$original_patient->county_id}}">{{ isset($counties[$original_patient->county_id]) ? $counties[$original_patient->county_id] : '' }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.sub_county') }}</font></th>
<td><input type="radio" class="original_radio" name="subcounty_id" value="{{$original_patient->subcounty_id}}">{{ isset($subcounties[$original_patient->subcounty_id]) ? $subcounties[$original_patient->subcounty_id] : '' }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.parish') }}</font></th>
<td><input type="radio" class="original_radio" name="parish_id" value="{{$original_patient->parish_id}}">{{ isset($parishes[$original_patient->parish_id]) ? $parishes[$original_patient->parish_id] : '' }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.village') }}</font></th>
<td><input type="radio" class="original_radio" name="village_id" value="{{$original_patient->village_id}}">{{ isset($villages[$original_patient->village_id]) ? $villages[$original_patient->village_id] : '' }}</td>
</tr>
</tbody>
</table>
</div>
<div class="col-sm-4" style="padding-left: 1px;">
<div class="table-responsive" id="modal_table"></div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success" id="completeMerge">{{ __('patients.complete') }}</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('layout.close') }}</button>
{{ Form::close() }}
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script type="text/javascript">
function mergeRecord(selectedDuplicatePatientId) {
console.log(selectedDuplicatePatientId);
$.ajax({
method: 'POST',
url: '/display_original_and_duplicate_patients',
data: {'patient_id': selectedDuplicatePatientId},
success: function(response){
let responseArray = JSON.parse(response);
$("#modal_table").html(responseArray["html"]);
$("#selectMasterDialog").modal("show");
}
});
}
$('#all_original_fields').change(function() {
if (this.checked === true) {
$(".original_radio").each(function() {
this.checked = true;
});
$(".duplicate_radio").each(function() {
this.checked = false;
});
$("#all_duplicate_fields").attr('checked', false);
} else {
$(".original_radio").each(function() {
this.checked = false;
});
}
});
$("#modal_table").on("change", "#all_duplicate_fields", function (e) {
if (this.checked === true) {
$(".duplicate_radio").each(function() {
this.checked = true;
});
$(".original_radio").each(function() {
this.checked = false;
});
$("#all_original_fields").attr('checked', false); //false for uncheck
} else {
$(".duplicate_radio").each(function() {
this.checked = false;
});
}
});
$('#completeMerge').click(function (e) {
if($("input[name='first_name']").is(':checked') == false){
alert("Please select first name");
e.preventDefault();
};
if($("input[name='last_name']").is(':checked') == false){
alert("Please select last name");
e.preventDefault();
};
if($("input[name='gender']").is(':checked') == false){
alert("Please select gender");
e.preventDefault();
};
if($("input[name='dob']").is(':checked') == false){
alert("Please select age");
e.preventDefault();
};
if($("input[name='district_id']").is(':checked') == false){
alert("Please select residence");
e.preventDefault();
};
});
</script>
@endpush
@@ -1,142 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-6">
<h4 class="page-title">{{ __('patients.confirm_appointment') }}</h4>
</div>
<div class="col-md-6">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patients.dashboard') }}</a></li>
<li><a href="{{ url('/patients/follow_up') }}">{{ __('patients.appointments') }}</a></li>
<li class="active">{{ __('patients.create') }}</li>
</ol>
</div>
</div>
@include('flash::message')
@include('errors.list')
<div class="white-box">
<h4>{{ __('patients.patient_information') }}</h4>
<br>
<div class="row">
<div class="col-md-6">
<p>{{ __('patients.first_name') }}: {{ get_name($appointment->patient_id, 'id', 'first_name', 'patients') }}</p>
<p>{{ __('patients.last_name') }}: {{ get_name($appointment->patient_id, 'id', 'last_name', 'patients') }}</p>
</div>
<div class="col-md-6">
<p>{{ __('patients.patient_number') }}: {{ get_name($appointment->patient_id, 'id', 'number', 'patients') }}</p>
<p>{{ __('patients.phone') }}: {{ get_name($appointment->patient_id, 'id', 'phone', 'patients') }}</p>
</div>
</div>
</div>
<div class="white-box">
<div class="row">
<div class="col-md-6">
<h4>{{ __('patients.previous_details') }}</h4>
<div class="form-group">
{{ Form::label('clinic_allocation', __('patients.assigned_clinic')) }}
@if($appointment->clinic_allocation == 0)
{{ Form::text('clinic_allocation_previous', __('patients.not_assigned'), ['class' => 'form-control col-sm-12 compulsory', 'readonly']) }}
@else
{{ Form::text('clinic_allocation_previous', $clinics[$appointment->clinic_allocation], ['class' => 'form-control col-sm-12 compulsory', 'readonly']) }}
@endif
</div>
<div class="form-group">
{{ Form::label('in_charge', __('patients.assigned_incharge')) }}
@if($appointment->incharge_id == 0)
{{ Form::text('in_charge_previous', __('patients.not_assigned'), ['class' => 'form-control col-sm-12 compulsory', 'readonly']) }}
@else
{{ Form::text('in_charge_previous', get_full_name($appointment->incharge_id, 'id', 'first_name', 'last_name', 'users'), ['class' => 'form-control col-sm-12 compulsory', 'readonly']) }}
@endif
</div>
<div class="form-group">
{{ Form::label('appointment_date_previous',__('patients.appointment_date')) }}
{{ Form::text('appointment_date_previous', streamline_date($appointment->appointment_date), ['class' => 'form-control col-sm-12 compulsory', 'readonly']) }}
</div>
<div class="form-group">
{{ Form::label('appointment_time_previous',__('patients.appointment_time')) }}
{{ Form::text('appointment_time_previous', $appointment->appointment_time, ['class' => 'form-control col-sm-12 compulsory', 'readonly']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('comments_previous',__('patients.comments')) }}
{{ Form::text('comments_previous', $appointment->comments, ['class' => 'form-control col-sm-12 compulsory', 'readonly']) }}
</div>
</div>
<div class="col-md-6">
<h4>{{ __('patients.new_details') }}</h4>
{{ Form::open(['route' => 'patients.save_confirmed_appointment']) }}
{{ Form::hidden('appointment_id', $appointment->id) }}
<div class="form-group">
{{ Form::label('clinic_allocation', __('patients.assign_clinic')) }}
{{ Form::select('clinic_allocation', $clinics, $appointment->clinic_allocation, ['class' => 'form-control col-sm-12 compulsory search_criteria', 'id' => 'clinic_allocation']) }}
</div>
<div class="form-group">
{{ Form::label('in_charge', __('patients.assign_incharge')) }}
<select name="in_charge" class="form-control col-sm-12 compulsory search_criteria">
<option value="0" selected>{{ __('patients.dont_assign_incharge') }}</option>
@foreach($users as $user)
<option value="{{ $user->id }}">{{ $user->first_name }} {{ $user->last_name }}</option>
@endforeach
</select>
</div>
<div class="form-group">
{{ Form::label('appointment_date',__('patients.appointment_date')) }}
<div class="input-group">
{{ Form::text('appointment_date', date('d-m-Y', strtotime($appointment->appointment_date)),['class' => 'compulsory form-control','readonly','id'=>'appointment_date', 'required']) }}
</div>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('appointment_time',__('patients.appointment_time')) }}
{{ Form::time('appointment_time',$appointment->appointment_time,['class' => 'compulsory form-control','required']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('comments',__('patients.comments')) }}
{{ Form::textarea('comments',$appointment->comments,['class' => 'form-control', 'data-error'=>'','id'=>'comments']) }}
<div class="help-block with-errors"></div>
</div>
{{ Form::button(__('patients.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
{{ Form::button(__('patients.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
{{ Form::close() }}
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/js/validator.js') }}"></script>
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script type="text/javascript">
$('#appointment_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy',
});
</script>
@endpush
@@ -1,768 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css"/>
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet"/>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patients.new_patient') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patients.dashboard') }}</a></li>
<li><a href="{{ route('patients.index') }}">{{ __('patients.patients') }}</a></li>
<li class="active">{{ __('patients.register') }}</li>
</ol>
</div>
</div>
<div class="white-box" id="white-box">
@include('flash::message')
{{ Form::open(['route' => 'patients.store','data-toggle'=>'validator']) }}
<div class="row">
<div class="col-sm-4">
<div class="form-group">
{{ Form::label('first_name',__('patients.first_name')) }}
{{ Form::text('first_name','',['class' => 'form-control compulsory', 'required', 'placeholder'=>'Christian name eg Fred', 'id' => 'first_name']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('last_name',__('patients.last_name')) }}
{{ Form::text('last_name','',['class' => 'form-control compulsory', 'required','placeholder'=>'Surname eg Asiimwe', 'id' => 'last_name']) }}
<div class="help-block with-errors"></div>
</div>
<label class="alert alert-danger" id="similar_patients_names" style="display: none"></label>
<div class="form-group">
{{ Form::label('gender',__('patients.gender')) }}
<br>
{{ Form::radio('gender', 1, false, ["required"]) }} {{ __('patients.male') }} &nbsp;&nbsp;
{{ Form::radio('gender', 2, false, ["required"]) }} {{ __('patients.female') }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('national_id',__('patients.national_id')) }}
{{ Form::text('national_id','',['class' => 'form-control','maxlength'=>15]) }}
</div>
<div class="form-group">
{{ Form::label('date_of_birth',__('patients.date_of_birth')) }}
<div class="input-group">
{{ Form::text('date_of_birth','',['class' => 'form-control compulsory','readonly','id'=>'date_of_birth', 'required']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
<div class="help-block with-errors"></div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('age',__('patients.years')) }}
{{ Form::number('age_in_years','0',['class' => 'form-control compulsory','id'=>'age_in_years','min'=>'0','max'=>'120', 'required']) }}
</div>
<div class="help-block with-errors"></div>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
{{ Form::label('age',__('patients.months')) }}
{{ Form::number('age_in_months','0',['class' => 'form-control','id'=>'age_in_months','min'=>'0','max'=>'12']) }}
</div>
</div>
</div>
<div class="form-group">
{{ Form::label('marital_status',__('patients.marital_status')) }}
<br>
@foreach($marital_statuses as $key=>$value)
{{ Form::radio('marital_status', $key,false,[]) }} {{ $value }} &nbsp;&nbsp;
@endforeach
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('religion',__('patients.religion')) }}
{{ Form::select('religion',$religions,'',['class' => 'form-control x']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
{{ Form::label('occupation',__('patients.occupation')) }}
{{ Form::select('occupation',$occupations,'',['class' => 'form-control occupation', 'id' => 'occupation']) }}
<a href="#modal_occupation" data-toggle="modal" id="modal_occupation_link"><font size="1">Add new occupation </font></a>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('next_of_kin',__('patients.next_of_kin')) }}
{{ Form::text('next_of_kin','',['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group" id="kin_div">
<div class="row">
<div class="col-sm-6">
{{ Form::label('next_of_kin_relationship',__('patients.next_of_kin_relationship')) }}
{{ Form::select('next_of_kin_relationship',$relationships,'',['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
<div class="col-sm-6">
{{ Form::label('next_of_kin_phone',__('patients.next_of_kin_phone')) }}
{{ Form::text('next_of_kin_phone','',['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<div class="form-group">
{{ Form::label('phone',__('patients.phone')) }}
{{ Form::text('phone','',['class' => 'form-control compulsory','id' => 'phone', 'required' ]) }}
<div class="help-block with-errors"></div>
</div>
<label class="alert alert-danger" id="similar_phone_number" style="display: none"></label>
<div class="form-group">
{{ Form::label('alternative_phone', 'Alternative Phone Number') }}
{{ Form::text('alternative_phone','',['class' => 'form-control','id' => 'alternative_phone']) }}
</div>
<div class="form-group">
{{ Form::label('phone_owner',__('patients.phone_owner')) }}
<br>
{{ Form::radio('phone_owner','self',false,['id'=>'owned']) }} {{ __('patients.self') }} &nbsp;&nbsp;
{{ Form::radio('phone_owner','other',false,['id'=>'non_owned']) }} {{ __('patients.other') }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group owner_name" style="display: none;">
{{ Form::label("owner_name",__('patients.phone_owner_name')) }}
{{ Form::text('owner_name','',['id'=>'owner_name','class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('patient_category',__('patients.patient_category'))}}
{{ Form::select('patient_category',$patient_categories,'1',['class' => 'form-control compulsory', 'required', 'data-error'=>'']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('company',__('patients.company_slash_employer'))}}
{{ Form::select('company', $companies ,'',['class' => 'form-control', 'data-error'=>'', 'id' => 'company']) }}
<div class="help-block with-errors"></div>
<a href="#modal_company" data-toggle="modal" id="modal_company_link"><font size="1">{{ __('patients.add_new_company') }} </font></a>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
{{ Form::label('language',__('patients.preferred_language')) }}
{{ Form::select('language',['vern'=>'Vernacular','eng'=>'English',],'eng',['class' => 'form-control compulsory', 'required', 'data-error'=>'Select the language']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('citizenship',__('patients.citizenship')) }}
{{ Form::select('citizenship',['1'=>'Ugandan','0'=>'Non Ugandan'],'',['class' => 'form-control compulsory', 'required', 'data-error'=>'Select the language','id' => 'citizenship']) }}
<div class="help-block with-errors"></div>
</div>
<div id="not_ugandan_regions" style="display: none;">
<div class="form-group">
{{ Form::label('country_id',__('patients.country_of_origin')) }}
{{ Form::select('country_id', $countries, '',['class' => 'form-control', 'data-error'=>'Select the country']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div id="ugandan_regions">
<div id="ugandan_regions">
<div class="form-group">
{{ Form::label('residence','Residence') }}
<select class="form-control col-md-12" name="residence" id="residence" style="display: block; width: 100%" required></select>
<div class="help-block with-errors"></div>
<a href="#modal_residence" data-toggle="modal" id="modal_residence_link"><font size="1">{{ __('patients.add_new_residence') }} </font></a>
</div>
</div>
</div>
@if(is_fingerprint_enabled())
<div>
{{ Form::label('fingerprint_template',__('patients.patient_fingerprint')) }}
<div class="fingerprint_box text-center">
<img id="fingerprint_image" height="240" width="220">
</div>
{{ Form::hidden('fingerprint_template', '', ['id' => 'fingerprint_template']) }}
<button type="button" onClick='capture_fingerprint()' class="btn btn-sm btn-primary">{{ __('patients.capture_fingerprint') }}</button>
<p id="scanner_msg"></p>
</div>
@endif
</div>
<div class="col-md-8">
<hr>
</div>
<div class="col-md-4">
{{ Form::button(__('patients.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10', 'id' => 'patients_submit']) }}
{{ Form::button(__('patients.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
</div>
</div>
{{ Form::close() }}
</div>
@endsection
<div class="modal fade" id="modal_occupation" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="exampleModalLabel1">{{ __('patients.register_occupation') }}</h4>
</div>
<div class="modal-body">
<div class="controls">
<input id="new_occupation_name" name="new_occupation_name"
type="text"/>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('patients.cancel') }}</button>
<input type="button" class="btn btn-success" id="submit_new_occupation" value="<?php echo __('patients.save') ?>"/>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal_company" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="exampleModalLabel1">{{ __('patients.register_company') }}</h4>
</div>
<div class="modal-body">
<div class="form-group">
{{ Form::label('company_name', __('patients.company_name')) }}
{{ Form::text('company_name', '', ['class' => 'form-control compulsory', 'id' => 'company_name']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('company_contact', __('patients.contact')) }}
{{ Form::text('company_contact', '', ['class' => 'form-control compulsory', 'id' => 'company_contact']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('company_identifier', __('patients.identifier')) }}
{{ Form::text('company_identifier', '', ['class' => 'form-control', 'id' => 'company_identifier']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('patients.cancel') }}</button>
<a class="btn btn-success" onclick="submitCompany()">{{ __('patients.save') }}</a>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal_residence" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">{{ __('patients.add_new_residence') }}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label>{{ __('patients.district') }}</label>
<div id="district_id_div">{{ Form::select('district_id', $districts, '', ['id'=>'district_id','class'=>'form-control compulsory']) }}</div>
{{ Form::text('new_district_name', '', ['id' => 'new_district_name', 'class' => 'form-control compulsory', 'style' => 'display: none']) }}
<a href="#" id="modal_district_link">{{ __('patients.add_new_district') }}</a>
</div>
<div class="form-group">
<label>{{ __('patients.county') }}</label>
<div id="county_id_div"><select class='form-control' name='county_id' id='county_id'></select></div>
{{ Form::text('new_county_name', '', ['id' => 'new_county_name', 'class' => 'form-control', 'style' => 'display: none']) }}
<a href="#" id="modal_county_link">{{ __('patients.add_new_county') }}</a>
</div>
<div class="form-group">
<label>{{ __('patients.sub_county') }}</label>
<div id="subcounty_id_div"><select class='form-control' name='subcounty_id' id='subcounty_id'></select></div>
{{ Form::text('new_subcounty_name', '', ['id' => 'new_subcounty_name', 'class' => 'form-control', 'style' => 'display: none']) }}
<a href="#" id="modal_subcounty_link">{{ __('patients.add_new_subcounty') }}</a>
</div>
<div class="form-group">
<label>{{ __('patients.parish') }}</label>
<div id="parish_id_div"><select class='form-control' name='parish_id' id='parish_id'></select></div>
{{ Form::text('new_parish_name', '', ['id' => 'new_parish_name', 'class' => 'form-control', 'style' => 'display: none']) }}
<a href="#" id="modal_parish_link">{{ __('patients.add_new_parish') }}</a>
</div>
<div class="form-group">
<label>{{ __('patients.village') }}</label>
{{ Form::text('new_village_name', '', ['id' => 'new_village_name', 'class' => 'form-control compulsory']) }}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('patients.cancel') }}</button>
<a class="btn btn-success" onclick="submitResidenceVillage()">{{ __('patients.save') }}</a>
</div>
</div>
</div>
</div>
<!-- end of residence modals -->
<div class="modal" id="modal_similar_patients" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title text-center"><b>{{ __('patients.similar_patients') }}</b></h4>
</div>
<div class="modal-body">
<div class="table-responsive" id="modal_table"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('patients.close') }}</button>
</div>
</div>
</div>
</div>
@push('scripts')
<!-- pull in select2 for auto searchanble drop downs -->
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
{{-- <script src="{{ asset('elite/js/validator.js') }}"></script> --}}
<script src="{{ asset('js/patients/create.js') }}"></script>
<script src="{{ asset('elite/js/mask.js') }}"></script>
<script type="text/javascript">
function capture_fingerprint() {
$.ajax({
url: '/patients/fetch_fingerprint_from_scanner/',
success: function(response){
let responseArray = JSON.parse(response);
if (responseArray["error_code"] == "0") {
let template = responseArray["template"];
let pngImage = "data:image/png;base64," + responseArray["image"];
$("#fingerprint_image").attr('src', pngImage);
$('#fingerprint_template').val(template);
$('#scanner_msg').text("Fingerprint Captured").css('color', 'green');
} else {
$('#scanner_msg').text("Error Code: " + responseArray["error_code"] + " - Error Message: " + responseArray["error_message"]).css('color', 'red');
}
}
});
}
function submitResidenceVillage() {
let district_id = $("#district_id").val();
let county_id = $("#county_id").val();
let subcounty_id = $("#subcounty_id").val();
let parish_id = $("#parish_id").val();
let new_district_name = $("#new_district_name").val();
let new_county_name = $("#new_county_name").val();
let new_subcounty_name = $("#new_subcounty_name").val();
let new_parish_name = $("#new_parish_name").val();
let new_village_name = $("#new_village_name").val();
if ((district_id === "" && new_district_name === "") || new_village_name === "") {
alert("Please make sure that you fill in a village name and a district");
return false;
}
$.ajax({
method: 'POST',
url: '/patients/quick_add_residence',
data: {
'district_id' : district_id, 'county_id' : county_id, 'subcounty_id' : subcounty_id, 'parish_id' : parish_id, 'new_district_name' : new_district_name,
'new_county_name' : new_county_name, 'new_subcounty_name' : new_subcounty_name, 'new_parish_name' : new_parish_name, 'new_village_name' : new_village_name
},
success: function(response){
$('#residence').append($('<option>', {
value: response,
text: new_village_name
})).val(response);
$('#modal_residence').modal('hide');
},
error: function(jqXHR, textStatus, errorThrown) {
console.log(JSON.stringify(jqXHR));
}
});
}
function submitCompany() {
var company_name = $("#company_name").val();
var company_contact = $("#company_contact").val();
var company_identifier = $("#company_identifier").val();
if ($("#company_name").val() === "" || !$("#company_name").val()) {
alert("Please make sure that you fill in a company name");
return false;
}
if ($("#company_contact").val() === "" || !$("#company_contact").val()) {
alert("Please make sure that you add the company contact");
return false;
}
var data = {'company_name':company_name, 'company_contact': company_contact, 'company_identifier': company_identifier};
$.ajax({
method: 'POST',
url: '/patients/add_company',
data: data,
success: function(response){
if(!isNaN(response)){
//response = last inserted id
$('#company').append($('<option>', {
value: response,
text: company_name
}));
$('#company').val(response);//preselect the newly added referral
$('#modal_company').modal('hide'); //manually hide the modal
} else {
alert("error occurred");
}
},
error: function(jqXHR, textStatus, errorThrown) {
alert(JSON.stringify(jqXHR));
console.log(JSON.stringify(jqXHR));
}
});
}
$('#date_of_birth').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd/mm/yyyy',
endDate: new Date()
});
$('#age_in_years, #age_in_months').on('change', function () {
let years = parseInt($('#age_in_years').val());
let months = parseInt($('#age_in_months').val());
let possibleBirthday = new Date();
if (!isNaN(years) || !isNaN(months)) {
possibleBirthday.setMonth(possibleBirthday.getMonth() - (months + (years * 12)));
$('#date_of_birth').val(format_date(possibleBirthday));
} else {
alert("<?php echo __('patients.valid_number_years')?>")
}
});
function format_date(date) {
let d = new Date(date),
month = '' + (d.getMonth() + 1),
day = '' + d.getDate(),
year = d.getFullYear();
if (month.length < 2) {
month = '0' + month;
}
if (day.length < 2) {
day = '0' + day;
}
return [day, month, year].join('/');
}
$("#date_of_birth").on('change', function () {
var today = new Date();
var birthDate = $(this).val();
var temp_date = birthDate.split("/");
birthDate = new Date(temp_date[2], (temp_date[1] - 1), temp_date[0]);
//calculate years
var age = today.getFullYear() - birthDate.getFullYear();
age = parseInt(age);
var m = today.getMonth() - birthDate.getMonth();
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
age--;
}
//calculate months
var monthBirth = birthDate.getMonth() + 1;
var monthToday = today.getMonth() + 1;
if (monthToday > monthBirth) {
var months = monthToday - monthBirth;
} else if (monthToday == monthBirth) {
var months = 0;
} else if (monthToday < monthBirth) {
var months = monthToday - monthBirth;
months = months + 12;
}
if (months < 10) {
months = '0' + months
}
//set the values
$('#age_in_years').val(age);
$('#age_in_months').val(months);
});
$('#next_of_kin').on('change', function () {
if ($(this).val() != "" && $(this).val() != " ") {
$('#kin_div').show();
} else {
$('#kin_div').hide();
}
});
$('#first_name, #last_name').change(function () {
let first_name = $('#first_name').val();
let last_name = $('#last_name').val();
if (first_name !== "" && last_name !== "") {
$.ajax({
method: 'POST',
url: '/patients/check_duplicate_patients',
data: {'first_name': first_name, 'last_name': last_name},
success: function(response){
let responseArray = JSON.parse(response);
if (responseArray["results_count"] > 0) {
$("#similar_patients_names").text(responseArray["results_count"] + " patient(s) with similar names were found. Click here to view them and avoid duplicate patient records");
$("#similar_patients_names").show();
$("#modal_table").html(responseArray["html"]);
} else {
$("#similar_patients_names").hide();
}
}
});
}
});
$('#phone').change(function () {
let phone = $('#phone').val();
$.ajax({
method: 'POST',
url: '/patients/check_duplicate_patients',
data: {'phone': phone},
success: function(response){
let responseArray = JSON.parse(response);
if (responseArray["results_count"] > 0) {
$("#similar_phone_number").text(responseArray["results_count"] + " patient(s) with similar phone numbers were found. Click to view them");
$("#similar_phone_number").show();
$("#modal_table").html(responseArray["html"]);
} else {
$("#similar_phone_number").hide();
}
}
});
});
$('#similar_patients_names, #similar_phone_number').click(function () {
$('#modal_similar_patients').modal('show');
});
$('#district_id').on('change', function () {
//remove content from all dependant dropdowns
$('#county_id').empty();
$('#subcounty_id').empty();
$('#parish_id').empty();
//get selected value
let id = $('#district_id').val();
$.ajax({
method: 'GET',
url: '/patients/get_counties/' + id,
success: function(response){
$('#county_id').html(response);
}
});
});
$('#county_id').on('change', function () {
$('#subcounty_id').empty();
$('#parish_id').empty();
//get selected value
let id = $('#county_id').val();
$.ajax({
method: 'GET',
url: '/patients/get_subcounties/' + id,
success: function(response){
$('#subcounty_id').html(response);
}
});
});
$('#subcounty_id').on('change', function () {
$('#parish_id').empty();
//get selected value
let id = $('#subcounty_id').val();
$.ajax({
method: 'GET',
url: '/patients/get_parishes/' + id,
success: function(response){
$('#parish_id').html(response);
}
});
});
/* make residence dropdowns searchable */
$('#district_id,#county_id,#subcounty_id,#parish_id,#company,#occupation').select2({
placeholder: "<?php echo __('patients.select')?>",
width: '100%',
});
$('#modal_district_link').click(function () {
if($('#new_district_name').is(":visible")) {
$('#district_id_div').show();
$('#new_district_name').val('').hide();
} else {
$('#new_district_name').show();
$('#district_id_div').val('').hide();
$('#district_id').val('');
}
});
$('#modal_county_link').click(function () {
if($('#new_county_name').is(":visible")) {
$('#county_id_div').show();
$('#new_county_name').val('').hide();
} else {
$('#new_county_name').show();
$('#county_id_div').hide();
$('#county_id').val('');
}
});
$('#modal_subcounty_link').click(function () {
if($('#new_subcounty_name').is(":visible")) {
$('#subcounty_id_div').show();
$('#new_subcounty_name').val('').hide();
} else {
$('#new_subcounty_name').show();
$('#subcounty_id_div').hide();
$('#subcounty_id').val('');
}
});
$('#modal_parish_link').click(function () {
if($('#new_parish_name').is(":visible")) {
$('#parish_id_div').show();
$('#new_parish_name').val('').hide();
} else {
$('#new_parish_name').show();
$('#parish_id_div').hide();
$('#parish_id').val('');
}
});
//$('.select2-selection.select2-selection--single').addClass('form-control');//add class to select2 display
$('.select2-selection.select2-selection--single').css('height', 'calc(3.85rem)');
$('.select2-selection.select2-selection--single').css('padding-top', '5px');
$('.select2-selection__arrow').css('top', '3px');
$("#submit_new_occupation").click(function () {
var new_occupation_name = $("#new_occupation_name").val();
if (new_occupation_name == '') {
alert("<?php echo __('patients.fill_name')?>");
} else {
$.ajax({
type: "POST",
url: "/add_new_occupation_dynamically",
data: {name: new_occupation_name},
cache: false,
success: function (response) {
if (response == 'false') {
alert("<?php echo __('patients.new_occupation_error')?>");
} else {
$('.occupation').append($('<option>', {
value: response,
text: new_occupation_name
}));
$('.occupation').val(response);//preselect the newly added referral
//$('#modal_occupation').hide();
$('#modal_occupation').modal('hide');
}
}
});
}
$("#new_occupation_name").val('');
$("#modal_occupation #close").click();
});
$("#citizenship").click(function(){
var citizenship = $("#citizenship").val();
if (citizenship == 0) {
$("#not_ugandan_regions").show();
$("#ugandan_regions").hide();
} else {
$("#not_ugandan_regions").hide();
$("#ugandan_regions").show();
$("#country_id").val('');
}
});
$('#residence').select2({
placeholder: 'Search residences',
ajax: {
url: '/patients/search_residences',
dataType: 'json',
delay: 250,
processResults: function (data) {
return {
results: $.map(data, function (item) {
return {
text: item.text,
id: item.ids
}
})
};
},
cache: true
}
});
$("#patients_submit").click(function (e) { // make sure that all compulsory fields have been filled out
var empty_compulsory_fields = [];
$("#white-box.compulsory").each(function () {
if ($(this).val() == "") {
var textname = $(this).attr('name');
$(this).focus();
empty_compulsory_fields.push(textname);
$(this).css('border','1px solid #F08080');
}
});
/* check if the array containing empty compulsory fields is not empty then return false */
if (empty_compulsory_fields.length != 0) {
alert("Please fill in all compulsory fields");
console.log(empty_compulsory_fields);
e.preventDefault();
return false;
}
});
</script>
@endpush
@@ -1,145 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-6">
<h4 class="page-title">{{ __('patients.create') }}</h4>
</div>
<div class="col-md-6">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patients.dashboard') }}</a></li>
<li><a href="{{ url('/patients/follow_up') }}">{{ __('patients.appointments') }}</a></li>
<li class="active">{{ __('patients.create') }}</li>
</ol>
</div>
</div>
@include('flash::message')
@include('errors.list')
<div class="row">
<div class="col-sm-6">
<div class="white-box">
<h3 class="box-title m-b-0">{{ __('patients.patient_search') }}</h3>
<div class="form-group">
<select class="patient_full_name form-control" style="width:100%;" name="patient_full_name" id="patient_full_name"></select>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="white-box">
<h3 class="box-title m-b-0">{{ __('patients.patient_information') }}</h3>
<div id="patient_information"></div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-body">
{{ Form::open(['route' => 'patients.save_appointment']) }}
{{ Form::hidden('patient_id', '', ['class' => 'patient_id', 'id' => 'patient_id']) }}
<div class="row">
<div class="col-md-6">
<div class="form-group">
{{ Form::label('clinic_allocation', __('patients.assign_clinic')) }}
{{ Form::select('clinic_allocation', $clinics, '', ['class' => 'form-control col-sm-12 compulsory search_criteria', 'id' => 'clinic_allocation']) }}
</div>
<div class="form-group">
{{ Form::label('in_charge', __('patients.assign_incharge')) }}
<select id="in_charge" class="form-control col-sm-12 compulsory search_criteria">
<option value="0">{{ __('patients.dont_assign_incharge') }}</option>
@foreach($users as $user)
<option value="{{ $user->id }}">{{ $user->first_name }} {{ $user->last_name }}</option>
@endforeach
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
{{ Form::label('appointment_date',__('patients.appointment_date')) }}
<div class="input-group">
{{ Form::text('appointment_date','',['class' => 'compulsory form-control','readonly','id'=>'appointment_date', 'required']) }}
</div>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('appointment_time',__('patients.appointment_time')) }}
{{ Form::time('appointment_time','',['class' => 'compulsory form-control','required']) }}
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<div class="form-group">
{{ Form::label('comments',__('patients.comments')) }}
{{ Form::textarea('comments','',['class' => 'form-control', 'data-error'=>'','id'=>'comments']) }}
<div class="help-block with-errors"></div>
</div>
{{ Form::button(__('patients.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10', 'disabled', 'id' => 'submit_button']) }}
{{ Form::button(__('patients.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
{{ Form::close() }}
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/js/validator.js') }}"></script>
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script type="text/javascript">
$('#appointment_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy',
});
$('.patient_full_name').change(function() {
let id = $('#patient_full_name').val();
$('#patient_id').val(id);
$.ajax({
method: 'GET',
url: "/patients/update_patient_info/" + id,
success: function(response){
$('#patient_information').html(response).show();
},
error: function (error) {
//console.log(error);
}
});
}).select2({
placeholder: "<?php echo "Search by patient name or number" ?>",
ajax: {
url: '/patients/search_patient_by_name_number',
dataType: 'json',
delay: 250,
processResults: function (data) {
return {
results: $.map(data, function (item) {
return {
text: item.first_name + " " + item.last_name + " ("+ item.number + ") " + item.phone,
id: item.id
}
})
};
},
cache: true
}
});
</script>
@endpush
@@ -1,701 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet"/>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patients.edit_patient') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patients.dashboard') }}</a></li>
<li><a href="{{ route('patients.index') }}">{{ __('patients.patients') }}</a></li>
<li class="active">{{ __('patients.edit_patient') }}</li>
</ol>
</div>
<!-- /.col-lg-12 -->
</div>
<div class="row">
<div class="col-md-12">
@include('flash::message')
@foreach ($errors->all() as $error)
<div>
<font color="red">{{ $error }}</font>
</div>
@endforeach
<div class="white-box" id="white-box">
{{ Form::model($patient, ['method' => 'PUT', 'route' => ['patients.update',$patient], 'data-toggle' => 'validator']) }}
<div class="row">
<div class="col-sm-4">
<div class="form-group">
{{ Form::label('first_name',__('patients.first_name')) }}
{{ Form::text('first_name',$patient->first_name,['class' => 'form-control compulsory', 'required', 'data-error'=>'','placeholder'=>'Christian name eg Fred']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('last_name',__('patients.last_name')) }}
{{ Form::text('last_name',$patient->last_name,['class' => 'form-control compulsory', 'required','placeholder'=>'Surname eg Asiimwe']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('gender',__('patients.gender')) }}
<br>
{{ Form::radio('gender', 1, false, ["required"]) }} {{ __('patients.male') }} &nbsp;&nbsp;
{{ Form::radio('gender', 2, false, ["required"]) }} {{ __('patients.female') }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('national_id',__('patients.national_id')) }}
{{ Form::text('national_id', strtoupper($patient->national_id),['class' => 'form-control','maxlength'=>15]) }}
</div>
<div class="form-group">
{{ Form::label('date_of_birth',__('patients.date_of_birth')) }}
<div class="input-group">
{{ Form::text('date_of_birth',$dob,['class' => 'form-control compulsory', 'required','readonly','id'=>'date_of_birth']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
<div class="help-block with-errors"></div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('age',__('patients.years')) }}
{{ Form::number('age_in_years',\Carbon\Carbon::now()->diffInYears($patient->date_of_birth),['class' => 'form-control compulsory','id'=>'age_in_years','min'=>'0', 'max'=>'120']) }}
</div>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
@php
$months = \Carbon\Carbon::now()->diffInMonths($patient->date_of_birth) - (\Carbon\Carbon::now()->diffInYears($patient->date_of_birth) *12);
@endphp
{{ Form::label('age',__('patients.months')) }}
{{ Form::number('age_in_months',$months,['class' => 'form-control','id'=>'age_in_months','min'=>'0','max'=>'12']) }}
</div>
</div>
</div>
<div class="form-group">
{{ Form::label('marital_status',__('patients.marital_status')) }}
<br>
@foreach($marital_statuses as $key=>$value)
{{ Form::radio('marital_status', $key,false,[]) }} {{ $value }} &nbsp;&nbsp;
@endforeach
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('religion',__('patients.religion')) }}
{{ Form::select('religion',$religions,$patient->religion_id,['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
@if( Auth::user()->hasRole('Super Admin'))
<div class="form-group">
{{ Form::label('is_test_patient',__('patients.is_test_patient')) }}
<br>
{{ Form::radio('is_test_patient', 1, $patient->is_test_patient == 1) }} Yes &nbsp;&nbsp;
{{ Form::radio('is_test_patient', 0, $patient->is_test_patient == 0) }} No &nbsp;&nbsp;
<div class="help-block with-errors"></div>
</div>
@endif
</div>
<div class="col-md-4">
<div class="form-group">
{{ Form::label('occupation',__('patients.occupation')) }}
{{ Form::select('occupation',$occupations, $patient->occupation_id,['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('next_of_kin',__('patients.next_of_kin')) }}
{{ Form::text('next_of_kin',$patient->next_of_kin,['class' => 'form-control compulsory','required', 'onchange' => "show('kin_div')"]) }}
</div>
<div class="form-group" id="kin_div">
{{ Form::label('next_of_kin_relationship',__('patients.next_of_kin_relationship')) }}
{{ Form::select('next_of_kin_relationship',$relationships,$patient->next_of_kin_relationship,['class' => 'form-control compulsory']) }}
<br>
{{ Form::label('next_of_kin_phone',__('patients.next_of_kin_phone')) }}
{{ Form::text('next_of_kin_phone',$patient->phone_of_next_of_kin,['class' => 'form-control']) }}
</div>
<div class="form-group">
{{ Form::label('phone',__('patients.phone')) }}
{{ Form::text('phone',$patient->phone,['class' => 'form-control compulsory']) }}
</div>
<div class="form-group">
{{ Form::label('alternative_phone', 'Alternative Phone Number') }}
{{ Form::text('alternative_phone',$patient->alternative_phone,['class' => 'form-control','id' => 'alternative_phone']) }}
</div>
<div class="form-group">
{{ Form::label('phone_owner',__('patients.phone_owner')) }}
<br>
{{ Form::radio('phone_owner','self',($patient->phone_owner == "Self" || $patient->phone_owner == "self") ? 1 : 0,['id'=>'owned']) }} {{ __('patients.self') }} &nbsp;&nbsp;
{{ Form::radio('phone_owner','other',$patient->phone_owner != "Self" ? 1 : 0,['id'=>'non_owned']) }} {{ __('patients.other') }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group owners_name">
{{ Form::label("owner_name",__('patients.phone_owner_name')) }}
{{ Form::text('owner_name',$patient->phone_owner,['id'=>'owner_name','class' => 'form-control compulsory']) }}
</div>
<!-- <div class="form-group">
{{ Form::label('lc_one',__('patients.lc_one')) }}
{{ Form::text('lc_one',$patient->lc_one,['class' => 'form-control', 'data-error'=>'LC 1 chairman\'s name']) }}
<div class="help-block with-errors"></div>
</div> -->
<div class="form-group">
{{ Form::label('patient_category',__('patients.patient_category'))}}
{{ Form::select('patient_category',$patient_categories,$patient->category_id,['class' => 'form-control compulsory', 'required', 'data-error'=>'']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('company',__('patients.company_slash_employer'))}}
{{ Form::select('company', $companies ,$patient->company_id,['class' => 'form-control', 'data-error'=>'', 'id' => 'company']) }}
<div class="help-block with-errors"></div>
<a href="#modal_company" data-toggle="modal" id="modal_company_link"><font size="1">{{ __('patients.add_new_company') }} </font></a>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
{{ Form::label('language',__('patients.preferred_language')) }}
{{ Form::select('language',['' => '- select -','eng'=>'English','vern'=>'Vernacular'],$patient->language,['class' => 'form-control compulsory', 'required', 'data-error'=>'Select the language']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('citizenship',__('patients.citizenship')) }}
{{ Form::select('citizenship',['' => '- Select -','1'=>'Ugandan','0'=>'Non Ugandan'],$patient->citizenship,['class' => 'form-control compulsory', 'required', 'data-error'=>'Select the language','id' => 'citizenship']) }}
<div class="help-block with-errors"></div>
</div>
<div id="not_ugandan_regions" @if($patient->citizenship == 1) style="display: none" @endif>
<div class="form-group">
{{ Form::label('country_id',__('patients.country_of_origin')) }}
{{ Form::select('country_id', $countries, $patient->country_id, ['class' => 'form-control', 'data-error'=>'Select the country']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div id="ugandan_regions" @if($patient->citizenship == 0) style="display: none" @endif>
<div id="ugandan_regions">
<div class="form-group">
{{ Form::label('residence','Residence') }}
<select class="form-control col-md-12" name="residence" id="residence" style="display: block; width: 100%" required>
@if(!is_null($patient->address_details))
@php
$residence_array = explode(",", $patient->address_details);
$district_id = isset($residence_array[4]) ? $residence_array[4] : 0;
$county_id = isset($residence_array[3])? $residence_array[3] : 0;
$subcounty_id = isset($residence_array[2]) ? $residence_array[2] : 0;
$parish_id = isset($residence_array[1]) ? $residence_array[1] : 0;
$village_id = isset($residence_array[0]) ? $residence_array[0] : 0;
@endphp
<option value="{{ $patient->address_details }}">{{ __('patients.village') }}: {{ get_name($village_id, "id", "name", "villages") }} {{ __('patients.district') }}: {{ get_name($district_id, "id", "name", "districts") }}</option>
@endif
</select>
<div class="help-block with-errors"></div>
<a href="#modal_village_residence" data-toggle="modal" id="modal_village_residence_link"><font size="1">{{ __('patients.add_new_residence') }} </font></a>
</div>
</div>
</div>
@if(is_fingerprint_enabled())
<div>
{{ Form::label('fingerprint_template', __('patients.patient_fingerprint')) }}
<div class="fingerprint_box text-center">
<img id="fingerprint_image" height="240" width="220">
</div>
{{ Form::hidden('fingerprint_template', '', ['id' => 'fingerprint_template']) }}
<button type="button" onClick='capture_fingerprint()' class="btn btn-sm btn-primary">{{ __('patients.capture_fingerprint') }}</button>
<p id="scanner_msg"></p>
</div>
@endif
</div>
<div class="col-md-8"><hr></div>
<div class="col-md-4">
{{ Form::button(__('patients.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10', 'id' => 'patients_submit']) }}
{{ Form::button(__('patients.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
{{ Form::close() }}
@if (!in_array($patient->id, $episodes))
<form action="{{url('patients', [$patient->id])}}" method="POST" style="float: right;">
<input type="hidden" name="_method" value="<?php echo __('patients.delete') ?>">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input href="#modal_reason" data-toggle="modal" id="modal_reason_link" type="button" class="btn btn-danger" value="<?php echo __('patients.deactivate_patient') ?>" />
</form>
@endif
</div>
</div>
</div>
</div>
</div>
<!-- Reason for Patient De-activation modal -->
<div class="modal fade" id="modal_reason" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="exampleModalLabel1">{{ __('patients.reason_for_deactivating_patient') }}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<input class="form-control compulsory" id="patient_deactivation_reasons" name="patient_deactivation_reasons" type="text" cols="44" rows="5"/>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('patients.cancel') }}</button>
<button type="button" class="btn btn-danger" onclick="submitDeactivationReason()"><?php echo __('patients.deactivate_patient') ?></button>
</div>
</div>
</div>
</div>
<!-- new residence modals (add village + add district) -->
<div class="modal fade" id="modal_village_residence" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="exampleModalLabel1">{{ __('patients.add_new_residence') }}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label>{{ __('patients.district') }}</label>
{{ Form::select('residence_district_name', $districts, '', ['id'=>'residence_district_name','class'=>'form-control compulsory']) }}
<a id="modal_district_residence_link" style="cursor: pointer;"><font size="1">{{ __('patients.add_new_district') }} </font></a>
</div>
<div class="form-group">
<label>{{ __('patients.village') }}</label>
<input class="form-control compulsory" id="new_residence_village_name" name="new_residence_village_name" type="text"/>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('patients.cancel') }}</button>
<a class="btn btn-success" onclick="submitResidenceVillage()">{{ __('patients.save') }}</a>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal_district_residence" tabindex="-1" role="dialog" style="padding-top: 50px;">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="exampleModalLabel1">{{ __('patients.add_new_residence') }}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label>{{ __('patients.district') }}</label>
<input class="form-control compulsory" id="new_residence_district_name" name="new_residence_district_name" type="text"/>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('patients.cancel') }}</button>
<a class="btn btn-success" onclick="submitResidenceDistrict()">{{ __('patients.save') }}</a>
</div>
</div>
</div>
</div>
<!-- end of residence modals -->
<div class="modal fade" id="modal_company" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="exampleModalLabel1">{{ __('patients.register_company') }}</h4>
</div>
<div class="modal-body">
<div class="form-group">
{{ Form::label('company_name', __('patients.company_name')) }}
{{ Form::text('company_name', '', ['class' => 'form-control compulsory', 'id' => 'company_name']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('company_contact', __('patients.contact')) }}
{{ Form::text('company_contact', '', ['class' => 'form-control compulsory', 'id' => 'company_contact']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('company_identifier', __('patients.identifier')) }}
{{ Form::text('company_identifier', '', ['class' => 'form-control', 'id' => 'company_identifier']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('patients.cancel') }}</button>
<a class="btn btn-success" onclick="submitCompany()">{{ __('patients.save') }}</a>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<!-- <script src="{{ asset('elite/js/validator.js') }}"></script> -->
<!-- pull in select2 for auto searchanble drop downs -->
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<!-- Date Picker Plugin JavaScript -->
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('elite/js/mask.js') }}"></script>
<script type="text/javascript">
let patient_id = <?php echo $patient->id; ?>;
function capture_fingerprint() {
$.ajax({
url: '/patients/fetch_fingerprint_from_scanner/',
success: function(response){
let responseArray = JSON.parse(response);
if (responseArray["error_code"] == "0") {
let template = responseArray["template"];
let pngImage = "data:image/png;base64," + responseArray["image"];
$("#fingerprint_image").attr('src', pngImage);
$('#fingerprint_template').val(template);
$('#scanner_msg').text("Fingerprint Captured").css('color', 'green');
} else {
$('#scanner_msg').text("Error Code: " + responseArray["error_code"] + " - Error Message: " + responseArray["error_message"]).css('color', 'red');
}
}
});
}
function submitResidenceDistrict(){
var new_residence_district_name = $("#new_residence_district_name").val();
if ($("#new_residence_district_name").val() === "" || !$("#new_residence_district_name").val()) {
alert("Please make sure that you fill in a district name");
return false;
}
var data = {'new_residence_district_name':new_residence_district_name};
$.ajax({
method: 'POST',
url: '/patients/quick_add_district_residence',
data: data,
success: function(response){
if(!isNaN(response)){
//response = last inserted id
$('#residence_district_name').append($('<option>', {
value: response,
text: new_residence_district_name
}));
$('#residence_district_name').val(response);//preselect the newly added
$('#modal_district_residence').modal('hide'); //manually hide the modal
$('#modal_village_residence').modal('show');
} else {
alert("error occurred");
}
},
error: function(jqXHR, textStatus, errorThrown) {
alert(JSON.stringify(jqXHR));
console.log(JSON.stringify(jqXHR));
}
});
}
function submitResidenceVillage() {
var residence_district_name = $("#residence_district_name").val();
var new_residence_village_name = $("#new_residence_village_name").val();
if ($("#new_residence_village_name").val() === "" || !$("#new_residence_village_name").val() || !$("#residence_district_name").val()) {
alert("Please make sure that you fill in a village name and a district");
return false;
}
var data = {'residence_district_name':residence_district_name, 'new_residence_village_name':new_residence_village_name};
var district_village_ids = "";
$.ajax({
method: 'POST',
url: '/patients/quick_add_village_residence',
data: data,
success: function(response){
if(!isNaN(response)){
//response = newly created village. Now create residence string i.e village,parish etc
district_village_ids = response+",0"+",0"+",0,"+residence_district_name;
$('#residence').append($('<option>', {
value: district_village_ids,
text: new_residence_village_name
}));
$('#residence').val(district_village_ids);//preselect the newly added
$('#modal_village_residence').modal('hide'); //manually hide the modal
} else {
alert("error occurred");
}
},
error: function(jqXHR, textStatus, errorThrown) {
alert(JSON.stringify(jqXHR));
console.log(JSON.stringify(jqXHR));
}
});
}
function submitDeactivationReason(){
var reason = $("#patient_deactivation_reasons").val();
if ($("#patient_deactivation_reasons").val() === "" || !$("#patient_deactivation_reasons").val()) {
alert("Please fill in the reason for deleting the Patient");
return false;
}
var data = {'patient_deactivation_reasons':reason, 'patient_id': patient_id};
$.ajax({
method: 'POST',
url: '/patients/delete_patient_with_reason',
data: data,
success: function(response){
if (response==1){
window.location.href = "/patients";
} else {
alert("error occurred");
}
},
error: function(jqXHR, textStatus, errorThrown) {
alert(JSON.stringify(jqXHR));
console.log(JSON.stringify(jqXHR));
}
});
}
function submitCompany(){
var company_name = $("#company_name").val();
var company_contact = $("#company_contact").val();
var company_identifier = $("#company_identifier").val();
if ($("#company_name").val() === "" || !$("#company_name").val()) {
alert("Please make sure that you fill in a company name");
return false;
}
if ($("#company_contact").val() === "" || !$("#company_contact").val()) {
alert("Please make sure that you add the company contact");
return false;
}
var data = {'company_name':company_name, 'company_contact': company_contact, 'company_identifier': company_identifier};
$.ajax({
method: 'POST',
url: '/patients/add_company',
data: data,
success: function(response){
if(!isNaN(response)){
//response = last inserted id
$('#company').append($('<option>', {
value: response,
text: company_name
}));
$('#company').val(response);//preselect the newly added referral
$('#modal_company').modal('hide'); //manually hide the modal
} else {
alert("error occurred");
}
},
error: function(jqXHR, textStatus, errorThrown) {
alert(JSON.stringify(jqXHR));
console.log(JSON.stringify(jqXHR));
}
});
}
$('#owned').on("click", function () {
$('.owners_name').hide();
$('#owner_name').val('');
});
$('#non_owned').on("click", function () {
$('.owners_name').show();
});
$('#h_contact_yes').on("click", function () {
$('.hosp_contact_div').show();
});
$('#h_contact_no').on("click", function () {
$('.hosp_contact_div').hide();
$('#hospital_contact').val('');
});
jQuery('#date_of_birth').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd/mm/yyyy',
endDate: new Date()
});
$('#age_in_years, #age_in_months').on('change', function () {
let years = parseInt($('#age_in_years').val());
let months = parseInt($('#age_in_months').val());
let possibleBirthday = new Date();
if (!isNaN(years) || !isNaN(months)) {
possibleBirthday.setMonth(possibleBirthday.getMonth() - (months + (years * 12)));
$('#date_of_birth').val(format_date(possibleBirthday));
} else {
alert("<?php echo __('patients.valid_number_years')?>")
}
});
function format_date(date) {
let d = new Date(date),
month = '' + (d.getMonth() + 1),
day = '' + d.getDate(),
year = d.getFullYear();
if (month.length < 2) {
month = '0' + month;
}
if (day.length < 2) {
day = '0' + day;
}
return [day, month, year].join('/');
}
$("#date_of_birth").on('change', function () {
var today = new Date();
var birthDate = $(this).val();
var temp_date = birthDate.split("/");
birthDate = new Date(temp_date[2],(temp_date[1] - 1),temp_date[0]);
//calculate years
var age = today.getFullYear() - birthDate.getFullYear();
age = parseInt(age);
var m = today.getMonth() - birthDate.getMonth();
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
age--;
}
//calculate months
var monthBirth = birthDate.getMonth() + 1;
var monthToday = today.getMonth() + 1;
if (monthToday > monthBirth) {
var months = monthToday - monthBirth;
} else if (monthToday == monthBirth) {
var months = 0;
} else if (monthToday < monthBirth) {
var months = monthToday - monthBirth;
months = months + 12;
}
if (months < 10) {
months = '0' + months
}
//set the values
$('#age_in_years').val(age);
$('#age_in_months').val(months);
});
$('#next_of_kin').on('change', function () {
if ($(this).val() != "" && $(this).val() != " ") {
$('#kin_div').show();
} else {
$('#kin_div').hide();
}
});
/* make residence drop downs searchable */
$('#company').select2({
placeholder: "-- select --"
});
//$('.select2-selection.select2-selection--single').addClass('form-control');//add class to select2 display
$('.select2-selection.select2-selection--single').css('height','calc(3.85rem)');
$('.select2-selection.select2-selection--single').css('padding-top','5px');
$('.select2-selection__arrow').css('top','3px');
$("#citizenship").click(function(){
var citizenship = $("#citizenship").val();
if (citizenship == 0) {
$("#not_ugandan_regions").show();
$("#ugandan_regions").hide();
} else {
$("#not_ugandan_regions").hide();
$("#ugandan_regions").show();
}
});
$('#residence').select2({
placeholder: 'Search residences',
ajax: {
url: '/patients/search_residences',
dataType: 'json',
delay: 250,
processResults: function (data) {
return {
results: $.map(data, function (item) {
return {
text: item.text,
id: item.ids
}
})
};
},
cache: true
}
});
$("#patients_submit").click(function (e) { // make sure that all compulsory fields have been filled out
var empty_compulsory_fields = [];
$("#white-box.compulsory").each(function () {
if ($(this).val() == "") {
var textname = $(this).attr('name');
$(this).focus();
empty_compulsory_fields.push(textname);
$(this).css('border','1px solid #F08080');
}
});
/* check if the array containing empty compulsory fields is not empty then return false */
if (empty_compulsory_fields.length != 0) {
alert("Please fill in all compulsory fields");
console.log(empty_compulsory_fields);
e.preventDefault();
return false;
}
});
</script>
@endpush
@@ -1,262 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('fullcalendar/packages/core/main.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('fullcalendar/packages/daygrid/main.css') }}" rel="stylesheet" />
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patients.appointments') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patients.dashboard') }}</a></li>
<li><a href="{{ route('patients.index') }}">{{ __('patients.patients') }}</a></li>
<li class="active">{{ __('patients.appointments') }}</li>
</ol>
</div>
</div>
<div class="white-box">
@include('flash::message')
<div class="row">
<div class="col-md-6">
<a href="{{ url('/patients/appointment_requests') }}" class="btn btn-success">{{ __('patients.view_appointment_requests') }}</a>
</div>
<div class="col-md-6">
<a href="{{ url('/patients/create_appointment') }}" class="btn btn-success pull-right">{{ __('patients.create_new_appointment') }}</a>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-4">
<div class="form-group">
{{ Form::label('clinic_allocation', __('patients.clinic_allocation')) }}
{{ Form::select('clinic_allocation', $clinics, '', ['class' => 'form-control col-sm-12 compulsory search_criteria', 'id' => 'clinic_allocation']) }}
</div>
</div>
<div class="col-md-4">
<div class="form-group">
{{ Form::label('in_charge', __('patients.incharge')) }}
<select id="in_charge" class="form-control col-sm-12 compulsory search_criteria">
<option value="0">{{ __('patients.all_staff') }}</option>
@foreach($users as $user)
<option value="{{ $user->id }}">{{ $user->first_name }} {{ $user->last_name }}</option>
@endforeach
</select>
</div>
</div>
</div>
<div id='calendar'></div>
<br><br>
<p>{{ __('patients.search_criteria') }} <code id="search_criteria_text">{{ __('patients.all') }}</code></p>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>{{ __('patients.patient_name') }}</th>
<th>{{ __('patients.clinic') }}</th>
<th>{{ __('patients.incharge') }}</th>
<th>{{ __('patients.appointment_time') }}</th>
<th>{{ __('patients.patient_contact') }}</th>
<th>{{ __('patients.comments') }}</th>
<th></th>
</tr>
</thead>
<tbody id="patients_table"></tbody>
</table>
</div>
</div>
<div class="modal" id="modal_select_actions" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">{{ __('patients.select_actions') }}</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-3">
<button class="btn btn-success btn-rounded" data-toggle="modal" id="startAppWithClinicBtn">{{ __('layout.start_appointment_with_clinic') }}</button>
</div>
<div class="col-md-3">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="btn btn-success btn-rounded" onclick="displayActivationModel()">{{ __('patients.start_appointment') }}</a>
</div>
<div class="col-md-3">
<a class="btn btn-warning btn-rounded" onclick="reschedule_appointment()">{{ __('patients.reschedule_appointment') }}</a>
</div>
<div class="col-md-3">
<a class="btn btn-danger btn-rounded" onclick="cancel_appointment()">{{ __('patients.cancel_appointment') }}</a>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- start an appointment with a clinic and a doctor option -->
<div class="modal fade" id="startAppointmentWithClinicModal" tabindex="-1" role="dialog" aria-labelledby="appointmentWithDoctorAndClinicLabel1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="appointmentWithDoctorAndClinicLabel1">{{ __('patient_episode.doctor_and_clinic_allocation') }}</h4>
</div>
<div class="modal-body">
{{ Form::open(['route' => 'patient_episodes.start_appointment_with_doctor_and_clinic']) }}
{{ Form::hidden('patient_id', 0, ['id' => 'selected_patient_id']) }}
{{ Form::hidden('selected_appointment_id', 0, ['id' => 'selected_appointment_id']) }}
<div class="form-group">
{{ Form::label('special_clinic_id', __('layout.select_clinic')) }}
{{ Form::select('special_clinic_id', $special_clinics, '', ['class' => 'form-control', 'required' => 'true'])}}
</div>
<div class="form-group">
{{ Form::label('allocated_services_id_with_doctor_id', __('patient_episode.doctor_allocation')) }}
{{ Form::select('allocated_services_id_with_doctor_id', $users_array, '', ['class' => 'form-control appWithClinicDoctorDropDown'])}}
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success btn-sm" onclick="return confirm('<?php echo __('patient_episode.are_you_sure_doctor_and_clinic'); ?>');">{{ __('patient_episode.continue_allocation') }}</button>
{{ Form::close() }}
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">{{ __('layout.close') }}</button>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('fullcalendar/packages/core/main.js') }}"></script>
<script src="{{ asset('fullcalendar/packages/interaction/main.js') }}"></script>
<script src="{{ asset('fullcalendar/packages/daygrid/main.js') }}"></script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script type="text/javascript">
let clinic_id = -1;
let user_id = 0;
let selected_date_search = "2020-01-01";
let selectedPatientId = 0;
let appointmentId = 0;
function reschedule_appointment() {
if (confirm("<?php echo __('patients.reschedule_appointment_warning')?>")) {
window.location.href = "/patients/reschedule_appointment/" + appointmentId;
}
}
function cancel_appointment() {
if (confirm("<?php echo __('patients.cancel_appointment_warning')?>")){
$.ajax({
method: 'GET',
url: '/patients/cancel_patient_appointment/' + appointmentId,
success: function(response){
if(response == 1) {
alert("<?php echo __('patients.appointment_cancelled')?>");
$("#modal_select_actions").modal("hide");
fetch_patients();
} else {
alert("<?php echo __('patients.cancel_appointment_failed')?>");
}
}
});
}
}
function displayAppointmentActions(patientId, appointment_id) {
selectedPatientId = patientId;
appointmentId = appointment_id;
$("#modal_select_actions").modal("show");
}
function displayActivationModel(){
window.location.href = "/patients/complete_appointment/" + appointmentId;
}
$('#startAppWithClinicBtn').click(function(e) {
$('#modal_select_actions').modal('hide');
$('#selected_appointment_id').val(appointmentId);
$('#selected_patient_id').val(selectedPatientId);
$('#startAppointmentWithClinicModal').modal('show');
});
$('.appWithClinicDoctorDropDown').select2({
placeholder: "Select",
width: "100%",
dropdownParent: $('#startAppointmentWithClinicModal')
});
document.addEventListener('DOMContentLoaded', function() {
$('#clinic_allocation, #in_charge').select2({
//
});
// ever felt like you're spelling a word wrong and auto-correct is taking it's sweet vacation time!
$('.search_criteria').change(function () {
user_id = $('#in_charge').val();
clinic_id = $('#clinic_allocation').val();
let user_name = $('#in_charge').find('option:selected').text();
let clinic_name = $('#clinic_allocation').find('option:selected').text();
let text = "<?php echo __('patients.clinic')?>: " + clinic_name + " | <?php echo __('patients.user')?>: " + user_name;
$('#search_criteria_text').text(text);
fetch_patients();
});
let calendarEl = document.getElementById('calendar');
let calendar = new FullCalendar.Calendar(calendarEl, {
plugins: [ 'interaction', 'dayGrid','bootstrap' ],
themeSystem: 'bootstrap',
height: 100,
selectable: true,
select: function(arg) {
selected_date_search = arg.start.getFullYear() + "-" + (arg.start.getMonth() + 1) + "-" + arg.start.getDate();
fetch_patients();
},
editable: true,
eventLimit: true,
events: <?php echo json_encode($calender_dates); ?>
});
calendar.render();
$(".fc-day-header").css("background", "#43c392");
$(".fc-button").click(function () {
$(".fc-day-header").css("background", "#43c392");
});
});
function fetch_patients() {
$.ajax({
type: "POST",
url: "/patients/follow_up_fetch_patients",
data: {
selected_date: selected_date_search,
clinic_id: clinic_id,
user_id: user_id
},
cache: false,
success: function (response) {
$('#patients_table').html(response);
}/*,
error: function(xhr, status, error) {
alert(xhr.responseText);
}*/
});
}
</script>
@endpush
@@ -1,125 +0,0 @@
@extends('layouts.main')
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patients.view') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patients.dashboard') }}</a></li>
<li><a href="{{ route('patients.index') }}">{{ __('patients.patients') }}</a></li>
<li class="active">{{ __('patients.view') }}</li>
</ol>
</div>
<!-- /.col-lg-12 -->
</div>
<div class="white-box">
<div class="row">
<div class="col-md-3">
<form action="{{ route('patients.search') }}" method="POST" role="search">
{{ csrf_field() }}
<div class="input-group">
<input type="text" class="form-control" name="number" placeholder="Patient number">
<!--<span class="input-group-btn">-->
<button type="submit" class="btn btn-success"><span class="glyphicon glyphicon-search"></span></button>
<!--</span>-->
</div>
</form>
</div>
<div class="col-md-3">
<form action="{{ route('patients.search') }}" method="POST" role="search">
{{ csrf_field() }}
<div class="input-group">
<input type="text" class="form-control" name="first_name" placeholder="First name">
<!--<span class="input-group-btn">-->
<button type="submit" class="btn btn-success"><span class="glyphicon glyphicon-search"></span></button>
<!--</span>-->
</div>
</form>
</div>
<div class="col-md-3">
<form action="{{ route('patients.search') }}" method="POST" role="search">
{{ csrf_field() }}
<div class="input-group">
<input type="text" class="form-control" name="last_name" placeholder="Last name">
<!--<span class="input-group-btn">-->
<button type="submit" class="btn btn-success"><span class="glyphicon glyphicon-search"></span></button>
<!--</span>-->
</div>
</form>
</div>
<div class="col-md-1"></div>
<div class="col-md-2">
<div class="text-center label-info btn-rounded">
<p class="text-white">{{ $PatientCount }} {{ __('patients.patients') }}</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
@if(isset($criteria) && isset($resultCount))
<p>{{ __('patients.search_criteria') }} : <code>{{ $criteria }}</code> &nbsp;&nbsp;&nbsp;{{ __('patients.total_results') }} : <code>{{ $resultCount }}</code> &nbsp;&nbsp;&nbsp;<a href="{{ route('patients.index') }}">{{ __('patients.clear_search') }}</a></p>
@endif
<div class="white-box">
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table table-striped table-hover">
<thead>
<tr>
<th>{{ __('patients.patient_number') }}</th>
<th>{{ __('patients.full_names') }}</th>
<th>{{ __('patients.gender') }}</th>
<th>{{ __('patients.age') }}</th>
<th>{{ __('patients.phone') }}</th>
<th>{{ __('patients.category') }}</th>
<th>{{ __('patients.marital_status') }}</th>
<th>{{ __('patients.deleted_by') }}</th>
<th>{{ __('patients.deleted_on') }}</th>
<th>{{ __('patients.reason_for_deactivation') }}</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@if(count($patients) > 0)
@foreach($patients as $patient)
@php $dob = new Carbon\Carbon($patient->date_of_birth); @endphp
<tr>
<td>{{ $patient->number }}</td>
<td>{{ $patient->first_name." ".$patient->last_name }}</td>
<td>
@if($patient->gender == 1)
{{ __('patients.male') }}
@else
{{ __('patients.female') }}
@endif
</td>
<td>{{ $dob->diffInYears(Carbon\Carbon::now()) }}yrs</td>
<td>{{ $patient->phone }}</td>
<td>{{ isset($categories[$patient->category_id]) ? $categories[$patient->category_id] : "N/A" }}</td>
<td>{{ isset($marital_statuses[$patient->marital_status]) ? $marital_statuses[$patient->marital_status] : null }}</td>
<td>{{ is_null($patient->deleted_by) ? get_full_name(get_name($patient->id, 'patient_id','created_by', 'patient_deactivation_reasons'), "id", "first_name", "last_name", "users") : get_full_name($patient->deleted_by, "id", "first_name", "last_name", "users")}}</td>
<td>{{ streamline_date_time($patient->deleted_at)}}</td>
<td>{{ get_name($patient->id, 'patient_id','reason', 'patient_deactivation_reasons') }}</td>
<td><a href="/patients/{{ $patient->id }}/" class="fcbtn btn btn-outline btn-info btn-rounded"><i class="fa fa-info"></i> {{ __('patients.details') }}</a></td>
<td>
{{ Form::model($patient->id ,['method' => 'POST', 'route' => ['patients.activate', $patient->id]]) }}
<button type="submit" class="btn btn-warning btn-rounded" onclick="return confirm('<?php echo __('patients.are_you_sure') ?>')"><i class="fa fa-check"></i> {{ __('patients.activate') }}</button>
{{ Form::close() }}
</td>
</tr>
@endforeach
@else
<tr class="warning"><td class="center" colspan="8">{{ __('patients.no_records_found') }}</td></tr>
@endif
</tbody>
</table>
</div>
{{ $patients->links() }}
</div>
</div>
</div>
@endsection
@@ -1,286 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<link href="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patients.view') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patients.dashboard') }}</a></li>
<li><a href="{{ route('patients.index') }}">{{ __('patients.patients') }}</a></li>
<li class="active">{{ __('patients.view') }}</li>
</ol>
</div>
</div>
<div class="white-box">
@include('flash::message')
{{ Form::open(['route' => 'patients.search', 'method' => 'ANY', 'role' => 'search']) }}
<div class="row">
<div class="col-md-2">
<div class="form-group" id="patient_numbers">
{{ Form::text('number', '', ['class' => 'form-control typeahead', 'placeholder' => 'Patient number', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
{{-- <div class="col-md-2">
<div class="form-group" id="first_names">
{{ Form::text('first_name', '', ['class' => 'form-control typeahead', 'placeholder' => 'First name', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-2">
<div class="form-group" id="last_names">
{{ Form::text('last_name', '', ['class' => 'form-control typeahead', 'placeholder' => 'Last name', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div> --}}
<div class="col-md-4">
<div class="form-group" id="full_names">
{{ Form::text('full_name', '', ['class' => 'form-control typeahead', 'placeholder' => 'Patient Name', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-2">
<div class="form-group" id="villages">
{{ Form::text('village', '', ['class' => 'form-control typeahead', 'placeholder' => 'Village', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-4">
<button type="submit" class="btn btn-rounded btn-success"><span class="glyphicon glyphicon-search"></span> {{ __('patients.search') }}</button>
<span class="label label-info float-right" style="font-size: 12.5px;"> {{ $patientCount }} {{ __('patients.patients_registered') }}</span>
</div>
</div>
@if(isset($criteria) && isset($resultCount))
<p>{{ __('patients.search_criteria') }} : <code>{{ $criteria }}</code> &nbsp;&nbsp;&nbsp;{{ __('patients.total_results') }} : <code>{{ $resultCount }}</code> &nbsp;&nbsp;&nbsp;<a href="{{ route('patients.index') }}">{{ __('patients.clear_search') }}</a></p>
@endif
{{ Form::close() }}
<div class="table-responsive">
<table class="table success-table table-sm table-striped table-hover" style="color: white;">
<thead >
<tr style="background-color: #00c292; color: white;">
<th>{{ __('patients.patient_number') }}</th>
<th>{{ __('patients.full_names') }}</th>
<th>{{ __('patients.gender') }}</th>
<th>{{ __('patients.age') }}</th>
<th>{{ __('patients.phone') }}</th>
<th>{{ __('patients.category') }}</th>
<th>{{ __('patients.village') }}</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@if(count($patients) > 0)
@foreach($patients as $patient)
<tr>
<td>{{ $patient->number }}</td>
<td>{!! insurance_flag($patient->id) !!}</td>
<td>
@if($patient->gender == 1)
{{ __('patients.male') }}
@else
{{ __('patients.female') }}
@endif
</td>
<td>{{ get_patients_age($patient->date_of_birth) }}</td>
<td>{{ $patient->phone }}</td>
<td><?php echo isset($categories[$patient->category_id]) ? $categories[$patient->category_id] : "N/A"; ?></td>
<td>{{ isset($patient_villages[$patient->village_id]) ? $patient_villages[$patient->village_id] : '' }}</td>
<td><a href="/patients/{{ $patient->id }}/" class="btn btn-rounded btn-info btn-sm"><i class="fa fa-info-circle"></i> {{ __('patients.details') }}</a></td>
<td>
<a href="/patients/{{ $patient->id }}/edit/" class="btn btn-warning btn-rounded btn-sm"><i class="fa fa-pencil"></i> {{ __('patients.edit') }}</a>
</td>
<td>
<a href="/patient_episodes/set_patient_id/{{ $patient->id }}" class="btn btn-rounded btn-primary btn-sm"><i class="fa fa-hand-pointer-o"></i> <strong>{{ __('patients.select') }}</strong></a>
</td>
</tr>
@endforeach
@else
<tr class="warning"><td class="center" colspan="10"><code>{{ __('patients.no_records_found') }}</code></td></tr>
@endif
</tbody>
</table>
</div>
{{ $patients->links() }}
</div>
@endsection
@push('scripts')
<!-- Typehead Plugin JavaScript -->
<script src="{{ asset('elite/bower_components/typeahead.js-master/dist/typeahead.bundle.min.js') }}"></script>
<!-- Data table javascript -->
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.colVis.min.js') }}"></script>
<script type="text/javascript">
var substringMatcher = function (strs) {
return function findMatches(q, cb) {
var matches, substringRegex;
// an array that will be populated with substring matches
matches = [];
// regex used to determine if a string contains the substring `q`
substrRegex = new RegExp(q, 'i');
// iterate through the pool of strings and for any string that
// contains the substring `q`, add it to the `matches` array
$.each(strs, function (i, str) {
if (substrRegex.test(str)) {
matches.push(str);
}
});
cb(matches);
};
};
$('#patient_numbers .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'patient_numbers',
source: substringMatcher(<?php echo json_encode($patient_numbers); ?>)
}
);
$('#first_names .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'first_names',
source: substringMatcher(<?php echo json_encode($first_names); ?>)
}
);
$('#last_names .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'last_names',
source: substringMatcher(<?php echo json_encode($last_names); ?>)
}
);
$('#villages .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'villages',
source: substringMatcher(<?php echo json_encode($villages); ?>)
}
);
$('#full_names .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'full_names',
source: substringMatcher(<?php echo json_encode($full_names); ?>)
}
);
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 200,
buttons: [
'copy',
{extend: 'csv',
message: "<php echo __('patients.registered_patients')?>",
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6]
},
},
{extend: 'excel',
message: "<php echo __('patients.registered_patients')?>",
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6]
},
sheetName: "<php echo __('patients.registered_patients')?>"
},
{extend: 'pdf',
message: "<php echo __('patients.registered_patients')?>",
orientation: 'portrait',
pageSize: 'LETTER',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6]
},
customize: function (doc) {
doc.defaultStyle.fontSize = 10;
// doc.styles.tableHeader.alignment = 'left';
}
},
{extend: 'print',
message: "<php echo __('patients.registered_patients')?>",
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6]
},
customize: function (win) {
$(win.document.body)
.css('font-size', '10pt')
.css('background', '#fff')
.prepend(
'<img src="<?php echo asset('uploads/logo/logo-sm.png'); ?>" style="position:absolute; top:0; right:0;" />'
);
$(win.document.body).find('table')
.addClass('compact')
.css('font-size', 'inherit');
}
}
]
});
$('.sorting').removeClass('sorting');//remove the sorting class
$('.sorting_asc').removeClass('sorting_asc');//remove the sorting class
</script>
@endpush
@push('styles')
<style type="text/css">
.color-bordered-table.success-bordered-table {
border-top: 0px;
}
</style>
@endpush
@@ -1,160 +0,0 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ base_path('public/uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'CHI Membership Card - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ base_path('public/bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style style="text-css">
body{
/*font-size: 1.2em;*/
}
thead {
/*display: table-header-group;*/
}
tfoot {
/*display: table-row-group;*/
}
tr {
/*page-break-inside: avoid;*/
}
th{
font-weight: bolder;
font-size: 22px;
color: #fff;
}
td{
font-size: 24px;
padding-top: 5px;
color: #fff;
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div style="background-color: rgb(43, 116, 91); color:#fff">
<div class="hospital-logo" style="padding-top: 10px;">
@include('layouts.header_pdf_print')
</div>
<div class="row" style="padding: 30px;">
<div class="col-12" style="padding-top: 10px;">
<table>
<tr>
<td><u>NAME</u></td>
<td style="padding-left: 15px;"><u>SEX</u></td>
</tr>
<tr>
<th>
{{ get_full_name($patient->id, "id", "first_name", "last_name", "patients") }}
</th>
<th style="padding-left: 15px;">
{{ $patient->gender == 1 ? "MALE" : "FEMALE" }}
</th>
</tr>
<tr>
<td></td>
<td style="padding-left: 15px;"></td>
</tr>
<tr>
<td><u>Stre@mline NUMBER</u></td>
<td style="padding-left: 15px;"><u>DATE OF BIRTH</u></td>
</tr>
<tr>
<th>
{{ $patient->number }}
</th>
<th style="padding-left: 15px;">
{{ streamline_date($patient->date_of_birth) }}
</th>
</tr>
<tr>
<td></td>
<td style="padding-left: 10px;"></td>
</tr>
<tr>
<td><u>NIN</u></td>
<td style="padding-left: 10px;"><u>HOLDER'S SIGNATURE</u></td>
</tr>
<tr>
<th>
{{ $patient->national_id }}
</th>
<th style="padding-left: 10px;">
{{-- signature --}}
</th>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<br><br><br>
<div class="row">
<div class="col-12">
<div style="background-color: rgb(43, 116, 91); padding:10px; padding-top: 120px;">
<table align="center">
<tr>
<td>HOST HEALTH FACILITY &nbsp;&nbsp;</td>
<td>
{{ $hospitalInfo->name }}
</td>
</tr>
<tr>
<td>VILLAGE</td>
<td>
{{ get_name(get_name($patient->id, "id", "village_id", "patients"), "id", "name", "villages") }}
</td>
</tr>
<tr>
<td>DISTRICT</td>
<td>
{{ get_name($patient->district_id, "id", "name", "districts") }}
</td>
</tr>
<tr>
<td colspan="2" style="background-color: #fff">
{{ getDNS1DBarcodePNGOtherOption(sprintf("%04u", $patient->id)) }}
<br>
<h4 style="color: black">{{ sprintf("%04u", $patient->id) }}</h4>
</td>
</tr>
</table>
<div style="text-align: center; color: #fff; padding: 10px; font-size: 22px;">
This card should only be used for identification at a Stre@mline network hospital.
</div>
</div>
</div>
</div>
</div>
</body>
</html>
@@ -1,142 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-6">
<h4 class="page-title">{{ __('patients.reschedule_appointment') }}</h4>
</div>
<div class="col-md-6">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patients.dashboard') }}</a></li>
<li><a href="{{ url('/patients/follow_up') }}">{{ __('patients.appointments') }}</a></li>
<li class="active">{{ __('patients.create') }}</li>
</ol>
</div>
</div>
@include('flash::message')
@include('errors.list')
<div class="white-box">
<h4>{{ __('patients.patient_information') }}</h4>
<br>
<div class="row">
<div class="col-md-6">
<p>{{ __('patients.first_name') }}: {{ get_name($appointment->patient_id, 'id', 'first_name', 'patients') }}</p>
<p>{{ __('patients.last_name') }}: {{ get_name($appointment->patient_id, 'id', 'last_name', 'patients') }}</p>
</div>
<div class="col-md-6">
<p>{{ __('patients.patient_number') }}: {{ get_name($appointment->patient_id, 'id', 'number', 'patients') }}</p>
<p>{{ __('patients.phone') }}: {{ get_name($appointment->patient_id, 'id', 'phone', 'patients') }}</p>
</div>
</div>
</div>
<div class="white-box">
<div class="row">
<div class="col-md-6">
<h4>{{ __('patients.previous_details') }}</h4>
<div class="form-group">
{{ Form::label('clinic_allocation', __('patients.assigned_clinic')) }}
@if($appointment->clinic_allocation == 0)
{{ Form::text('clinic_allocation_previous', __('patients.not_assigned'), ['class' => 'form-control col-sm-12 compulsory', 'readonly']) }}
@else
{{ Form::text('clinic_allocation_previous', $clinics[$appointment->clinic_allocation], ['class' => 'form-control col-sm-12 compulsory', 'readonly']) }}
@endif
</div>
<div class="form-group">
{{ Form::label('in_charge', __('patients.assigned_incharge')) }}
@if($appointment->incharge_id == 0)
{{ Form::text('in_charge_previous', __('patients.not_assigned'), ['class' => 'form-control col-sm-12 compulsory', 'readonly']) }}
@else
{{ Form::text('in_charge_previous', get_full_name($appointment->incharge_id, 'id', 'first_name', 'last_name', 'users'), ['class' => 'form-control col-sm-12 compulsory', 'readonly']) }}
@endif
</div>
<div class="form-group">
{{ Form::label('appointment_date_previous',__('patients.appointment_date')) }}
{{ Form::text('appointment_date_previous', streamline_date($appointment->appointment_date), ['class' => 'form-control col-sm-12 compulsory', 'readonly']) }}
</div>
<div class="form-group">
{{ Form::label('appointment_time_previous',__('patients.appointment_time')) }}
{{ Form::text('appointment_time_previous', $appointment->appointment_time, ['class' => 'form-control col-sm-12 compulsory', 'readonly']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('comments_previous',__('patients.comments')) }}
{{ Form::text('comments_previous', $appointment->comments, ['class' => 'form-control col-sm-12 compulsory', 'readonly']) }}
</div>
</div>
<div class="col-md-6">
<h4>{{ __('patients.new_details') }}</h4>
{{ Form::open(['route' => 'patients.save_rescheduled_appointment']) }}
{{ Form::hidden('appointment_id', $appointment->id, ['class' => 'patient_id']) }}
<div class="form-group">
{{ Form::label('clinic_allocation', __('patients.assign_clinic')) }}
{{ Form::select('clinic_allocation', $clinics, $appointment->clinic_allocation, ['class' => 'form-control col-sm-12 compulsory search_criteria', 'id' => 'clinic_allocation']) }}
</div>
<div class="form-group">
{{ Form::label('in_charge', __('patients.assign_incharge')) }}
<select name="in_charge" class="form-control col-sm-12 compulsory search_criteria">
<option value="0" selected>{{ __('patients.dont_assign_incharge') }}</option>
@foreach($users as $user)
<option value="{{ $user->id }}">{{ $user->first_name }} {{ $user->last_name }}</option>
@endforeach
</select>
</div>
<div class="form-group">
{{ Form::label('appointment_date',__('patients.appointment_date')) }}
<div class="input-group">
{{ Form::text('appointment_date', date('d-m-Y', strtotime($appointment->appointment_date)),['class' => 'compulsory form-control','readonly','id'=>'appointment_date', 'required']) }}
</div>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('appointment_time',__('patients.appointment_time')) }}
{{ Form::time('appointment_time',$appointment->appointment_time,['class' => 'compulsory form-control','required']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('comments',__('patients.comments')) }}
{{ Form::textarea('comments',$appointment->comments,['class' => 'form-control', 'data-error'=>'','id'=>'comments']) }}
<div class="help-block with-errors"></div>
</div>
{{ Form::button(__('patients.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
{{ Form::button(__('patients.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
{{ Form::close() }}
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/js/validator.js') }}"></script>
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script type="text/javascript">
$('#appointment_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy',
});
</script>
@endpush
@@ -1,286 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
<style type="text/css">
label{
background-color: #3a87ad;
color: #fff;
border-radius: 3px;
display: inline-block;
padding: 2px 4px;
font-size: 11.844px;
font-weight: bold;
line-height: 14px;
vertical-align: baseline;
white-space: nowrap;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patients.view') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patients.dashboard') }}</a></li>
<li><a href="{{ route('patients.index') }}">{{ __('patients.patients') }}</a></li>
<li class="active">{{ __('patients.view') }}</li>
</ol>
</div>
</div>
<div class="white-box">
@include('flash::message')
{{ Form::open(['route' => 'patients.select', 'method' => 'ANY', 'role' => 'search']) }}
<div class="row">
<div class="col-md-3">
<div class="form-group" id="patient_numbers">
{{ Form::label('number', __('patients.patient_number')) }}
{{ Form::text('number', '', ['class' => 'form-control typeahead', 'placeholder' => 'Patient number', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-3">
<div class="form-group" id="first_names">
{{ Form::label('first_name', __('patients.first_name')) }}
{{ Form::text('first_name', '', ['class' => 'form-control typeahead', 'placeholder' => 'First name', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-3">
<div class="form-group" id="last_names">
{{ Form::label('last_name', __('patients.last_name')) }}
{{ Form::text('last_name', '', ['class' => 'form-control typeahead', 'placeholder' => 'Last name', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-3">
<div class="form-group" id="national_ids">
{{ Form::label('national_id', __('patients.national_id')) }}
{{ Form::text('national_id', '', ['class' => 'form-control typeahead', 'placeholder' => 'National ID', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
@if(is_chi_enabled())
<div class="col-md-3">
<div class="form-group" id="insurance_groups">
{{ Form::label('insurance_group', __('patients.insurance_group')) }}
{{ Form::text('insurance_group', '', ['class' => 'form-control typeahead', 'placeholder' => 'Insurance Group', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
@endif
<div class="col-md-3">
<div class="form-group" id="patient_categorys">
{{ Form::label('patient_category', __('patients.patient_category')) }}
{{ Form::text('patient_category', '', ['class' => 'form-control typeahead', 'placeholder' => 'Patient Category', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-3">
<div class="form-group" id="subcountys">
{{ Form::label('subcounty', __('patients.sub_county')) }}
{{ Form::text('subcounty', '', ['class' => 'form-control typeahead', 'placeholder' => 'SubCounty', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-3">
<div class="form-group" id="parishs">
{{ Form::label('parish', __('patients.parish')) }}
{{ Form::text('parish', '', ['class' => 'form-control typeahead', 'placeholder' => 'Parish', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-3">
<div class="form-group" id="villages">
{{ Form::label('village', __('patients.village')) }}
{{ Form::text('village', '', ['class' => 'form-control typeahead', 'placeholder' => 'Village', 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-3">
<div class="form-group">
{{ Form::label('date_of_birth', __('patients.date_of_birth')) }}
<div class="input-group">
{{ Form::text('date_of_birth','',['class' => 'form-control', 'readonly', 'id'=>'datepicker-autoclose']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group" id="phone_number">
{{ Form::label('phone_number', __('patients.phone_number')) }}
{{ Form::text('phone_number', '', ['class' => 'form-control typeahead', 'placeholder' => __('patients.phone_number'), 'autocomplete' => 'off', 'spellcheck' => false]) }}
</div>
</div>
<div class="col-md-1" style="padding-top: 23px;">
<button type="submit" class="btn btn-success">{{ __('patients.search') }}</button>
</div>
</div>
<div class="row">
<div class="col-md-12">
<img src="/uploads/streamline_images/two_surgeons.jpg" class="img-rounded" style=" height: 150px; margin: auto;" alt="surgery" />
</div>
</div>
{{ Form::close() }}
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<!-- Typehead Plugin JavaScript -->
<script src="{{ asset('elite/bower_components/typeahead.js-master/dist/typeahead.bundle.min.js') }}"></script>
<script type="text/javascript">
$('#datepicker-autoclose').datepicker(
{
autoclose: true,
todayHighlight: true,
format: 'dd/mm/yyyy'
}
);
let substringMatcher = function(strs) {
return function findMatches(q, cb) {
let matches, substrRegex;
// an array that will be populated with substring matches
matches = [];
// regex used to determine if a string contains the substring `q`
substrRegex = new RegExp(q, 'i');
// iterate through the pool of strings and for any string that
// contains the substring `q`, add it to the `matches` array
$.each(strs, function(i, str) {
if (substrRegex.test(str)) {
matches.push(str);
}
});
cb(matches);
};
};
$('#patient_numbers .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'patient_numbers',
source: substringMatcher(<?php echo json_encode($patient_numbers); ?>)
}
);
$('#first_names .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'first_names',
source: substringMatcher(<?php echo json_encode($first_names); ?>)
}
);
$('#last_names .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'last_names',
source: substringMatcher(<?php echo json_encode($last_names); ?>)
}
);
$('#national_ids .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'national_ids',
source: substringMatcher(<?php echo json_encode($national_ids); ?>)
}
);
$('#insurance_groups .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'insurance_groups',
source: substringMatcher(<?php echo json_encode($insurance_groups); ?>)
}
);
$('#patient_categorys .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'patient_categorys',
source: substringMatcher(<?php echo json_encode($patient_categories); ?>)
}
);
$('#subcountys .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'subcountys',
source: substringMatcher(<?php echo json_encode($subcounties); ?>)
}
);
$('#parishs .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'parishs',
source: substringMatcher(<?php echo json_encode($parishes); ?>)
}
);
$('#villages .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'villages',
source: substringMatcher(<?php echo json_encode($villages); ?>)
}
);
</script>
@endpush
@@ -1,237 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<style>
ul#results li {
display:inline;
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patients.search_results') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patients.dashboard') }}</a></li>
<li><a href="{{ route('patients.index') }}">{{ __('patients.patients') }}</a></li>
<li class="active">{{ __('patients.search_results') }}</li>
</ol>
</div>
</div>
@include('flash::message')
@include ('errors.list')
<div class="white-box">
<h3 class="page-title">{{ __('patients.search_results') }}</h3>
<div class="row">
<div class="col-md-12">
@if(isset($criteria) && isset($patient_count))
<p>{{ __('patients.search_criteria') }} : <code>{{ $criteria }}</code> &nbsp;&nbsp;&nbsp;{{ __('patients.total_results') }} : <code>{{ count($patients) }}</code> &nbsp;&nbsp;&nbsp;<a href="{{ route('patients.select') }}">{{ __('patients.clear_search') }}</a></p>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th style="width: 5%">{{ __('patients.patient_number') }}</th>
<th style="width: 10%">{{ __('patients.full_names') }}</th>
<th style="width: 10%">{{ __('patients.gender') }}</th>
<th style="width: 10%">{{ __('patients.age') }}</th>
<th style="width: 10%">{{ __('patients.next_of_kin') }}</th>
<th style="width: 10%">{{ __('patients.marital_status') }}</th>
<th style="width: 5%">{{ __('patients.phone') }}</th>
<th style="width: 10%">{{ __('patients.occupation') }}</th>
<th style="width: 10%">{{ __('patients.category') }}</th>
<th style="width: 10%"></th>
</tr>
</thead>
<tbody>
@if(count($patients ) > 0)
@foreach($patients as $patient)
<tr>
<td>{{ $patient->number }}</td>
<td>{{ $patient->first_name." ".$patient->last_name }}</td>
<td>{{ $patient->gender == 2 ? "Female" : "Male" }}</td>
<td>{{ get_patients_age($patient->date_of_birth) }}</td>
<td>{{ $patient->next_of_kin }}</td>
<td>{{ array_key_exists($patient->marital_status, $marital_statuses) ? $marital_statuses[$patient->marital_status] : "N/A" }}</td>
<td>{{ $patient->phone }}</td>
<td>{{ array_key_exists($patient->occupation_id, $occupations) ? $occupations[$patient->occupation_id] : "N/A" }}</td>
<td>{{ array_key_exists($patient->category_id, $categories) ? $categories[$patient->category_id] : "N/A" }}</td>
<td>
<a href="/patient_episodes/set_patient_id/{{ $patient->id }}" class="btn btn-success btn-sm">{{ __('patients.select') }}</a>
@if(is_fingerprint_enabled() && !is_null($patient->fingerprint_template))
<br><br>
<a href="#" onclick="confirm_fingerprint({{ $patient->id }})" class="btn btn-success btn-sm">{{ __('patients.confirm_fingerprint') }}</a>
@endif
</td>
</tr>
@endforeach
@else
<tr><td colspan="10"><code>{{ __('patients.no_records_found') }}</code></td></tr>
@endif
</tbody>
</table>
</div>
@endif
</div>
</div>
</div>
<div class="modal" id="modal_confirm_fingerprint" tabindex="-1" role="dialog" aria-labelledby="confirm_fingerprint_modal_label" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">{{ __('patients.confirm_fingerprint') }}</h4>
</div>
<div class="modal-body">
<div class="fingerprint_box text-center">
<img id="fingerprint_image" height="240" width="220">
</div>
{{ Form::hidden('fingerprint_patient_id', '', ['id' => 'fingerprint_patient_id']) }}
{{ Form::hidden('fingerprint_template', '', ['id' => 'fingerprint_template']) }}
{{ Form::hidden('saved_fingerprint_template', '', ['id' => 'saved_fingerprint_template']) }}
<button type="button" onClick='capture_fingerprint()' class="btn btn-sm btn-primary">{{ __('patients.capture_fingerprint') }}</button>
<button type="button" onClick='search_fingerprint()' class="btn btn-sm btn-primary">{{ __('patients.confirm_fingerprint') }}</button>
<p id="scanner_msg"></p>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script>
$('.table').DataTable({
dom: 'Bfrtip',
buttons: [
'copy', 'csv',
{
extend: 'pdf',
exportOptions: {
columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8 ]
},
title: 'Selected patients'
},
{
extend: 'print',
exportOptions: {
columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8 ]
},
title: 'Selected patients'
},
{
extend: 'excelHtml5',
exportOptions: {
columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8 ]
},
title: 'Selected patients'
}
],
});
$('.sorting').removeClass('sorting');//remove the sorting class
$('.sorting_asc').removeClass('sorting_asc');//remove the sorting class
function confirm_fingerprint(id) {
$.ajax({
method: 'GET',
url: '/patients/get_fingerprint/' + id,
success: function(response){
if (response != '0') {fingerprint_patient_id
$('#saved_fingerprint_template').val(response);
$('#fingerprint_patient_id').val(id);
$('#modal_confirm_fingerprint').modal('show');
} else {
alert("Patient has no registered fingerprints");
}
}
});
}
function search_fingerprint() {
let fingerprint_template = $('#fingerprint_template').val();
let saved_fingerprint_template = $('#saved_fingerprint_template').val();
let fingerprint_patient_id = $('#fingerprint_patient_id').val();
if (fingerprint_template !== '' && saved_fingerprint_template !== '') {
$.ajax({
type: "POST",
url: '/patients/compare_fingerprint_from_scanner/',
data: {fingerprint_template: fingerprint_template, saved_fingerprint_template: saved_fingerprint_template},
success: function(response){
let responseArray = JSON.parse(response);
console.log(responseArray);
if (responseArray["error_code"] == "0") {
let score = Math.round(responseArray["score"]);
if(score > 50) {
window.location.href = "/patient_episodes/set_patient_id/" + fingerprint_patient_id;
} else {
alert("Fingerprint does not match with record");
}
} else {
$('#scanner_msg').text("Error Code: " + responseArray["error_code"] + " - Error Message: " + responseArray["error_message"]).css('color', 'red');
}
}
});
} else {
alert("Please capture the patient's fingerprint before searching");
}
}
function capture_fingerprint() {
$.ajax({
url: '/patients/fetch_fingerprint_from_scanner/',
success: function(response){
let responseArray = JSON.parse(response);
if (responseArray["error_code"] == "0") {
let template = responseArray["template"];
let pngImage = "data:image/png;base64," + responseArray["image"];
$("#fingerprint_image").attr('src', pngImage);
$('#fingerprint_template').val(template);
$('#scanner_msg').text("Fingerprint Captured").css('color', 'green');
} else {
$('#scanner_msg').text("Error Code: " + responseArray["error_code"] + " - Error Message: " + responseArray["error_message"]).css('color', 'red');
}
}
});
}
</script>
@endpush
@push('styles')
<style type="text/css">
.color-bordered-table.success-bordered-table {
border-top: 0px;
}
</style>
@endpush
@@ -1,201 +0,0 @@
@extends('layouts.main')
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('patients.view') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('patients.dashboard') }}</a></li>
<li><a href="{{ route('patients.index') }}">{{ __('patients.patients') }}</a></li>
<li class="active">{{ __('patients.view') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<div class="row">
<div class="col-sm-3">
<a class="img" href="#modal-photo" data-toggle="modal" style="color: whitesmoke">
@if(!is_null($patient->photo) && $patient->photo != "")
<img src='{{ asset($patient->photo) }}' class="img-rounded center" alt='Photo not available' />
@else
<img src="/uploads/streamline_images/person-place-holder.jpg" class="img-rounded center" style='height: 120px; width: 50%' alt='Photo not available' />
@endif
</a>
</div>
<div class="col-sm-6">
<table class="table-bordered table-condensed table-striped">
<tbody>
<tr>
<th><font color="black">{{ __('patients.patient_number') }}</font></th>
<td>{{ $patient->number }}</td>
</tr>
<tr>
<th>Code</th>
<td>
{{ getDNS1DBarcodePNGOtherOption(sprintf("%04u", $patient->id)) }}
<h4>{{ sprintf("%04u", $patient->id) }}</h4>
</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.full_names') }}</font></th>
<td>{{ $patient->first_name }} {{ $patient->last_name }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.gender') }}</font></th>
<td>{{ $patient->gender == 1 ? 'Male' : 'Female' }}</td>
</tr>
<tr>
<th class="hidden-phone"><font color="black">{{ __('patients.age') }}</font></th>
<td>{{ get_patients_age($patient->date_of_birth) }}</td>
</tr>
</tbody>
</table>
</div>
<div class="col-sm-3">
<a href="/patient_card/{{ $patient->id }}" target="_blank" class="btn btn-rounded btn-primary btn-sm float-right">{{ __('patients.print_patient_card') }}</a>
</div>
</div>
</div>
<div class="white-box">
<div class="row">
<div class="col-sm-4">
<table class="table-bordered table-condensed table-striped">
<tr>
<th><font color="black">{{ __('patients.phone') }}</font></th>
<td>{{ $patient->phone }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.occupation') }}</font></th>
<td>{{ isset($occupations[$patient->occupation_id]) ? $occupations[$patient->occupation_id] : '' }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.insurance') }}</font></th>
<td>{{ $patient->insurance_status == 1 ? __('patients.yes') : __('patients.no') }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.religion') }}</font></th>
<td>{{ isset($religions[$patient->religion_id]) ? $religions[$patient->religion_id] : '' }}</td>
</tr>
<tr>
<th><font color="black">{{__('patients.next_of_kin')}}</font></th>
<td>{{ $patient->next_of_kin }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.next_of_kin_relationship') }}</font></th>
<td>{{ isset($relationships[$patient->next_of_kin_relationship]) ? $relationships[$patient->next_of_kin_relationship] : '' }}</td>
</tr>
<tr>
<th><font color="black">{{__('patients.phone_of_next_of_kin')}}</font></th>
<td>{{ $patient->phone_of_next_of_kin }}</td>
</tr>
</table>
</div>
<div class="col-sm-4">
<table class="table-bordered table-condensed table-striped">
<tr>
<th><font color="black">{{ __('patients.district') }}</font></th>
<td>{{ isset($districts[$patient->district_id]) ? $districts[$patient->district_id] : '' }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.county') }}</font></th>
<td>{{ isset($counties[$patient->county_id]) ? $counties[$patient->county_id] : '' }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.sub_county') }}</font></th>
<td>{{ isset($subcounties[$patient->subcounty_id]) ? $subcounties[$patient->subcounty_id] : '' }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.parish') }}</font></th>
<td>{{ isset($parishes[$patient->parish_id]) ? $parishes[$patient->parish_id] : '' }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.village') }}</font></th>
<td>{{ isset($villages[$patient->village_id]) ? $villages[$patient->village_id] : '' }}</td>
</tr>
</table>
</div>
<div class="col-sm-4">
<table class="table">
<tr>
<th style="width: 30%"><font color="black">{{ __('patients.last_patient_visit') }} : </font></th>
<td>
@if(!is_null($last_episode))
@php
$diagnosis = null;
$primary_diagnosis_id = get_name($last_episode->id, 'episode_id', 'primary_diagnosis', 'consultations');
if($primary_diagnosis_id != "N/A" && $primary_diagnosis_id != ""){
$diagnosis = \Streamline\Models\Diagnosis::withTrashed()->find($primary_diagnosis_id);
}
@endphp
<strong>{{ __('patients.primary_diagnosis') }} : </strong>{{ !is_null($diagnosis) ? $diagnosis->name : '' }}<br>
<strong>{{ __('patients.comments') }} : </strong>{{ get_name($last_episode->id, 'episode_id', 'comments', 'consultations') }}<br>
@endif
<strong>{{ __('patients.date') }} : </strong> {{ !is_null($last_episode) ? streamline_date($last_episode->created_at) : __('patients.no_visit_yet') }}
</td>
</tr>
<tr>
<th style="width: 30%"><font color="black">{{ __('patients.date_registered') }} :</font></th>
<td>{{streamline_date($patient->created_at) }}</td>
</tr>
<tr>
<th style="width: 30%"><font color="black">{{ __('patients.created_by') }} :</font></th>
<td>{{ get_full_name($patient->created_by, "id", "first_name", "last_name", "users") }}</td>
</tr>
@if (mother_of_patient($patient->id))
@php
$mother_id = mother_of_patient($patient->id);
@endphp
<tr>
<th style="width: 30%; font-size: 16px; font-weight:bolder"><font color="black">{{ __('patients.mother_name') }}:</font></th>
<td style="font-size: 16px;">
<a href="/patients/{{ $mother_id }}">
{{ get_full_name($mother_id, "id", "first_name", "last_name", "patients") }} ({{ get_name($mother_id, "id", "number", "patients") }})
</a>
</td>
</tr>
@endif
@if (children_of_patient($patient->id))
@php
$children_ids_array = children_of_patient($patient->id);
@endphp
<tr>
<th style="width: 30%; font-size: 16px; font-weight:bolder"><font color="black">{{ __('patients.children') }}:</font></th>
<td style="font-size: 16px;">
<ol>
@for ($i = 0; $i < count($children_ids_array); $i++)
<li>
<a href="/patients/{{ $children_ids_array[$i] }}">
{{ get_full_name($children_ids_array[$i], "id", "first_name", "last_name", "patients") }} ({{ get_name($children_ids_array[$i], "id", "number", "patients") }})
</a>
</li>
@endfor
</ol>
</td>
</tr>
@endif
</table>
<a href="/patient_episodes/set_patient_id/{{ $patient->id }}" class="btn btn-success btn-sm">{{ __('patients.select_patient_history') }}</a>
</div>
</div>
</div>
</div>
</div>
@endsection
@@ -1,947 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<style></style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('point_of_sale.point_of_sale') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> {{ __('point_of_sale.home') }}</a></li>
<li class="active"><i class="fa fa-shopping-cart"></i> {{ __('point_of_sale.point_of_sale') }}</li>
</ol>
</div>
</div>
<div class="white-box">
@include('flash::message')
{{ Form::open(['route'=>'point_of_sale.confirm_pricing']) }}
<div class="tap_div_to_calculate_bill_total">
<div class="row">
<div class="col-12">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th class="text-center">#</th>
<th class="text-center">{{ __('point_of_sale.first_name') }}</th>
<th class="text-center">{{ __('point_of_sale.last_name') }}</th>
<th class="text-center">{{ __('point_of_sale.patient_category') }}</th>
<th class="text-center">{{ __('point_of_sale.phone_number') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="5"><h5><b>{{ __('point_of_sale.patient_information') }}</b></h5></td>
</tr>
<tr>
<td class="text-center">{{ $patient->number }}</td>
<td class="text-center">{{ $patient->first_name }}</td>
<td class="text-center">{{ $patient->last_name }}</td>
<td class="text-center">{{ get_name($patient->category_id, 'id', 'name', 'patient_categories') }}</td>
<td class="text-center">{{ $patient->phone }}</td>
</tr>
</tbody>
</table>
</div>
</div>
<br/>
@if($pre_ordered_eye_glasses)
<div class="row">
<div class="col-10">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th class="text-center">{{ __('point_of_sale.select') }}</th>
<th class="text-center">{{ __('point_of_sale.eye_glasses') }}</th>
<th class="text-center">{{ __('point_of_sale.quantity') }}</th>
<th class="text-center">{{ __('point_of_sale.unit_cost') }}</th>
<th class="text-center">{{ __('point_of_sale.cost') }}</th>
</tr>
</thead>
<tbody>
@php $pre_order_amount_sum = 0; @endphp
<tr><td colspan='5' style='background-color: #FFE6E6; font-weight: bolder; text-decoration: underline;'>{{ __('point_of_sale.selected') }}</td></tr>
@foreach($pre_ordered_eye_glasses as $pre_order)
<tr id="eye_glass_row{{ $pre_order->id }}" class="eye_glass_remove">
<td>
<input type="checkbox" id="chk" name="eye_glass_item[]" class="eye_glass_check" value="{{ $pre_order->id }}">
</td>
<td>
@if($pre_order->insurance == 1)
<span style='color: green'> {{ $pre_order->name }} </span>
@else
<span style='color: orange'> {{ $pre_order->name }} </span>
@endif
</td>
<td>
<input type='number' name='eye_glass_quantity[]' style="margin-bottom: 0px;" id="pre_order_quantity_{{$pre_order->id}}" class="form-control compulsory"/>
</td>
<td>
@if($pre_order->insurance == 1 && patient_insurance_status($patient_id) == 1)
{{-- {{ ugandan_shillings($pre_order->insured_price) }}--}}
<input type='number' disabled name='pre_order_cost[]' id="pre_order_cost_{{ $pre_order->id }}" class="form-control" value="{{ $pre_order->insured_price }}"/>
@else
{{-- {{ ugandan_shillings($pre_order->non_insured_price) }}--}}
<input type='number' disabled name='pre_order_cost[]' id="pre_order_cost_{{ $pre_order->id }}" class="form-control" value="{{ $pre_order->non_insured_price }}"/>
@endif
</td>
@php
// get insurance status for drug
$eye_glass_insurance_status = get_name($pre_order->id, "id", "insurance", "eye_glasses");
$eye_glass_amount = get_name($pre_order->id, "id", "non_insured_price", "eye_glasses");
// insurance flag
$is_insured = 0;
// check if drug and patient is eligible for insurance
if($eye_glass_insurance_status == 1 && patient_insurance_status($patient_id) == 1){
$insurance_amount = get_name($pre_order->id, "id", "non_insured_price", "eye_glasses") - $eye_glass_amount;
$is_insured = 1;
} else {
$insurance_amount = 0;
}
@endphp
<input type="hidden" name="eye_glass_amount[]" id="eye_glass_amount_{{ $pre_order->id }}">
<input type="hidden" name="eye_glass_insurance_amount[]" value="0">
<input type="hidden" name="eye_glass_insurance_status[]" value="{{ $eye_glass_insurance_status }}">
<input type="hidden" name="eye_glass_order_ids[]" value="{{ $pre_order->id }}">
<td>
<input id="pre_order_cost_sum_{{ $pre_order->id }}" class="" type="number" name="eye_glass_subtotal[]"> .UGx
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="col-2">
<div>
<label for="pre_eye_glasses_grand_total"><b>{{ __('point_of_sale.eye_glass_total') }} :</b></label>
<input id="pre_eye_glasses_grand_total" readonly name="eye_glass_total" class="form-control" type="number"> {{ __('point_of_sale.ugx') }}
</div>
</div>
</div>
@endif
<br/>
@if($pre_ordered_services)
<div class="row">
<div class="col-md-10">
<div class="table-responsive">
<table class="table table-striped color-bordered-table success-bordered-table">
<thead>
<tr>
<th class="text-center">{{ __('service_items.select') }}</th>
<th class="text-center">{{ __('service_items.service') }}</th>
<th class="text-center">{{ __('service_items.quantity') }}</th>
<th class="text-center">{{ __('service_items.unit_cost') }}</th>
<th class="text-center">{{ __('service_items.total_cost') }}</th>
</tr>
</thead>
<tbody>
@php
$service_order_amount_sum = 0;
@endphp
<tr>
<td colspan='5' style='background-color: #FFE6E6; font-weight: bolder; text-decoration: underline;'>{{ __('service_items.selected_service_orders') }}</td>
</tr>
@foreach($pre_ordered_services as $service_order)
<tr>
<td>
<input type="checkbox" name="service_id[]" value="{{ $service_order->id }}" checked>
</td>
<td>
@if($service_order->insurance_coverage == 1)
<span style='color: green'> {{ $service_order->name }} </span>
@else
<span style='color: orange'> {{ $service_order->name }} </span>
@endif
</td>
<td>
<input type='number' name='quantity[]' style="margin-bottom: 0px;" id="service_order_quantity_{{$service_order->id}}" class="form-control compulsory" required />
</td>
<td>
@php
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
@endphp
@if($price_list_id)
{{ ugandan_shillings(get_price_list_category_price($price_list_id, 6, $service_order->id)) }}
<input type='hidden' name='service_order_cost[]' id="service_order_cost_{{ $service_order->id }}" class="form-control" value="{{ get_price_list_category_price($price_list_id, 6, $service_order->id) }}"/>
@else
@php
$service_insurance = $service_order->insurance_coverage;
@endphp
@if($service_insurance == 1 && patient_insurance_status($patient_id) == 1)
{{ ugandan_shillings($service_order->insured_price) }}
<input type='hidden' name='service_order_cost[]' id="service_order_cost_{{ $service_order->id }}" class="form-control" value="{{ $service_order->insured_price }}"/>
@else
{{ ugandan_shillings($service_order->non_insured_price) }}
<input type='hidden' name='service_order_cost[]' id="service_order_cost_{{ $service_order->id }}" class="form-control" value="{{ $service_order->non_insured_price }}"/>
@endif
@endif
</td>
<td>
<div class="input-group">
<input id="service_order_cost_sum_{{ $service_order->id }}" class="form-control" readonly type="number" name="service_item_subtotal[]">
<span class="input-group-addon">{{ __('point_of_sale.ugx') }}</span>
</div>
</td>
</tr>
@endforeach
<!-- display row showing total amount -->
@if(!$pre_ordered_services)
<tr>
<td colspan="5" class='text-center' style='color: maroon; font-weight: bold;'>{{ __('service_items.select_services_above') }}</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div class="col-md-2">
<label for="service_grand_total"><b>SERVICES TOTAL :</b></label>
<div class="input-group">
<input id="service_grand_total" class="form-control" readonly type="number" name="service_grand_total">
<span class="input-group-addon">{{ __('point_of_sale.ugx') }}</span>
</div>
</div>
</div>
@endif
@php
$allergy_check = "";
$fre_drop = "";
$results = \DB::select("select * from dosage_frequencies order by name");
foreach ($results as $result){
$fre_drop .= "<option value='" . $result->id . "'>" . $result->name . "</option>";
}
@endphp
@if($manual_patient_prescriptions)
<div class="row">
<div class="col-10">
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="manual_prescription_table">
<thead>
<tr>
<th>#</th>
<th>{{ __('point_of_sale.drug') }}</th>
<th style="display: none">{{ __('point_of_sale.dosage') }}</th>
<th style="display: none">{{ __('point_of_sale.frequency') }}</th>
<!-- <th style="width: 20%;">Prompt</th> -->
<th style="display:none;">{{ __('point_of_sale.duration') }}</th>
<th>{{ __('point_of_sale.quantity_to_dispense') }}</th>
<th>{{ __('point_of_sale.price') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2" style="background-color: #FFE6E6; font-weight: bolder; text-decoration: underline;border: 1px solid #ddd;">{{ __('point_of_sale.selected') }}</td>
<td colspan="2" style="border: 1px solid #ddd;"></td>
</tr>
@if($manual_patient_prescriptions)
@if(count($manual_patient_prescriptions) > 0)
@foreach($manual_patient_prescriptions as $prescription)
@php
if(isset($allergies['names'])){
$allergies_explode = explode(",", $allergies['names']);
$allergy_check = \Streamline\Http\Controllers\PrescriptionsController::checkPatientAllergies($allergies_explode, $prescription->drug_category);
}
@endphp
<tr id="my_row{{ $prescription->id }}" class="to_remove">
@php
$is_insured = 0;
@endphp
<!-- # -->
<td style="border: 1px solid #ddd;">
@php
$total_stock = $prescription->pharmacy_stock;
@endphp
@if ($total_stock > 0 && $allergy_check != 'Allergic')
<input type="checkbox" name="drug_id[]" id="chk" class="prescription-check" value="{{ $prescription->id }}" />
@endif
</td>
<!-- drug -->
<td style="border: 1px solid #ddd;">
@php
$insurance_color = ($prescription->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1) ? "green" : "orange";
@endphp
@if ($allergy_check == 'Allergic')
<span class='allergic'>{{ __('point_of_sale.patient_is_allergic') }}</span>&nbsp;&nbsp;
@endif
@if ($total_stock <= 0)
<span class="badge badge-danger">{{ __('point_of_sale.out_of_stock') }}</span>
@endif
<span style="color:{{ $insurance_color }}"> {{ $prescription->name }}</span>
<?php
$pharm_comment = trim($prescription->pharmacy_comment);
if(isset($prescription->reference_areas)){ $reference_array = explode(",", $prescription->reference_areas); } else { $reference_array = []; }
if(isset($prescription->reference_name)){ $reference_name = explode(",", $prescription->reference_name); } else { $reference_name = []; }
for ($x = 0; $x < count($reference_array); $x++) {
?>
<a style="font-weight:normal;" href="{{ $reference_array[$x] }}" target="blank">{{ $reference_name[$x] }}</a>
<br>
<?php
}
if (!empty($pharm_comment)):
echo "<div style='padding: 1px; margin: 6px 1px 0px 1px; font-size: smaller' class='alert alert-info span12 margin-none well'>" . $pharm_comment . "</div>";
endif;
?>
@for ($x = 0; $x < count($reference_array); $x++)
@if(isset($reference_array[$x]) && isset($reference_name[$x]))
<a style="font-weight:normal;" href="{{ $reference_array[$x] }}" target="blank">{{ $reference_name[$x] }}</a><br>
@endif
@endfor
@if (!empty($pharm_comment))
<div style='padding: 1px; margin: 6px 1px 0px 1px; font-size: smaller' class='alert alert-info span12 margin-none well'>{{ $pharm_comment }}</div>
@endif
</td>
<td style="border: 1px solid #ddd;">
<input type='number' style="margin-bottom: 0px;" name='treatment_quantity[]' id="manual_quantity_dispensed{{$prescription->id}}" class="form-control" required />
<span style="margin-bottom: 4px; font-size: x-small; float: right;" id="price_per_unit_drug{{ $prescription->id }}"></span>
<input type="hidden" name="treatment_id"/>
<input type="hidden" name="treatment_item[]" value="{{ $prescription->id }}" />
<!-- <input type="hidden" name="drug_id[]" id="chk" value="{{ $prescription->id }}" />-->
<input type="hidden" name="treatment_amount[]" value="{{ $prescription->non_insured_price }}">
<input type="hidden" name="treatment_insurance_status[]" value="{{ $prescription->insurance_coverage }}">
<input type="hidden" name="treatment_insurance_amount[]" value="{{ $prescription->insured_price }}">
<?php $drug_form = getTableInfo('unit_of_measure','name','id='.$prescription->form_id); ?>
<input type="hidden" id="drug_form{{$prescription->id}}" value="{{$drug_form}}">
@if($prescription->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1)
<input type="hidden" id="selling_price{{$prescription->id}}" value="{{$prescription->insured_price}}">
@else
<input type="hidden" id="selling_price{{$prescription->id}}" value="{{$prescription->non_insured_price}}">
@endif
<input type="hidden" name="pack[]" id="pack{{$prescription->id}}" value="{{$prescription->pack}}">
<input type="hidden" name="strength[]" id="strength{{$prescription->id}}" value="{{$prescription->strength}}">
</td>
<!-- price -->
<td>
<div class="input-group">
<input class="center form-control" id="auto_prescription_price{{$prescription->id}}" style="padding: 2px;border: 1px solid #ddd;" name="treatment_subtotal[]">
<span class="input-group-addon">{{ __('point_of_sale.ugx') }}</span>
</div>
</td>
</tr>
@endforeach
@endif
@else
<tr class="warning"><td class="center" colspan="8" style="border: 1px solid #ddd;">{{ __('point_of_sale.no_drugs_have_been_searched_yet') }}</td></tr>
@endif
</tbody>
</table>
</div>
</div>
<div class="col-2">
<label for="grand_total_column"><b>{{ __('point_of_sale.drugs_total') }} :</b></label>
<div class="input-group">
<input id="grand_total_column" name="treatment_total" class="form-control" readonly type="number">
<span class="input-group-addon">{{ __('point_of_sale.ugx') }}</span>
</div>
</div>
</div>
@endif
@if($automatic_patient_prescriptions)
<div class="row">
<div class="col-10">
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table" id="prescription_table">
<thead>
<tr>
<th style="width: 5%;">#</th>
<th style="width: 15%;">{{ __('point_of_sale.drug') }}</th>
<th style="width: 20%;">{{ __('point_of_sale.dosage') }}</th>
<!-- <th style="width: 20%;">Prompt</th> -->
<th style="width: 20%;">{{ __('point_of_sale.duration') }}</th>
<th style="width: 20%;">{{ __('point_of_sale.dispense') }}</th>
<th style="width: 20%;">{{ __('point_of_sale.price') }}</th>
<!-- <th style="width: 10%;">Instruction</th> -->
</tr>
</thead>
<tbody>
<tr>
<td colspan="2" style="background-color: #FFE6E6; font-weight: bolder; text-decoration: underline;border: 1px solid #ddd;">{{ __('point_of_sale.selected') }}</td>
<td colspan="4" style="border: 1px solid #ddd;"></td>
</tr>
@if($automatic_patient_prescriptions)
@if(count($automatic_patient_prescriptions) > 0)
@foreach($automatic_patient_prescriptions as $prescription)
@php
if(isset($allergies['names'])){
$allergies_explode = explode(",", $allergies['names']);
$allergy_check = \Streamline\Http\Controllers\PrescriptionsController::checkPatientAllergies($allergies_explode, $prescription->drug_category);
}
@endphp
<tr id="my_row{{ $prescription->id }}" class="to_remove">
@php
$is_insured = 0;
@endphp
<td style="border: 1px solid #ddd;">
@php
$total_stock = $prescription->pharmacy_stock;
@endphp
@if ($total_stock > 0 && $allergy_check != 'Allergic')
<input type="checkbox" name="drug_id[]" id="chk" class="prescription-check" value="{{ $prescription->id }}" />
@endif
</td>
<td style="border: 1px solid #ddd;">
@php
$insurance_color = ($prescription->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1) ? "green" : "orange";
@endphp
@if ($allergy_check == 'Allergic')
<span class='allergic'>{{ __('point_of_sale.patient_is_allergic') }}</span>&nbsp;&nbsp;
@endif
@if ($total_stock <= 0)
<span class="badge badge-danger">{{ __('point_of_sale.out_of_stock') }}</span>
@endif
<span style="color:{{ $insurance_color }}"> {{ $prescription->name }}</span>
<?php
$pharm_comment = trim($prescription->pharmacy_comment);
if(isset($prescription->reference_areas)){ $reference_array = explode(",", $prescription->reference_areas); } else { $reference_array = []; }
if(isset($prescription->reference_name)){ $reference_name = explode(",", $prescription->reference_name); } else { $reference_name = []; }
for ($x = 0; $x < count($reference_array); $x++) {
?>
<a style="font-weight:normal;" href="{{ $reference_array[$x] }}" target="blank">{{ $reference_name[$x] }}</a>
<br>
<?php
}
if (!empty($pharm_comment)):
echo "<div style='padding: 1px; margin: 6px 1px 0px 1px; font-size: smaller' class='alert alert-info span12 margin-none well'>" . $pharm_comment . "</div>";
endif;
?>
@for ($x = 0; $x < count($reference_array); $x++)
@if(isset($reference_array[$x]) && isset($reference_name[$x]))
<a style="font-weight:normal;" href="{{ $reference_array[$x] }}" target="blank">{{ $reference_name[$x] }}</a><br>
@endif
@endfor
@if (!empty($pharm_comment))
<div style='padding: 1px; margin: 6px 1px 0px 1px; font-size: smaller' class='alert alert-info span12 margin-none well'>{{ $pharm_comment }}</div>
@endif
</td>
<td style="border: 1px solid #ddd;">
<div class="row">
<div class="col-sm-4">
<input type='number' step="0.001" style="margin-bottom: 0px;" name='dose[]' id="dose{{$prescription->id}}" class="form-control" required />
<span style="margin-bottom: 4px; font-size: smaller;">
<?php $drugunit = getTableInfo('drug_units','name','id='.$prescription->unit_id); ?>
{{ $drugunit }}
</span>
</div>
<div class="col-sm-8">
<select class="form-control" name='frequency[]' style="margin-bottom: 0px;" id="frequency{{$prescription->id}}" required>
<option value=''>{{ __('point_of_sale._select') }}</option>
<?php echo $fre_drop; ?>
</select>
<span style="margin-bottom: 4px; font-size: smaller;" id="equiv1{{$prescription->id}}"></span>
</div>
</div>
</td>
<td style="border: 1px solid #ddd;">
<input type='number' style="margin-bottom: 0px;" name='duration[]' id="duration{{$prescription->id}}" class="form-control" placeholder="days" required />
<input type="hidden" name="time[]" value="Days" class="span4" readonly required >
<span style="margin-bottom: 4px; font-size: xx-small; float: right;">{{ __('point_of_sale.duration_in_days') }}</span>
</td>
<td style="border: 1px solid #ddd;">
<input type='number' style="margin-bottom: 0px;" name='treatment_quantity[]' id="quantity_dispensed{{$prescription->id}}" class="form-control" required readonly />
<input type="hidden" name="treatment_item[]" value="{{ $prescription->id }}" />
<!-- <input type="hidden" name="drug_id[]" id="chk" value="{{ $prescription->id }}" />-->
<input type="hidden" name="treatment_amount[]" value="{{ $prescription->non_insured_price }}">
<input type="hidden" name="treatment_insurance_status[]" value="{{ $prescription->insurance_coverage }}">
<input type="hidden" name="treatment_insurance_amount[]" value="{{ $prescription->insured_price }}">
<?php $drug_form = getTableInfo('unit_of_measure','name','id='.$prescription->form_id); ?>
<input type="hidden" id="drug_form{{$prescription->id}}" value="{{$drug_form}}">
@if($prescription->insurance_coverage == 1 && patient_insurance_status($patient_id) == 1)
<input type="hidden" id="selling_price{{$prescription->id}}" value="{{$prescription->insured_price}}">
@else
<input type="hidden" id="selling_price{{$prescription->id}}" value="{{$prescription->non_insured_price}}">
@endif
<input type="hidden" name="pack[]" id="pack{{$prescription->id}}" value="{{$prescription->pack}}">
<input type="hidden" name="strength[]" id="strength{{$prescription->id}}" value="{{$prescription->strength}}">
</td>
<td>
<div class="input-group">
<input class="center" id="auto_prescription_price{{$prescription->id}}" style="padding: 2px;border: 1px solid #ddd;" name="treatment_subtotal[]">
<span class="input-group-addon">{{ __('point_of_sale.ugx') }}</span>
</div>
</td>
<!-- <td style="padding: 2px;border: 1px solid #ddd;">
<textarea name="instructions[]" id="instructions{{$prescription->id}}" class="form-control" rows="3" placeholder="Instructions to the patient .."></textarea>
</td> -->
</tr>
@endforeach
@endif
@else
<tr class="warning"><td class="center" colspan="8" style="border: 1px solid #ddd;">{{ __('point_of_sale.no_drugs_have_searched_yet') }}</td></tr>
@endif
</tbody>
</table>
</div>
</div>
<div class="col-2">
<label for="grand_total_column"><b>{{ __('point_of_sale.drugs_total') }} :</b></label>
<div class="input-group">
<input id="grand_total_column" name="treatment_total" class="form-control" readonly type="number">
<span class="input-group-addon">{{ __('point_of_sale.ugx') }}</span>
</div>
</div>
</div>
@endif
@if($pre_ordered_sundries)
<div class="row">
<div class="col-10">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th class="text-center">{{ __('point_of_sale.select') }}</th>
<th class="text-center">{{ __('point_of_sale.sundry') }}</th>
<th class="text-center">{{ __('point_of_sale.quantity') }}</th>
<th class="text-center">{{ __('point_of_sale.unit_cost') }}</th>
<th class="text-center">{{ __('point_of_sale.total_cost') }}</th>
</tr>
</thead>
<tbody>
@php $pre_order_amount_sum = 0; @endphp
<tr><td colspan='5' style='background-color: #FFE6E6; font-weight: bolder; text-decoration: underline;'>{{ __('point_of_sale.selected_sundries_orders') }}</td></tr>
@foreach($pre_ordered_sundries as $pre_order)
<tr>
<td>
<input type="checkbox" name="pos_sundry_ids[]" value="{{ $pre_order->id }}" checked>
</td>
<td>
@if($pre_order->insurance == 1)
<span style='color: green'> {{ $pre_order->name }} </span>
@else
<span style='color: orange'> {{ $pre_order->name }} </span>
@endif
</td>
@php
$insurance_amount = 0;
// get insurance status for sundry
$sundry_insurance_status = get_name($pre_order->id, "id", "insurance", "sundries");
// insurance flag
$is_insured = 0;
if($sundry_insurance_status == 1 && patient_insurance_status($patient_id) == 1){
$sundry_amount = get_name($pre_order->id, "id", "insured_price", "sundries");
$insurance_amount = get_name($pre_order->id, "id", "non_insured_price", "sundries") - $sundry_amount;
$is_insured = 1;
} else {
$sundry_amount = get_name($pre_order->id, "id", "non_insured_price", "sundries");
}
// }
@endphp
<td>
<input type='number' name='sundry_quantity[]' style="margin-bottom: 0px;" id="pre_order_sundry_quantity_{{$pre_order->id}}" class="form-control compulsory" required />
</td>
<td>
@php $price_list_id = is_patient_category_attached_to_price_list($patient_id); @endphp
@if($price_list_id)
{{ ugandan_shillings(get_price_list_category_price($price_list_id, 5, $pre_order->id)) }}
<input type='hidden' name='pre_order_sundry_cost[]' id="pre_order_sundry_cost_{{ $pre_order->id }}" class="form-control" value="{{ get_price_list_category_price($price_list_id, 5, $pre_order->id) }}"/>
@else
@php $sundry_insurance = $pre_order->insurance; @endphp
@if($sundry_insurance == 1 && patient_insurance_status($patient_id) == 1)
{{ ugandan_shillings($pre_order->insured_price) }}
<input type='hidden' name='pre_order_sundry_cost[]' id="pre_order_sundry_cost_{{ $pre_order->id }}" class="form-control" value="{{ $pre_order->insured_price }}"/>
@else
{{ ugandan_shillings($pre_order->non_insured_price) }}
<input type='hidden' name='pre_order_sundry_cost[]' id="pre_order_sundry_cost_{{ $pre_order->id }}" class="form-control" value="{{ $pre_order->non_insured_price }}"/>
@endif
@endif
</td>
<td>
<div class="input-group">
<input id="pre_order_sundry_cost_sum_{{ $pre_order->id }}" class="form-control" name="sundry_subtotal[]" readonly>
<span class="input-group-addon">{{ __('point_of_sale.ugx') }}</span>
</div>
</td>
{{ Form::hidden('sundry_insurance_status[]', $is_insured) }}
{{ Form::hidden('sundry_insurance_amount[]', $insurance_amount, ['class' => 'insurance_amount']) }}
</tr>
@endforeach
<!-- display row showing total amount -->
</tbody>
</table>
</div>
<div class="col-2">
<label for="pre_grand_sundry_total"><b>{{ __('point_of_sale.sundries_total') }} :</b></label>
<div class="input-group">
<input id="pre_grand_sundry_total" name="sundry_grand_total" class="form-control" readonly type="number">
<span class="input-group-addon">{{ __('point_of_sale.ugx') }}</span>
</div>
</div>
</div>
@endif
<br/>
<div class="row">
<div class="col-md-2 offset-10">
<label for=""><b>BILL TOTAL :</b></label>
<div class="input-group">
<input id="bill_total" class="form-control" name="sundry_subtotal[]" type="number"readonly>
<span class="input-group-addon">{{ __('point_of_sale.ugx') }}</span>
</div>
</div>
</div>
<div class="row mt-5">
<div class="col-md-12">
<input type="button" id="delete_row_button" class="btn btn-success btn-rounded pull-right" value="Confirm Selection" />
<button class="btn btn-success btn-rounded pull-right" style="display: none;" id="approve_sale">{{ __('point_of_sale.approve_and_print_order') }}</button>
</div>
</div>
<input type="hidden" name="patient_id" value="{{ $patient_id }}" />
<input type="hidden" name="episode_id" value="{{ $episode_id }}" />
</div>
{{ Form::close() }}
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script type="text/javascript">
$('.tap_div_to_calculate_bill_total').click(function() {
//e.preventDefault();
let sundry_grand_total = $('#pre_grand_sundry_total').val();
let eye_glass_grand_total = $('#pre_eye_glasses_grand_total').val();
let treatment_grand_total = $('#grand_total_column').val();
let service_grand_total = $('#service_grand_total').val();
let grand_total = parseInt((isNaN(sundry_grand_total) || sundry_grand_total == "") ? 0 :sundry_grand_total) +
parseInt((isNaN(eye_glass_grand_total) || eye_glass_grand_total == "") ? 0 :eye_glass_grand_total) +
parseInt((isNaN(treatment_grand_total) || treatment_grand_total == "") ? 0 :treatment_grand_total) +
parseInt((isNaN(service_grand_total) || service_grand_total == "") ? 0 :service_grand_total);
$('#bill_total').val(grand_total);
});
$("#delete_row_button").click(function (e) {
var atleast_one_drug_selected = $('input:checkbox').is(':checked'); // Atleast one checkbox selected
if (atleast_one_drug_selected) {
// begin checking to ensure there is enough quantity dispensed
let drug_id = $("input[name='drug_id[]']" ).map(function(){
return this.value;
}).get();
let quantity_dispensed = $("input[name='treatment_quantity[]']" ).map(function(){
return this.value;
}).get();
if(drug_id.length > 0){
$.ajax({
url: '/check_dispensed_drugs_quantity',
data: {'drug_id_array[]':drug_id, 'quantity_dispensed_array[]':quantity_dispensed},
success: function(response){
if (response[0] === "1") {
alert(response[1]);
return false;
} else {
$(".to_remove").remove();
$(".prescription-check").attr("disabled", "disabled");
$('#approve_sale').show();
$('#delete_row_button').hide();
/*loop thru the prescription_check row and is checked and get the auto_price*/
/********************************************/
var auto_price_grand_total = 0;
$("[id^=auto_prescription_price]").each(function(){
var unit_price = $(this).val();
var auto_price = isNaN(unit_price) ? 0 : unit_price;
var auto_price_integer = parseInt(auto_price);
auto_price_grand_total += auto_price_integer;
});
$("#grand_total_column").val(auto_price_grand_total);
}
}
});
}else{
$('#approve_sale').show();
$('#delete_row_button').hide();
}
} else {
e.preventDefault();
alert("Please Be Sure To Select Atleast One Item.");
return false;
}
});
$("[id^='manual_dose'],[id^='manual_frequency'],[id^='duration'], [id^='manual_quantity_dispensed']").on("change keyup", function () {
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
var pack = parseFloat($("#pack" + id).val());
var strength = parseFloat($("#strength" + id).val()) || 0;
var dose1 = parseFloat($("#manual_dose" + id).val()) || 0;
var equiv1 = dose1 / strength;
var manual_qty_dispensed = $("#manual_quantity_dispensed" + id).val();
// Adding a prompt dynamically eg 500mg = 2tabs
$("#equiv1" + id).text("( " + equiv1 + " " + $("#drug_form" + id).val() + " )");
var frequency_id = $("#manual_frequency" + id).val() || 0;
$.ajax({
url: '/prescriptions/get_factor/'+frequency_id,
data: {},
success: function(data){
var selling_price = parseInt($("#selling_price" + id).val());
$('#price_per_unit_drug' + id).text(selling_price +'.ugx ' +' per '+ $("#drug_form" + id).val())
var cost = selling_price * manual_qty_dispensed;
if(isNaN(cost)){ cost = 0 }
$("#auto_prescription_price" + id).val(cost);
},
error: function(response){
//
}
});
});
/* on table losing focus */
$("#manual_prescription_table").focusout(function(e) {
var manual_auto_price_grand_total = 0;
$("[id^=auto_prescription_price]").each(function(){
var unit_price = $(this).val();
var auto_price = isNaN(unit_price) ? 0 : unit_price;
var auto_price_integer = parseInt(auto_price);
manual_auto_price_grand_total += auto_price_integer;
});
$("#grand_total_column").val(manual_auto_price_grand_total);
});
$("#instruction_button").click(function () {
$(".instruction_td").show();
$(this).hide();
$("#hide_instruction_button").show();
});
$("#hide_instruction_button").click(function () {
$(".instruction_td").hide();
$(this).hide();
$("#instruction_button").show();
});
/* highlight the checked treatment table row */
$('.prescription-check').click(function(e) {
if($(this).is(':checked')){
$(this).parent().parent().css({'background-color': '#FFFF99'});
$('#my_row' + $(this).val()).addClass('color-tr').removeClass('to_remove');
} else{
$(this).parent().parent().css({'background-color': '#fff'});
$('#my_row' + $(this).val()).removeClass('color-tr').addClass('to_remove');
}
});
$('.eye_glass_check').click(function(e) {
if($(this).is(':checked')){
$(this).parent().parent().css({'background-color': '#FFFF99'});
$('#eye_glass_row' + $(this).val()).addClass('color-tr').removeClass('eye_glass_remove');
} else{
$(this).parent().parent().css({'background-color': '#fff'});
$('#eye_glass_row' + $(this).val()).removeClass('color-tr').addClass('eye_glass_remove');
}
});
$("[id^='dose'],[id^='frequency'],[id^='duration'], [id^='quantity_dispensed']").on("change keyup", function () {
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
var pack = parseFloat($("#pack" + id).val());
var strength = parseFloat($("#strength" + id).val()) || 0;
var dose = parseFloat($("#dose" + id).val()) || 0;
var equiv1 = dose / strength;
// Adding a prompt dynamically eg 500mg = 2tabs
$("#equiv1" + id).text("( " + equiv1 + " " + $("#drug_form" + id).val() + " )");
var equiv_total = dose / strength;
var frequency_id = $("#frequency" + id).val() || 0;
var duration_days = parseInt($("#duration" + id).val()) || 0;
$.ajax({
url: '/prescriptions/get_factor/'+frequency_id,
data: {},
success: function(data){
var factor = parseFloat(data);
var quantity = parseFloat(equiv_total * factor * duration_days) || 0;
var required = quantity / pack;
var dispense = Math.ceil(required); // @TODO Roundup this to the nearest whole number
$("#quantity_dispensed" + id).val(dispense);
var selling_price = parseInt($("#selling_price" + id).val());
var cost = dispense * selling_price;
if(isNaN(cost)){ cost = 0 }
$("#auto_prescription_price" + id).val(cost);
},
error: function(response){
//
}
});
});
/* on table losing focus */
$("#prescription_table").focusout(function(e) {
var auto_price_grand_total = 0;
$("[id^=auto_prescription_price]").each(function(){
var auto_price = $(this).val();
var auto_price_integer = parseInt(auto_price);
auto_price_grand_total += auto_price_integer;
});
$("#grand_total_column").val(auto_price_grand_total);
});
$("[id^='pre_order_sundry_quantity_']").on("change", function () {
let pre_auto_price_grand_total = 0;
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
var quantity = parseFloat($("#pre_order_sundry_quantity_" + id).val());
var cost = parseFloat($("#pre_order_sundry_cost_" + id).val()) || 0;
var total_cost = quantity * cost;
$("#pre_order_sundry_cost_sum_" + id).val(total_cost);
$("[id^=pre_order_sundry_cost_sum_]").each(function(){
var auto_price = $(this).val();
// if (auto_price.slice(-3) == 'UGx') {
var without_ugx = auto_price;
var auto_price_integer = parseInt(without_ugx);
pre_auto_price_grand_total += auto_price_integer;
// }
});
$("#pre_grand_sundry_total").val(pre_auto_price_grand_total);
});
//eye glasses
$("[id^='order_quantity_']").on("change", function () {
let auto_price_grand_total = 0;
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
var quantity = parseFloat($("#order_quantity_" + id).val());
var cost = parseFloat($("#order_cost_" + id).val()) || 0;
var total_cost = quantity * cost;
$("#order_cost_sum_" + id).text(total_cost + " UGx");
$("[id^=order_cost_sum_]").each(function(){
var auto_price = $(this).text();
if (auto_price.slice(-3) == 'UGx') { //if the auto_price column is a UGx
var without_ugx = auto_price.slice(0,-3); /*remove 'UGx' e.g turn 2300UGx to 2300*/
var auto_price_integer = parseInt(without_ugx);
auto_price_grand_total += auto_price_integer;
}
});
$("#order_grand_total").text(auto_price_grand_total + " UGx");
});
$("[id^='pre_order_quantity_']").on("change", function () {
let pre_auto_price_grand_total = 0;
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
var quantity = parseFloat($("#pre_order_quantity_" + id).val());
var cost = parseFloat($("#pre_order_cost_" + id).val()) || 0;
var total_cost = quantity * cost;
$("#pre_order_cost_sum_" + id).val(total_cost);
$("[id^=pre_order_cost_sum_]").each(function(){
var auto_price = $(this).val();
var auto_price_integer = parseInt(auto_price);
pre_auto_price_grand_total += auto_price_integer;
});
$("#pre_eye_glasses_grand_total").val(pre_auto_price_grand_total);
});
$("[id^='pre_order_cost_sum_']").on("change", function () {
let pre_auto_price_grand_total = 0;
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
var quantity = parseFloat($("#pre_order_quantity_" + id).val());
var cost = this.value;
var total_cost = quantity * cost;
$("#pre_order_cost_sum_" + id).val(total_cost);
$("#eye_glass_amount_"+ id).val(cost);
$("[id^=pre_order_cost_sum_]").each(function(){
var auto_price = $(this).val();
var auto_price_integer = parseInt(auto_price);
pre_auto_price_grand_total += auto_price_integer;
});
$("#pre_eye_glasses_grand_total").val(pre_auto_price_grand_total);
});
$("[id^='service_order_quantity_']").on("change", function () {
let service_auto_price_grand_total = 0;
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
var quantity = parseFloat($("#service_order_quantity_" + id).val());
var cost = parseFloat($("#service_order_cost_" + id).val()) || 0;
var total_cost = quantity * cost;
$("#service_order_cost_sum_" + id).val(total_cost);
$("[id^=service_order_cost_sum_]").each(function(){
var auto_price = $(this).val();
var without_ugx = isNaN(auto_price) ? 0 : auto_price;
var auto_price_integer = parseInt(without_ugx);
service_auto_price_grand_total += isNaN(auto_price_integer) ? 0 : auto_price_integer;
});
$("#service_grand_total").val(service_auto_price_grand_total);
});
</script>
@endpush
@@ -1,173 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css"/>
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('point_of_sale.point_of_sale') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> {{ __('point_of_sale.home') }}</a></li>
<li class="active"><i class="fa fa-shopping-cart"></i> {{ __('point_of_sale.point_of_sale') }}</li>
</ol>
</div>
</div>
<div class="white-box">
{{ Form::open(['method'=>'post','route' => 'point_of_sale.index']) }}
<div class="row">
<div class="col-md-2">
<div class="form-group">
<label>{{ __('pharmacy.select_date') }}:</label>
<select class="form-control compulsory required" name="search_date_by" id="search_date_by" required>
<option value="today">{{ __('pharmacy.today') }}</option>
<option value="yesterday">{{ __('pharmacy.yesterday') }}</option>
<option value="custom_date">{{ __('pharmacy.custom_date') }}</option>
<option value="custom_date_range">{{ __('pharmacy.date_range') }}</option>
</select>
</div>
</div>
<div class="col-md-2" id="start_date_div" style="display: none;">
<div class="form-group">
{{ Form::label('start_date', __('pharmacy.date_on')) }}
<div class="input-group">
{{ Form::text('start_date', '', ['class'=>'form-control compulsory', 'readonly', 'id'=>'start_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
<div class="col-md-2" id="end_date_div" style="display: none;">
<div class="form-group">
{{ Form::label('end_date', __('pharmacy.end_date')) }}
<div class="input-group">
{{ Form::text('end_date', '', ['class'=>'form-control compulsory', 'readonly', 'id'=>'end_date']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group" style="margin-top: 25px;">
{{ Form::submit(__('investigations.search'), ['class'=>'btn btn-success pull-right']) }}
</div>
</div>
</div>
{{ Form::close() }}
</div>
<div class="white-box">
@if(session()->get("print_pos_pdf") == 1)
{{ Form::hidden('print_pos_pdf', 1, ['id' => 'print_pos_pdf']) }}
@endif
@include('flash::message')
<h4><label class="label label-info">{{ $search_text }}</label></h4>
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table table-striped" style="width:100%">
<thead>
<tr>
<th>{{ __('point_of_sale.patient_names') }}</th>
<th>{{ __('point_of_sale.items') }}</th>
<th>{{ __('point_of_sale.record_created_by') }}</th>
<th>{{ __('point_of_sale.record_created_on') }}</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($records as $record)
<tr>
<td>{{ $record->first_name . ' ' . $record->last_name }} ({{ $record->number }})</td>
<td>
<ul>
@if(!is_null($record->treatments))
<li>{{ __('point_of_sale.treatments') }}</li>
@endif
@if(!is_null($record->eye_glasses))
<li>{{ __('point_of_sale.eye_glasses') }}</li>
@endif
@if(!is_null($record->sundries))
<li>{{ __('point_of_sale.sundries') }}</li>
@endif
@if(!is_null($record->services))
<li>{{ __('point_of_sale.services') }}</li>
@endif
</ul>
</td>
<td>{{ get_full_name($record->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
<td>{{ streamline_date_time($record->created_at) }}</td>
<td><a href="/point_of_sale/print/{{ $record->id }}" class="btn btn-success btn-sm">{{ __('point_of_sale.print') }}</a></td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.colVis.min.js') }}"></script>
<script>
// check if the patient has paid and a pdf print is required
if ($('#print_pos_pdf').val() == 1) {
var win = window.open('/point_of_sale/print_pos_pdf', '_blank');
if (win) {
win.focus();
} else {
alert('Please allow popups for Stre@mline');
}
}
$('#search_date_by').change(function() {
if($(this).val() === "custom_date"){
$("#end_date_div").hide();
$("#start_date_div").show();
} else if($(this).val() === "custom_date_range") {
$("#start_date_div").show();
$("#end_date_div").show();
} else {
$("#end_date_div").hide();
$("#start_date_div").hide();
}
});
$('#end_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
$('#start_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd-mm-yyyy'
});
$('.table').DataTable({
dom: 'Bfrtip',
pageLength: 100,
buttons: ['copy', 'csv', 'excel', 'pdf', 'print']
});
</script>
@endpush
@@ -1,632 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css"/>
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<style>
.modal {
text-align: center;
}
@media screen and (min-width: 768px) {
.modal:before {
display: inline-block;
vertical-align: middle;
content: " ";
height: 100%;
}
}
.modal-dialog {
display: inline-block;
text-align: center;
vertical-align: middle;
width: 500px;
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('point_of_sale.point_of_sale') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> {{ __('point_of_sale.home') }}</a></li>
<li class="active"><i class="fa fa-shopping-cart"></i> {{ __('point_of_sale.point_of_sale') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
@include('flash::message')
<div class="panel">
<div class="panel-body">
{{ Form::open(['route'=>'point_of_sale.confirm_items']) }}
{{ Form::hidden('patient_id', '', ['class' => 'patient_id', 'id' => 'patient_id']) }}
<div class="row">
<div class="col-md-12">
<h4>Patient / Client</h4>
<div class="row">
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon bg-info">
<input id="new_patient" type="checkbox">
</span>
<label for="new_patient" type="text" class="form-control" aria-label="Text input with checkbox">{{ __('point_of_sale.new_patient') }}</label>
</div>
</div>
<div class="col-md-6">
<div class="input-group">
<span class="input-group-addon bg-info">
<input id="existing_patient" type="checkbox">
</span>
<label for="existing_patient" type="text" class="form-control" aria-label="Text input with checkbox">{{ __('point_of_sale.existing_patient') }}</label>
</div>
</div>
<div class="col-md-12">
<div id="new_patient_div" class="mt-5" style="display: none;">
<h4>Patient / Client Information.</h4>
<div class="row">
<div class="col-md-2">
<div class="form-group">
<label for="">First Name</label>
<input class="form-control compulsory" id="first_name" name="first_name" placeholder="First Name">
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label for="">Last Name</label>
<input class="form-control compulsory" id="last_name" name="last_name" placeholder="Last Name">
</div>
</div>
<div class="col-md-2">
<div class="form-group">
{{ Form::label('gender',__('patients.gender')) }}
<br>
{{ Form::radio('gender', 1, false) }} {{ __('patients.male') }} &nbsp;&nbsp;
{{ Form::radio('gender', 2, false) }} {{ __('patients.female') }}
</div>
</div>
<div class="col-md-2">
<div class="form-group">
{{ Form::label('date_of_birth',__('patients.date_of_birth')) }}
<div class="input-group">
{{ Form::text('date_of_birth','',['class' => 'form-control compulsory','readonly','id'=>'date_of_birth']) }}
<span class="input-group-addon"><i class="icon-calender"></i></span>
</div>
<div class="help-block with-errors"></div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('age',__('patients.years')) }}
{{ Form::number('age_in_years','',['class' => 'form-control compulsory','id'=>'age_in_years','min'=>'0']) }}
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('age',__('patients.months')) }}
{{ Form::number('age_in_months','',['class' => 'form-control','id'=>'age_in_months','readonly','min'=>'0']) }}
</div>
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label for="">Phone Number</label>
<input class="form-control compulsory" id="phone_number" data-mask="0799 999 999" name="phone_number" placeholder="Phone Number">
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label for="">Referral Hospital</label>
<select class="form-control" id="referral_hospital" name="referral_hospital">
<option value="">{{ __('point_of_sale._select') }}</option>
@foreach($referral_hospitals as $item)
<option value="{{ $item->id }}">{{ $item->name }}</option>
@endforeach
</select>
<a class="pull-right label label-success" style="font-size: x-small; margin-top: 10px; color: white;"
data-toggle="modal" data-target="#referralsmodal" >Add New</a>
<div class="modal fade" id="referralsmodal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="exampleModalLabel1">Add New Referral</h4>
</div>
<div class="modal-body">
{{ Form::text('referral_name', '', ['class' => 'form-control', 'id' => 'referral_name', 'placeholder' => 'Referral Name']) }}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('point_of_sale.cancel') }}</button>
<a class="btn btn-primary" onclick="submitReferral()">Save Referral</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="existing_patient_div" class="mt-5" style="display: none;">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<select class="patient_full_name form-control" style="width:100%;" name="patient_full_name" id="patient_full_name"></select>
</div>
</div>
<div class="col-md-6 text-left" id="patient_info" style="display: none;"></div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-12 mt-5">
<h4>{{ __('point_of_sale.select_items') }}</h4>
<div class="row">
<div class="col-md-2">
<div class="input-group">
<span class="input-group-addon bg-success">
<input id="manual_drugs" type="checkbox">
</span>
<label for="manual_drugs" type="text" class="label label-success form-control" aria-label="Text input with checkbox">{{ __('point_of_sale.drugs_with_quantity') }}</label>
</div>
</div>
<div class="col-md-2">
<div class="input-group">
<span class="input-group-addon bg-warning">
<input id="automatic_drugs" type="checkbox">
</span>
<label for="automatic_drugs" type="text" class="label label-success form-control" aria-label="Text input with checkbox">{{ __('point_of_sale.drugs_with_prescription') }}</label>
</div>
</div>
<div class="col-md-2">
<div class="input-group">
<span class="input-group-addon bg-primary">
<input id="eye_glasses" type="checkbox">
</span>
<label for="eye_glasses" type="text" class="label label-success form-control" aria-label="Text input with checkbox">{{ __('point_of_sale.eye_glasses') }}</label>
</div>
</div>
<div class="col-md-2">
<div class="input-group">
<span class="input-group-addon bg-danger">
<input id="sundries" type="checkbox">
</span>
<label for="sundries" type="text" class="label label-success form-control" aria-label="Text input with checkbox">{{ __('point_of_sale.sundries') }}</label>
</div>
</div>
<div class="col-md-2">
<div class="input-group">
<span class="input-group-addon bg-info">
<input id="services" type="checkbox">
</span>
<label for="services" type="text" class="label label-success form-control" aria-label="Text input with checkbox">Services</label>
</div>
</div>
<div class="col-md-2">
<div class="input-group">
<span class="input-group-addon bg-danger">
<input id="all" type="checkbox">
</span>
<label for="all" type="text" class="label label-success form-control" aria-label="Text input with checkbox">{{ __('point_of_sale.all') }}</label>
</div>
</div>
</div>
<br/>
<div class="row" >
<div class="col-md-12" id="items" style="display: none">
<h4> {{ __('point_of_sale.items') }}</h4>
<div id="manual_drugs_div" style="display: none;">
<h4>{{ __('point_of_sale.drugs') }}</h4>
<div class="row">
<div class="col-md-12">
<input type="hidden" name="manual_drug_select" id="manual_drug_select">
<select class="form-control select" id="man_select_drugs" name="selected_drugs[]" multiple="multiple" style="width: 100%;">
<option value="">{{ __('point_of_sale._select') }}</option>
@foreach($drugs as $drug)
<option value="{{ $drug->id }}">{{ $drug->name }}</option>
@endforeach
</select>
</div>
</div>
</div>
<div id="automatic_drugs_div" style="display: none;">
<h4>Drugs</h4>
<div class="row">
<div class="col-md-12">
<input type="hidden" name="automatic_drug_select" id="automatic_drug_select">
<select class="form-control select" id="auto_select_drugs" name="selected_drugs[]" multiple="multiple" style="width: 100%;">
<option value="">{{ __('point_of_sale._select') }}</option>
@foreach($drugs as $drug)
<option value="{{ $drug->id }}">{{ $drug->name }}</option>
@endforeach
</select>
</div>
</div>
</div>
<div id="eye_glasses_div" style="display: none;">
<h4>{{ __('point_of_sale.eye_glasses') }}</h4>
<div class="row">
<div class="col-md-12">
<select class="form-control select" id="select_eye_glasses" name="selected_eye_glasses[]" multiple="multiple" style="width: 100%;">
<option value="">{{ __('point_of_sale._select') }}</option>
@foreach($eye_glasses as $item)
<option value="{{ $item->id }}">{{ $item->name }}</option>
@endforeach
</select>
</div>
</div>
</div>
<div id="sundries_div" style="display: none;">
<h4>{{ __('point_of_sale.sundries') }}</h4>
<div class="row">
<div class="col-md-12">
<select class="form-control select" id="select_sundries" name="selected_sundries[]" multiple="multiple" style="width: 100%;">
<option value="">{{ __('point_of_sale.select') }}</option>
@foreach($sundries as $item)
<option value="{{ $item->id }}">{{ $item->name }}</option>
@endforeach
</select>
</div>
</div>
</div>
<div id="services_div" style="display: none;">
<h4>Services</h4>
<div class="row">
<div class="col-md-12">
<select class="form-control select" id="select_services" name="selected_services[]" multiple="multiple" style="width: 100%;">
<option value="">{{ __('point_of_sale.select') }}</option>
@foreach($services as $item)
<option value="{{ $item->id }}">{{ $item->name }}</option>
@endforeach
</select>
</div>
</div>
</div>
</div>
</div>
<br/>
<div id="proceed-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<i style="color: red" class="fa fa-3x fa-question-circle"></i> <h4 class="modal-title">Do you wish proceed ?</h4>
</div>
<div class="modal-footer" style="background-color: lightgrey">
<button type="button" class="btn btn-default btn-rounded waves-effect" data-dismiss="modal">{{ __('point_of_sale.close') }}</button>
<button class="btn btn-success waves-effect btn-rounded waves-light" >{{ __('point_of_sale.proceed') }}</button>
</div>
</div>
</div>
</div>
</div>
</div>
{{ Form::close() }}
<div class="row" id="confirm_info">
<br/>
<div class="col-md-12">
<button class="btn btn-success btn-rounded pull-right" onclick="confirm_info()">{{ __('point_of_sale.confirm_selection') }}</button>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script src="{{ asset('elite/js/mask.js') }}"></script>
<script type="text/javascript">
$('#date_of_birth').datepicker({
autoclose: true,
todayHighlight: true,
format: 'dd/mm/yyyy',
endDate: new Date()
});
$('#age_in_years').on('change', function () {
let years = parseInt($(this).val());
let possibleBirthday = new Date();
if (!isNaN(years)) {
possibleBirthday.setMonth(possibleBirthday.getMonth() - (years * 12));
$('#date_of_birth').val(format_date(possibleBirthday));
} else {
alert("<?php echo __('patients.valid_number_years')?>")
}
});
$("#date_of_birth").on('change', function () {
var today = new Date();
var birthDate = $(this).val();
var temp_date = birthDate.split("/");
birthDate = new Date(temp_date[2], (temp_date[1] - 1), temp_date[0]);
//calculate years
var age = today.getFullYear() - birthDate.getFullYear();
age = parseInt(age);
var m = today.getMonth() - birthDate.getMonth();
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
age--;
}
//calculate months
var monthBirth = birthDate.getMonth() + 1;
var monthToday = today.getMonth() + 1;
if (monthToday > monthBirth) {
var months = monthToday - monthBirth;
} else if (monthToday == monthBirth) {
var months = 0;
} else if (monthToday < monthBirth) {
var months = monthToday - monthBirth;
months = months + 12;
}
if (months < 10) {
months = '0' + months
}
//set the values
$('#age_in_years').val(age);
$('#age_in_months').val(months);
});
$('.patient_full_name').change(function() {
let id = $('#patient_full_name').val();
$('#patient_id').val(id);
$.ajax({
method: 'GET',
url: "/patients/update_patient_info/" + id,
success: function(response){
$('#patient_info').html(response).show();
},
error: function (error) {
console.log(error);
}
});
}).select2({
placeholder: "<?php echo "Search by patient name or number" ?>",
ajax: {
url: '/patients/search_patient_by_name_number',
dataType: 'json',
delay: 250,
processResults: function (data) {
return {
results: $.map(data, function (item) {
return {
text: item.first_name + " " + item.last_name + " ("+ item.number + ") " + item.phone,
id: item.id
}
})
};
},
cache: true
}
});
function confirm_info() {
var new_patient_checkbox = $('#new_patient:checkbox:checked').length ;
var existing_patient_checkbox = $('#existing_patient:checkbox:checked').length;
var man_drugs = $('#man_select_drugs').val();
var auto_drugs = $('#auto_select_drugs').val();
var sundries = $('#select_sundries').val();
var services = $('#select_services').val();
var eye_glasses = $('#select_eye_glasses').val();
if(new_patient_checkbox != 0 || existing_patient_checkbox != 0){
if(auto_drugs != null || man_drugs != null || sundries != null || eye_glasses != null || services != null){
if ((is_new_patient && $('#first_name').val() != '' && $('#last_name').val() != '') ||
(!is_new_patient && +$('#patient_id').val() != NaN)) {
$('#confirm_info').hide();
$('#proceed-modal').modal('show');
} else {
alert("Please Be Sure to Enter The Patient's Details Or Select A Patient.");
}
}else{
alert('Please Be Sure to Select An Item.');
}
}else{
alert('Please Be Sure to Select A Patient Or Register A New One.');
}
}
$('.sundries').select2({
placeholder: "Select sundry"
});
$('.eye_glasses').select2({
placeholder: "Select eye glasses"
});
function submitReferral(){
var name = $("#referral_name").val();
$.ajax({
method: 'POST',
url: '/triage/add_referral',
data: {'name' : name},
success: function(response){
if(!isNaN(response)){
//response = last inserted id
$('#referral_hospital').append($('<option>', {
value: response,
text: name
}));
$('#referral_hospital').val(response);//preselect the newly added referral
$('#referralsmodal').modal('hide'); //manually hide the modal
} else {
alert("Adding referral failed");
}
},
error: function(jqXHR, textStatus, errorThrown) {
alert(JSON.stringify(jqXHR));
}
});
}
// searchable select on input fields
$('.select').select2();
let is_new_patient = false;
// get existing patient form.
$("#existing_patient").change(function() {
if(this.checked) {
is_new_patient = false;
$('#new_patient_div').hide();
$('#existing_patient_div').show();
$('#new_patient').prop('checked', false);
}
});
// get new patient form.
$("#new_patient").change(function() {
if(this.checked) {
is_new_patient = true;
$('#new_patient_div').show();
$('#existing_patient_div').hide();
$('#existing_patient').prop('checked', false);
}
});
// get manual drugs form.
$("#manual_drugs").change(function() {
if(this.checked) {
$('#items').show();
$('#manual_drugs_div').show();
$('#automatic_drugs_div').hide();
$('#eye_glasses_div').hide();
$('#sundries_div').hide();
$('#services_div').hide();
$('#automatic_drugs').prop('checked', false);
$('#sundries').prop('checked', false);
$('#eye_glasses').prop('checked', false);
$('#all').prop('checked', false);
$('#manual_drug_select').val(1);
$('#automatic_drug_select').val(0);
}
});
// get automatic drugs form.
$("#automatic_drugs").change(function() {
if(this.checked) {
$('#items').show();
$('#automatic_drugs_div').show();
$('#manual_drugs_div').hide();
$('#eye_glasses_div').hide();
$('#sundries_div').hide();
$('#services_div').hide();
$('#manual_drugs').prop('checked', false);
$('#sundries').prop('checked', false);
$('#eye_glasses').prop('checked', false);
$('#all').prop('checked', false);
$('#manual_drug_select').val(0);
$('#automatic_drug_select').val(1);
}
});
// get eyeglasses form.
$("#eye_glasses").change(function() {
if(this.checked) {
$('#items').show();
$('#eye_glasses_div').show();
$('#manual_drugs_div').hide();
$('#automatic_drugs_div').hide();
$('#drugs_div').hide();
$('#sundries_div').hide();
$('#services_div').hide();
$('#manual_drugs').prop('checked', false);
$('#automatic_drugs').prop('checked', false);
$('#sundries').prop('checked', false);
$('#all').prop('checked', false);
$('#drugs').prop('checked', false);
}
});
// get sundries form.
$("#sundries").change(function() {
if(this.checked) {
$('#items').show();
$('#sundries_div').show();
$('#eye_glasses_div').hide();
$('#manual_drugs_div').hide();
$('#automatic_drugs_div').hide();
$('#drugs_div').hide();
$('#services_div').hide();
$('#manual_drugs').prop('checked', false);
$('#automatic_drugs').prop('checked', false);
$('#all').prop('checked', false);
$('#drugs').prop('checked', false);
$('#eye_glasses').prop('checked', false);
}
});
// get services form.
$("#services").change(function() {
if(this.checked) {
$('#items').show();
$('#services_div').show();
$('#sundries_div').hide();
$('#eye_glasses_div').hide();
$('#manual_drugs_div').hide();
$('#automatic_drugs_div').hide();
$('#drugs_div').hide();
$('#manual_drugs').prop('checked', false);
$('#automatic_drugs').prop('checked', false);
$('#all').prop('checked', false);
$('#drugs').prop('checked', false);
$('#eye_glasses').prop('checked', false);
}
});
// get all item forms.
$("#all").change(function() {
if(this.checked) {
$('#items').show();
$('#eye_glasses_div').show();
$('#sundries_div').show();
$('#manual_drugs_div').show();
$('#services_div').show();
$('#automatic_drugs_div').hide();
$('#manual_drugs').prop('checked', false);
$('#automatic_drugs').prop('checked', false);
$('#sundries').prop('checked', false);
$('#eye_glasses').prop('checked', false);
$('#drugs').prop('checked', false);
$('#manual_drug_select').val(1);
$('#automatic_drug_select').val(0);
}
});
</script>
@endpush
@@ -1,175 +0,0 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Patient Receipt - Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
body{
font-size: 0.8em;
}
/*thead, tfoot { display: table-row-group }*/
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-before: always;
page-break-after: always;
page-break-inside: avoid;
}
</style>
</head>
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<table class="table table-bordered">
<tr>
<td><b>{{ __('patient_finance.patient_names') }}</b></td>
<td>{{ $patient->first_name }} {{ $patient->last_name }}</td>
<td><b>{{ __('patient_finance.patient_number') }}</b></td>
<td>{{ $patient->number }}</td>
<td><b>{{ __('patient_finance.patient_category') }}</b></td>
<td>{{ get_name($patient->category_id, "id", "name", "patient_categories") }}</td>
</tr>
<!-- <tr>
<td><b>{{ __('point_of_sale.record_date') }}</b></td>
<td colspan="2">{{ streamline_date_time_short($receipt_date) }}</td>
<td><b>{{ __('point_of_sale.print_date') }}</b></td>
<td colspan="2">{{ streamline_date_time_short($receipt_reprint_date) }}</td>
</tr>-->
</table>
<table class="table table-bordered">
<thead>
<th style="width: 60%"><b>{{ __('point_of_sale.description') }}</b></th>
<th style="width: 20%"><b>{{ __('point_of_sale.quantity') }}</b></th>
<th style="width: 20%"><b>{{ __('point_of_sale.price') }}</b></th>
</thead>
<tbody>
@php $total_to_pay = 0; @endphp
@if(isset($service_ids_array) && count($service_ids_array) > 0)
<tr>
<td colspan="3" class="text-center">Services</td>
</tr>
@for($i = 0; $i < count($service_ids_array); $i++)
<tr>
<td>{{ get_name($service_ids_array[$i], "id", "name", "services") }}</td>
<td>{{ $service_quantity_array[$i] }}</td>
<td>{{ ugandan_shillings($service_prices_array[$i]) }}</td>
</tr>
@php $total_to_pay += $service_prices_array[$i]; @endphp
@endfor
@endif
@if(isset($eye_glasses_ids_array) && count($eye_glasses_ids_array) > 0)
<tr>
<td colspan="3" class="text-center">Eye Glasses</td>
</tr>
@for($i = 0; $i < count($eye_glasses_ids_array); $i++)
<tr>
<td>{{ get_name($eye_glasses_ids_array[$i], "id", "name", "eye_glasses") }}</td>
<td>{{ $eye_glasses_quantity_array[$i] }}</td>
<td>{{ ugandan_shillings($eye_glasses_prices_array[$i] * $eye_glasses_quantity_array[$i]) }}</td>
</tr>
@php $total_to_pay += $eye_glasses_prices_array[$i] * $eye_glasses_quantity_array[$i]; @endphp
@endfor
@endif
@if(isset($procedure_ids_array) && count($procedure_ids_array) > 0)
<tr>
<td colspan="3" class="text-center">Procedures</td>
</tr>
@for($i = 0; $i < count($procedure_ids_array); $i++)
<tr>
<td>{{ get_name($procedure_ids_array[$i], "id", "name", "procedures") }}</td>
<td>N/A</td>
<td>{{ ugandan_shillings($procedure_amounts_array[$i]) }}</td>
</tr>
@php $total_to_pay += $procedure_amounts_array[$i]; @endphp
@endfor
@endif
@if(isset($investigation_ids_array) && count($investigation_ids_array) > 0)
<tr>
<td colspan="3" class="text-center">Investigations</td>
</tr>
@for($i = 0; $i < count($investigation_ids_array); $i++)
<tr>
<td>{{ get_name($investigation_ids_array[$i], "id", "name", "investigations") }}</td>
<td>N/A</td>
<td>{{ ugandan_shillings($investigation_amounts_array[$i]) }}</td>
</tr>
@php $total_to_pay += $investigation_amounts_array[$i]; @endphp
@endfor
@endif
@if(isset($treatment_item) && count($treatment_item) > 0)
<tr>
<td colspan="3" class="text-center">Treatments</td>
</tr>
@for($i = 0; $i < count($treatment_item); $i++)
<tr>
<td>{{ get_name($treatment_item[$i], "id", "name", "drugs") }}</td>
<td>{{ $treatment_quantity[$i] }}</td>
<td>{{ ugandan_shillings($treatment_subtotal[$i]) }}</td>
</tr>
@php $total_to_pay += $treatment_subtotal[$i]; @endphp
@endfor
@endif
@if(isset($sundry_item) && count($sundry_item) > 0)
<tr>
<td colspan="3" class="text-center">Sundries</td>
</tr>
@for($i = 0; $i < count($sundry_item); $i++)
<tr>
<td>{{ get_name($sundry_item[$i], "id", "name", "sundries") }}</td>
<td>{{ $sundry_quantity[$i] }}</td>
<td>{{ ugandan_shillings($sundry_subtotal[$i]) }}</td>
</tr>
@php $total_to_pay += $sundry_subtotal[$i]; @endphp
@endfor
@endif
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="2"><b>{{ __('point_of_sale.total_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($total_to_pay) }}</b></td>
</tr>
</tbody>
</table>
<div class="row">
<div class="col">
<i style="font-size: 0.8em; float: left">&copy; {{ date('Y') }} Stre@mline</i>
</div>
<div class="col">
<i style="float: right">{{ __('patient_finance.printed_on') }} {{ date(" d M Y h:ia") }} {{ __('patient_finance.by') }} {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</i>
</div>
</div>
</div>
</body>
</html>
@@ -1,205 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<style type="text/css">
#divToPrint{
font-size: 13px;
color: #7c7c7c;
}
#receipt_table{
font-size: 1em;
font-weight: normal;
font-family: monospace
}
#receipt_table th{
border: 1px solid #dddddd;
}
#receipt_table td{
border: 1px solid #dddddd;
}
.receipt-label{
margin-top: 10px;
padding: 10px;
}
.receipt-title{
font-weight: bolder;
text-decoration: underline;
display: block; font-family:
monospace
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-md-7">
<h4>{{ __('point_of_sale.patient_order_request') }}</h4>
</div>
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('point_of_sale.point_of_sale') }}</a></li>
<li class="active">{{ __('point_of_sale.point_of_sale') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="white-box">
<div class="row" style="float:right;"><button class="btn btn-success glyphicon glyphicon-print" onclick="print_receipt()"> {{ __('point_of_sale.print') }}</button></div>
<div class="row" id="divToPrint">
<div class="col-sm-3"></div>
<div class="col-sm-6" style="text-align: center;">
<p style="text-align: center; font-size: 1em">
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace"><b>{{ $hospital_information->name }}</b></span>
<span style="font-weight: bolder; text-decoration: underline; display: block; font-family: monospace">{{ $hospital_information->address }}</span>
<span class="receipt-label"><b>{{ __('point_of_sale.tel') }}:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('point_of_sale.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('point_of_sale.dispensed_by') }}:</b> {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('point_of_sale.record_date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>{{ __('point_of_sale.print_date') }}:</b> {{ streamline_date_time_short($receipt_reprint_date) }}</span><br>
<span class="receipt-label"><b>{{ __('point_of_sale.patient_name') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('point_of_sale.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('point_of_sale.patient_category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span><br>
</p>
<div>
<table class="table" id="receipt_table">
<thead>
<th style="width: 60%"><b>{{ __('point_of_sale.description') }}</b></th>
<th style="width: 20%"><b>{{ __('point_of_sale.quantity') }}</b></th>
<th style="width: 20%"><b>{{ __('point_of_sale.price') }}</b></th>
</thead>
<tbody>
@php $total_to_pay = 0; @endphp
@if(isset($service_ids_array) && count($service_ids_array) > 0)
<tr>
<td colspan="3" class="text-center">Services</td>
</tr>
@for($i = 0; $i < count($service_ids_array); $i++)
<tr>
<td>{{ get_name($service_ids_array[$i], "id", "name", "services") }}</td>
<td>{{ $service_quantity_array[$i] }}</td>
<td>{{ ugandan_shillings($service_prices_array[$i]) }}</td>
</tr>
@php $total_to_pay += $service_prices_array[$i]; @endphp
@endfor
@endif
@if(isset($eye_glasses_ids_array) && count($eye_glasses_ids_array) > 0)
<tr>
<td colspan="3" class="text-center">Eye Glasses</td>
</tr>
@for($i = 0; $i < count($eye_glasses_ids_array); $i++)
<tr>
<td>{{ get_name($eye_glasses_ids_array[$i], "id", "name", "eye_glasses") }}</td>
<td>{{ $eye_glasses_quantity_array[$i] }}</td>
<td>{{ ugandan_shillings($eye_glasses_prices_array[$i] * $eye_glasses_quantity_array[$i]) }}</td>
</tr>
@php $total_to_pay += $eye_glasses_prices_array[$i] * $eye_glasses_quantity_array[$i]; @endphp
@endfor
@endif
@if(isset($procedure_ids_array) && count($procedure_ids_array) > 0)
<tr>
<td colspan="3" class="text-center">Procedures</td>
</tr>
@for($i = 0; $i < count($procedure_ids_array); $i++)
<tr>
<td>{{ get_name($procedure_ids_array[$i], "id", "name", "procedures") }}</td>
<td>N/A</td>
<td>{{ ugandan_shillings($procedure_amounts_array[$i]) }}</td>
</tr>
@php $total_to_pay += $procedure_amounts_array[$i]; @endphp
@endfor
@endif
@if(isset($investigation_ids_array) && count($investigation_ids_array) > 0)
<tr>
<td colspan="3" class="text-center">Investigations</td>
</tr>
@for($i = 0; $i < count($investigation_ids_array); $i++)
<tr>
<td>{{ get_name($investigation_ids_array[$i], "id", "name", "investigations") }}</td>
<td>N/A</td>
<td>{{ ugandan_shillings($investigation_amounts_array[$i]) }}</td>
</tr>
@php $total_to_pay += $investigation_amounts_array[$i]; @endphp
@endfor
@endif
@if(isset($treatment_item) && count($treatment_item) > 0)
<tr>
<td colspan="3" class="text-center">Treatments</td>
</tr>
@for($i = 0; $i < count($treatment_item); $i++)
<tr>
<td>{{ get_name($treatment_item[$i], "id", "name", "drugs") }}</td>
<td>{{ $treatment_quantity[$i] }}</td>
<td>{{ ugandan_shillings($treatment_subtotal[$i]) }}</td>
</tr>
@php $total_to_pay += $treatment_subtotal[$i]; @endphp
@endfor
@endif
@if(isset($sundry_item) && count($sundry_item) > 0)
<tr>
<td colspan="3" class="text-center">Sundries</td>
</tr>
@for($i = 0; $i < count($sundry_item); $i++)
<tr>
<td>{{ get_name($sundry_item[$i], "id", "name", "sundries") }}</td>
<td>{{ $sundry_quantity[$i] }}</td>
<td>{{ ugandan_shillings($sundry_subtotal[$i]) }}</td>
</tr>
@php $total_to_pay += $sundry_subtotal[$i]; @endphp
@endfor
@endif
<tr>
<td colspan="3"></td>
</tr>
<tr>
<td colspan="2"><b>{{ __('point_of_sale.total_to_pay') }}</b></td>
<td><b>{{ ugandan_shillings($total_to_pay) }}</b></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-sm-3">
</div>
<i style="font-size: 0.8em; margin-left: 50%;">{{ __('point_of_sale.streamline') }}</i>
</div>
</div>
</div>
</div>
@endsection
@push('styles')
<script type="text/javascript">
function print_receipt() {
let myDiv = document.getElementById('divToPrint');
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
newWindow.document.write("<html><body " +
"class='' " +
" onload='window.print()'>" +
myDiv.innerHTML +
"</body></html>");
newWindow.document.close();
return false;
}
</script>
@endpush
@@ -1,122 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">Assign VHT To Discharged Patient</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">Dashboard</a></li>
<li class="active">Assign VHT</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-md-12">
@include('patients::allergies.header')
<br>
</div>
</div>
<div class="white-box">
<h3>Select a VHT for discharged patient</h3>
<br>
{{ Form::open(['route' => 'post_discharge_risk.save_assign_vht']) }}
{{ Form::hidden('discharge_id', $discharge_id) }}
<div class="row">
<div class="col-md-4">
{{ Form::label('search_vht', 'Search For VHT By Name or Village') }}
<div class="input-group">
<select class="form-control" name="vht" id="vht" required></select>
</div>
{{ Form::hidden('vht_id', 0, ['id' => 'vht_id']) }}
</div>
<div class="col-md-8">
<div class="table-responsive">
<table class="table table-striped table-bordered">
<tr>
<th><b>VHT Name</b></th>
<td id="vht_name"></td>
<th><b>Facility</b></th>
<td id="vht_facility"></td>
</tr>
<tr>
<th><b>Parish Name</b></th>
<td id="vht_parish"></td>
<th><b>Village Name</b></th>
<td id="vht_village"></td>
</tr>
</table>
</div>
</div>
</div>
<br>
{{ Form::button('Assign VHT',['type'=>'submit','class' => 'btn btn-success', 'style'=>'float:right;']) }}
<br><br>
{{ Form::close() }}
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/typeahead.js-master/dist/typeahead.bundle.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script>
$('#vht').change(function () {
let id = $('#vht').val();
$('#vht_id').val(id);
$.ajax({
type: "get",
url: "/post_discharge_risk/get_info_about_vht/" + id,
cache: false,
success: function (result) {
let result_arr = result.split('&&');
$('#vht_name').html(result_arr[0]);
$('#vht_facility').html(result_arr[1]);
$('#vht_parish').html(result_arr[2]);
$('#vht_village').html(result_arr[3]);
}
});
});
$('#vht').select2({
placeholder: 'Search by vht details (names and village)',
ajax: {
url: '/post_discharge_risk/search_vht_by_name_village',
dataType: 'json',
delay: 250,
processResults: function (data) {
return {
results: $.map(data, function (item) {
return {
text: item.name + " (" + item.village_name + " in " + item.parish_name + " Parish)",
id: item.id
}
})
};
},
cache: true
}
});
</script>
@endpush
@@ -1,177 +0,0 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
<title>{{ config('app.name', 'Stre@mline') }}</title>
<!-- Bootstrap Core CSS -->
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<style>
thead {
display: table-header-group;
}
tfoot {
display: table-row-group;
}
tr {
page-break-before: always;
page-break-after: always;
page-break-inside: avoid;
}
</style>
</head>
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h5 style="text-align: center;"><b>VHT FOLLOW-UP FORM</b></h5>
<h6><b>Part 1</b></h6>
<h6><b>To be filled at the discharging facility and given to the patient / caregiver to give to their VHT for Follow Up</b></h6>
<div class="row">
<div class="col">Patient Name:</div>
<div class="col">{{ get_full_name($patient_id, 'id', 'first_name', 'last_name', 'patients') }}</div>
<div class="col">Reference Number:</div>
<div class="col">{{ get_name($patient_id, 'id', 'number', 'patients') }}</div>
</div>
<div class="row">
<div class="col">Age:</div>
<div class="col">{{ get_patients_age(get_name($patient_id, 'id', 'date_of_birth', 'patients')) }}</div>
<div class="col">Sex:</div>
<div class="col">{{ (get_name($patient_id, 'id', 'gender', 'patients') == 1) ? 'Male' : 'Female' }}</div>
</div>
<div class="row">
<div class="col">Admission Date:</div>
<div class="col">{{ $admission_date }}</div>
<div class="col">Discharge Date:</div>
<div class="col">{{ $discharge_date }}</div>
</div>
<div class="row">
<div class="col-2">Address:</div>
<div class="col-10">{{ patient_residence($patient_id) }}</div>
</div>
<div class="row">
<div class="col-4">Discharging Hospital/Facility:</div>
<div class="col-8">{{ $hospital_info->name }}</div>
</div>
<div class="row">
<div class="col-4">Main Presenting Complaint:</div>
<div class="col-8">{{ $main_symptom }}</div>
</div>
<div class="row">
<div class="col-3">Discharge Diagnosis:</div>
<div class="col-3">{{ $discharge_diagnosis }}</div>
<div class="col-4">Post Discharge Risk of Mortality:</div>
<div class="col-2">{!! get_post_discharge_mortality_risk_score_display($discharge_risk_score->post_discharge_mortality_risk, $discharge_risk_score->date_of_birth) !!}</div>
</div>
<div class="row">
<div class="col">Referral Health Facility:</div>
<div class="col"></div>
<div class="col">District:</div>
<div class="col"></div>
</div>
<div class="row">
<div class="col">Name of VHT:</div>
<div class="col">{{ $vht_name }}</div>
<div class="col">Telephone Contact:</div>
<div class="col">{{ $vht_contact }}</div>
</div>
<div class="row">
<div class="col">Name of Health Assistant:</div>
<div class="col"></div>
<div class="col">Telephone Contact:</div>
<div class="col"></div>
</div>
<div class="row">
<div class="col">Nearest facility Incharge:</div>
<div class="col"></div>
<div class="col">Telephone Contact:</div>
<div class="col"></div>
</div>
<div class="row">
<div class="col">Discharging Health worker:</div>
<div class="col"></div>
<div class="col">Telephone Contact:</div>
<div class="col"></div>
</div>
<p>------------------------------------------------------------------------------------------------------------------------------------------------------------------------</p>
<h6><b>Part 2</b></h6>
<h6><b>ATTENTION: Village Health Team Member</b></h6>
<h6>You are required to follow this child on the 2 <sup>nd</sup>, 7 <sup>th</sup> and 14 <sup>th</sup> day following discharge from the hospital
and offer post discharge care. Examine the child to see if they have any danger signs. Children identified with danger signs
should be referred early for further management at the nearest Health Facility</h6>
<h6><b>Fill out each section of the form for each follow-up appointment</b></h6>
<p>------------------------------------------------------------------------------------------------------------------------------------------------------------------------</p>
@php
$follow_up_days = [1 => "2", 2 => "7", 3 => "14"];
@endphp
@for($i = 1; $i < 4; $i++)
<div class="row">
<div class="col-4"><b>Scheduled Visit {{ $i }} at day {{ $follow_up_days[$i] }}:</b></div>
<div class="col-2">
@if($i == 1)
{{ $first_followup_date }}
@elseif($i == 2)
{{ $second_followup_date }}
@else
{{ $third_followup_date }}
@endif
</div>
<div class="col-4"><b>Actual Visit Date</b></div>
<div class="col-2">....................................</div>
</div>
<h6><b>Does child have any of the following danger signs?</b></h6>
<div class="row">
<div class="col">{{ Form::checkbox('checkbox') }} Vomiting Everything<br><br>{{ Form::checkbox('checkbox') }} Lethargic/very sleepy</div>
<div class="col">{{ Form::checkbox('checkbox') }} Convulsions<br><br>{{ Form::checkbox('checkbox') }} Blood in stool</div>
<div class="col">{{ Form::checkbox('checkbox') }} Difficulty breathing<br><br>{{ Form::checkbox('checkbox') }} Other (Specify)</div>
<div class="col">{{ Form::checkbox('checkbox') }} Not able to breastfeed or drink<br><br>{{--{{ Form::checkbox('checkbox') }} --}}</div>
</div>
<h6><b>Visit Outcome (Circle One)</b></h6>
<div class="row">
<div class="col">{{ Form::checkbox('checkbox') }} Counselling on Post Discharge Care</div>
<div class="col">{{ Form::checkbox('checkbox') }} Referral to the nearest facility</div>
</div>
<div class="row">
<div class="col-2">VHT Name:</div>
<div class="col-4">{{ $vht_name }}</div>
<div class="col-2">Signature:</div>
<div class="col-4">................................................</div>
</div>
<p>------------------------------------------------------------------------------------------------------------------------------------------------------------------------</p>
@endfor
</div>
</body>
</html>
@@ -1,186 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">Patients To Follow Up</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">Dashboard</a></li>
<li class="active">Follow Up</li>
</ol>
</div>
</div>
<div class="white-box">
{{ Form::open(['route' => 'post_discharge_risk.view_follow_up_patients' , 'data-toggle' => 'validator']) }}
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-4">
<div class="form-group">
{{ Form::label('start_date','Date From') }}
{{ Form::text('start_date','',['class' => 'form-control compulsory', 'required','readonly','id'=>'start_date']) }}
</div>
</div>
<div class="col-md-4">
<div class="form-group">
{{ Form::label('end_date','Date To') }}
{{ Form::text('end_date','',['class' => 'form-control compulsory', 'required','readonly','id'=>'end_date']) }}
</div>
</div>
<div class="col-md-3">
<br>
{{ Form::button('Search',['type'=>'submit','class'=>'btn btn-rounded btn-success waves-effect waves-light m-r-10']) }}
</div>
</div>
{{ Form::close() }}
</div>
<div class="panel panel-default">
<div class="panel-body">
@include('flash::message')
<p><code>{{ $search_text }}</code></p>
<p class="text-muted m-b-30">Export data to Copy, CSV, Excel, PDF & Print</p>
<div class="table-responsive">
<table id="table" class="table table-striped color-bordered-table success-bordered-table">
<thead>
<tr>
<th>Patient Names</th>
<th>Gender (Age)</th>
<th>MUAC</th>
<th>WAZ Score</th>
<th>PD Mortality Risk</th>
<th>Discharge Date</th>
<th>Follow-Up Dates</th>
<th>Caregiver</th>
<th>Caregiver Contact</th>
<th>VHT Name (Contact)</th>
<th>VHT Parish</th>
<th>VHT Village</th>
</tr>
</thead>
<tbody>
@foreach($risk_scores as $record)
@if(is_patient_at_post_discharge_high_risk($record->post_discharge_mortality_risk, $record->date_of_birth) && in_array(get_name($record->patient_id, 'id', 'subcounty_id', 'patients'), [3,4]))
<tr>
<td>{{ get_full_name($record->patient_id, 'id', 'first_name', 'last_name', 'patients') }} ({{ get_name($record->patient_id, 'id', 'number', 'patients') }})</td>
<td>{{ ($record->gender == 1) ? 'Male' : 'Female' }} ({{ get_patients_age($record->date_of_birth) }})</td>
<td>{{ $record->muac_below_6 }}</td>
<td>{{ $record->weight_for_age_zscore_below_6 ?? $record->weight_for_age_zscore }}</td>
<td>{{ $record->post_discharge_mortality_risk }}</td>
@php
$discharge_date = new \Carbon\Carbon(get_patient_discharge_date($record->inpatient_id));
$first_followup_date = $discharge_date->copy()->addDays(2);
$second_followup_date = $discharge_date->copy()->addDays(7);
$third_followup_date = $discharge_date->copy()->addDays(14);
$caregiver_phone = "None";
$caregiver_name = "None";
$vht_name = "None";
$vht_number = "None";
$parish = "";
$village = "";
$vht = DB::table('vht_contacts')
->where('village', get_name($record->patient_id, 'id', 'village_id', 'patients'))
->orWhere('village', get_name(get_name($record->patient_id, 'id', 'village_id', 'patients'), 'id', 'name', 'villages'))
->first();
if ($vht) {
$vht_name = $vht->name;
$vht_number = "+256" . $vht->contact;
$village = $vht->village_name;
$parish = $vht->parish_name;
}
$caregiver_name = get_name($record->patient_id, 'id', 'next_of_kin', 'patients');
$next_of_kin_contact = get_name($record->patient_id, 'id', 'phone_of_next_of_kin', 'patients');
if ($next_of_kin_contact != "" && !is_null($next_of_kin_contact)) {
$caregiver_phone = $next_of_kin_contact;
} else {
$caregiver_phone = get_name($record->patient_id, 'id', 'phone', 'patients');
}
@endphp
<td>{{ streamline_date($discharge_date) }}</td>
<td>{{ streamline_date($first_followup_date) }} / {{ streamline_date($second_followup_date) }} / {{ streamline_date($third_followup_date) }}</td>
<td>{{ $caregiver_name }}</td>
<td>{{ $caregiver_phone }}</td>
<td>{{ $vht_name }} ({{ $vht_number }})</td>
<td>{{ $parish }}</td>
<td>{{ $village }}</td>
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script>
$('#table').DataTable({
dom: 'Bfrtip',
bInfo: false,
bPaginate: false,
buttons: [
'csv', 'excel', 'pdf', 'print'
]
});
$(document).ready(function() {
$('#start_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'yyyy/mm/dd'
});
$('#end_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'yyyy/mm/dd'
});
});
function retry_sending_sms(id) {
$.ajax({
type: "get",
url: "/post_discharge_risk/retry_sending_message/" + id,
cache: false,
success: function (result) {
if (result == 1) {
alert("A messages was sent to the VHT");
location.reload();
} else {
alert("Sending message failed");
}
}
});
}
</script>
@endpush
@@ -1,185 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">Post Discharge Risk Scores</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">Dashboard</a></li>
<li class="active">Risk Scores</li>
</ol>
</div>
</div>
<div class="white-box">
{{ Form::open(['route' => 'post_discharge_risk.view_scores' , 'data-toggle' => 'validator']) }}
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-4">
<div class="form-group">
{{ Form::label('start_date','Date From') }}
{{ Form::text('start_date','',['class' => 'form-control compulsory', 'required','readonly','id'=>'start_date']) }}
</div>
</div>
<div class="col-md-4">
<div class="form-group">
{{ Form::label('end_date','Date To') }}
{{ Form::text('end_date','',['class' => 'form-control compulsory', 'required','readonly','id'=>'end_date']) }}
</div>
</div>
<div class="col-md-3">
<br>
{{ Form::button('Search',['type'=>'submit','class'=>'btn btn-rounded btn-success waves-effect waves-light m-r-10']) }}
</div>
</div>
{{ Form::close() }}
</div>
<div class="panel panel-default">
<div class="panel-body">
<a href="/post_discharge_risk/view_follow_up_patients/" class="btn btn-success pull-right">Follow up Patients</a>
<br><br>
@include('flash::message')
<p><code>{{ $search_text }}</code></p>
<p class="text-muted m-b-30">Export data to Copy, CSV, Excel, PDF & Print</p>
<div class="table-responsive">
<table id="table" class="table table-striped color-bordered-table success-bordered-table">
<thead>
<tr>
<th>Patient Names</th>
<th>Gender (Age)</th>
<th>Risk Score</th>
<th>Date Calculated</th>
<th>Discharge Status</th>
<th>VHT Alerted</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($risk_scores as $record)
<tr>
<td>{{ get_full_name($record->patient_id, 'id', 'first_name', 'last_name', 'patients') }}</td>
<td>{{ ($record->gender == 1) ? 'Male' : 'Female' }} ({{ get_patients_age($record->date_of_birth) }})</td>
<td>{{ $record->post_discharge_mortality_risk }} ({!! get_post_discharge_mortality_risk_score_display($record->post_discharge_mortality_risk, $record->date_of_birth) !!})</td>
<td>{{ streamline_date_time($record->updated_at) }}</td>
<td>
@php
$scheduled_followups = \DB::table('phone_followup_patients')->where('discharge_mortality_risk_id', $record->id)->get();
$patient_discharge_date = get_patient_discharge_date($record->inpatient_id);
$vht_form_generate = ($record->child_with_proven_infection == 1) && should_vht_form_be_generated($record->post_discharge_mortality_risk, $record->date_of_birth);
$village_id = get_name($record->patient_id, 'id', 'village_id', 'patients');
@endphp
@if($patient_discharge_date)
Discharged ({{ streamline_date($patient_discharge_date) }})
@if($vht_form_generate)
<br><br>
@if (count($scheduled_followups) > 0)
<a href="/post_discharge_risk/print_vht_discharge_forms/{{ $record->id }}" target="_blank">Print VHT Discharge form</a>
@else
<a href="/post_discharge_risk/assign_vht/{{ $record->id }}">Assign VHT To Patient</a>
@endif
@endif
@else
Not Discharged
@endif
</td>
<td>
@if($vht_form_generate && $patient_discharge_date)
@if($record->is_vht_alerted == 0)
No
@php
$vht = \DB::table('vht_contacts')
->where('village', $village_id)
->orWhere('village', get_name($village_id, 'id', 'name', 'villages'))
->first();
@endphp
@if (count($scheduled_followups) < 1 && isset($vht->contact))
<br><br>
<a href="#" onclick="retry_sending_sms(<?php echo $record->id; ?>)">Retry Sending Message</a>
@endif
@else
Yes
@endif
@endif
</td>
<td><a href="/patient_episodes/set_patient_id/{{ $record->patient_id }}" class="btn btn-success btn-sm">Select Patient</a></td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script>
$('#table').DataTable({
dom: 'Bfrtip',
bInfo: false,
bPaginate: false,
buttons: [
'csv', 'excel', 'pdf', 'print'
]
});
$(document).ready(function() {
$('#start_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'yyyy/mm/dd'
});
$('#end_date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'yyyy/mm/dd'
});
});
function retry_sending_sms(id) {
$.ajax({
type: "get",
url: "/post_discharge_risk/retry_sending_message/" + id,
cache: false,
success: function (result) {
if (result == 1) {
alert("A messages was sent to the VHT");
location.reload();
} else {
alert("Sending message failed");
}
}
});
}
</script>
@endpush
@@ -1,18 +0,0 @@
<?php
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::middleware('auth:api')->get('/patients', function () {
return "Patients";
});
@@ -1,178 +0,0 @@
<?php
use Illuminate\Support\Facades\Route;
Route::group(['middleware' => ['auth', 'disablebackbutton', 'user-locale']], function () {
/* Alerts */
Route::post('store_patient_alerts', 'AlertsController@store_patient_alerts');
Route::any('alerts/view_alerts', 'AlertsController@view_alerts');
Route::any('alerts/edit_alert/{id}', 'AlertsController@edit_alert');
Route::any('alerts/save_edit_alert', 'AlertsController@save_edit_alert')->name('alerts.save_edit_alert');
Route::any('alerts/delete_alert/{id}', 'AlertsController@delete_alert');
Route::resource('alerts', 'AlertsController');
/* Allergies */
Route::resource('allergies', 'AllergiesController');
Route::post('store_patient_allergies', 'AllergiesController@store_patient_allergies');
/* Consultation Controller */
Route::get('consultation/route', 'ConsultationController@route');
Route::any('consultation/create_with_notes', 'ConsultationController@create_with_notes');
Route::any('consultation/review_episode/{current_episode_id}/{parent_episode_id}/{type}', 'ConsultationController@review_episode');
Route::resource('consultation', 'ConsultationController');
Route::get('edit_patient_consultation', 'ConsultationController@edit_patient_consultation');
Route::any('opd_referral_notes_print/{patient_id}/{episode_id}', 'ConsultationController@opd_referral_notes_print')->name('consultation.opd_referral_notes_print');
Route::any('consultation/add_diagnosis', 'ConsultationController@add_diagnosis')->name('consultation.add_diagnosis');
Route::get('get_outcome_slug/{id}', 'ConsultationController@get_outcome_slug');
/* Triage Controller */
Route::any('/triage/add_symptom', 'TriageController@add_symptom')->name('triage.add_symptom');
Route::any('/triage/add_referral', 'TriageController@add_referral')->name('triage.add_referral');
Route::any('/triage/get_prompt', 'TriageController@get_prompt')->name('triage.get_prompt');
Route::any('/triage/create_without_etat', 'TriageController@create_without_etat')->name('triage.create_without_etat');
Route::any('/triage/store_without_etat', 'TriageController@store_without_etat')->name('triage.store_without_etat');
Route::any('/triage/show_without_etat/{id}', 'TriageController@show_without_etat');
Route::any('/triage/save_smart_triage_score', 'TriageController@save_smart_triage_score');
Route::any('/triage/smart_triage_report', 'TriageController@smart_triage_report')->name('triage.smart_triage_report');
Route::any('/triage/get_nutrition_status', 'NutritionController@get_nutrition_status')->name('triage.get_nutrition_status');
Route::resource('triage', 'TriageController');
Route::any('/triage/edit_for_post_discharge/{episode_id}', 'TriageController@edit_for_post_discharge');
Route::any('/triage/save_edits_for_post_discharge/', 'TriageController@save_edits_for_post_discharge')->name('triage.save_edits_for_post_discharge');
Route::post('/patient_documents/modal_store', 'PatientDocumentController@modal_store')->name('patient_documents.modal_store');
Route::resource('patient_documents', 'PatientDocumentController'); // Patient Documents
Route::get('set_episode_id/{id}/patient_documents', 'PatientDocumentController@set_episode_id');
Route::resource('patient_documents/store', 'PatientDocumentController@modal_store');
/* Patient Flow Monitoring Controller */
Route::any('/patient_flow_monitoring/index', 'PatientFlowMonitoringController@index')->name('patient_flow_monitoring.index');
Route::get('/patient_flow_monitoring/patient_route/{episode_id}/{route}', 'PatientFlowMonitoringController@patient_route');
Route::any('patient_flow_monitoring_admission', 'PatientFlowMonitoringController@inpatient_admission')->name('patient_flow_monitoring.inpatient_admission');
Route::any('/point_of_sale/order_items', 'PointOfSaleController@order_items')->name('point_of_sale.order_items');
Route::any('/point_of_sale/confirm_items', 'PointOfSaleController@confirm_items')->name('point_of_sale.confirm_items');
Route::any('/point_of_sale/confirm_pricing', 'PointOfSaleController@confirm_pricing')->name('point_of_sale.confirm_pricing');
Route::any('/point_of_sale/print/{id}', 'PointOfSaleController@print');
Route::any('/point_of_sale/print_pos_pdf', 'PointOfSaleController@print_pos_pdf');
Route::any('point_of_sale', 'PointOfSaleController@index')->name('point_of_sale.index');
// post discharge risk
Route::any('/post_discharge_risk/view_scores/', 'PostDischargeRiskController@view_scores')->name('post_discharge_risk.view_scores');
Route::any('/post_discharge_risk/vht_discharge_forms/', 'PostDischargeRiskController@vht_discharge_forms')->name('post_discharge_risk.vht_discharge_forms');
Route::any('/post_discharge_risk/save_edits_for_post_discharge/', 'PostDischargeRiskController@save_edits_for_post_discharge')->name('post_discharge_risk.save_edits_for_post_discharge');
Route::any('/post_discharge_risk/print_vht_discharge_forms/{discharge_risk_score_id}', 'PostDischargeRiskController@print_vht_discharge_forms');
Route::any('/post_discharge_risk/assign_vht/{discharge_risk_score_id}', 'PostDischargeRiskController@assign_vht');
Route::any('/post_discharge_risk/search_vht_by_name_village', 'PostDischargeRiskController@search_vht_by_name_village');
Route::any('/post_discharge_risk/get_info_about_vht/{vht_id}', 'PostDischargeRiskController@get_info_about_vht');
Route::any('/post_discharge_risk/save_assign_vht/', 'PostDischargeRiskController@save_assign_vht')->name('post_discharge_risk.save_assign_vht');
Route::any('/post_discharge_risk/retry_sending_message/{discharge_risk_score_id}', 'PostDischargeRiskController@retry_sending_message');
Route::any('/post_discharge_risk/view_follow_up_patients/', 'PostDischargeRiskController@view_follow_up_patients')->name('post_discharge_risk.view_follow_up_patients');
/* Patient Episode Controller */
Route::any('/patient_episodes/create_episode', 'PatientEpisodeController@create_episode')->name('patient_episodes.create_episode');
Route::any('/patient_episodes/set_patient_id/{id}', 'PatientEpisodeController@set_patient_id')->name('patient_episodes.set_patient_id');
Route::any('/patient_episodes/route_patient_episode', 'PatientEpisodeController@route_patient_episode')->name('patient_episodes.route_patient_episode');
Route::any('/patient_episodes/internal_clinic_transfer/{id}', 'PatientEpisodeController@internal_clinic_transfer')->name('patient_episodes.internal_clinic_transfer');
Route::any('/patient_episodes/save_internal_clinic_transfer', 'PatientEpisodeController@save_internal_clinic_transfer')->name('patient_episodes.save_internal_clinic_transfer');
Route::get('/patients/episode_summary/{episode_id}', 'PatientEpisodeController@episode_summary');
Route::any('/patient_episodes/delete_episode/{episode_id}', 'PatientEpisodeController@delete_episode');
Route::resource('patient_episodes', 'PatientEpisodeController');
/* create an episode with an allocated special clinic or ward */
Route::any('create_special_clinic_episode', 'PatientEpisodeController@create_special_clinic_episode')->name('patient_episodes.create_special_clinic_episode');
Route::any('create_episode_with_ward', 'PatientEpisodeController@create_episode_with_ward')->name('patient_episodes.create_episode_with_ward');
Route::any('admit_patient_with_episode', 'PatientEpisodeController@admit_patient_with_episode')->name('patient_episodes.admit_patient_with_episode');
/* create an episode with an allocated doctor */
Route::any('create_episode_with_doctor', 'PatientEpisodeController@create_episode_with_doctor')->name('patient_episodes.create_episode_with_doctor');
Route::any('create_episode_with_doctor_and_clinic', 'PatientEpisodeController@create_episode_with_doctor_and_clinic')->name('patient_episodes.create_episode_with_doctor_and_clinic');
/* Claim Number */
Route::any('edit_claim_number', 'PatientEpisodeController@edit_claim_number')->name('patient_episodes.edit_claim_number');
/* create an episode with a self lab request */
Route::any('create_episode_with_lab_self_request', 'PatientEpisodeController@create_episode_with_lab_self_request')->name('patient_episodes.create_episode_with_lab_self_request');
/* start an appointment with a clinic */
Route::any('start_appointment_with_clinic', 'PatientEpisodeController@start_appointment_with_clinic')->name('patient_episodes.start_appointment_with_doctor_and_clinic');
/* save a doctor transfer */
Route::any('/patient_episodes/save_doctor_transfer', 'PatientEpisodeController@save_doctor_transfer')->name('patient_episodes.save_doctor_transfer');
Route::any('patient_episodes/get_assigned_doctor/{episode_id}', 'PatientEpisodeController@get_assigned_doctor');
/*merge patient episodes */
Route::any('episode_merge_preview', 'PatientEpisodeController@episode_merge_preview');
Route::any('patient_episodes_merge', 'PatientEpisodeController@merge_patient_episodes')->name('patient_episodes.merge');
Route::any('complete_episodes_merge', 'PatientEpisodeController@complete_episodes_merge')->name('patient_episodes.complete_merge');
Route::any('display_original_and_duplicate_episodes', 'PatientEpisodeController@display_original_and_duplicate_episodes');
//check for consultation
Route::any('check_clinical_consultation_payment', 'PatientEpisodeController@check_clinical_consultation_payment');
/* Patient Controller */
Route::get('/patients/inactive', 'PatientController@inactive')->name('patients.inactive');
Route::get('/patients/follow_up', 'PatientController@follow_up')->name('patients.follow_up');
Route::get('/patients/appointment_requests', 'PatientController@appointment_requests')->name('patients.appointment_requests');
Route::get('/patients/confirm_appointment/{id}', 'PatientController@confirm_appointment');
Route::any('/patients/save_confirmed_appointment', 'PatientController@save_confirmed_appointment')->name('patients.save_confirmed_appointment');
Route::any('/patients/follow_up_fetch_patients', 'PatientController@follow_up_fetch_patients')->name('patients.follow_up_fetch_patients');
Route::any('/patients/create_appointment', 'PatientController@create_appointment')->name('patients.create_appointment');
Route::any('/patients/save_appointment', 'PatientController@save_appointment')->name('patients.save_appointment');
Route::any('/patients/complete_appointment/{id}', 'PatientController@complete_appointment');
Route::any('/patients/cancel_patient_appointment/{id}', 'PatientController@cancel_patient_appointment');
Route::any('/patients/reschedule_appointment/{id}', 'PatientController@reschedule_appointment');
Route::any('/patients/save_rescheduled_appointment', 'PatientController@save_rescheduled_appointment')->name('patients.save_rescheduled_appointment');
Route::get('/patients/search_patient_by_name_number', 'PatientController@search_patient_by_name_number')->name('patients.search_patient_by_name_number');
Route::get('/patients/update_patient_info/{id}', 'PatientController@update_patient_info')->name('patients.update_patient_info');
Route::get('/patients/create', 'PatientController@create')->name('patients.create');
Route::any('/patients/selected', 'PatientController@select')->name('patients.selected');
Route::any('/patients/select', 'PatientController@select')->name('patients.select');
Route::post('/activate{id}/patients', 'PatientController@activate')->name('patients.activate');
Route::any('/patients/get_counties/{id}', 'PatientController@get_counties')->name('patients.get_counties');
Route::any('/patients/get_subcounties/{id}', 'PatientController@get_subcounties')->name('patients.get_subcounties');
Route::any('/patients/get_parishes/{id}', 'PatientController@get_parishes')->name('patients.get_parishes');
Route::any('/patients/get_villages/{id}', 'PatientController@get_villages')->name('patients.get_villages');
Route::get('/patients/search_residences', 'PatientController@search_residences')->name('patients.search_residences');
Route::any('/patients/save_patient_with_episode', 'PatientController@save_patient_with_episode')->name('patients.save_patient_with_episode');
Route::any('/patients/check_duplicate_patients', 'PatientController@check_duplicate_patients')->name('patients.check_duplicate_patients');
Route::post('/patients/delete_patient_with_reason', 'PatientController@delete_patient_with_reason')->name('patients.delete_patient_with_reason');
Route::any('/patients/search', 'PatientController@search')->name('patients.search');
Route::any('patients/add_company', 'PatientController@add_company')->name('patients.add_company');
Route::any('patients/quick_add_district_residence', 'PatientController@quick_add_district_residence');
Route::any('patients/quick_add_village_residence', 'PatientController@quick_add_village_residence');
Route::any('patients/quick_add_residence', 'PatientController@quick_add_residence');
Route::any('patients/get_fingerprint/{id}', 'PatientController@get_fingerprint');
Route::any('patients/fetch_fingerprint_from_scanner/', 'PatientController@fetch_fingerprint_from_scanner');
Route::any('patients/compare_fingerprint_from_scanner/', 'PatientController@compare_fingerprint_from_scanner');
/* patient residences */
Route::get('patient_residence/{disctrict_id}', 'PatientController@get_residence');
Route::get('patient_residence/district/{district_id}', 'PatientController@get_residence_district');
Route::get('patient_residence/county/{county_id}', 'PatientController@get_residence_county');
Route::get('patient_residence/sub_county/{sub_county_id}', 'PatientController@get_residence_sub_county');
Route::get('patient_residence/parish/{parish_id}', 'PatientController@get_residence_parish');
Route::resource('patients', 'PatientController');
Route::any('add_new_occupation_dynamically', 'PatientController@add_new_occupation_dynamically');
Route::any('add_new_district_dynamically', 'PatientController@add_new_district_dynamically');
Route::any('add_new_county_dynamically', 'PatientController@add_new_county_dynamically');
Route::any('add_new_subcounty_dynamically', 'PatientController@add_new_subcounty_dynamically');
Route::any('add_new_parish_dynamically', 'PatientController@add_new_parish_dynamically');
Route::any('add_new_village_dynamically', 'PatientController@add_new_village_dynamically');
// duplicate patients
Route::any('possible_duplicate_patients/{id}', 'PatientController@possible_duplicate_patients');
Route::post('display_original_and_duplicate_patients', 'PatientController@display_original_and_duplicate_patients');
Route::any('merge_patient_records', 'PatientController@merge_records')->name('patients.merge_records');
//patient appointments report
Route::any('patient_appointments_report', 'PatientController@patient_appointments_report')->name('patients.patient_appointments_report');
Route::post('view_dna_patient_demographic', 'PatientController@view_dna_patient_demographic');
Route::any('store_appointment_comment', 'PatientController@store_appointment_comment');
Route::any('patient_card/{id}', 'PatientController@patient_card');
});
@@ -1,11 +0,0 @@
{
"name": "Patients",
"alias": "patients",
"description": "Patients OPD, Appointments and Point of sale",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\Patients\\Providers\\PatientsServiceProvider"
],
"files": []
}
-47
View File
@@ -1,47 +0,0 @@
# Stre@mline #
This is the official repository for [Stre@mline](http://streamlinehealth.org/).
### How do I get set up? ###
* **Summary of set up**
* This [laravel](https://laravel.com/) application requires PHP 8+ and Composer for dependency management.
* Visit [laravel documentation](https://laravel.com/docs/5.5) for updated laravel docs.
* Install [Composer](https://getcomposer.org/download/).
* Install the LAMP stack.
* **Configuration**
* Run `git clone <this repository>` and `cd` into its root directory.
* **Dependencies**
* Run `composer install` to update the dependencies.
* **Database configuration**
* Create the '.env' file (which is a copy of '.env.example') i.e. `cp .env.example .env`
* Set the database details (database, username, password)
* Run `php artisan key:generate` to generate a unique key for the application.
* Be sure to create the database; the tables and initial data will be auto-created by the next command.
* Run `php artisan migrate --seed`
* Run `php artisan serve` to use the application on a local server. You will see a url in the command results.
* You can preferably run the application as you would a website on your operating system of choice.
* **How to run tests**
* Locally, you can set up a .env.testing for doing tests if you want.
* Run `phpunit` to run all tests in the application.
* Run `phpunit tests/feature/ExampleTest.php` To test the file 'ExampleTest.php'.
* Remotely, visit [pipelines]() to run all tests in the application.
### Managing Submodules ###
* After pulling:
* Run `git config user.name` and `git config user.password` to set credentials and avoid being bothered with password requests
* Then run `git submodule update --init --recursive` to initialize the modules
* Then run `git submodule foreach --recursive git checkout main` to reset each submodule to main
* And finally `git submodule foreach --recursive git pull` to update the branch. You can use the two commands whenever you checkout to another branch
* If you make any changes within the Modules folder, commit to each repo affected and then commit to the container repo
* For more references, use the links below
* [Initial Commit](https://initialcommit.com/blog/git-submodule)
* [Github](https://gist.github.com/gitaarik/8735255)
* [Bitbucket](https://www.atlassian.com/git/tutorials/git-submodule)
@@ -1,126 +0,0 @@
<?php
namespace Streamline\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Streamline\Models\Equity;
use Streamline\Models\Journal;
use Streamline\Models\PatientCategoryInvoice;
class CorrectFinanceCommand extends Command {
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'correct:finance';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct() {
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle() {
$start = "2020-01-01";
$end = "2023-09-16";
$patient_category_invoices = DB::table('patient_category_invoices')->whereBetween('created_at', [$start, $end])->get();
if (count($patient_category_invoices)) {
foreach ($patient_category_invoices as $single_record) {
$items_array = explode(",", $single_record->items_ids);
$tag_id = $single_record->tag_id;
$income_accounts_array = $cost_of_goods_account_array = $inventory_account_array = [];
for ($i = 0; $i < count($items_array); $i++) {
//Consultations / Services
if ($tag_id == 6 || $tag_id == 8 || $tag_id == 7 || $tag_id == 10) {
$income_account = get_name($items_array[$i], 'id', 'account_id', 'services');
$income_account = is_numeric($income_account) ? $income_account : 7;
$income_accounts_array[] = $income_account;
}
//Drugs / Treatments
elseif ($tag_id == 3 || $tag_id == 1) {
$income_account = get_name($items_array[$i], 'id', 'account_id', 'drugs');
$income_account = is_numeric($income_account) ? $income_account : 4;
$income_accounts_array[] = $income_account;
$inventory_account = get_name($items_array[$i], 'id', 'inventory_account', 'drugs');
$inventory_account_array[] = $inventory_account;
$cost_of_goods_account = get_name($items_array[$i], 'id', 'cost_of_goods_account', 'drugs');
$cost_of_goods_account_array[] = $cost_of_goods_account;
$cost_price_array[$i] = get_latest_inventory_cost_price($items_array[$i], 1, Carbon::today()->toDateString());
}
//Sundries
elseif ($tag_id == 5) {
$income_account = get_name($items_array[$i], 'id', 'account_id', 'sundries');
$income_account = is_numeric($income_account) ? $income_account : 12;
$income_accounts_array[] = $income_account;
$inventory_account = get_name($items_array[$i], 'id', 'inventory_account', 'sundries');
$inventory_account_array[] = $inventory_account;
$cost_of_goods_account = get_name($items_array[$i], 'id', 'cost_of_goods_account', 'sundries');
$cost_of_goods_account_array[] = $cost_of_goods_account;
$cost_price_array[$i] = get_latest_inventory_cost_price($items_array[$i], 2, Carbon::today()->toDateString());
}
//Investigations
elseif ($tag_id == 2) {
$income_account = get_name($items_array[$i], 'id', 'account_id', 'investigations');
$income_account = is_numeric($income_account) ? $income_account : 11;
$income_accounts_array[] = $income_account;
}
//Procedures
elseif ($tag_id == 4) {
$income_account = get_name($items_array[$i], 'id', 'account_id', 'procedures');
$income_account = is_numeric($income_account) ? $income_account : 8;
$income_accounts_array[] = $income_account;
}
}
$income_accounts_string = is_null($income_accounts_array) ? "" : implode(',', $income_accounts_array);
$cost_of_goods_accounts_string = is_null($cost_of_goods_account_array) ? null : implode(',', $cost_of_goods_account_array);
$inventory_accounts_string = is_null($inventory_account_array) ? null : implode(',', $inventory_account_array);
$existing_patient_category_invoice = PatientCategoryInvoice::withTrashed()->find($single_record->id);
$existing_patient_category_invoice->income_account = $income_accounts_string;
if ($tag_id == 3 || $tag_id == 1 || $tag_id == 5) {
$existing_patient_category_invoice->cost_of_goods_account = $cost_of_goods_accounts_string;
$existing_patient_category_invoice->inventory_account = $inventory_accounts_string;
}
$existing_patient_category_invoice->update();
}
}
$equities = Equity::all();
foreach ($equities as $equity) {
$equity->transaction_date = $equity->created_at;
$equity->update();
//pick the equity and update it with the journal date if it was journaled
if (str_contains($equity, 'Journal (')) {
$journal_number = getStringBetweenCharacters($equity->name,"(",")");
$journal = Journal::find($journal_number);
if($journal){
//update the equity record's transaction date with the date it was journaled
$equity->transaction_date = $journal->journal_date;
$equity->update();
}
}
}
}
}
@@ -1,144 +0,0 @@
<?php
namespace Streamline\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class ImportCsvItemsCommand extends Command {
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'import:csv {id}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct() {
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle() {
$id = $this->argument('id');
$record = DB::table('csv_imports_processes')->where('id', $id)->first();
$data = file(base_path('public/' . $record->csv_path));
$account_id = $record->account_id;
$inventory_account = $record->inventory_account;
$cost_of_goods_account = $record->cost_of_goods_account;
$data_count = count($data);
$counter = 0;
foreach($data as $item) {
$split_item = explode(',', $item);
if ($record->tag_id == 3) {
try {
DB::table('drugs')->insert([
"code" => str_replace('"', '', $split_item[0]),
"name" => str_replace('"', '', $split_item[1]),
"cost_price" => str_replace('"', '', $split_item[2]),
"non_insured_price" => str_replace('"', '', $split_item[3]),
"account_id" => $account_id,
"inventory_account" => $inventory_account,
"cost_of_goods_account" => $cost_of_goods_account,
"opening_cost_price" => str_replace('"', '', $split_item[2]),
"category_id" => 1,
"pack" => 1,
"strength" => $split_item[6],
"form_id" => $split_item[5],
"unit_id" => $split_item[4],
"created_at" => now(),
"updated_at" => now()
]);
} catch (\Exception $exception) {}
} else if ($record->tag_id == 2) {
try {
DB::table('investigations')->insert([
"code" => str_replace('"', '', $split_item[0]),
"name" => str_replace('"', '', $split_item[1]),
"non_insured_price" => str_replace('"', '', $split_item[2]),
"category" => 2,
"account_id" => $account_id,
"created_at" => now(),
"updated_at" => now()
]);
} catch (\Exception $exception) {}
} else if ($record->tag_id == 4) {
try {
DB::table('procedures')->insert([
"code" => str_replace('"', '', $split_item[0]),
"name" => str_replace('"', '', $split_item[1]),
"non_insured_price" => str_replace('"', '', $split_item[2]),
"category_id" => 1,
"account_id" => $account_id,
"created_at" => now()
]);
} catch (\Exception $exception) {}
} else if ($record->tag_id == 5) {
try {
DB::table('sundries')->insert([
"code" => str_replace('"', '', $split_item[0]),
"name" => str_replace('"', '', $split_item[1]),
"cost_price" => str_replace('"', '', $split_item[2]),
"non_insured_price" => str_replace('"', '', $split_item[3]),
"account_id" => $account_id,
"inventory_account" => $inventory_account,
"cost_of_goods_account" => $cost_of_goods_account,
"created_at" => now(),
"updated_at" => now()
]);
} catch (\Exception $exception) {}
} else if ($record->tag_id == 6) {
try {
DB::table('services')->insert([
"code" => str_replace('"', '', $split_item[0]),
"name" => str_replace('"', '', $split_item[1]),
"non_insured_price" => str_replace('"', '', $split_item[2]),
"account_id" => $account_id,
"created_at" => now(),
"updated_at" => now()
]);
} catch (\Exception $exception) {}
}
$counter++;
$percentage = round((($counter / $data_count) * 100));
$is_run_complete = 0;
if ($counter == $data_count) {
$is_run_complete = 1;
} elseif ($percentage == 100) {
// because of the round(), 100% is reached before completion
$percentage = 99;
}
DB::table('csv_imports_processes')
->where('id', $id)
->update([
"records_completed" => $percentage,
"is_complete" => $is_run_complete
]);
}
}
}
@@ -1,159 +0,0 @@
<?php
namespace Streamline\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class ImportCsvPriceListsCommand extends Command {
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'import:price_list {id}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Import items price lists';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct() {
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle() {
$id = $this->argument('id');
$record = DB::table('csv_imports_processes')->where('id', $id)->first();
$data = file(base_path('public/' . $record->csv_path));
$data_count = count($data);
$counter = 0;
$price_list_category = "";
foreach($data as $item) {
$split_item = explode(',', $item);
$item_id = 0;
// check if this is the first row and get ids
if ($counter == 0) {
$category_id_arr = [];
for ($i = 1; $i < count($split_item); $i++){
$category_id = get_name(get_name(trim($split_item[$i]), 'name', 'id', 'patient_categories'),
'patient_category_id', 'id', 'price_list_categories');
$category_id_arr[] = $category_id != 'N/A' ? $category_id : 0;
}
$price_list_category = implode(",", $category_id_arr);
$counter++;
continue;
} else {
$category_price = [];
// get the item id
if ($record->tag_id == 3) {
$item_id = get_name($split_item[0], 'name', 'id', 'drugs');
} else if ($record->tag_id == 2) {
$item_id = get_name($split_item[0], 'name', 'id', 'investigations');
} else if ($record->tag_id == 4) {
$item_id = get_name($split_item[0], 'name', 'id', 'procedures');
} else if ($record->tag_id == 5) {
$item_id = get_name($split_item[0], 'name', 'id', 'sundries');
} else if ($record->tag_id == 6) {
$item_id = get_name($split_item[0], 'name', 'id', 'services');
}
if (!is_numeric($item_id)) {
continue;
}
for ($i = 1; $i < count($split_item); $i++){
try {
// catch non numeric error for some cases
$category_price[] = +trim($split_item[$i]);
} catch (\Exception $exception) {
$category_price[] = 0;
}
}
$price_list_price = implode(",", $category_price);
}
if ($record->tag_id == 3) {
try {
DB::table('drugs')->where('id', $item_id)->update([
"price_list_category" => $price_list_category,
"price_list_price" => $price_list_price,
"updated_at" => now()
]);
} catch (\Exception $exception) {}
} else if ($record->tag_id == 2) {
try {
DB::table('investigations')->where('id', $item_id)->update([
"price_list_category" => $price_list_category,
"price_list_price" => $price_list_price,
"updated_at" => now()
]);
} catch (\Exception $exception) {}
} else if ($record->tag_id == 4) {
try {
DB::table('procedures')->where('id', $item_id)->update([
"price_list_category" => $price_list_category,
"price_list_price" => $price_list_price,
"updated_at" => now()
]);
} catch (\Exception $exception) {}
} else if ($record->tag_id == 5) {
try {
DB::table('sundries')->where('id', $item_id)->update([
"price_list_category" => $price_list_category,
"price_list_price" => $price_list_price,
"updated_at" => now()
]);
} catch (\Exception $exception) {}
} else if ($record->tag_id == 6) {
try {
DB::table('services')->where('id', $item_id)->update([
"price_list_category" => $price_list_category,
"price_list_price" => $price_list_price,
"updated_at" => now()
]);
} catch (\Exception $exception) {}
}
$counter++;
$percentage = round((($counter / $data_count) * 100));
$is_run_complete = 0;
if ($counter == $data_count) {
$is_run_complete = 1;
} elseif ($percentage == 100) {
// because of the round(), 100% is reached before completion
$percentage = 99;
}
DB::table('csv_imports_processes')
->where('id', $id)
->update([
"records_completed" => $percentage,
"is_complete" => $is_run_complete
]);
}
}
}
@@ -1,186 +0,0 @@
<?php
namespace Streamline\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class MigrateInsuranceExpenditureCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'migrate:insurance_expenditure';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Migrate insurance expenditure to new CHI model';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct() {
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle() {
DB::beginTransaction();
$grouped_episodes = [];
echo "Fetching OPD insurance expenditure... \n";
$expenditures = DB::table('insurance_expenditure')->whereNull('deleted_at')->get();
foreach ($expenditures as $expenditure) {
$grouped_episodes[$expenditure->episode_id . "-" . $expenditure->tag_id . '-' . $expenditure->patient_id][] = [
"item" => $expenditure->item_id, "created_by" => $expenditure->created_by, "created_on" => $expenditure->created_at,
"amount" => $expenditure->insurance_amount, "account" => $expenditure->income_account
];
}
try {
echo "Creating new claim records... \n";
foreach ($grouped_episodes as $episode_key => $details) {
$explode_key = explode("-", $episode_key);
$item_type = $explode_key[1];
// convert to insurance tags
switch ($item_type) {
case 2:
$item_type = 3;
break;
case 3:
$item_type = 4;
break;
case 4:
$item_type = 2;
break;
case 6:
case 7:
case 8:
$item_type = 1;
break;
}
$details_collection = collect($details);
$item_ids = $details_collection->implode('item', ',');
$item_amounts = $details_collection->implode('amount', ',');
$item_amount_sum = $details_collection->sum('amount');
$item_accounts = $details_collection->implode('account', ',');
$count = $details_collection->count();
$array_of_zero = implode(",", array_fill(0, $count, 0));
$array_of_ones = implode(",", array_fill(0, $count, 1));
DB::table('insurance_claims')->insert([
"patient_id" => $explode_key[2], "episode_id" => $explode_key[0], "claim_status" => 6,
"plan_id" => 1, "benefit_ids" => $array_of_ones, "inpatient_outpatient" => 0,
"primary_plan_claim_total" => $item_amount_sum, "item_type" => $item_type, "item_ids" => $item_ids,
"item_quantities" => $array_of_ones, "tariff_ids" => $array_of_zero, "tariff_amounts" => $item_amounts,
"co_payment_amounts" => $array_of_zero, "item_cash_amounts" => $item_amounts, "current_chart_of_accounts" => $item_accounts,
"order_id" => 0, "is_item_authorisation_required" => $array_of_zero, "is_authorisation_required" => 0,
"created_by" => $details[0]['created_by'], "updated_by" => $details[0]['created_by'], "created_at" => $details[0]['created_on'], "updated_at" => $details[0]['created_on']
]);
}
echo "Fetching IPD insurance expenditure... \n";
$bills = DB::table('inpatient_bills')->whereNull('deleted_at')->get();
echo "Creating new claim records... \n";
foreach ($bills as $bill) {
if ($bill->insurance_treatment_cost > 0 || $bill->insurance_tta_cost > 0) {
$total_cost = $bill->insurance_treatment_cost + $bill->insurance_tta_cost;
DB::table('insurance_claims')->insert([
"patient_id" => $bill->patient_id, "episode_id" => $bill->episode_id, "claim_status" => 6,
"plan_id" => 1, "benefit_ids" => 1, "inpatient_outpatient" => 1,
"primary_plan_claim_total" => $total_cost, "item_type" => 4, "item_ids" => 0,
"item_quantities" => 1, "tariff_ids" => 0, "tariff_amounts" => $total_cost,
"co_payment_amounts" => 0, "item_cash_amounts" => $total_cost, "current_chart_of_accounts" => 0,
"order_id" => $bill->inpatient_info_id, "is_item_authorisation_required" => 0, "is_authorisation_required" => 0,
"created_by" => $bill->created_by, "updated_by" => $bill->updated_by, "created_at" => $bill->created_at, "updated_at" => $bill->updated_at
]);
}
if ($bill->insurance_sundries_cost > 0) {
DB::table('insurance_claims')->insert([
"patient_id" => $bill->patient_id, "episode_id" => $bill->episode_id, "claim_status" => 6,
"plan_id" => 1, "benefit_ids" => 1, "inpatient_outpatient" => 1,
"primary_plan_claim_total" => $bill->insurance_sundries_cost, "item_type" => 5, "item_ids" => 0,
"item_quantities" => 1, "tariff_ids" => 0, "tariff_amounts" => $bill->insurance_sundries_cost,
"co_payment_amounts" => 0, "item_cash_amounts" => $bill->insurance_sundries_cost, "current_chart_of_accounts" => 0,
"order_id" => $bill->inpatient_info_id, "is_item_authorisation_required" => 0, "is_authorisation_required" => 0,
"created_by" => $bill->created_by, "updated_by" => $bill->updated_by, "created_at" => $bill->created_at, "updated_at" => $bill->updated_at
]);
}
/*if ($bill->insurance_services_cost > 0) {
DB::table('insurance_claims')->insert([
"patient_id" => $bill->patient_id, "episode_id" => $bill->episode_id, "claim_status" => 6,
"plan_id" => 1, "benefit_ids" => 1, "inpatient_outpatient" => 1,
"primary_plan_claim_total" => $bill->insurance_services_cost, "item_type" => 1, "item_ids" => 0,
"item_quantities" => 1, "tariff_ids" => 0, "tariff_amounts" => $bill->insurance_services_cost,
"co_payment_amounts" => 0, "item_cash_amounts" => $bill->insurance_services_cost, "current_chart_of_accounts" => 0,
"order_id" => $bill->inpatient_info_id, "is_item_authorisation_required" => 0, "is_authorisation_required" => 0,
"created_by" => $bill->created_by, "updated_by" => $bill->updated_by, "created_at" => $bill->created_at, "updated_at" => $bill->updated_at
]);
}*/
if ($bill->insurance_procedures_cost > 0) {
DB::table('insurance_claims')->insert([
"patient_id" => $bill->patient_id, "episode_id" => $bill->episode_id, "claim_status" => 6,
"plan_id" => 1, "benefit_ids" => 1, "inpatient_outpatient" => 1,
"primary_plan_claim_total" => $bill->insurance_procedures_cost, "item_type" => 2, "item_ids" => 0,
"item_quantities" => 1, "tariff_ids" => 0, "tariff_amounts" => $bill->insurance_procedures_cost,
"co_payment_amounts" => 0, "item_cash_amounts" => $bill->insurance_procedures_cost, "current_chart_of_accounts" => 0,
"order_id" => $bill->inpatient_info_id, "is_item_authorisation_required" => 0, "is_authorisation_required" => 0,
"created_by" => $bill->created_by, "updated_by" => $bill->updated_by, "created_at" => $bill->created_at, "updated_at" => $bill->updated_at
]);
}
if ($bill->insurance_investigation_cost > 0) {
DB::table('insurance_claims')->insert([
"patient_id" => $bill->patient_id, "episode_id" => $bill->episode_id, "claim_status" => 6,
"plan_id" => 1, "benefit_ids" => 1, "inpatient_outpatient" => 1,
"primary_plan_claim_total" => $bill->insurance_investigation_cost, "item_type" => 3, "item_ids" => 0,
"item_quantities" => 1, "tariff_ids" => 0, "tariff_amounts" => $bill->insurance_investigation_cost,
"co_payment_amounts" => 0, "item_cash_amounts" => $bill->insurance_investigation_cost, "current_chart_of_accounts" => 0,
"order_id" => $bill->inpatient_info_id, "is_item_authorisation_required" => 0, "is_authorisation_required" => 0,
"created_by" => $bill->created_by, "updated_by" => $bill->updated_by, "created_at" => $bill->created_at, "updated_at" => $bill->updated_at
]);
}
if ($bill->insurance_hospital_stay_cost > 0) {
DB::table('insurance_claims')->insert([
"patient_id" => $bill->patient_id, "episode_id" => $bill->episode_id, "claim_status" => 6,
"plan_id" => 1, "benefit_ids" => 1, "inpatient_outpatient" => 1,
"primary_plan_claim_total" => $bill->insurance_hospital_stay_cost, "item_type" => 6, "item_ids" => 0,
"item_quantities" => 1, "tariff_ids" => 0, "tariff_amounts" => $bill->insurance_hospital_stay_cost,
"co_payment_amounts" => 0, "item_cash_amounts" => $bill->insurance_hospital_stay_cost, "current_chart_of_accounts" => 0,
"order_id" => $bill->inpatient_info_id, "is_item_authorisation_required" => 0, "is_authorisation_required" => 0,
"created_by" => $bill->created_by, "updated_by" => $bill->updated_by, "created_at" => $bill->created_at, "updated_at" => $bill->updated_at
]);
}
}
DB::commit();
} catch (\Exception $e) {
echo $e->getMessage() . "\n";
DB::rollback();
}
return 0;
}
}
@@ -1,57 +0,0 @@
<?php
namespace Streamline\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Streamline\Http\Controllers\SMSController;
class SendAppointmentRemaindersCommand extends Command {
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'appointment:remainders';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Send sms alerts to remind patients of appointments a day before';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct() {
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle() {
$tomorrow_start = Carbon::now()->startOfDay()->addDay();
$tomorrow_end = Carbon::now()->endOfDay()->addDay();
$appointments = DB::table('patient_appointments')
->whereBetween('appointment_date', [$tomorrow_start, $tomorrow_end])
->get();
foreach ($appointments as $appointment) {
if (is_sms_enabled()) {
// send sms alert to the patient
$sms = "This is a reminder that your appointment at " . get_name(1, 'id', 'name', 'hospital_information') .
" is scheduled for tomorrow the " . streamline_date($appointment->appointment_date) . " at " . $appointment->appointment_time;
(new SMSController)->send_appointments_alert($appointment->patient_id, $sms);
}
}
}
}
@@ -1,275 +0,0 @@
<?php
namespace Streamline\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class SetupCHICommand extends Command {
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'setup:chi';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Used to migrate old CHI data to the new Ubuntu model to setup CHI faster';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct() {
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle() {
DB::beginTransaction();
$hospital_info = DB::table('hospital_information')->where('id', 1)->first();
$hospital_name = $hospital_info->name;
$hospital_prefix = $hospital_info->patient_number_abbr;
$today = now();
try {
echo "Creating new plan... \n";
$plan_id = DB::table('community_health_insurance_plans')
->insertGetId(['name' => $hospital_name . ' Plan', 'plan_fee' => 0, 'plan_start_date' => $today, 'plan_end_date' => now()->addYear(),
'member_annual_limit' => 0, 'family_annual_limit' => 0, 'is_authorized_required' => 0,
'membership_card_color' => 'blue', 'created_by' => 1, 'created_at' => $today, 'updated_at' => $today]);
echo "Creating new benefit... \n";
$benefit_id = DB::table('insurance_benefits')
->insertGetId(['name' => $hospital_name . ' Benefit', 'waiting_period' => 0, 'fee' => 0, 'annual_member_limit' => 0,
'annual_family_limit' => 0, 'created_by' => 1, 'created_at' => $today, 'updated_at' => $today, 'plan_id' => $plan_id]);
// array to hold insurance benefit items
$insurance_benefit_items = [];
echo "Fetching insured drugs \n";
$drugs = DB::table('drugs')->where('insurance_coverage', 1)->whereNull('deleted_at')
->get(['id', 'insured_price', 'non_insured_price']);
echo "Creating drug benefit items \n";
foreach ($drugs as $drug) {
$insurance_benefit_items[4][] = $drug->id;
$json_array = [$benefit_id => [
"co_payment" => $drug->insured_price, "ipd_co_payment" => $drug->insured_price,
"capitation_fee" => 0, "annual_member_limit" => 0,
"annual_family_limit" => 0, "authorisation" => 0,
"apply_opd_percentage" => 0, "apply_ipd_percentage" => 0,
]];
DB::table('drugs')->where('id', $drug->id)->update(['insurance_benefit_details' => json_encode($json_array)]);
}
echo "Fetching insured sundries \n";
$sundries = DB::table('sundries')->where('insurance', 1)->whereNull('deleted_at')
->get(['id', 'insured_price', 'non_insured_price']);
echo "Creating sundries benefit items \n";
foreach ($sundries as $sundry) {
$insurance_benefit_items[5][] = $sundry->id;
$json_array = [$benefit_id => [
"co_payment" => $sundry->insured_price, "ipd_co_payment" => $sundry->insured_price,
"capitation_fee" => 0, "annual_member_limit" => 0,
"annual_family_limit" => 0, "authorisation" => 0,
"apply_opd_percentage" => 0, "apply_ipd_percentage" => 0,
]];
DB::table('sundries')->where('id', $sundry->id)->update(['insurance_benefit_details' => json_encode($json_array)]);
}
echo "Fetching insured investigations \n";
$investigations = DB::table('investigations')->where('insurance_coverage', 1)->whereNull('deleted_at')
->get(['id', 'insured_price', 'non_insured_price']);
echo "Creating investigation benefit items \n";
foreach ($investigations as $investigation) {
$insurance_benefit_items[3][] = $investigation->id;
$json_array = [$benefit_id => [
"co_payment" => $investigation->insured_price, "ipd_co_payment" => $investigation->insured_price,
"capitation_fee" => 0, "annual_member_limit" => 0,
"annual_family_limit" => 0, "authorisation" => 0,
"apply_opd_percentage" => 0, "apply_ipd_percentage" => 0,
]];
DB::table('investigations')->where('id', $investigation->id)->update(['insurance_benefit_details' => json_encode($json_array)]);
}
echo "Fetching insured procedures \n";
$procedures = DB::table('procedures')->where('insurance', 1)->whereNull('deleted_at')
->get(['id', 'insured_price', 'non_insured_price']);
echo "Creating procedures benefit items \n";
foreach ($procedures as $procedure) {
$insurance_benefit_items[2][] = $procedure->id;
$json_array = [$benefit_id => [
"co_payment" => $procedure->insured_price, "ipd_co_payment" => $procedure->insured_price,
"capitation_fee" => 0, "annual_member_limit" => 0,
"annual_family_limit" => 0, "authorisation" => 0,
"apply_opd_percentage" => 0, "apply_ipd_percentage" => 0,
]];
DB::table('procedures')->where('id', $procedure->id)->update(['insurance_benefit_details' => json_encode($json_array)]);
}
echo "Fetching insured services \n";
$services = DB::table('services')->where('insurance_coverage', 1)->whereNull('deleted_at')
->get(['id', 'insured_price', 'non_insured_price']);
echo "Creating services benefit items \n";
foreach ($services as $service) {
$insurance_benefit_items[1][] = $service->id;
$json_array = [$benefit_id => [
"co_payment" => $service->insured_price, "ipd_co_payment" => $service->insured_price,
"capitation_fee" => 0, "annual_member_limit" => 0,
"annual_family_limit" => 0, "authorisation" => 0,
"apply_opd_percentage" => 0, "apply_ipd_percentage" => 0,
]];
DB::table('services')->where('id', $service->id)->update(['insurance_benefit_details' => json_encode($json_array)]);
}
echo "Creating new benefit items... \n";
foreach ($insurance_benefit_items as $item_type => $benefit_items) {
DB::table('insurance_benefit_items')
->insert(['plan_id' => $plan_id, 'benefit_id' => $benefit_id, 'item_type' => $item_type,
'item_id' => implode(",", $benefit_items), 'created_by' => 1]);
}
// begin shifting the patients to new CHI model
echo "Fetching heads of family and updating... \n";
$heads = DB::table('insurance_heads_of_family')->whereNull('deleted_at')->get();
foreach ($heads as $head) {
// fetch the family members ignoring those who have been deleted
$family_members_arr = [];
$family_members_amount_arr = [];
$family_subscription_id = false;
$family_members = DB::table('insurance_members')->join('patients', 'patients.id', '=', 'insurance_members.patient_id')
->whereNull('insurance_members.deleted_at')
->whereNull('patients.deleted_at')
->where('insurance_members.family_id', $head->id)
->get(['insurance_members.patient_id', 'insurance_members.group_id', 'insurance_members.id', 'patients.gender']);
$family_subs = DB::table('insurance_subscriptions')->whereNull('deleted_at')
->whereRaw('FIND_IN_SET(' . $head->id . ',family_heads)')->orderBy('end_date', 'desc')
->first(['id', 'family_heads', 'family_amount', 'start_date', 'end_date', 'payment_date', 'covered_member_ids', 'covered_member_premiums_paid']);
if ($family_subs) {
$temp_family_heads = explode(",", $family_subs->family_heads);
$temp_family_amounts = explode(",", $family_subs->family_amount);
$family_premium = $temp_family_amounts[array_search($head->id, $temp_family_heads)] ?? 0;
$family_start_date = $family_subs->start_date;
$family_end_date = $family_subs->end_date;
$family_payment_date = $family_subs->payment_date;
$family_subscription_id = $family_subs->id;
} else {
$family_premium = 0;
$family_start_date = NULL;
$family_end_date = NULL;
$family_payment_date = NULL;
}
$number_of_family_members = count($family_members);
$last_member_premium = 0;
// avoid 0 division
if ($family_premium != 0 && $number_of_family_members != 0) {
// check if money can be shared equally, else force it
if ($family_premium % $number_of_family_members == 0) {
$individual_premium = $family_premium / $number_of_family_members;
} else {
$individual_premium = (int)floor($family_premium / $number_of_family_members);;
// get any remainder and give it to the last member
$last_member_premium = $family_premium - ($individual_premium * ($number_of_family_members - 1));
// confirm the amount not negative else just return 0
$last_member_premium = ($last_member_premium > 0) ? $last_member_premium : 0;
}
} else {
$individual_premium = 0;
}
// loop through the family members to get valid ones
foreach ($family_members as $family_member) {
$title = (empty($family_member->gender) || $family_member->gender == 1) ? 1 : 2;
$member_account_number = $hospital_prefix . "/" . date('Y') . "/" . $family_member->group_id. "/" . sprintf("%04d", $family_member->id);
// check if this is the last person
if ((count($family_members_arr) + 1) == $number_of_family_members && $number_of_family_members != 1) {
$individual_premium = $last_member_premium;
}
$family_members_arr[] = $family_member->id;
$family_members_amount_arr[] = $individual_premium;
DB::table('insurance_members')->where('id', $family_member->id)
->update(['title' => $title, 'premium' => $individual_premium, 'chi_plan' => $plan_id,
'membership_start_date' => $family_start_date, 'member_account_number' => $member_account_number, 'membership_registration_date' => $family_payment_date,
'existing_premium_start_date' => $family_start_date, 'existing_premium_end_date' => $family_end_date]);
}
// if the subscription table is available then update
if ($family_subscription_id && $family_subs) {
$exploded_covered_member_ids = is_null($family_subs->covered_member_ids) ? [] : explode(",", $family_subs->covered_member_ids);
$exploded_covered_member_premiums = is_null($family_subs->covered_member_premiums_paid) ? [] : explode(",", $family_subs->covered_member_premiums_paid);
$exploded_covered_member_ids = array_merge($exploded_covered_member_ids, $family_members_arr);
$exploded_covered_member_premiums = array_merge($exploded_covered_member_premiums, $family_members_amount_arr);
DB::table('insurance_subscriptions')->where('id', $family_subscription_id)
->update(['covered_member_ids' => implode(",", $exploded_covered_member_ids),
'covered_member_premiums_paid' => implode(",", $exploded_covered_member_premiums)]);
}
// update the family listing
DB::table('insurance_heads_of_family')->where('id', $head->id)
->update(['family_members_ids' => implode(",", $family_members_arr),
'family_member_premiums' => implode(",", $family_members_amount_arr)]);
}
// fetch number of insurance members with null
$member_count = DB::table('insurance_members')->whereNull(['deleted_at', 'chi_plan'])->count();
echo "Insurance members with null are " . $member_count . "\n";
// fetch number of insurance heads with null
$heads_count = DB::table('insurance_heads_of_family')->whereNull(['deleted_at', 'family_members_ids'])->count();
echo "Insurance heads of family with null are " . $heads_count . "\n";
// fetch number of insurance subscriptions with null
$subs_count = DB::table('insurance_subscriptions')->whereNull(['deleted_at', 'covered_member_ids'])->count();
echo "Insurance subscriptions with null are " . $subs_count . "\n";
echo "Migration complete \n";
DB::commit();
} catch (\Exception $e) {
echo $e->getMessage() . "\n";
DB::rollback();
}
return 0;
}
}
@@ -1,49 +0,0 @@
<?php
namespace Streamline\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Streamline\Console\Commands\CorrectFinanceCommand;
use Streamline\Console\Commands\ImportCsvPriceListsCommand;
use Streamline\Console\Commands\MigrateInsuranceExpenditureCommand;
use Streamline\Console\Commands\SendAppointmentRemaindersCommand;
use Streamline\Console\Commands\ImportCsvItemsCommand;
use Streamline\Console\Commands\SetupCHICommand;
class Kernel extends ConsoleKernel {
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
// Publishing commands
SendAppointmentRemaindersCommand::class,
ImportCsvItemsCommand::class,
ImportCsvPriceListsCommand::class,
CorrectFinanceCommand::class,
SetupCHICommand::class,
MigrateInsuranceExpenditureCommand::class,
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule) {
$schedule->command('appointment:remainders')->dailyAt('09:00');
}
/**
* Register the Closure based commands for the application.
*
* @return void
*/
protected function commands() {
require base_path('routes/console.php');
}
}
@@ -1,36 +0,0 @@
<?php
namespace Streamline\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
class Event
{
use Dispatchable, InteractsWithSockets, SerializesModels;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Get the channels the event should broadcast on.
*
* @return \Illuminate\Broadcasting\Channel|array
*/
public function broadcastOn()
{
return new PrivateChannel('channel-name');
}
}
@@ -1,72 +0,0 @@
<?php
namespace Streamline\Exceptions;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
class Handler extends ExceptionHandler {
/**
* A list of the exception types that should not be reported.
*
* @var array
*/
protected $dontReport = [
\Illuminate\Auth\AuthenticationException::class,
\Illuminate\Auth\Access\AuthorizationException::class,
\Symfony\Component\HttpKernel\Exception\HttpException::class,
\Illuminate\Database\Eloquent\ModelNotFoundException::class,
\Illuminate\Session\TokenMismatchException::class,
\Illuminate\Validation\ValidationException::class,
];
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param Throwable $exception
* @return void
*/
public function report(Throwable $exception) {
parent::report($exception);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param Throwable $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Throwable $exception) {
if ($exception instanceof \Spatie\Permission\Exceptions\UnauthorizedException) {
flash('Access to that page is restricted. Contact system administrator.')->error();
return redirect()->back();
// return response()->json(['Access to this page is restricted. Please contact system administrator.']);
}
return parent::render($request, $exception);
}
/**
* Convert an authentication exception into an unauthenticated response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception
* @return \Illuminate\Http\Response
*/
protected function unauthenticated($request, AuthenticationException $exception) {
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
}
return redirect()->guest(url('/'));//
}
}
@@ -1,625 +0,0 @@
<?php
namespace Streamline\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use OwenIt\Auditing\Models\Audit;
use Carbon\Carbon;
use Streamline\Models\User;
use Streamline\Models\Patient;
use Streamline\Models\PatientEpisode;
use Streamline\Models\Triage;
use Barryvdh\Snappy\Facades\SnappyPdf;
class AuditTrailController extends Controller
{
public function __construct()
{
$this->middleware('auth');
$this->middleware('permission:audit_trail-list', ['only' => ['index', 'search', 'patient_timeline', 'user_timeline']]);
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$audits = Audit::with('user')
->where('created_at', '>=', Carbon::now()->subDay())
->orderBy('created_at', 'desc')
->paginate(100);
if ($audits->count() <= 0) {
flash("There are no records in the audit trail")->error();
}
// users with activity
$user_id_array = DB::table('audits')
->groupBy('user_id')
->select('user_id')
->get()
->toArray();
$user_id = array(count($user_id_array));
foreach ($user_id_array as $value) {
$user_id[$value->user_id] = get_full_name($value->user_id, 'id', 'first_name', 'last_name', 'users');
}
// remove the count from the array
unset($user_id[0]);
// add --select--
$user_id = ['all' => 'ALL'] + $user_id;
// users with activity
$action_performed_array = DB::table('audits')
->groupBy('event')
->select('event')
->get()
->toArray();
$action_performed = array(count($action_performed_array));
foreach ($action_performed_array as $value) {
$action_performed[$value->event] = ucwords($value->event);
}
// remove the count from the array
unset($action_performed[0]);
// add --select--
$action_performed = ['all' => 'ALL'] + $action_performed;
// users with activity
$records_affected_array = DB::table('audits')
->groupBy('auditable_type')
->select('auditable_type')
->get()
->toArray();
$records_affected = array(count($records_affected_array));
foreach ($records_affected_array as $value) {
$record = str_replace('Streamline\\', '', $value->auditable_type);
/*================ show better text on forming the drop down ===========*/
$cleaned_model_name = str_replace('Streamline\\', '', $value->auditable_type);
$cleaned_model_name = preg_split('/(?=[A-Z])/', $cleaned_model_name);
$spaced_model_name = implode(' ', $cleaned_model_name);
/*========================================================*/
$records_affected[$record] = $spaced_model_name;
}
// remove the count from the array
unset($records_affected[0]);
// add --select--
$records_affected = ['all' => 'ALL'] + $records_affected;
// get all first names
$first_names = DB::table('users')->pluck('first_name', 'id');
// get all last names
$last_names = DB::table('users')->pluck('last_name', 'id');
return view('audit_trail.index',
compact([
'audits',
'first_names',
'last_names',
'user_id',
'action_performed',
'records_affected'
]));
}
public function audit_trail_print(Request $request)
{
$audit_trail_values = json_decode($request->data, 1);
$hospitalInfo = DB::table('hospital_information')->find(1);
$receipt_date = date('Y-m-d h:i:s');
$data = [
'hospitalInfo' => $hospitalInfo,
'audit_trail' => $request->data,
'receipt_data' => $receipt_date
];
$audit_trail = json_decode($data['audit_trail'])->data;
//return view('audit_trail.audit_trail_print', compact('audit_trail'));
$pdf = SnappyPDF::loadView('audit_trail.audit_trail_print', compact('audit_trail'))
->setOrientation('portrait')
->setOption('margin-bottom', 7)
->setOption('margin-top', 5)
->setOption('footer-html', '<i>Stre@mline</i>');
return $pdf->inline('Audit Trail' . date(" d-m-y h:ia") . '.pdf');
}
public function failed_login_print(Request $request){
$audit_trail_values = json_decode($request->data, 1);
$hospitalInfo = DB::table('hospital_information')->find(1);
$receipt_date = date('Y-m-d h:i:s');
$data = [
'hospitalInfo' => $hospitalInfo,
'failed_login_data' => $request->data,
'receipt_data' => $receipt_date
];
$failed_login_data = json_decode($data['failed_login_data'])->data;
//return view('audit_trail.failed_login_print', compact('data', 'failed_login_data'));
$pdf = SnappyPDF::loadView('audit_trail.failed_login_print', compact('failed_login_data'))
->setOrientation('portrait')
->setOption('margin-bottom', 7)
->setOption('margin-top', 5)
->setOption('footer-html', '<i>Stre@mline</i>');
return $pdf->inline('Audit Trail' . date(" d-m-y h:ia") . '.pdf');
}
public function online_user_print(Request $request){
$audit_trail_values = json_decode($request->data, 1);
$hospitalInfo = DB::table('hospital_information')->find(1);
$receipt_date = date('Y-m-d h:i:s');
$data = [
'hospitalInfo' => $hospitalInfo,
'audit_trail' => $audit_trail_values,
'receipt_data' => $receipt_date
];
$online_users = $audit_trail_values['data'];
//return view('audit_trail.online_user_print', compact('online_users'));
$pdf = SnappyPDF::loadView('audit_trail.online_user_print', compact('online_users'))
->setOrientation('portrait')
->setOption('margin-bottom', 7)
->setOption('margin-top', 5)
->setOption('footer-html', '<i>Stre@mline</i>');
return $pdf->inline('Audit Trail' . date(" d-m-y h:ia") . '.pdf');
}
/**
* Return audit table.
*
* @return \Illuminate\Http\Response
*/
public static function return_audit_table() {
$audits = Audit::with('user')->orderBy('created_at', 'desc')->paginate(100);
echo " <b>Old values</b>
<table>
@if(array_key_exists('updated_at', $audit->toArray()['old_values']))
@foreach ($audit->toArray()['old_values'] as $key => $value)
<tr>
<td>{{ format_key($key) }}</td>
$patient = Streamline\Models\Patient::where('id', $value)->first();
$user = Streamline\Models\User::where('id', $value)->first();
if($patient->id == $value && $key == 'patient_id')
<td>{{ $patient ? $patient->first_name : '' }}
{{ $patient ? $patient->last_name : '' }}</td>
@elseif($key == 'updated_by' || $key == 'created_by' || $key ==
'staff_id')
<td>{{ $user ? $user->first_name : '' }}
{{ $user ? $user->last_name : '' }}</td>
@else
<td>{{ $value }}</td>
@endif
</tr>
@endforeach
@endif
</table>
<b>New values</b>
</html>";
}
/**
* Search for audit trail records with given parameters
*
* @param Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Foundation\Application|\Illuminate\View\View
*/
public function search(Request $request)
{
$user_id = $request->user_id;
$action_performed = $request->action_performed;
$records_affected = $request->records_affected;
// Get the selected date criteria
$dates = $request->dates;
$filters = [];
if ($user_id != 'all') :
array_push($filters, ['user_id', '=', $user_id]);
endif;
if ($action_performed != 'all') :
array_push($filters, ['event', '=', $action_performed]);
endif;
if ($records_affected != 'all') :
array_push($filters, ['auditable_type', '=', 'Streamline\\' . $records_affected]);
endif;
// switch the selected date search criteria - today, yesterday, last week, last month etc
switch ($dates) {
case 'today':
$today = Carbon::today()->format('Y-m-d');
$audits = Audit::orderBy('created_at', 'desc')->where($filters)->whereDate('created_at', $today)->paginate(100);
break;
case 'yesterday':
$yesterday = Carbon::yesterday()->format('Y-m-d');
$audits = Audit::orderBy('created_at', 'desc')->where($filters)->whereDate('created_at', $yesterday)->paginate(100);
break;
case 'week':
$week_ago = Carbon::today()->subDays(7)->format('Y-m-d');
$audits = Audit::orderBy('created_at', 'desc')->where($filters)->whereDate('created_at', '>=', $week_ago)->paginate(100);
break;
case 'month':
$month_ago = Carbon::today()->subDays(30)->format('Y-m-d');
$audits = Audit::orderBy('created_at', 'desc')->where($filters)->whereDate('created_at', '>=', $month_ago)->paginate(100);
break;
case 'custom-date':
$start_date = Carbon::parse($request->start_date)->format('Y-m-d');
$audits = Audit::orderBy('created_at', 'desc')->where($filters)->whereDate('created_at', '=', $start_date)->paginate(100);
break;
case 'custom-range':
$start_date = Carbon::parse($request->start_date)->format('Y-m-d');
$end_date = Carbon::parse($request->end_date)->format('Y-m-d');
$audits = Audit::orderBy('created_at', 'desc')->where($filters)->whereBetween('created_at', [$start_date, $end_date])->paginate(100);
break;
default:
$audits = Audit::orderBy('created_at', 'desc')->where($filters)->paginate(150);
break;
}
if ($audits->count() <= 0) {
flash("There are no records found in the search")->error();
}
// users with activity
$user_id_array = DB::table('audits')->groupBy('user_id')->select('user_id')->get()->toArray();
$user_id = array(count($user_id_array));
foreach ($user_id_array as $value) {
$user_id[$value->user_id] = get_full_name($value->user_id, 'id', 'first_name', 'last_name', 'users');
}
// remove the count from the array
unset($user_id[0]);
// add --select--
$user_id = ['all' => 'ALL'] + $user_id;
// users with activity
$action_performed_array = DB::table('audits')->groupBy('event')->select('event')->get()->toArray();
$action_performed = array(count($action_performed_array));
foreach ($action_performed_array as $value) {
$action_performed[$value->event] = ucwords($value->event);
}
// remove the count from the array
unset($action_performed[0]);
// add --select--
$action_performed = ['all' => 'ALL'] + $action_performed;
// users with activity
$records_affected_array = DB::table('audits')->groupBy('auditable_type')->select('auditable_type')->get()->toArray();
$records_affected = array(count($records_affected_array));
foreach ($records_affected_array as $value) {
$record = str_replace('Streamline\\', '', $value->auditable_type);
//$records_affected[$record] = $record;
/*================ show better text on forming the drop down ===========*/
$cleaned_model_name = str_replace('Streamline\\', '', $value->auditable_type);
$cleaned_model_name = preg_split('/(?=[A-Z])/', $cleaned_model_name);
$spaced_model_name = implode(' ', $cleaned_model_name);
/*========================================================*/
$records_affected[$record] = $spaced_model_name;
}
// remove the count from the array
unset($records_affected[0]);
// add --select--
$records_affected = ['all' => 'ALL'] + $records_affected;
// get all first names
$first_names = DB::table('users')->pluck('first_name', 'id');
// get all last names
$last_names = DB::table('users')->pluck('last_name', 'id');
return view('audit_trail.index', compact('audits', 'first_names', 'last_names', 'user_id', 'action_performed', 'records_affected'));
}
public function audit_trail_details($id)
{
//$audits = Audit::where(['id' => $id])->get();
$audit = Audit::where(['id' => $id])->first();
$user = User::where('id', $audit->user_id)->first();
//dd($audit);
// get all first names
$first_names = DB::table('users')->pluck('first_name', 'id');
// get all last names
$last_names = DB::table('users')->pluck('last_name', 'id');
// get full names
$full_names = $user->first_name." ".$user->last_name;
return view('audit_trail.audit_trail_details', compact('full_names', 'audit', 'last_names', 'first_names'));
}
public function select_patient_and_episode(Request $request) {
$patient = [];
$patient_episodes_details = [];
if (isset($request->patient_id)) {
$patient_searched = true;
$patient = Patient::find($request->patient_id);
if ($patient) {
$patient_episodes = PatientEpisode::where('patient_id', $patient->id)->get();
$counter = 0;
foreach ($patient_episodes as $episode) {
$patient_episodes_details[$counter]['id'] = $episode->id;
$patient_episodes_details[$counter]['created_at'] = streamline_date_time($episode->created_at);
$counter++;
}
}
} else {
$patient_searched = false;
}
return view('audit_trail.select_patient_and_episode', compact('patient_searched', 'patient', 'patient_episodes_details'));
}
public function patient_timeline($patient_id, $episode_id)
{
$patient = Patient::find($patient_id);
$episode = PatientEpisode::find($episode_id);
$patient_timeline = [];
$index = 0;
// add when episode was created
$patient_timeline[$index]["date"] = streamline_date_time($episode->created_at);
$patient_timeline[$index]["text"] = "Episode was started by " . get_full_name($episode->created_by, 'id', 'first_name', 'last_name', 'users');
$index++;
// fetch triage info
if (!is_null($episode->triage_id)) {
$triage_audits = Audit::where(['auditable_type' => 'Streamline\\Triage', 'auditable_id' => $episode->triage_id])
->select('old_values', 'new_values', 'event', 'created_at', 'user_id')
->orderBy('created_at', 'desc')
->get()
->toArray();
foreach ($triage_audits as $audit) {
if ($audit["event"] == "created") {
$patient_timeline[$index]["date"] = streamline_date_time($audit["created_at"]);
$patient_timeline[$index]["text"] = "Patient Triage was carried out by " . get_full_name($audit["user_id"], 'id', 'first_name', 'last_name', 'users') .
" with patient being assigned to the " . get_name($audit["new_values"]["clinic_allocation"], 'id', 'name', 'clinics') . " clinic with severe grade of " . severe_grade($audit["new_values"]["severe_grade"]);
} else {
$text = "Patient Triage was edited by " . get_full_name($audit["user_id"], 'id', 'first_name', 'last_name', 'users');
if (key_exists("clinic_allocation", $audit["new_values"])) {
$text .= "<br>Clinic allocation changed to " . get_name($audit["new_values"]["clinic_allocation"], 'id', 'name', 'clinics');
}
if (key_exists("severe_grade", $audit["new_values"])) {
$text .= "<br>Severe Grade changed to " . severe_grade($audit["new_values"]["severe_grade"]);
}
$patient_timeline[$index]["date"] = streamline_date_time($audit["created_at"]);
$patient_timeline[$index]["text"] = $text;
}
$index++;
}
}
// fetch consultation data
if (!is_null($episode->consultation_id)) {
$consultation_audits = Audit::where(['auditable_type' => 'Streamline\\Consultation', 'auditable_id' => $episode->consultation_id])
->select('old_values', 'new_values', 'event', 'created_at', 'user_id')
->orderBy('created_at', 'desc')
->get()
->toArray();
foreach ($consultation_audits as $audit) {
if ($audit["event"] == "created") {
$patient_timeline[$index]["date"] = streamline_date_time($audit["created_at"]);
$patient_timeline[$index]["text"] = "Patient Consultation was carried out by " . get_full_name($audit["user_id"], 'id', 'first_name', 'last_name', 'users') .
" with primary diagnosis set as " . get_name($audit["new_values"]["primary_diagnosis"], 'id', 'name', 'diagnoses') . " and outcome of " . get_name($audit["new_values"]["outcome_id"], 'id', 'name', 'outcomes');
} else {
$text = "Patient Consultation was edited by " . get_full_name($audit["user_id"], 'id', 'first_name', 'last_name', 'users');
if (key_exists("primary_diagnosis", $audit["new_values"])) {
$text .= "<br>Primary Diagnosis changed to " . get_name($audit["new_values"]["primary_diagnosis"], 'id', 'name', 'diagnoses');
}
if (key_exists("outcome_id", $audit["new_values"])) {
$text .= "<br>Outcome changed to " . get_name($audit["new_values"]["outcome_id"], 'id', 'name', 'outcomes');
}
$patient_timeline[$index]["date"] = streamline_date_time($audit["created_at"]);
$patient_timeline[$index]["text"] = $text;
}
$index++;
}
}
// fetch treatment data
if (!is_null($episode->treatment_id)) {
$treatment_audits = Audit::where(['auditable_type' => 'Streamline\\Treatment', 'auditable_id' => $episode->treatment_id])
->select('old_values', 'new_values', 'event', 'created_at', 'user_id')
->orderBy('created_at', 'desc')
->get()
->toArray();
foreach ($treatment_audits as $audit) {
if ($audit["event"] == "created") {
$patient_timeline[$index]["date"] = streamline_date_time($audit["created_at"]);
$text = "Prescriptions were ordered by " . get_full_name($audit["user_id"], 'id', 'first_name', 'last_name', 'users');
$text .= "<br><b>Treatments</b>:";
$drugs = explode(",", $audit["new_values"]["drugs"]);
$durations = explode(",", $audit["new_values"]["durations"]);
for ($i = 0; $i < count($drugs); $i++) {
$text .= "<br>" . get_name($drugs[$i], 'id', 'name', 'drugs') .
" for " . $durations[$i];
}
$patient_timeline[$index]["text"] = $text;
} else if ($audit["event"] == "updated" && key_exists("drugs", $audit["new_values"]) && key_exists("durations", $audit["new_values"])) {
$patient_timeline[$index]["date"] = streamline_date_time($audit["created_at"]);
$text = "Prescriptions were edited by " . get_full_name($audit["user_id"], 'id', 'first_name', 'last_name', 'users');
$text .= "<br><b>Treatments</b>:";
$drugs = explode(",", $audit["new_values"]["drugs"]);
$durations = explode(",", $audit["new_values"]["durations"]);
for ($i = 0; $i < count($drugs); $i++) {
$text .= "<br>" . get_name($drugs[$i], 'id', 'name', 'drugs') .
" for " . $durations[$i];
}
$patient_timeline[$index]["text"] = $text;
}
$index++;
}
}
// check for any ordered investigations
$ordered_investigations = DB::table('ordered_investigations')
->where('patient_id', $patient_id)
->where('episode_id', $episode_id)
->get();
foreach ($ordered_investigations as $inv) {
$investigation_audits = Audit::where(['auditable_type' => 'Streamline\\OrderedInvestigation', 'auditable_id' => $inv->id])
->select('old_values', 'new_values', 'event', 'created_at', 'user_id')
->orderBy('created_at', 'desc')
->get()
->toArray();
foreach ($investigation_audits as $audit) {
if ($audit["event"] == "created") {
$patient_timeline[$index]["date"] = streamline_date_time($audit["created_at"]);
$text = "Investigations were ordered by " . get_full_name($audit["user_id"], 'id', 'first_name', 'last_name', 'users');
$text .= "<br><b>Investigations ( " . $audit["new_values"]["order_type"] . ")</b>:";
$invs_id = explode(",", $audit["new_values"]["investigation_id"]);
for ($i = 0; $i < count($invs_id); $i++) {
$text .= "<br>" . get_name($invs_id[$i], 'id', 'name', 'investigations');
}
$patient_timeline[$index]["text"] = $text;
} else if ($audit["event"] == "updated" && key_exists("investigation_id", $audit["new_values"])) {
$patient_timeline[$index]["date"] = streamline_date_time($audit["created_at"]);
$text = "Investigations were edited by " . get_full_name($audit["user_id"], 'id', 'first_name', 'last_name', 'users');
$text .= "<br><b>Investigations ( " . get_name($inv->id, 'id', 'order_type', 'ordered_investigations') . ")</b>:";
$invs_id = explode(",", $audit["new_values"]["investigation_id"]);
for ($i = 0; $i < count($invs_id); $i++) {
$text .= "<br>" . get_name($invs_id[$i], 'id', 'name', 'investigations');
}
$patient_timeline[$index]["text"] = $text;
}
$index++;
}
}
// check for any ordered procedures
$ordered_procedures = DB::table('ordered_procedures')
->where('patient_id', $patient_id)
->where('episode_id', $episode_id)
->get();
// here we shall categorize the procedures. If their created at is within 5 seconds
// then they are in the same group of being created
$categorized_procedures = [];
$counter = 0;
$time_last_procedure_was_created = 0;
foreach ($ordered_procedures as $procedure) {
if ($time_last_procedure_was_created != 0) {
$diff_in_time = Carbon::createFromTimeString($procedure->created_at)->diffInSeconds($time_last_procedure_was_created);
if ($diff_in_time < 5) {
$categorized_procedures[$counter - 1]['ids'][] = $procedure->procedure_id;
$categorized_procedures[$counter - 1]['deleted'][] = $procedure->deleted_at;
} else {
$categorized_procedures[$counter]['ids'] = [$procedure->procedure_id];
$categorized_procedures[$counter]['time'] = $procedure->created_at;
$categorized_procedures[$counter]['user_id'] = $procedure->created_by;
$categorized_procedures[$counter]['deleted'] = [$procedure->deleted_at];
$time_last_procedure_was_created = $procedure->created_at;
$counter++;
}
} else {
$categorized_procedures[$counter]['ids'] = [$procedure->procedure_id];
$categorized_procedures[$counter]['time'] = $procedure->created_at;
$categorized_procedures[$counter]['user_id'] = $procedure->created_by;
$categorized_procedures[$counter]['deleted'] = [$procedure->deleted_at];
$time_last_procedure_was_created = $procedure->created_at;
$counter++;
}
}
foreach ($categorized_procedures as $record) {
$patient_timeline[$index]["date"] = streamline_date_time($record['time']);
$text = "Procedures were ordered by " . get_full_name($record['user_id'], 'id', 'first_name', 'last_name', 'users');
$text .= "<br><b>Procedures</b>:";
for ($i = 0; $i < count($record['ids']); $i++) {
$text .= "<br>" . get_name($record['ids'][$i], 'id', 'name', 'procedures');
if ($record['deleted'][$i]) {
$text .= " <span style='color: red'>was later removed at " . streamline_date_time($record['deleted'][$i]) . "</span>";
}
}
$patient_timeline[$index]["text"] = $text;
$index++;
}
// sort the array in descending order according to the date
usort($patient_timeline, array($this, "sort_timeline_by_date"));
return view('audit_trail.patient_timeline', compact('patient', 'patient_timeline'));
}
public function user_timeline(Request $request)
{
//
}
function sort_timeline_by_date($a, $b)
{
return strcmp($a["date"], $b["date"]);
}
}

Some files were not shown because too many files have changed in this diff Show More