cleanup & setting up sync update

This commit is contained in:
2025-03-24 17:19:51 +03:00
parent a2ce9248f0
commit 22473c8f3f
13650 changed files with 507 additions and 1947259 deletions
+23
View File
@@ -0,0 +1,23 @@
FROM php:cli
# Install required dependencies
RUN apt-get update && apt-get install -y cron unzip curl && rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-install pdo pdo_mysql
RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev \
&& pecl install redis && docker-php-ext-enable redis
# Copy the cron job script
WORKDIR /app
COPY fetch_and_send.php /app/fetch_and_send.php
COPY crontab /etc/cron.d/crontab
RUN chmod +x /app/fetch_and_send.php
# Give execution rights on the cron job file
RUN chmod 0644 /etc/cron.d/crontab && crontab /etc/cron.d/crontab
RUN touch /var/log/cron.log && touch /app/statistics.log
# Start cron in the foreground
CMD ["cron", "-f"]
+1
View File
@@ -0,0 +1 @@
00 23 * * * php /app/fetch_and_send.php >> /var/log/cron.log 2>&1
+207
View File
@@ -0,0 +1,207 @@
<?php
$dsn = "mysql:host=" . getenv('DB_HOST') . ";dbname=" . getenv('DB_DATABASE');
$username = getenv('DB_USERNAME');
$password = getenv('DB_PASSWORD');
$pdo = new PDO($dsn, $username, $password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
checkFailedData();
$previous = $pdo->query("SELECT * FROM signalytic_data")->fetch(PDO::FETCH_ASSOC)['last_fetch_date'];
$hospitalInformation = $pdo->query("SELECT * FROM hospital_information")->fetch(PDO::FETCH_ASSOC);
$episodes = $pdo->query("SELECT triage_id, consultation_id, gender, clinic_id, name, slug FROM patient_episodes
JOIN patients ON patient_episodes.patient_id = patients.id
LEFT JOIN clinics ON patient_episodes.clinic_id = clinics.id
WHERE patient_episodes.created_at > '{$previous}'");
$episodes_created_male = 0;
$episodes_created_female = 0;
$episodes_completed_with_outcome = [];
$episodes_per_clinic = [];
$episodes_triaged = 0;
while ($row = $episodes->fetch(PDO::FETCH_ASSOC)) {
if ($row['gender'] == 1) {
$episodes_created_male++;
} else if ($row['gender'] == 2) {
$episodes_created_female++;
}
if (!is_null($row['triage_id'])) {
$episodes_triaged++;
}
if (!is_null($row['clinic_id'])) {
$episodes_per_clinic[$row['clinic_id']] = [
'clinic_name' => $row['name'],
'clinic_type' => $row['slug'],
'clinic_count' => ($episodes_per_clinic[$row['clinic_id']]['clinic_count'] ?? 0) + 1,
];
}
if (!is_null($row['consultation_id'])) {
$cons = $pdo->query("SELECT consultations.outcome_id, outcomes.name FROM consultations
JOIN outcomes ON consultations.outcome_id = outcomes.id
WHERE consultations.id = '{$row['consultation_id']}'")->fetch(PDO::FETCH_ASSOC);
$episodes_completed_with_outcome[$cons['outcome_id']] = [
'outcome_name' => $cons['name'],
'outcome_count' => ($episodes_completed_with_outcome[$cons['outcome_id']]['outcome_count'] ?? 0) + 1,
];
}
}
$users_seen = $pdo->query("SELECT * FROM users WHERE last_seen > '{$previous}'")->rowCount();
$male_patients = $pdo->query("SELECT * FROM patients WHERE created_at > '{$previous}' AND gender = '1'")->rowCount();
$female_patients = $pdo->query("SELECT * FROM patients WHERE created_at > '{$previous}' AND gender = '2'")->rowCount();
$receipts = $pdo->query("SELECT * FROM track_receipts WHERE created_at > '{$previous}'")->rowCount();
$pharmacyRec = $pdo->query("SELECT * FROM pharmacy_stock_reconciliations WHERE created_at > '{$previous}' AND completion_status = 1")->rowCount();
$storeRec = $pdo->query("SELECT * FROM store_stock_reconciliations WHERE created_at > '{$previous}' AND completion_status = 1")->rowCount();
$quotations = $pdo->query("SELECT * FROM quotations WHERE created_at > '{$previous}' AND receive_date IS NOT NULL")->rowCount();
$inpatients = $pdo->query("SELECT inpatient_info.discharged, inpatient_info.died_on, patients.gender FROM inpatient_info JOIN patients ON inpatient_info.patient_id = patients.id WHERE inpatient_info.created_at > '{$previous}'");
$patients_admitted_male = 0;
$patients_admitted_female = 0;
$patients_discharged_male = 0;
$patients_discharged_female = 0;
while ($row = $inpatients->fetch(PDO::FETCH_ASSOC)) {
if ($row['gender'] == 1) {
$patients_admitted_male++;
} else if ($row['gender'] == 2) {
$patients_admitted_female++;
}
if ($row['discharged'] === 1 || !is_null($row['died_on'])) {
if ($row['gender'] == 1) {
$patients_discharged_male++;
} else if ($row['gender'] == 2) {
$patients_discharged_female++;
}
}
}
$investigations = $pdo->query("SELECT * FROM ordered_investigations WHERE created_at > '{$previous}'");
$investigation_requests = 0;
$investigation_results = 0;
while ($row = $investigations->fetch(PDO::FETCH_ASSOC)) {
$investigation_requests++;
// top_investigations
if ($row['investigation_status'] === 1) {
$investigation_results++;
}
}
$treatments = $pdo->query("SELECT * FROM treatments WHERE created_at > '{$previous}'");
$prescriptions = 0;
$prescriptions_dispensed = 0;
while ($row = $treatments->fetch(PDO::FETCH_ASSOC)) {
$prescriptions++;
if ($row['dispense_status'] === 1) {
$prescriptions_dispensed++;
}
}
$top_diagnosis = $pdo->query("SELECT primary_diagnosis, COUNT(*) AS freq, name FROM consultations JOIN diagnoses ON consultations.primary_diagnosis = diagnoses.id WHERE consultations.created_at > '{$previous}' GROUP BY primary_diagnosis ORDER BY freq DESC LIMIT 5")->fetchAll();
$data = json_encode([
'facility_name' => $hospitalInformation['name'],
'facility_email' => $hospitalInformation['email'],
'facility_address' => $hospitalInformation['address'],
'facility_unique_identifier' => $hospitalInformation['unique_hospital_identifier'] ?? '',
'time_period' => "{$previous} to " . date("Y-m-d H:i:s"),
'episodes_created_male' => $episodes_created_male,
'episodes_created_female' => $episodes_created_female,
'episodes_completed_with_outcome' => $episodes_completed_with_outcome,
'episodes_triaged' => $episodes_triaged,
'patients_admitted_male' => $patients_admitted_male,
'patients_admitted_female' => $patients_admitted_female,
'patients_discharged_male' => $patients_discharged_male,
'patients_discharged_female' => $patients_discharged_female,
'number_of_prescriptions' => $prescriptions,
'number_of_prescriptions_dispensed' => $prescriptions_dispensed,
'payment_receipts_generated' => $receipts,
'active_users' => $users_seen,
'male_patients_registered' => $male_patients,
'female_patients_registered' => $female_patients,
'investigation_requests' => $investigation_requests,
'investigation_requests_with_results' => $investigation_results,
'times_inventory_stock_received' => $quotations,
'times_stock_reconciled_pharmacy' => $pharmacyRec,
'times_stock_reconciled_store' => $storeRec,
'top_diagnosis' => $top_diagnosis,
'top_investigations' => [],
'top_prescribed_drugs_opd' => [],
'top_prescribed_drugs_ipd' => [],
'top_dispensed_drugs_opd' => [],
'top_dispensed_drugs_ipd' => [],
'episodes_per_clinic' => $episodes_per_clinic,
]);
sendData(false, $data);
function checkFailedData()
{
$redis = new Redis();
$redis->connect(getenv('REDIS_HOST'), getenv('REDIS_PORT'));
$failedRequests = $redis->lrange("failed_requests", 0, -1);
foreach ($failedRequests as $request) {
$data = json_decode($request, true);
$response = sendData(true, $data['data']);
if ($response) {
// success, remove from redis list
$redis->lrem("failed_requests", $request, 1);
}
}
}
function sendData($is_retry, $data)
{
global $pdo;
$server_endpoint = getenv("SERVER_URL");
$ch = curl_init($server_endpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
curl_close($ch);
if ($httpCode >= 200 && $httpCode < 300) {
// success
$stmt = $pdo->prepare("UPDATE signalytic_data SET last_fetch_date = ? WHERE id = ?");
$stmt->execute([date("Y-m-d H:i:s"), 1]);
return true;
} else if (!$is_retry) {
// request failed
$failedRequest = json_encode([
'timestamp' => date('Y-m-d H:i:s'),
'data' => $data,
'error' => $error ?: "HTTP Code $httpCode",
]);
$redis = new Redis();
$redis->connect(getenv('REDIS_HOST'), getenv('REDIS_PORT'));
$redis->lpush("failed_requests", $failedRequest);
return true;
} else {
return false;
}
}
+228
View File
@@ -0,0 +1,228 @@
<?php
class sync{
protected $db_host;
protected $db;
protected $db_user;
protected $db_password;
protected $redis;
function __construct(){
# database setup
$this->db = getenv('DB_DATABASE');
$this->db_user = getenv('DB_USERNAME');
$this->db_password = getenv('DB_PASSWORD');
# redis
$this->redis_host = getenv("REDIS_HOST");
$this->redis_host = getenv("REDIS_PORT");
$this->redis = new Redis();
$this->redis->connect($this->redis_host, $this->redis_host);
}
function databaseConnection(){
$dsn = "mysql:host=". $this->db_host .";dbname=". $this->db;
$pdo = new PDO($dsn, $this->db_user, $this->db_password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
function connectionFail(){
$failedRequests = $this->redis->lrange("failed_requests", 0, -1);
foreach ($failedRequests as $request) {
$data = json_decode($request, true);
$response = sendData(true, $data['data']);
if ($response) {
// success, remove from redis list
$redis->lrem("failed_requests", $request, 1);
}
}
}
function fetchData(){
$previous = $pdo->query("SELECT * FROM signalytic_data")->fetch(PDO::FETCH_ASSOC)['last_fetch_date'];
$hospitalInformation = $pdo->query("SELECT * FROM hospital_information")->fetch(PDO::FETCH_ASSOC);
$episodes = $pdo->query("SELECT triage_id, consultation_id, gender, clinic_id, name, slug FROM patient_episodes
JOIN patients ON patient_episodes.patient_id = patients.id
LEFT JOIN clinics ON patient_episodes.clinic_id = clinics.id
WHERE patient_episodes.created_at > '{$previous}'");
$episodes_created_male = 0;
$episodes_created_female = 0;
$episodes_completed_with_outcome = [];
$episodes_per_clinic = [];
$episodes_triaged = 0;
while ($row = $episodes->fetch(PDO::FETCH_ASSOC)) {
if ($row['gender'] == 1) {
$episodes_created_male++;
} else if ($row['gender'] == 2) {
$episodes_created_female++;
}
if (!is_null($row['triage_id'])) {
$episodes_triaged++;
}
if (!is_null($row['clinic_id'])) {
$episodes_per_clinic[$row['clinic_id']] = [
'clinic_name' => $row['name'],
'clinic_type' => $row['slug'],
'clinic_count' => ($episodes_per_clinic[$row['clinic_id']]['clinic_count'] ?? 0) + 1,
];
}
if (!is_null($row['consultation_id'])) {
$cons = $pdo->query("SELECT consultations.outcome_id, outcomes.name FROM consultations
JOIN outcomes ON consultations.outcome_id = outcomes.id
WHERE consultations.id = '{$row['consultation_id']}'")->fetch(PDO::FETCH_ASSOC);
$episodes_completed_with_outcome[$cons['outcome_id']] = [
'outcome_name' => $cons['name'],
'outcome_count' => ($episodes_completed_with_outcome[$cons['outcome_id']]['outcome_count'] ?? 0) + 1,
];
}
}
$users_seen = $pdo->query("SELECT * FROM users WHERE last_seen > '{$previous}'")->rowCount();
$male_patients = $pdo->query("SELECT * FROM patients WHERE created_at > '{$previous}' AND gender = '1'")->rowCount();
$female_patients = $pdo->query("SELECT * FROM patients WHERE created_at > '{$previous}' AND gender = '2'")->rowCount();
$receipts = $pdo->query("SELECT * FROM track_receipts WHERE created_at > '{$previous}'")->rowCount();
$pharmacyRec = $pdo->query("SELECT * FROM pharmacy_stock_reconciliations WHERE created_at > '{$previous}' AND completion_status = 1")->rowCount();
$storeRec = $pdo->query("SELECT * FROM store_stock_reconciliations WHERE created_at > '{$previous}' AND completion_status = 1")->rowCount();
$quotations = $pdo->query("SELECT * FROM quotations WHERE created_at > '{$previous}' AND receive_date IS NOT NULL")->rowCount();
$inpatients = $pdo->query("SELECT inpatient_info.discharged, inpatient_info.died_on, patients.gender FROM inpatient_info JOIN patients ON inpatient_info.patient_id = patients.id WHERE inpatient_info.created_at > '{$previous}'");
$patients_admitted_male = 0;
$patients_admitted_female = 0;
$patients_discharged_male = 0;
$patients_discharged_female = 0;
while ($row = $inpatients->fetch(PDO::FETCH_ASSOC)) {
if ($row['gender'] == 1) {
$patients_admitted_male++;
} else if ($row['gender'] == 2) {
$patients_admitted_female++;
}
if ($row['discharged'] === 1 || !is_null($row['died_on'])) {
if ($row['gender'] == 1) {
$patients_discharged_male++;
} else if ($row['gender'] == 2) {
$patients_discharged_female++;
}
}
}
$investigations = $pdo->query("SELECT * FROM ordered_investigations WHERE created_at > '{$previous}'");
$investigation_requests = 0;
$investigation_results = 0;
while ($row = $investigations->fetch(PDO::FETCH_ASSOC)) {
$investigation_requests++;
// top_investigations
if ($row['investigation_status'] === 1) {
$investigation_results++;
}
}
$treatments = $pdo->query("SELECT * FROM treatments WHERE created_at > '{$previous}'");
$prescriptions = 0;
$prescriptions_dispensed = 0;
while ($row = $treatments->fetch(PDO::FETCH_ASSOC)) {
$prescriptions++;
if ($row['dispense_status'] === 1) {
$prescriptions_dispensed++;
}
}
$top_diagnosis = $pdo->query("SELECT primary_diagnosis, COUNT(*) AS freq, name FROM consultations JOIN diagnoses ON consultations.primary_diagnosis = diagnoses.id WHERE consultations.created_at > '{$previous}' GROUP BY primary_diagnosis ORDER BY freq DESC LIMIT 5")->fetchAll();
$data = json_encode([
'facility_name' => $hospitalInformation['name'],
'facility_email' => $hospitalInformation['email'],
'facility_address' => $hospitalInformation['address'],
'facility_unique_identifier' => $hospitalInformation['unique_hospital_identifier'] ?? '',
'time_period' => "{$previous} to " . date("Y-m-d H:i:s"),
'episodes_created_male' => $episodes_created_male,
'episodes_created_female' => $episodes_created_female,
'episodes_completed_with_outcome' => $episodes_completed_with_outcome,
'episodes_triaged' => $episodes_triaged,
'patients_admitted_male' => $patients_admitted_male,
'patients_admitted_female' => $patients_admitted_female,
'patients_discharged_male' => $patients_discharged_male,
'patients_discharged_female' => $patients_discharged_female,
'number_of_prescriptions' => $prescriptions,
'number_of_prescriptions_dispensed' => $prescriptions_dispensed,
'payment_receipts_generated' => $receipts,
'active_users' => $users_seen,
'male_patients_registered' => $male_patients,
'female_patients_registered' => $female_patients,
'investigation_requests' => $investigation_requests,
'investigation_requests_with_results' => $investigation_results,
'times_inventory_stock_received' => $quotations,
'times_stock_reconciled_pharmacy' => $pharmacyRec,
'times_stock_reconciled_store' => $storeRec,
'top_diagnosis' => $top_diagnosis,
'top_investigations' => [],
'top_prescribed_drugs_opd' => [],
'top_prescribed_drugs_ipd' => [],
'top_dispensed_drugs_opd' => [],
'top_dispensed_drugs_ipd' => [],
'episodes_per_clinic' => $episodes_per_clinic,
]);
return $data;
}
function uploadData(){
global $pdo;
$server_endpoint = getenv("SERVER_URL");
$ch = curl_init($server_endpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
curl_close($ch);
if ($httpCode >= 200 && $httpCode < 300) {
// success
$stmt = $pdo->prepare("UPDATE signalytic_data SET last_fetch_date = ? WHERE id = ?");
$stmt->execute([date("Y-m-d H:i:s"), 1]);
return true;
} else if (!$is_retry) {
// request failed
$failedRequest = json_encode([
'timestamp' => date('Y-m-d H:i:s'),
'data' => $data,
'error' => $error ?: "HTTP Code $httpCode",
]);
$redis = new Redis();
$redis->connect(getenv('REDIS_HOST'), getenv('REDIS_PORT'));
$redis->lpush("failed_requests", $failedRequest);
return true;
} else {
return false;
}
}
}
$sync = new Sync();
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,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 $?
@@ -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
-37
View File
@@ -1,37 +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=
DOCKER_ACTIVE=false
-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,254 +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[] = intval($split_item[0]);
$formatted_data[intval($split_item[0])] = [intval($split_item[1]), intval($split_item[2]), intval($split_item[3]), intval($split_item[4]), intval(str_replace(["\r", "\n"], "", $split_item[5]))];
}
// check if height is out of bounds
if ($height < $lengths[0] || $height > $lengths[count($lengths) - 1]) {
$text = "Nutrition Status Not Available";
$reason = "Height is out of range";
$text_color = "red";
return $text . "&&&&" . $reason . "&&&&" . $text_color;
}
$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[] = intval($split_item[0]);
$formatted_data[intval($split_item[0])] = [intval($split_item[1]), intval($split_item[2]), intval($split_item[3]), intval($split_item[4]), intval(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,243 +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.
*
*/
public function store(Request $request) {
request()->validate([
'documenttitle' => 'required'
]);
$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();
// redirect to consultation or patient_episode page depending on where the user is from
if (session()->has('redirect_to_consultation')) {
$url = session()->get('redirect_to_consultation');
session()->forget('redirect_to_consultation');
return redirect($url);
} else {
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,231 +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);
}
if($search_by === 0){
// last 24 hours
$start_date_search = Carbon::yesterday()->startOfDay()->toDateTimeString();
$end_date_search = Carbon::yesterday()->endOfDay()->toDateTimeString();
$date_search = "Yesterday";
} elseif($search_by == 1){
// custom date
$start_date_search = Carbon::parse($reg_date)->startOfDay()->toDateTimeString();
$end_date_search = Carbon::parse($reg_date)->endOfDay()->toDateTimeString();
$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();
$date_search = streamline_date($start_date_search) . " to " . streamline_date($end_date_search);
} else {
// Today
$start_date_search = Carbon::today()->startOfDay()->toDateTimeString();
$end_date_search = Carbon::today()->endOfDay()->toDateTimeString();
$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')
->whereBetween('patient_episodes.created_at', [$start_date_search, $end_date_search])
->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])
->whereBetween('patient_episodes.created_at', [$start_date_search, $end_date_search])
->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;
$diagnoses = DB::table('diagnoses')->where('available', 1)->whereNull('deleted_at')->pluck("name", "id")->toArray();
$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', 'diagnoses'));
}
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';
session()->put('triage_without_etat', 0);
} elseif ($route == 'consultation'){
session()->put('consultation_with_notes', 0);
$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') {
session()->put('triage_without_etat', 1);
$url = '/triage';
} elseif ($route == 'consultation_with_notes') {
session()->put('consultation_with_notes', 1);
$url = '/consultation/route';
} elseif ($route == 'view_patient_history') {
$url = '/patient_episodes/';
} elseif ($route == 'main_exam') {
$url = '/eye_clinic/main_exam_route';
} elseif ($route == 'base_refraction_exam') {
$url = '/eye_clinic/base_exam_refraction';
}
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) {
flash("This episode already exists!")->error();
return back()->withInput();
}
}
}
@@ -1,451 +0,0 @@
<?php
namespace Modules\Patients\Http\Controllers;
use Barryvdh\Snappy\Facades\SnappyPdf;
use Carbon\Carbon;
use Illuminate\Database\QueryException;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Streamline\Models\Drug;
use Streamline\Models\EyeGlasses;
use Streamline\Models\HospitalInformation;
use Streamline\Models\OrderedEyeGlasses;
use Streamline\Models\OrderedService;
use Streamline\Models\OrderedSundry;
use Streamline\Models\Patient;
use Streamline\Models\PatientEpisode;
use Streamline\Models\PointOfSaleRecord;
use Streamline\Models\ReferralHospital;
use Streamline\Models\Sundry;
use Streamline\Models\Services;
use Streamline\Models\Treatment;
class PointOfSaleController extends Controller {
public function index(Request $request){
$search_text = "";
switch ($request->search_date_by){
case 'yesterday':
$end_date = Carbon::yesterday()->endOfDay();
$start_date = Carbon::yesterday()->startOfDay();
$search_text .= "Yesterday ";
break;
case 'custom_date':
$end_date = Carbon::parse($request->start_date)->endOfDay();
$start_date = Carbon::parse($request->start_date)->startOfDay();
$search_text .= "From: " . streamline_date($start_date) . " ";
break;
case 'custom_date_range':
$end_date = Carbon::parse($request->end_date)->endOfDay();
$start_date = Carbon::parse($request->start_date)->startOfDay();
$search_text .= "From: " . streamline_date($start_date) . " to " . streamline_date($end_date) . " ";
break;
case 'today':
default:
$end_date = Carbon::today()->endOfDay();
$start_date = Carbon::today()->startOfDay();
$search_text .= "Today ";
break;
}
$records = PointOfSaleRecord::join('patients', 'point_of_sale_records.patient_id', '=', 'patients.id')
->whereBetween('point_of_sale_records.created_at', [$start_date, $end_date])
->limit(500)->get(['point_of_sale_records.*', 'patients.first_name', 'patients.last_name', 'patients.number']);
return view('patients::point_of_sale.index', compact('records', 'search_text'));
}
public function order_items(){
$drugs = Drug::get();
$sundries = Sundry::where('available', 1)->get();
$services = Services::where('available', 1)->get();
$eye_glasses = EyeGlasses::get();
$referral_hospitals = ReferralHospital::orderBy('name')->get();
return view('patients::point_of_sale.order_items', compact('drugs', 'eye_glasses', 'sundries', 'referral_hospitals', 'services'));
}
public function confirm_items(Request $request){
$pre_ordered_eye_glasses = [];
$manual_patient_prescriptions = [];
$automatic_patient_prescriptions = [];
$pre_ordered_sundries = [];
$pre_ordered_services = [];
if($request->patient_id) {
$patient_id = $request->patient_id;
$patient = Patient::find($patient_id);
// double check if for existing patient_id
if($patient){
$patient_number = Patient::where('id', $patient_id)->pluck('number')->first();
$episode_id = PatientEpisode::where('patient_id',$patient_id)->whereDate('created_at', Carbon::today()->toDateString())->pluck('id')->first();
if(!$episode_id){
$episode = new PatientEpisode;
$episode->patient_id = $patient_id;
$episode->paid_over = "pos";
$episode->created_by = Auth::user()->id;
$episode->updated_by = Auth::user()->id;
$episode->save();
flash('A new episode for patient with patient number ' . $patient_number . ' has been initiated.');
$episode_id = $episode->id;
}
} else {
flash('Patient not found')->error();
redirect('point_of_sale');
}
} else {
$patient = new Patient;
$patient->first_name = $request->first_name;
$patient->last_name = $request->last_name;
$patient->phone = $request->phone_number ?? "";
$patient->referred_from = $request->referral_hospital ?? 1;
$patient->category_id = 1;
$patient->created_by = Auth::user()->id;
$patient->gender = $request->gender ?? 2;
if (is_null($request->date_of_birth)) {
$age_in_years = $request->age_in_years ?? 18;
$calculated_dob = \Carbon\Carbon::now()->subYears($age_in_years);
$calculated_date_of_birth = $calculated_dob->toDateString();
$patient->date_of_birth = $calculated_date_of_birth;
} else {
$patient->date_of_birth = Carbon::createFromFormat('d/m/Y', $request->date_of_birth)->toDateString();
}
if ($patient->save()):
$prefix = DB::table('hospital_information')->where('id', 1)->value('patient_number_abbr');
$patient_id = $patient->id;
$new_id = quadLimit($patient_id);
$patient_number = $prefix . "-" . $new_id;
DB::table('patients')->where('id', $new_id)->update(['number' => $patient_number]); // Updating the patient number
else:
flash("There was an error")->error();
return back()->withInput();
endif;
$episode = new PatientEpisode;
$episode->patient_id = $patient_id;
$episode->clinic_id = get_default_hospital_clinic();
$episode->paid_over = "pos";
$episode->created_by = Auth::user()->id;
$episode->updated_by = Auth::user()->id;
try {
$episode->save();
$episode_id = $episode->id;
flash('Patient with patient number ' . $patient_number . ' has been successfully registered.')->success();
} catch (QueryException $e) {
flash("This episode already exists!")->error();
return back()->withInput();
}
}
if ($request->selected_eye_glasses) {
$pre_ordered_eye_glasses = EyeGlasses::whereIn('id', $request->selected_eye_glasses)->get();
}
if ($request->selected_drugs) {
if($request->manual_drug_select == 1){
$manual_patient_prescriptions = Drug::whereIn('id', $request->selected_drugs)->get();
}else if($request->automatic_drug_select == 1){
$automatic_patient_prescriptions = Drug::whereIn('id', $request->selected_drugs)->get();
}
}
if ($request->selected_sundries) {
$pre_ordered_sundries = Sundry::whereIn('id', $request->selected_sundries)->get();
}
if ($request->selected_services) {
$pre_ordered_services = Services::whereIn('id', $request->selected_services)->get();
}
$allergies = DB::table('allergies')->where(['patient_id' => $patient_id])->pluck('patient_id', 'names');
return view('patients::point_of_sale.confirm_items', compact('patient_id', 'episode_id', 'pre_ordered_eye_glasses',
'manual_patient_prescriptions', 'automatic_patient_prescriptions', 'allergies', 'patient', 'pre_ordered_sundries', 'pre_ordered_services'));
}
public function confirm_pricing(Request $request){
if($request->treatment_item){
$treatment = new Treatment;
$treatment->patient_id = $request->patient_id;
$treatment->episode_id = $request->episode_id;
$treatment->drugs = implode(',', $request->treatment_item);
$drugs_array = $request->treatment_item;
$duration_array = $request->duration;
$time_array = $request->time;
$time_duration = [];
$doses = $request->dose ?? [];
$frequencies = $request->frequency ?? [];
$dose_array = [];
$frequencies_array = [];
$instructions_array = [];
for ($i = 0; $i < count($drugs_array); $i++) {
if (is_drug_chronic($drugs_array[$i])) {
register_chronic_patient($request->patient_id, $request->episode_id, $drugs_array[$i]);
}
if (isset($duration_array[$i]) && isset($time_array[$i])) {
$time_duration[] = $duration_array[$i] . " " . $time_array[$i];
} else {
$time_duration[] = "1 Days";
}
if (isset($doses[$i])) {
$dose_array[] = $doses[$i];
} else {
$dose_array[] = "1";
}
if (isset($frequencies[$i])) {
$frequencies_array[] = $frequencies[$i];
} else {
$frequencies_array[] = "2";
}
$instructions_array[] = "";
}
$treatment->doses = implode(',', $dose_array);
$treatment->frequencies = implode(',', $frequencies_array);
$treatment->instruction = implode(',', $instructions_array);
$treatment->durations = implode(',', $time_duration);
$treatment->quantities_dispensed = implode(',', $request->treatment_quantity);
$treatment->dispense_status = 0;
$treatment->created_by = Auth::id();
$treatment->save();
$request->treatment_id = DB::table('treatments')->where('episode_id', $request->episode_id)->where('patient_id', $request->patient_id)->latest()->pluck('id')->first();
}
$eye_glass_ids = $request->eye_glass_item;
$eye_glass_quantity = $request->eye_glass_quantity;
if($request->eye_glass_item){
for ($i=0; $i < count($eye_glass_ids) ; $i++) {
$new_ordered_eye_glasses = new OrderedEyeGlasses;
$new_ordered_eye_glasses->patient_id = $request->patient_id;
$new_ordered_eye_glasses->episode_id = $request->episode_id;
$new_ordered_eye_glasses->eye_glasses_id = $eye_glass_ids[$i];
$new_ordered_eye_glasses->quantity = $eye_glass_quantity[$i];
$new_ordered_eye_glasses->payment_status = 0; //0 by default to mean not paid
$new_ordered_eye_glasses->created_by = auth()->user()->id;
$new_ordered_eye_glasses->save();
}
}
if($request->pos_sundry_ids){
$new_ordered_sundries = new OrderedSundry;
$new_ordered_sundries->patient_id = $request->patient_id;
$new_ordered_sundries->episode_id = $request->episode_id;
$new_ordered_sundries->sundries_id = implode(",", $request->pos_sundry_ids);
$new_ordered_sundries->quantity = implode(",", $request->sundry_quantity);
$new_ordered_sundries->created_by = auth()->user()->id;
$new_ordered_sundries->save();
}
if ($request->service_id && $request->service_id[0] != null) {
$new_ordered_service = new OrderedService;
$new_ordered_service->patient_id = $request->patient_id;
$new_ordered_service->episode_id = $request->episode_id;
$new_ordered_service->service_id = implode(",", $request->service_id);
$new_ordered_service->quantity = implode(",", $request->quantity);
$new_ordered_service->performed = 0;
$new_ordered_service->performed_id = 0;
$new_ordered_service->created_by = auth()->user()->id;
$new_ordered_service->save();
}
$request->ordered_sundry_ids = OrderedSundry::where('episode_id', $request->episode_id)->where('patient_id', $request->patient_id)
->whereDate('created_at', Carbon::today()->toDateString())->pluck('id')->toArray();
$treatment_item = $treatment_quantity = $treatment_subtotal = [];
// save for treatment
if($request->treatment_id){
$treatment_item = $request->treatment_item;
$treatment_quantity = $request->treatment_quantity;
$treatment_subtotal = $request->treatment_subtotal;
}
$eye_glasses_prices_array = $eye_glasses_quantity_array = $eye_glasses_ids_array = [];
// save for eye_glasses arrays
if($request->eye_glass_item){
$eye_glasses_prices_array = $request->eye_glass_amount;
$eye_glasses_quantity_array = $request->eye_glass_quantity;
$eye_glasses_ids_array = $request->eye_glass_item;
}
$sundry_item = $sundry_quantity = $sundry_subtotal = [];
// save for sundries array
if($request->pos_sundry_ids){
$sundry_item = $request->pos_sundry_ids;
$sundry_quantity = $request->sundry_quantity;
$sundry_subtotal = $request->sundry_subtotal;
}
// save for service arrays
$service_ids_array = [];
$service_prices_array = [];
$service_quantity_array = [];
if($request->service_id){
$service_prices_array = $request->service_item_subtotal;
$service_ids_array = $request->service_id;
$service_quantity_array = $request->quantity;
}
$pos_record = new PointOfSaleRecord();
$pos_record->patient_id = $request->patient_id;
$pos_record->episode_id = $request->episode_id;
$pos_record->treatments = count($treatment_item) > 0 ? json_encode([
"ids" => $treatment_item, "quantity" => $treatment_quantity,
"subtotal" => $treatment_subtotal
]) : NULL;
$pos_record->eye_glasses = count($eye_glasses_ids_array) > 0 ? json_encode([
"ids" => $eye_glasses_ids_array, "quantity" => $eye_glasses_quantity_array,
"subtotal" => $eye_glasses_prices_array
]) : NULL;
$pos_record->sundries = count($sundry_item) > 0 ? json_encode([
"ids" => $sundry_item, "quantity" => $sundry_quantity,
"subtotal" => $sundry_subtotal
]) : NULL;
$pos_record->services = count($service_ids_array) > 0 ? json_encode([
"ids" => $service_ids_array, "quantity" => $service_quantity_array,
"subtotal" => $service_prices_array
]) : NULL;
$pos_record->created_by = Auth::id();
$pos_record->save();
return redirect('point_of_sale/print/' . $pos_record->id);
}
public function add_referral(Request $request) {
$logged_in_user_id = Auth::user()->id;
$referral_hospital = new ReferralHospital;
$referral_hospital->name = $request->name;
$referral_hospital->created_by = $logged_in_user_id;
$referral_hospital->updated_by = $logged_in_user_id;
if ($referral_hospital->save()) {
//insert successful
return $referral_hospital->id;
} else {
return 0;
}
}
public function get_patient(Request $request){
$patient = Patient::where('id', $request->patient_id)->first();
return $patient;
}
public function print($id) {
$record = PointOfSaleRecord::find($id);
if ($record) {
if (is_cashier_receipt_type_print_html()) {
$hospital_information = HospitalInformation::first();
$patient = Patient::find($record->patient_id);
$receipt_date = $record->created_at;
$receipt_reprint_date = date('Y-m-d h:i:s');
$treatments_array = json_decode($record->treatments, true);
$sundries_array = json_decode($record->sundries, true);
$eye_glasses_array = json_decode($record->eye_glasses, true);
$services_array = json_decode($record->services, true);
$treatment_item = $treatments_array ? $treatments_array["ids"] : [];
$treatment_quantity = $treatments_array ? $treatments_array["quantity"] : [];
$treatment_subtotal = $treatments_array ? $treatments_array["subtotal"] : [];
$eye_glasses_ids_array = $eye_glasses_array ? $eye_glasses_array["ids"] : [];
$eye_glasses_quantity_array = $eye_glasses_array ? $eye_glasses_array["quantity"] : [];
$eye_glasses_prices_array = $eye_glasses_array ? $eye_glasses_array["subtotal"] : [];
$sundry_item = $sundries_array ? $sundries_array["ids"] : [];
$sundry_quantity = $sundries_array ? $sundries_array["quantity"] : [];
$sundry_subtotal = $sundries_array ? $sundries_array["subtotal"] : [];
$service_ids_array = $services_array ? $services_array["ids"] : [];
$service_quantity_array = $services_array ? $services_array["quantity"] : [];
$service_prices_array = $services_array ? $services_array["subtotal"] : [];
return view('patients::point_of_sale.receipt', compact('treatment_item', 'treatment_quantity', 'treatment_subtotal',
'eye_glasses_prices_array', 'eye_glasses_quantity_array', 'eye_glasses_ids_array', 'hospital_information', 'patient', 'receipt_date',
'sundry_item','sundry_quantity','sundry_subtotal', 'service_ids_array', 'service_prices_array', 'service_quantity_array', 'receipt_reprint_date'));
} else {
// set up the redirect link for html
session()->put('print_pos_pdf', 1);
session()->put('print_pos_pdf_id', $id);
return redirect('/point_of_sale');
}
} else {
return redirect('/point_of_sale');
}
}
public function print_pos_pdf() {
$id = session()->get("print_pos_pdf_id");
// add check for when the people try to reload the page
if (!$id) {
return redirect('/point_of_sale');
}
// lest i forget Thy love for me
session()->forget('print_pos_pdf');
session()->forget('print_pos_pdf_id');
$record = PointOfSaleRecord::find($id);
if ($record) {
$hospital_information = HospitalInformation::first();
$patient = Patient::find($record->patient_id);
$receipt_date = $record->created_at;
$receipt_reprint_date = date('Y-m-d h:i:s');
$treatments_array = json_decode($record->treatments, true);
$sundries_array = json_decode($record->sundries, true);
$eye_glasses_array = json_decode($record->eye_glasses, true);
$services_array = json_decode($record->services, true);
$treatment_item = $treatments_array ? $treatments_array["ids"] : [];
$treatment_quantity = $treatments_array ? $treatments_array["quantity"] : [];
$treatment_subtotal = $treatments_array ? $treatments_array["subtotal"] : [];
$eye_glasses_ids_array = $eye_glasses_array ? $eye_glasses_array["ids"] : [];
$eye_glasses_quantity_array = $eye_glasses_array ? $eye_glasses_array["quantity"] : [];
$eye_glasses_prices_array = $eye_glasses_array ? $eye_glasses_array["subtotal"] : [];
$sundry_item = $sundries_array ? $sundries_array["ids"] : [];
$sundry_quantity = $sundries_array ? $sundries_array["quantity"] : [];
$sundry_subtotal = $sundries_array ? $sundries_array["subtotal"] : [];
$service_ids_array = $services_array ? $services_array["ids"] : [];
$service_quantity_array = $services_array ? $services_array["quantity"] : [];
$service_prices_array = $services_array ? $services_array["subtotal"] : [];
$data = [
"patient" => $patient, "receipt_date" => $receipt_date, "receipt_reprint_date" => $receipt_reprint_date, "hospital_information" => $hospital_information,
"treatment_item" => $treatment_item, "treatment_quantity" => $treatment_quantity, "treatment_subtotal" => $treatment_subtotal,
"eye_glasses_ids_array" => $eye_glasses_ids_array, "eye_glasses_quantity_array" => $eye_glasses_quantity_array, "eye_glasses_prices_array" => $eye_glasses_prices_array,
"sundry_item" => $sundry_item, "sundry_quantity" => $sundry_quantity, "sundry_subtotal" => $sundry_subtotal,
"service_ids_array" => $service_ids_array, "service_quantity_array" => $service_quantity_array, "service_prices_array" => $service_prices_array,
];
$pdf = SnappyPDF::loadView('patients::point_of_sale.print_pos_pdf', $data)
->setOrientation('portrait')
->setPaper('a4')
->setOption('margin-bottom', 5)
->setOption('margin-top', 5)
->setOption('footer-html', '<i>&copy; ' . date('Y') . ' Stre@mline</i>');
return $pdf->inline('Patient Receipt' . date(" d-m-y h:ia") . '.pdf');
} else {
return redirect('/point_of_sale');
}
}
}
@@ -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'));
}
}
File diff suppressed because it is too large Load Diff
@@ -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,523 +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 mx-4 px-4">
<strong>{{ __('allergies.category') }} :</strong>
{{ $categories[$patient->category_id] ?? 'N/A' }}
</span>
<div class="row consultation-pat-row">
<div class="col-sm-9 consultation-pat mb-2" style="overflow-x: auto; overflow-y: hidden;">
<div class="row consultation-pat-table h-100 align-items-stretch" style="flex-wrap: nowrap;">
<div class="col p-0">
<div class="card h-100 m-0">
<div class="card-header w-100">{{ __('allergies.patient_number') }}</div>
<div class="card-body">{{ $patient->number }}</div>
</div>
</div>
<div class="col p-0">
<div class="card h-100 m-0">
<div class="card-header w-100">{{ __('allergies.full_names') }}</div>
<div class="card-body">{!! 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
</div>
</div>
</div>
<div class="col p-0">
<div class="card h-100 m-0">
<div class="card-header w-100">{{ __('allergies.gender') }}</div>
<div class="card-body">
{{ $patient->gender == 1 ? __('allergies.male') : __('allergies.female') }}</div>
</div>
</div>
<div class="col p-0">
<div class="card h-100 m-0">
<div class="card-header w-100">{{ __('allergies.age') }}</div>
<div class="card-body">{{ get_patients_age($patient->date_of_birth) }}</div>
</div>
</div>
<div class="col p-0">
<div class="card h-100 m-0">
<div class="card-header w-100">{{ __('allergies.national_id') }}</div>
<div class="card-body">{!! $patient->national_id == null || $patient->national_id == ''
? "<span class='label label-info'>National ID Missing</span>"
: strtoupper($patient->national_id) !!}</div>
</div>
</div>
</div>
</div>
<div class="col-sm-3 mb-2">
<div class="button-box h-100">
<a class="img" href="#modal-photo" data-toggle="modal" style="color: whitesmoke">
<div class="center img-pat-profile"
style="height: 100%; width: 100%; background: url(@if (!is_null($patient->photo) && $patient->photo != '') {{ asset($patient->photo) }} @else {{ asset('/uploads/streamline_images/person-place-holder.jpg') }} @endif) center no-repeat; background-size: auto 100%; min-height: 110px; position: relative;">
<!-- img-rounded -->
<i class="fa fa-refresh"
style="display: none; position: absolute; right: -10px; top: -10px"></i>
</div>
</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 text-center">
<img src="@if (!is_null($patient->photo) && $patient->photo != '') {{ asset($patient->photo) }} @else {{ asset('/uploads/streamline_images/person-place-holder.jpg') }} @endif"
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 mb-1 d-flex justify-content-between align-items-center"
data-toggle="modal" data-target="#modal-allergies"
style="line-height: 10px; font-size: 11px; gap: 10px;">{{ __('allergies.allergies') }} <i
class="fa fa-plus-circle"></i></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">
<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; ?>" />
</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>
</div>
</div>
</div>
</div>
<table class="table-bordered table-condensed table-striped w-100 mb-3 br-5"
id="allergies_drugs_table"
style="border-collapse: collapse; border-spacing: 0; border-spacing: 0;">
<tbody>
<tr style="border-spacing: 0;">
<td style="font-weight: normal; border-spacing: 0;">
<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>
</tr>
</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 mb-1 d-flex justify-content-between align-items-center"
data-toggle="modal" data-target="#modal-alerts"
style="line-height: 10px; font-size: 11px; gap: 10px;">{{ __('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 w-100 mb-3 br-5"
style="border-collapse: collapse; border-spacing: 0;">
<tbody>
<tr style="border-spacing: 0;">
<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>
</tr>
</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 mb-1 d-flex justify-content-between align-items-center gap-2"
style="line-height: 10px; font-size: 11px; gap: 10px;">
Post Discharge Risk of Mortality
</a>
</div>
<table class="table-bordered table-condensed table-striped w-100 br-5">
<tbody class="br-5">
<tr class="br-5">
<td class="br-5">
@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);
}
});
});
$(window).on('load', function() {
let def_view = true;
$('.img-pat-profile').hover(
function() {
$('.img-pat-profile i').css('display', '');
},
function() {
$('.img-pat-profile i').css('display', 'none');
});
$('.img-pat-profile i').on('click tap', function(e) {
e.preventDefault();
if (def_view) {
$('.img-pat-profile').css('background-size', '100% auto');
} else {
$('.img-pat-profile').css('background-size', ' auto 100%');
}
def_view = !def_view;
})
});
</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,60 +0,0 @@
<div class="modal fade" id="diagnosisModal" 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">{{ __('consultations.add_new_diagnosis') }}</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('diagnosis_name', __('diagnoses.diagnosis_name')) }}
{{ Form::text('diagnosis_name', '', ['class' => 'form-control compulsory', 'id'=>'diagnosis_name']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('icd10_code', __('diagnoses.icd_10_code')) }}
{{ Form::text('icd10_code', '', ['class' => 'form-control','id'=>'icd10_code']) }}
</div>
<div class="form-group">
{{ Form::label('hmis_no_outpatient', __('diagnoses.hmis_out_patient_number')) }}
{{ Form::text('hmis_no_outpatient', '', ['class'=>'form-control','id'=>'hmis_no_outpatient']) }}
</div>
<div class="form-group">
{{ Form::label('hmis_no_inpatient', __('diagnoses.hmis_inpatient_category')) }}
{{ Form::text('hmis_no_inpatient', '', ['class'=>'form-control','id'=>'hmis_no_inpatient']) }}
</div>
<div class="form-group">
{{ Form::label('hmis_category', __('diagnoses.hmis_category')) }}
{{ Form::select('hmis_category', $hmis_categories, '', ['class' => 'form-control','id'=>'hmis_category']) }}
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('diagnosis_prompts', __('diagnoses.diagnosis_prompt')) }}
{{ Form::textArea('diagnosis_prompts', '', ['class'=>'form-control','id'=>'diagnosis_prompts', 'rows' => 5]) }}
</div>
<div class="form-group">
{{ Form::label('', __('diagnoses.chronic_status'), ["class"=>'col-md-12']) }}
&nbsp;{{ __('diagnoses.yes') }} {{ Form::radio('chronic_status', 1, false, ['class' => 'check', 'id' => 'chronic_yes']) }}
&nbsp;{{ __('diagnoses.no') }} {{ Form::radio('chronic_status', 0, false, ['class' => 'check', 'id' => 'chronic_no']) }}
<div class="help-block with-errors"></div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('consultations.cancel') }}</button>
<a class="btn btn-success" onclick="submitDiagnosis()">{{ __('consultations.add_diagnosis') }}</a>
</div>
</div>
</div>
</div>
@@ -1,63 +0,0 @@
<div class="modal" id="document_modal" tabindex="-1" role="dialog" aria-labelledby="document_modal_label" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="debt_plan_modal_label"><b>Add Patient Document</b></h5>
</div>
<div class="modal-body">
<div class="row">
{{ Form::open(['route' => 'patient_documents.modal_store','data-toggle'=>'validator','files'=>'true']) }}
{{--<form id="add_document_form" method="post" enctype="multipart/form-data">--}}
<div class="col-sm-12">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('patientnumber','Patient Number') }}
{{ Form::text('patientnumber',$patient->number,['class' => 'form-control compulsory', 'required',
'data-error'=>'','readonly'=>'true', 'id'=>'patientnumber']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('documenttitle','Document Title') }}
{{ Form::text('documenttitle','',['class' => 'form-control compulsory', 'required', 'data-error'=>'', 'id'=>'documenttitle' ]) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('description','Description') }}
{{ Form::textArea('description','',['class' => 'form-control', 'id'=>'description']) }}
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('documentdate','Date of document') }}
<div class="input-group">
{{ Form::text('documentdate','',['class' => 'form-control compulsory', 'required','readonly',
'id'=>'documentdate']) }}
<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','Document') }}
{{ Form::file('document',['class' => 'form-control compulsory', 'required', 'id'=>'document']) }}
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancel Document</button>
<button type="submit" class="btn btn-success" >Save Document</button>
</div>
{{--</form>--}}
{{ Form::close() }}
</div>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
@@ -1,250 +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', 'Referral Notes - 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;
}
.card-header{
padding: 5px;
}
</style>
</head>
@php
$total_deposits_paid = 0;
$total_amount_to_pay = 0;
$discount_amount = 0;
$insurance_hospital_stay = 0;
$insurance_investigations = 0;
$insurance_treatments = 0;
$insurance_sundries = 0;
$insurance_procedures = 0;
$insurance_tta = 0;
$insurance_services = 0;
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
$investigation_amount_total = 0;
@endphp
<body>
<div class="container-fluid">
@include('layouts.header_pdf_print')
<h5 class="heading" style="text-align: center;"> OUT-PATIENT REFERRAL NOTES</h5>
<div class="row">
<table class="table table-light table-sm table-borderless">
<tr>
<th scope="row">{{ __('inpatient.patient_number') }}</th>
<td>{{ $patient->number}}</td>
<td width="60" style="border-top: 0px;">&nbsp;</td>
<th>Clinic</th>
<td>
{{ get_name($consultation->clinic_id, 'id', 'name', 'clinics') }} &nbsp;
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.patient_names') }}</th>
<td>{{ $patient->first_name}} {{ $patient->last_name}}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th>Consultation Date</th>
<td>
{{ streamline_date($consultation->created_at) }}
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.age') }}</th>
<td><?php echo get_patients_age($patient->date_of_birth); ?></td>
<td style="border-top: 0px;">&nbsp;</td>
<th></th>
<td>
</td>
</tr>
<tr>
<th scope="row">{{ __('inpatient.gender') }}</th>
<td>{{ $patient->gender == 1 ? __('inpatient.male') : __('inpatient.female') }}</td>
<td style="border-top: 0px;">&nbsp;</td>
<th scope="row">{{ __('inpatient.category') }}</th>
<td>
{{ get_name($patient->category_id, 'id', 'name', 'patient_categories') }}
@if(!is_null($patient_discount))
({{ $patient_discount["discount"] }} % {{ __('inpatient.discount') }})
@endif
</td>
</tr>
</table>
</div>
<div class="row">
@if( Auth::user()->can('view-patient-episode-primary-diagnoses'))
<div class="col">
<div class="card">
<div class="card-header">
<strong>Primary Diagnosis</strong>
</div>
@php
$primary_diagnosis = \Streamline\Models\Diagnosis::withTrashed()->find($consultation->primary_diagnosis);
@endphp
<table class="table table-light table-sm">
<thead>
<tr>
<td>{{ $primary_diagnosis ? $primary_diagnosis->name : "" }}</td>
</tr>
</thead>
</table>
</div>
@php
$other_diagnoses = @unserialize($consultation->other_diagnoses);
@endphp
@if(!empty($other_diagnoses))
<div class="card">
<div class="card-header">
<strong>Secondary Diagnosis</strong>
</div>
<table class="table table-light table-sm">
<thead>
@foreach($other_diagnoses as $diagnosis)
@php
$other_diagnosis = \Streamline\Models\Diagnosis::withTrashed()->find($diagnosis);
@endphp
<tr>
<td>{{ $other_diagnosis ? $other_diagnosis->name : "" }}</td>
</tr>
@endforeach
</thead>
</table>
</div>
@endif
</div>
@endif
</div>
<br>
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">
<strong>Investigations done</strong>
</div>
<table class="table table-light table-sm">
<thead>
@if(count($ward_investigations) > 0)
@for($i = 0; $i < count($ward_investigations['name']); $i++)
@if(in_array($i, $ward_investigations_position))
<tr>
<td colspan="3">
<h5><code>{{ $ward_investigations_date[array_search($i, $ward_investigations_position)] }}</code></h5>
</td>
</tr>
@endif
<tr>
<td>{{ $ward_investigations['name'][$i] }}</td>
<input type="hidden" name="ward_investigation_ids[]" value="{{ $ward_investigations['id'][$i] }}">
<td>
@if($ward_investigations['type'][$i] == 1 && $ward_investigations['value'][$i] != "Pending")
<i style="color: blue"> Refer to investigation report </i>
@else
{{ $ward_investigations['value'][$i] }}
@endif
</td>
<td>{{ $ward_investigations['comment'][$i] }}</td>
</tr>
@endfor
@else
<tr>
<td colspan="3">No investigations done</td>
</tr>
@endif
</thead>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">
<strong>Referral Notes</strong>
</div>
<table class="table table-light table-sm">
<thead>
<tr>
<td>{{ $consultation->referral_notes }}</td>
</tr>
</thead>
</table>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col">
<div class="card">
<table class="table table-light table-sm">
<thead>
<tr>
<td><b>Referred By: </b></td>
<td>{{ !is_null($consultation->consultation_done_by) ? get_full_name($consultation->consultation_done_by, "id", "first_name", "last_name", "users") : get_full_name($consultation->created_by, "id", "first_name", "last_name", "users")}} to {{ get_name($consultation->referred_to, 'id', 'name', 'referral_hospitals') }}</td>
</tr>
</thead>
</table>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">
Printed By
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item">
<?php echo Auth::user()->first_name . ' ' . Auth::user()->last_name; ?>
&nbsp;&nbsp;&nbsp;....................................................
&nbsp;&nbsp;&nbsp;({{ streamline_date(date("Y-m-d")) }})
</li>
</ul>
</div>
</div>
</div>
</div>
</body>
</html>
@@ -1,88 +0,0 @@
@php
$had_positive_response_to_tb_qn = false;
@endphp
@if($triage)
@if ($triage->any_tb_sysmptoms == 1)
@php
if($triage->cough_for_2_weeks == 1 || $triage->fever_for_2_weeks || $triage->tb_weight_loss || $triage->tb_poor_weight_gain || $triage->tb_excessive_night_sweats || $triage->tb_contact_with_tb_person){
$had_positive_response_to_tb_qn = true;
}
$consultation = \Streamline\Models\Consultation::where(['patient_id' => $patient_id, 'episode_id' => $episode_id])->first();
$tb_assessment_status = false;
if ($consultation) {
$tb_assessment_status = $consultation->tb_status_assessment;
}
@endphp
@endif
@endif
@if ($had_positive_response_to_tb_qn)
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<table class="table table-hover color-table info-table table-bordered">
<thead>
<tr>
<th colspan="3">Please show your assessment of the patients TB Status: </span></th>
</tr>
</thead>
<tbody>
<tr class="cough_tb_question" style="background-color: #f3f3f5;">
<td>Definite TB &nbsp;
<input type="radio" name='tb_status_assessment' id='patient_tb_status_definite_tb' class="patient_tb_status" value="1" {!! $tb_assessment_status == 1 ? "checked='true'" : "" !!} required>
</td>
<td>Possible TB &nbsp;
<input type="radio" name='tb_status_assessment' id='patient_tb_status_possible_tb' class="patient_tb_status" value="2" {!! $tb_assessment_status == 2 ? "checked='true'" : "" !!} required>
</td>
<td>Definitely not TB &nbsp;
<input type="radio" name='tb_status_assessment' id='patient_tb_status_definitely_not_tb' class="patient_tb_status" value="3" {!! $tb_assessment_status == 3 ? "checked='true'" : "" !!} required>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="modal fade" id="TBActionModal" tabindex="-1" role="dialog" aria-labelledby="modalTBActionLabel1" style="margin-top: 10%">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<br>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="exampleModalLabel1"><strong style="color: rgb(68, 165, 221);">TB Assesment</strong></h4>
</div>
<div class="modal-body">
<div class="definite_tb_message" style="display:none; font-weight:bolder; font-size:16px">
Ensure the Patient is registered in TB Treatment Unit
</div>
<div class="possible_tb_message" style="display:none; font-weight:bolder; font-size:16px">
Organise further investigations and follow up to check for TB
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">OK</button>
</div>
</div>
</div>
</div>
@push('scripts')
<script>
$('.patient_tb_status').change(function(){
if($("#patient_tb_status_definite_tb").is(':checked') && $("#patient_tb_status_possible_tb").is(":not(:checked)")){
$("#TBActionModal").modal("show");
$(".definite_tb_message").show();
$(".possible_tb_message").hide();
}
if($("#patient_tb_status_possible_tb").is(":checked") && $("#patient_tb_status_definite_tb").is(":not(:checked)")){
$("#TBActionModal").modal("show");
$(".possible_tb_message").show();
$(".definite_tb_message").hide();
}
})
</script>
@endpush
@endif
@@ -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,102 +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>
<td>{{ get_full_name($document->created_by, 'id', 'first_name', 'last_name', 'users') }}</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,965 +0,0 @@
@extends('layouts.main')
@push('styles')
<style type="text/css">
button.h-100.br-5 {
min-height: 4rem;
}
#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 br-5">
@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.patient_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 = '';
$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 = '';
$right_eye_diagnoses = $left_eye_diagnoses = [];
$eye_consultation_comment = "";
$eye_triage_comment = '';
$eye_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');
try {
$other_diagnoses_ids = !empty($anc->other_diagnoses)? explode(',',$anc->other_diagnoses): unserialize(trim(get_name($consultation_id, 'id', 'other_diagnoses', 'consultations')));
} catch (\ErrorException $exception) {}
// confirm it's an array
$other_diagnoses_ids = is_array($other_diagnoses_ids) ? $other_diagnoses_ids : [];
$consultation_comment = !empty($anc->comments)? trim($anc->comments): trim(get_name($consultation_id, 'id', 'comments', 'consultations'));
$consultation_comment = clean_streamline_database_output(trim(get_name($consultation_id, 'id', 'comments', 'consultations')));
$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;
$right_eye_diagnoses = explode(',',get_name($consultation_id, 'id', 'right_eye_diagnosis', 'eye_clinic_main_exam'));
$left_eye_diagnoses = explode(',',get_name($consultation_id, 'id', 'left_eye_diagnosis', 'eye_clinic_main_exam'));
$eye_consultation_comment = trim(get_name($consultation_id, 'id', 'advice', 'eye_clinic_main_exam'));
$eye_triage_comment = !is_null($triage_id) ? trim(get_name($triage_id, 'id', 'comment', 'eye_clinic_base_exam_refraction')) : '';
$eye_triage_and_consultation_comments = '<b>Base Refraction Exam: </b>'.$eye_triage_comment.' '.'<br><b>Main Exam: </b>'.$eye_consultation_comment;
@endphp
@endif
@php
$primary_diagnosis = $diagnoses[$primary_diagnosis_id] ?? '';
$other_diagnoses = "";
for($s = 0; $s < count($other_diagnoses_ids); $s++){
$other_diagnoses .= isset($diagnoses[$other_diagnoses_ids[$s]]) ? ($diagnoses[$other_diagnoses_ids[$s]] . ", ") : '';
}
$is_patient_in_eye_clinic = is_patient_in_eye_clinic($episode_id);
@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'))
@if(is_eye_module_enabled() && $is_patient_in_eye_clinic)
@if(count($right_eye_diagnoses) > 0)
@for($x = 0; $x < count($right_eye_diagnoses); $x++)
{{ get_name(get_name($right_eye_diagnoses[$x], 'id', 'diagnosis_category', 'diagnoses'), 'id', 'name', 'diagnosis_categories') }} - {{ $diagnoses[$right_eye_diagnoses[$x]] ?? '' }}<br/>
@endfor
@endif
@else
{{ __('patient_episode.primary_diagnosis') . ': ' . $primary_diagnosis }}
@endif
@endif
<hr>
@if( Auth::user()->can('view-patient-episode-other-diagnoses'))
@if(is_eye_module_enabled() && $is_patient_in_eye_clinic)
@if(count($left_eye_diagnoses) > 0)
@for($x = 0; $x < count($left_eye_diagnoses); $x++)
{{ get_name(get_name($left_eye_diagnoses[$x], 'id', 'diagnosis_category', 'diagnoses'), 'id', 'name', 'diagnosis_categories') }} - {{ $diagnoses[$left_eye_diagnoses[$x]] ?? '' }}<br/>
@endfor
@endif
@else
{!! __('patient_episode.other_diagnosis') . ': <br>' !!}
{!! 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
@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'), manage_eye_menus('{{ $is_patient_in_eye_clinic }}')" 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
@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'] }}
<br><br>
{{ __('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) }}
<br><br>
<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 id="menu1" style="display: none;">
<div class="row">
<div class="col-sm-2">
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12 eye_button" value="base_refraction_exam">Base Refraction Exam</button>
@if(Auth::user()->can('perform-triage') && !is_add_attendance_to_consultation_enabled())
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12 normal_button" value="triage">{{ __('patient_episode.triage') }}</button>
@endif
</div>
<div class="col-sm-2">
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12 eye_button" value="main_exam">Main Exam</button>
@if(Auth::user()->can('create-consultation'))
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12 normal_button" 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('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('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 btn-sm 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 btn-sm 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('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 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> <br>
<div class="row">
@if(Auth::user()->can('order-for-eye-glasses') && is_eye_module_enabled())
<div class="col-sm-2">
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12" value="eye_glasses">Order Eye Glasses</button>
</div>
@endif
</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
<div class="col-sm-2">
<button type="submit" name="submit" class="btn btn-primary btn-block btn-sm" value="treatment_sheet">{{ __('patient_episode.treatment_sheet') }}</button>
</div>
<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 manage_eye_menus(is_patient_in_eye_clinic) {
if(is_patient_in_eye_clinic == 1) {
$('.eye_button').show();
$('.normal_button').hide();
} else {
$('.eye_button').hide();
$('.normal_button').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';
}
$(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");
});
</script>
@endpush
@push('styles')
<style type="text/css">
.btn-default.btn-sm.btn-link{
width: 100%;
}
</style>
@endpush
@@ -1,904 +0,0 @@
@push('styles')
<style>
.episode-menu li {
display: inline-block;
}
.episode-menu a {
white-space: normal !important;
}
.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" />
@endpush
<div class="row d-flex align-items-stretch">
<div class="col-sm-9 mb-4">
<div class="white-box h-100 br-5 mb-0">
<ul class="episode-menu m-0 p-0">
<div class="row m-0 w-100">
<div class="col-sm-2">
<li class="w-100">
<button type="button" class="btn btn-success btn-sm w-100 h-100 br-5" data-toggle="modal"
data-target="#demographicsModal">{{ __('layout.demographics') }}</button>
</li>
</div>
<div class="col-sm-3">
<div class="form-group">
<select class="form-control w-100" 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 w-100 h-100 br-5"
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 w-100 h-100 br-5"
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 w-100 h-100 br-5"
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 w-100 h-100 br-5"
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 w-100 h-100 br-5"
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 w-100 h-100 br-5"
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 w-100 h-100 br-5"
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 w-100 h-100 br-5"
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 w-100 h-100 br-5"
name="createNewEpisode">{{ __('layout.yes') }}</button>
<button type="button"
class="btn btn-default w-100 h-100 br-5"
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 mb-4">
<div class="white-box h-100 br-5 mb-0">
<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>
@php
$registration_fields = !empty($patient->registration_fields)? json_decode($patient->registration_fields, true):[];
@endphp
@foreach ($registration_fields as $key => $registration_field)
@php $keys = explode("_",$key) @endphp
@if (!empty($keys[2]))
<tr>
<th class="highlight">{{ get_name($keys[2], 'id', 'name', 'patient_registration_fields') }}</th>
<td>{{ $registration_field }}</td>
</tr>
@endif
@endforeach
<tr>
<th class="highlight">Referred From</th>
<td>{{ $patient->referred_from }}</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,825 +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'=>'Yesterday','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 = \Illuminate\Support\Facades\DB::table('patients')->where('id', $episode->patient_id)->first();
$investigation_results = \Illuminate\Support\Facades\DB::table('investigation_results')->where('episode_id', $episode->id)->first();
$investigation_orders = \Illuminate\Support\Facades\DB::table('ordered_investigations')->where('episode_id', $episode->id)->first();
$treatment_details = \Illuminate\Support\Facades\DB::table('treatments')->where('episode_id', $episode->id)->orderBy('created_at', 'desc')->first();
$main_exam = \Illuminate\Support\Facades\DB::table('eye_clinic_main_exam')->where('episode_id', $episode->id)->first();
$is_patient_in_eye_clinic = is_patient_in_eye_clinic($episode->id);
@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($is_patient_in_eye_clinic)
@php $base_refraction = \Illuminate\Support\Facades\DB::table('eye_clinic_base_exam_refraction')->where('episode_id', $episode->id)->first() @endphp
@if($base_refraction)
Base Exam Completed By {{ get_full_name($base_refraction->created_by, 'id', 'first_name', 'last_name', 'users') }}
@else
<span style="background-color: #FFFF00; color: black" class="label">Pending Base Exam</span>
@endif
<hr>
@if (is_null($episode->consultation_id))
<span style="background-color: red" class="label">Pending Main Exam</span>
@elseif (!is_null($episode->consultation_id) && get_name($episode->consultation_id, 'id', 'completed', 'eye_clinic_main_exam') == 0)
<span style="background-color: #FFFF00; color: black" class="label">Ongoing Main Exam</span>
@else
Main Exam Outcome: {{ $main_exam ? get_name($main_exam->outcome_id, 'id', 'name', 'outcomes') : "N/A" }}
@endif
@else
@if (!$episode->episode_triage_id)
N/A
@else
{!! severe_grade($episode->severe_grade) !!}
@endif
@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>
@if($is_patient_in_eye_clinic)
@php
$right_eye_diagnoses = explode(',',get_name($episode->consultation_id, 'id', 'right_eye_diagnosis', 'eye_clinic_main_exam'));
$left_eye_diagnoses = explode(',',get_name($episode->consultation_id, 'id', 'left_eye_diagnosis', 'eye_clinic_main_exam'));
@endphp
@if(count($right_eye_diagnoses) > 0)
<h5>Right Eye Diagnosis</h5>
<ul>
@for($x = 0; $x < count($right_eye_diagnoses); $x++)
<li>{{ get_name(get_name($right_eye_diagnoses[$x], 'id', 'diagnosis_category', 'diagnoses'), 'id', 'name', 'diagnosis_categories') }} - {{ $diagnoses[$right_eye_diagnoses[$x]] ?? '' }}</li>
@endfor
</ul>
@endif
@if(count($left_eye_diagnoses) > 0)
<h5>Left Eye Diagnosis</h5>
<ul>
@for($x = 0; $x < count($left_eye_diagnoses); $x++)
<li>{{ get_name(get_name($left_eye_diagnoses[$x], 'id', 'diagnosis_category', 'diagnoses'), 'id', 'name', 'diagnosis_categories') }} - {{ $diagnoses[$left_eye_diagnoses[$x]] ?? '' }}</li>
@endfor
</ul>
@endif
@else
@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
@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>
@php $outcome = "N/A"; @endphp
@if($episode->consultation_id || $episode->antenatal_outcome_id)
@if($main_exam)
{{ get_full_name($main_exam->created_by, 'id', 'first_name', 'last_name', 'users') }}
@elseif(!is_null($episode->consultation_done_by) && empty($episode->antenatal_outcome_id))
{{ 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
@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 && empty($episode->antenatal_primary_diagnosis))
@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)
@if($main_exam)
{{ get_name($main_exam->outcome_id, 'id', 'name', 'outcomes') }}
@else
<span style="background-color: #FFFF00; color: black" class="label">{{ __('patient_flow_monitoring.ongoing_consultation') }}</span>
@endif
@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 && empty($episode->antenatal_primary_diagnosis))
<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 }}), manage_eye_menus('{{ $is_patient_in_eye_clinic }}')" 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">
<button type="submit" name="base_refraction_exam" class="btn btn-success btn-sm col-sm-12 eye_button" value="base_refraction_exam" id="base_refraction_exam">Base Refraction Exam</button>
@if(Auth::user()->can('perform-triage') && !is_add_attendance_to_consultation_enabled())
<button type="submit" name="triage" class="btn btn-success btn-sm col-sm-12 normal_button" value="triage" id="triage">{{ __('patient_flow_monitoring.triage') }}</button>
@endif
</div>
&nbsp;
<div class="col-sm-2">
<button type="submit" name="main_exam" class="btn btn-success btn-sm col-sm-12 eye_button" value="main_exam" id="main_exam">Main Exam</button>
@if(Auth::user()->can('create-consultation'))
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12 normal_button" 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">
<button type="submit" name="base_refraction_exam" class="btn btn-success btn-sm col-sm-12 eye_button" value="base_refraction_exam" id="base_refraction_exam">Base Refraction Exam</button>
@if(Auth::user()->can('perform-triage') && !is_add_attendance_to_consultation_enabled())
<button type="submit" name="triage" class="btn btn-success btn-sm col-sm-12 normal_button" value="triage" id="triage">{{ __('patient_flow_monitoring.triage') }}</button>
@endif
</div>
&nbsp;
<div class="col-sm-2">
<button type="submit" name="main_exam" class="btn btn-success btn-sm col-sm-12 eye_button" value="main_exam" id="main_exam">Main Exam</button>
@if(Auth::user()->can('create-consultation'))
<button type="submit" name="submit" class="btn btn-success btn-sm col-sm-12 normal_button" 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,#main_exam,#base_refraction_exam').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') ?>");
}
}
});
}
});
function manage_eye_menus(is_patient_in_eye_clinic) {
if(is_patient_in_eye_clinic == 1) {
$('.eye_button').show();
$('.normal_button').hide();
} else {
$('.eye_button').hide();
$('.normal_button').show();
}
}
</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,793 +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 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>
@if (!empty($patient_registration_fields))
@foreach ($patient_registration_fields as $patient_registration_field)
<input type="hidden" name="registration_field_names[]" id="reg_field_{{$patient_registration_field->id}}" value="reg_field_{{$patient_registration_field->id}}"/>
@if (!empty($patient_registration_field->options))
<div class="form-group">
{{ Form::label($patient_registration_field->name, $patient_registration_field->name) }}
<select name="registration_field_values[]" id="{{$patient_registration_field->name}}" class="col-sm-12 {{ ($patient_registration_field->compulsory == 1)? 'compulsory':'' }} form-control" {{ ($patient_registration_field->compulsory == 1)? 'required':'' }}>
<option value="">--select--</option>
@php
$options = explode(',',$patient_registration_field->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
</div>
@else
<div class="form-group">
{{ Form::label($patient_registration_field->name, $patient_registration_field->name) }}
<input type="text" name="registration_field_values[]" class="col-sm-12 {{ ($patient_registration_field->compulsory == 1)? 'compulsory':'' }} form-control" {{ ($patient_registration_field->compulsory == 1)? 'required':'' }}>
</div>
@endif
@endforeach
@endif
@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();
$('#residence').prop('required', false);
} else {
$("#not_ugandan_regions").hide();
$("#ugandan_regions").show();
$("#country_id").val('');
$('#residence').prop('required', true);
}
});
$('#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', '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,768 +0,0 @@
@php use Streamline\Enums\Roles; @endphp
@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(Roles::SUPER_ADMIN->value))
<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 class="form-group">
{{ Form::label('residence','Residence') }}
<select class="form-control" name="residence" id="residence" required>
@php
$residence_array = explode(",", $patient->address_details);
$district_id = $residence_array[4] ?? 0;
$county_id = $residence_array[3] ?? 0;
$subcounty_id = $residence_array[2] ?? 0;
$parish_id = $residence_array[1] ?? 0;
$village_id = $residence_array[0] ?? 0;
@endphp
<option value="{{ $patient->address_details ?? '0,0,0,0,0' }}" selected>{{ __('patients.village') }}
: {{ get_name($village_id, "id", "name", "villages") }} {{ __('patients.district') }}
: {{ get_name($district_id, "id", "name", "districts") }}</option>
</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>
@if (!empty($patient_registration_fields))
@php $registration_fields = !empty($patient->registration_fields)? json_decode($patient->registration_fields, true):[]; @endphp
@foreach ($patient_registration_fields as $patient_registration_field)
@php
$field_value = 'reg_field_'.$patient_registration_field->id;
@endphp
<input type="hidden" name="registration_field_names[]"
id="reg_field_{{$patient_registration_field->id}}"
value="reg_field_{{$patient_registration_field->id}}"/>
@if (!empty($patient_registration_field->options))
<div class="form-group">
{{ Form::label($patient_registration_field->name, $patient_registration_field->name) }}
<select name="registration_field_values[]"
id="{{$patient_registration_field->name}}"
class="col-sm-12 {{ ($patient_registration_field->compulsory == 1)? 'compulsory':'' }} form-control" {{ ($patient_registration_field->compulsory == 1)? 'required':'' }}>
<option value="">--select--</option>
@php
$options = explode(',',$patient_registration_field->options);
for ($i=0; $i < count($options) ; $i++) {
if(!empty($registration_fields[$field_value]) && $options[$i] == $registration_fields[$field_value]) echo '<option selected value="'.$options[$i].'">'.$options[$i].'</option>';
else echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
</div>
@else
<div class="form-group">
{{ Form::label($patient_registration_field->name, $patient_registration_field->name) }}
<input type="text" name="registration_field_values[]"
class="col-sm-12 {{ ($patient_registration_field->compulsory == 1)? 'compulsory':'' }} form-control"
{{ ($patient_registration_field->compulsory == 1)? 'required':'' }} value="{{ !empty($registration_fields[$field_value])? $registration_fields[$field_value]:'' }}">
</div>
@endif
@endforeach
@endif
@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();
$('#residence').prop('required', false);
} else {
$("#not_ugandan_regions").hide();
$("#ugandan_regions").show();
$('#residence').prop('required', true);
}
});
$('#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,293 +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" @if(!is_eye_module_enabled()) style='display: none' @endif>
<div class="form-group" id="previous_numbers">
{{ Form::text('previous_id', '', ['class' => 'form-control typeahead', 'placeholder' => 'Previous Number', '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-2">
<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); ?>)
}
);
$('#previous_numbers .typeahead').typeahead(
{
hint: true,
highlight: true,
minLength: 1
},
{
name: 'previous_numbers',
source: substringMatcher(<?php echo json_encode($previous_ids); ?>)
}
);
$('#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,215 +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>{{ get_name($patient->occupation_id, 'id', 'name', 'occupations') }}</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>{{ get_name($patient->religion_id, 'id', 'name', 'religions') }}</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>{{ get_name($patient->next_of_kin_relationship, 'id', 'name', 'family_relations') }}</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>{{ get_name($patient->district_id, 'id', 'name', 'districts') }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.county') }}</font></th>
<td>{{ get_name($patient->county_id, 'id', 'name', 'counties') }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.sub_county') }}</font></th>
<td>{{ get_name($patient->subcounty_id, 'id', 'name', 'subcounties') }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.parish') }}</font></th>
<td>{{ get_name($patient->parish_id, 'id', 'name', 'parishes') }}</td>
</tr>
<tr>
<th><font color="black">{{ __('patients.village') }}</font></th>
<td>{{ get_name($patient->village_id, 'id', 'name', 'villages') }}</td>
</tr>
<tr>
<th><font color="black">Referred From</font></th>
<td>{{ $patient->referred_from }}</td>
</tr>
@php $registration_fields = !empty($patient->registration_fields)? json_decode($patient->registration_fields, true):[]; @endphp
@foreach ($registration_fields as $key => $registration_field)
@php $keys = explode("_",$key) @endphp
@if (!empty($keys[2]))
<tr>
<th><font color="black">{{ get_name($keys[2], 'id', 'name', 'patient_registration_fields') }}</font></th>
<td>{{ $registration_field }}</td>
</tr>
@endif
@endforeach
</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 = \Modules\Pharmacy\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 = \Modules\Pharmacy\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,220 +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>{{ __('patient_finance.tel') }}:</b> {{ $hospital_information->phone_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.email') }}:</b> {{ $hospital_information->email }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.cashier') }}:</b> {{ get_full_name($cashier, 'id', 'first_name', 'last_name', 'users') }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.original_print_date') }}:</b> {{ streamline_date_time_short($receipt_date) }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.reprint_date') }}:</b> {{ streamline_date_time_short(date('Y-m-d H:i:s')) }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.receipt_number') }}:</b> {{ $receipt_number }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_name') }}</b> : {{ $patient->first_name }} {{ $patient->last_name }}</span><br>
<span class="receipt-label"><b>{{ __('patient_finance.patient_number') }}</b> : {{ $patient->number }} </span><br>
<span class="receipt-label"><b>{{ __('patient_finance.category') }} :</b> {{ get_name($patient->category_id, "id", "name", "patient_categories") }}</span>
</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
@if(isset($optic_item) && count($optic_item) > 0)
<tr>
<td colspan="3" class="text-center"><b>Optical Items</b></td>
</tr>
@for($i = 0; $i < count($optic_item); $i++)
<tr>
<td>{{ get_name($optic_item[$i], "id", "name", "eye_glasses") }}</td>
<td>{{ $optic_quantity[$i] }}</td>
<td>{{ ugandan_shillings($optic_subtotal[$i]) }}</td>
@php $total_amount_pay += $optic_subtotal[$i]; @endphp
</tr>
@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
File diff suppressed because it is too large Load Diff
@@ -1,607 +0,0 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<style>
.triage-grade li {
display: inline-block;
}
.same_width {
width: 100%;
table-layout: fixed;
}
.wrapper {
border: 1px solid #00c292;
border-radius: 6px;
padding: 20px;
margin-bottom: 20px;
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-6 col-md-7 col-sm-7 col-xs-12">
<h4 class="page-title">{{ __('triage.edit_triage') }}</h4>
</div>
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('triage.dashboard') }}</a></li>
<li><a href="{{ route('patient_episodes.index') }}">{{ __('triage.patient_home') }}</a></li>
<li class="active">{{ __('triage.triage') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('patients::allergies.header')
<br>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
<div class="white-box br-5" style="padding-top: 5px;">
<h5 class="page-title"><strong>{{ __('triage.triage') }} ({{ $age_group_display }})
{{ __('triage.for_episode') }} : <font color="blue">
{{ streamline_date(get_name($episode_id, 'id', 'created_at', 'patient_episodes')) }}</font>
</strong></h5>
<hr>
{{ Form::model($triage, ['method' => 'PUT', 'route' => ['triage.update', $triage], 'data-toggle' => 'validator']) }}
{{ Form::hidden('episode_id', $episode_id) }}
{{ Form::hidden('patient_id', $patient_id) }}
@php
$alert1 = '<div class="alert alert-warning "> <button type="button" class="close" data-dismiss="alert">×</button>' . __('triage.sick_children_warning') . '</div>';
$alert2 = '<div class="alert alert-warning "> <button type="button" class="close" data-dismiss="alert">×</button>' . __('triage.poison_warning') . '</div>';
$symptoms_array = [];
@endphp
@php
$option_symptoms = '';
$option_symptoms_periods = '';
$symptom_counter = 1;
@endphp
@if (!are_symptoms_on_consultation())
<div class="table-responsive">
<table class="table table-hover color-table success-table table-bordered" id="symptom_table">
<thead>
<tr>
<th class="text-center">{{ __('triage.symptoms') }} <a data-toggle="modal"
data-target="#symptomsmodal"
class="label labelRight label-info pull-right">{{ __('triage.add_new') }}</a>
</th>
<th class="text-center">{{ __('triage.duration') }}</th>
<th class="text-center">{{ __('triage.prompt') }}</th>
<th class="text-center">{{ __('triage.reference_text') }}</th>
<th></th>
</tr>
</thead>
<tbody class='symptoms_input_fields_wrap'>
@php
$symptoms_array = explode(',', $triage->symptoms);
$symptoms_duration_array = explode(',', $triage->symptom_duration);
foreach ($symptoms as $key => $value) {
$option_symptoms .= "<option value='$key'>" . str_replace('"', '', $value) . '</option>';
}
foreach ($symptoms_periods as $key => $value){
$option_symptoms_periods .= "<option value='$key'>$value</option>";
}
@endphp
@if(empty($symptoms_array) || count($symptoms_array) != count($symptoms_duration_array))
<tr>
<td style='width: 20%;'>
<select name='symptoms[]' id='symptoms_0' class='form-control col-sm-12 compulsory' onchange='showPrompt(this.value, 0)' required>@php echo $option_symptoms; @endphp</select>
</td>
<td style='width: 21%'>
<div class='row'>
<div class='col-sm-3'>
<input type='text' style='display: block;' name='duration[]' id='symptoms_duration_0' class='col-sm-12 form-control' required>
</div>
<div class='col-sm-9'>
<select style='display: inline-block;' name='time[]' id='symptoms_time_0' class='col-sm-12 form-control' required>@php echo $option_symptoms_periods; @endphp</select>
</div>
</div>
</td>
<td id='symptoms_prompt_0' style='width: 30%'></td>
<td id='symptoms_reference_0'></td>
<td style='width: 1%;'></td>
</tr>
@else
@for($i = 0; $i < count($symptoms_array); $i++)
@php
$duration_array = explode(" ", $symptoms_duration_array[$i]);
@endphp
<tr>
<td style='width: 20%;'>
<select name='symptoms[]' id='symptoms_0'
class='form-control col-sm-12 compulsory'
onchange='showPrompt(this.value, 0)' required>@php echo $option_symptoms; @endphp</select>
</td>
<td style='width: 21%'>
<div class='row'>
<div class='col-sm-3'>
<input type='text' style='display: block;' name='duration[]'
id='symptoms_duration_0' class='col-sm-12 form-control h-100'>
</div>
<div class='col-sm-9'>
<select style='display: inline-block;' name='time[]'
id='symptoms_time_0'
class='col-sm-12 form-control select2-hidden-accessible'>@php echo $option_symptoms_periods; @endphp</select>
</div>
</div>
</td>
<td id='symptoms_prompt_0' style='width: 30%'></td>
<td id='symptoms_reference_0'></td>
<td style='width: 1%;'></td>
</tr>
@else
@for ($i = 0; $i < count($symptoms_array); $i++)
@php
$duration_array = explode(' ', $symptoms_duration_array[$i]);
@endphp
<tr>
<td style="width: 20%;">
{{ Form::select('symptoms[]', $symptoms, $symptoms_array[$i], ['id' => 'symptoms_' . $i, 'class' => 'form-control col-sm-12 compulsory initial_symptoms_select', 'onchange' => 'showPrompt(this.value, ' . $i . ')']) }}
</td>
<td style="width: 21%">
<div class="row m-0 d-flex justify-content-between align-items-stretch">
<div class="col-sm-3 p-0">
<input type="text" style="display: block;" name="duration[]"
id="duration[]" class="col-sm-12 form-control h-100"
value="{{ $duration_array[0] }}">
</div>
<div class="col-sm-9 p-0">
<select style="display: inline-block;" name="time[]" id="time[]"
class="w-100 form-control select-2 h-100">
<option value="{{ $duration_array[1] }}" selected>
{{ $duration_array[1] }}</option>
<option value="<?php echo __('triage.hours'); ?>">{{ __('triage.hours') }}
</option>
<option value="<?php echo __('triage.days'); ?>">{{ __('triage.days') }}
</option>
<option value="<?php echo __('triage.weeks'); ?>">{{ __('triage.weeks') }}
</option>
<option value="<?php echo __('triage.months'); ?>">{{ __('triage.months') }}
</option>
<option value="<?php echo __('triage.years'); ?>">{{ __('triage.years') }}
</option>
</select>
</div>
</div>
</td>
<td id="symptoms_prompt_{{ $i }}" style="width: 30%"></td>
<td id="symptoms_reference_{{ $i }}"></td>
<td style="width: 1%;"></td>
</tr>
@endfor
@endif
</tbody>
</table>
<a class="btn btn-success btn-xs" onclick="add_symptom_row()"
id="add_row">{{ __('triage.add_row') }}</a>
<hr>
</div>
@endif
@if (is_tuberculosis_screening_enabled())
@include('patients::triage.edit.edit_tb_screening')
@endif
@if (is_hiv_screening_tool_enabled())
@include('patients::triage.edit.edit_hiv_screening')
@endif
@if (is_gbv_screening_tool_enabled())
@include('patients::triage.edit.edit_gbv_screening')
@endif
<div class="row">
<div class="col-md-8">
<div class="table-responsive">
<table class="table table-hover table-striped color-table success-table table-bordered"
id="observations_table">
<thead>
<tr>
<th>{{ __('triage.observation') }}</th>
<th>{{ __('triage.value') }}</th>
<th>{{ __('triage.normal_range') }}</th>
@if ($age_group == 5)
<th>KEWS</th>
<th>NEWS</th>
@else
<th>KEWS</th>
@endif
</tr>
</thead>
<tbody>
@include('patients::triage.edit.observations_changed')
</tbody>
</table>
</div>
@if (between($years, 16, 50))
@include('patients::triage.edit.family_planning_questions')
@endif
@if (between($years, 0, 12))
@include('patients::triage.edit.emergency_signs')
@endif
</div>
<div class="col-md-4">
@if ($age_group == 1 || $age_group == 2)
<?php echo $alert2; ?>
<?php echo $alert1; ?>
@else
<?php echo $alert2; ?>
@endif
<br>
@if (!is_add_attendance_to_consultation_enabled())
<div class="table-responsive">
<table class="table table-hover color-table success-table table-bordered">
<thead>
<tr>
<th colspan="2" class="text-center">
{{ __('triage.patient_attendance') }}
</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2">
<font color="#C85F6A" class="text-center">{{ __('triage.re_attendance_or_new') }}</font>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="new_attendance" id="new_attendance" @if(!empty($triage->new_attendance)) checked @endif/> {{ __('triage.new_attendance') }}
</td>
<td>
<input type="checkbox" name="re_attendance" id="re_attendance" @if(!empty($triage->re_attendance)) checked @endif/> {{ __('triage.re_attendance') }}
</td>
</tr>
</tbody>
</table>
</div>
@endif
@if (between($years, 0, 12))
@include('patients::triage.edit.priority_signs')
@endif
<div style="background: #F5F5F5; padding: 10px;">
<h4 class="text-center">{{ __('triage.triage_grade') }}</h4>
<hr>
<div class="row text-center">
<div class="col-md-4 br">
{{ Form::radio('triage_grade', 1, $triage->severe_grade == 1, ['required', 'id' => 'triage_grade_green']) }}
<b style="color: #006400; font-weight: 900; font-size: 18;">{{ __('triage.green') }}
</b>
</div>
<div class="col-md-4">
{{ Form::radio('triage_grade', 2, $triage->severe_grade == 2, ['required', 'id' => 'triage_grade_yellow']) }}
<b style="color: #FFC40C; font-weight: 900; font-size: 18; ">{{ __('triage.yellow') }}
</b>
</div>
<div class="col-md-4">
{{ Form::radio('triage_grade', 3, $triage->severe_grade == 3, ['required', 'id' => 'triage_grade_red']) }}
<b style="color: #FF4500; font-weight: 900; font-size: 18;">{{ __('triage.red') }}</b>
</div>
</div>
</div>
<h4 style="background: #F5F5F5; padding: 10px;">{{ __('triage.referral_clinic_allocation') }}</h4>
<div class="form-group">
{{ Form::label('referral_hospital', __('triage.referred_by')) }}
{{ Form::select('referral_hospital', $referral_hospitals, $triage->referral, ['class' => 'form-control compulsory', 'required', 'id' => 'referral_hospital']) }}
<a class="pull-right" style="font-size: x-small" data-toggle="modal"
data-target="#referralsmodal">{{ __('triage.add_new') }}</a>
</div>
<div class="form-group">
{{ Form::label('clinic_allocation', __('triage.clinic_allocation')) }}
@if (is_numeric(get_name($episode_id, 'id', 'clinic_id', 'patient_episodes')))
{{ Form::select('clinic_allocation', $clinics, get_name($episode_id, 'id', 'clinic_id', 'patient_episodes'), ['class' => 'form-control col-sm-12 compulsory', 'required']) }}
@else
{{ Form::select('clinic_allocation', $clinics, '', ['class' => 'form-control col-sm-12 compulsory', 'required']) }}
@endif
</div>
<h4 style="background: #F5F5F5; padding: 10px;">{{ __('triage.comment') }}</h4>
<textarea name='comment' id="comment" class="col-sm-12" placeholder="<?php echo __('triage.type_comments_here'); ?>">{{ $triage->comments }}</textarea>
<br><br>
{{ Form::button(__('triage.submit_triage'), ['type' => 'submit', 'class' => 'btn btn-success col-sm-12', 'id' => 'submit_triage']) }}
<br><br>
{{ __('triage.triage_done_by') }} : <span
style="color: green; font-weight: bold;">{{ ucwords(Auth::user()->first_name) . ' ' . ucwords(Auth::user()->last_name) }}</span>
</div>
</div>
{{ Form::close() }}
</div>
</div>
</div>
<div class="modal fade" id="symptomsmodal" 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">{{ __('triage.add_new_symptom') }}</h4>
</div>
<div class="modal-body">
{{ Form::text('symptom_name', '', ['class' => 'form-control', 'id' => 'symptom_name', 'placeholder' => __('triage.symptom_name')]) }}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">{{ __('triage.cancel') }}</button>
<a class="btn btn-success" onclick="submitSymptom()">{{ __('triage.add_symptom') }}</a>
</div>
</div>
</div>
</div>
<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">{{ __('triage.add_new_referral') }}</h4>
</div>
<div class="modal-body">
{{ Form::text('referral_name', '', ['class' => 'form-control', 'id' => 'referral_name', 'placeholder' => __('triage.referral_name')]) }}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">{{ __('triage.cancel') }}</button>
<a class="btn btn-primary" onclick="submitReferral()">{{ __('triage.add_referral') }}</a>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script type="text/javascript">
let max_rows = 20;
let wrapper = $(".symptoms_input_fields_wrap");
let x = {{ !empty($symptoms_array)? count($symptoms_array):1 }};
let smart_triage_variables = {};
// check if smart triage is enabled
let smart_triage_enabled = <?php echo is_smart_triage_enabled() ? 1 : 0; ?>;
let apply_triage_grade = <?php echo apply_triage_grade() ? 1 : 0; ?>;
$(wrapper).on("click", ".remove_field", function(e) {
e.preventDefault();
$(this).parent('td').parent('tr').remove();
x--;
});
function add_symptom_row() {
if (x < max_rows) {
$(wrapper).append("<tr>\
<td style='width: 20%;'>\
<select name='symptoms[]' id='symptoms_" + x + "' class='form-control col-sm-12 compulsory' onchange='showPrompt(this.value, " + x + ")' required>@php echo $option_symptoms; @endphp</select>\
</td>\
<td style='width: 21%'>\
<div class='row'>\
<div class='col-sm-3'>\
<input type='text' style='display: block;' name='duration[]' id='symptoms_duration_" + x + "' class='col-sm-12 form-control' required>\
</div>\
<div class='col-sm-9'>\
<select style='display: inline-block;' name='time[]' id='symptoms_time_" + x + "' class='col-sm-12 form-control' required>@php echo $option_symptoms_periods; @endphp</select>\
</div>\
</div>\
</td>\
<td id='symptoms_prompt_" + x + "' style='width: 30%'></td>\
<td id='symptoms_reference_" + x + "'></td>\
<td style='width: 1%;'><a class='remove_field btn btn-sm btn-rounded btn-danger' style='color: white;'><i class='fa fa-trash'></i></a></td>\
</tr>");
generalSelect2Set('symptoms_' + x);
$("#symptoms_" + x).load('/symptoms/get_symptoms');
x++;
}
}
function generalSelect2Set(id) {
$('#' + id).select2({
width: "100%"
});
}
function showPrompt(symptom_id, id) {
if (symptom_id == "") {
return;
}
$.ajax({
method: 'POST',
url: '/triage/get_prompt',
data: {
'symptom_id': symptom_id
},
success: function(response) {
let returnText = response.split('&&&&');
$('#symptoms_prompt_' + id).html('<p style="color: #C85F6A;">' + returnText[0] + '</p>');
$('#symptoms_reference_' + id).html(returnText[1]);
},
error: function(jqXHR, textStatus, errorThrown) {
alert(JSON.stringify(jqXHR));
console.log(JSON.stringify(jqXHR));
}
});
}
function submitSymptom() {
var symptom_name = $("#symptom_name").val();
$.ajax({
method: 'POST',
url: '/triage/add_symptom',
data: {
'symptom_name': symptom_name
},
success: function(response) {
if (response == 1) {
//reload all dropdowns
$(".1000").load('/symptoms/get_symptoms');
alert(symptom_name + ' symptom has been added.');
$('#symptomsmodal').modal('hide');
} else {
alert("<?php echo __('triage.adding_symptom_failed'); ?>");
}
},
error: function(jqXHR, textStatus, errorThrown) {
alert(JSON.stringify(jqXHR));
console.log(JSON.stringify(jqXHR));
}
});
}
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("<?php echo __('triage.adding_referral_failed'); ?>");
}
},
error: function(jqXHR, textStatus, errorThrown) {
alert(JSON.stringify(jqXHR));
console.log(JSON.stringify(jqXHR));
}
});
}
$(document).ready(function() {
$('.initial_symptoms_select').select2({
width: "100%"
});
$('.select-2').select2({
width: "100%"
});
var cons_attendance = <?php echo is_add_attendance_to_consultation_enabled() ? 1 : 0 ?>;
$("#submit_triage").click(function(e) { // make sure that all compulsory fields have been filled out
var empty_compulsory_fields = [];
$(".compulsory").each(function() {
if ($(this).val() == "") {
var textname = $(this).attr('name');
$(this).focus();
empty_compulsory_fields.push(textname);
$(this).css('border', '1px solid #F08080');
}
});
if(cons_attendance == 0 && !$('#new_attendance').is(':checked') && !$('#re_attendance').is(':checked')){
alert('Please fill in Patient attendance.');
e.preventDefault();
return false;
$('#new_attendance, #re_attendance').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("<?php echo __('triage.compulsory_fields_warning'); ?>");
console.log(empty_compulsory_fields);
e.preventDefault();
return false;
}
});
$('#new_attendance').click(function() {
$('#re_attendance').not('#new_attendance').removeAttr('checked');
});
$('#re_attendance').click(function() {
$('#new_attendance').not('#re_attendance').removeAttr('checked');
});
});
$(document).ready(function() {
$("#child_feeling_unsafe_section").hide();
$("#tested_for_hiv_last_3_months_section").hide();
$(".hiv_positive_section").hide();
});
function hide_tested_for_hiv_last_3_months_questions() {
$("#tested_for_hiv_last_3_months_section").hide();
}
function show_tested_for_hiv_last_3_months_questions() {
$("#tested_for_hiv_last_3_months_section").show();
}
function show_feeling_unsafe_questions() {
$('#child_feeling_unsafe_section').show();
}
function hide_feeling_unsafe_questions() {
$('#child_feeling_unsafe_section').hide();
}
function show_hiv_positive_questions() {
$(".hiv_positive_section").show();
}
function hide_hiv_positive_questions() {
$(".hiv_positive_section").hide();
}
// below 15
$('input[type=radio][name=mother_hiv_positive]').change(function() {
if (this.value == '1') {
$('.child-hiv-status').removeClass('d-none').css('display', '');
$('.child-hiv-status-questions').removeClass('d-none').css('display', '');
} else if (this.value == '0') {
$('.child-hiv-status').addClass('d-none').css('display', 'none');
$('.child-hiv-status-questions').addClass('d-none').css('display', 'none');
$('.child-hiv-status-questions input[type=radio]').each(function() {
this.value('');
})
}
});
</script>
@endpush
@@ -1,154 +0,0 @@
<div class="row">
<h4>{{ __('layout.triage') }}: {{ __('layout.children') }} </h4>
</div>
<div class="row">
<h5>{{ __('layout.emergency_signs') }} *** </h5>
</div>
<div class="row">
<div class="table-responsive">
<table class="table table-bordered table-striped table-condensed">
<tbody>
<tr>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col" width="2%">{{ __('layout.yes') }}</th>
<th scope="col" width="2%">{{ __('layout.no') }}</th>
</tr>
<tr>
<th scope="row">{{ __('layout.airway_breathing') }}</th>
<td>{{ __('layout.cyanosis') }}</td>
<td>
<div class="controls">
<input type="radio" name="cyanosis" value="{{ __('layout.yes') }}" id="cyanosis_0" required @if(!empty($airway[__('layout.cyanosis')]) && $airway[__('layout.cyanosis')] == __('layout.yes')) checked @endif>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="cyanosis" value="{{ __('layout.no') }}" id="cyanosis_0" required @if(!empty($airway[__('layout.cyanosis')]) && $airway[__('layout.cyanosis')] == __('layout.no')) checked @endif>
</div>
</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>{{ __('layout.stridor_breathing_choking') }}</td>
<td>
<div class="controls">
<input type="radio" name="stridor" value="{{ __('layout.yes') }}" id="stridor_0" required @if(!empty($airway[__('layout.stridor_breathing_choking')]) && $airway[__('layout.stridor_breathing_choking')] == __('layout.yes')) checked @endif>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="stridor" value="{{ __('layout.no') }}" id="stridor_1" required @if(!empty($airway[__('layout.stridor_breathing_choking')]) && $airway[__('layout.stridor_breathing_choking')] == __('layout.no')) checked @endif>
</div>
</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>{{ __('layout.severe_resp_distress') }}</td>
<td>
<div class="controls">
<input type="radio" name="severe_distress" value="{{ __('layout.yes') }}" id="severe_distress_0" required @if(!empty($airway[__('layout.severe_resp_distress')]) && $airway[__('layout.severe_resp_distress')] == __('layout.yes')) checked @endif>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="severe_distress" value="{{ __('layout.no') }}" id="severe_distress_1" required @if(!empty($airway[__('layout.severe_resp_distress')]) && $airway[__('layout.severe_resp_distress')] == __('layout.no')) checked @endif>
</div>
</td>
</tr>
<tr>
<th scope="row">{{ __('layout.circulation') }}</th>
<td>{{ __('layout.capillary_refill_seconds') }}</td>
<td>
<div class="controls">
<input type="radio" name="refill" value="{{ __('layout.yes') }}" id="refill_0" required @if(!empty($circulation[__('layout.capillary_refill_seconds')]) && $circulation[__('layout.capillary_refill_seconds')] == __('layout.yes')) checked @endif>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="refill" value="{{ __('layout.no') }}" id="refill_1" required @if(!empty($circulation[__('layout.capillary_refill_seconds')]) && $circulation[__('layout.capillary_refill_seconds')] == __('layout.no')) checked @endif>
</div>
</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>{{ __('layout.severe_bleeding') }}</td>
<td>
<div class="controls">
<input type="radio" name="severe_bleeding" value="{{ __('layout.yes') }}" id="severe_bleeding_0" required @if(!empty($circulation[__('layout.severe_bleeding')]) && $circulation[__('layout.severe_bleeding')] == __('layout.yes')) checked @endif>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="severe_bleeding" value="{{ __('layout.no') }}" id="severe_bleeding_1" required @if(!empty($circulation[__('layout.severe_bleeding')]) && $circulation[__('layout.severe_bleeding')] == __('layout.no')) checked @endif>
</div>
</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>{{ __('layout.weak_fast_pulse') }}</td>
<td>
<div class="controls">
<input type="radio" name="weak_fast_pulse" value="{{ __('layout.yes') }}" id="weak_fast_pulse_0" required @if(!empty($circulation[__('layout.weak_fast_pulse')]) && $circulation[__('layout.weak_fast_pulse')] == __('layout.yes')) checked @endif>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="weak_fast_pulse" value="{{ __('layout.no') }}" id="weak_fast_pulse_1" required @if(!empty($circulation[__('layout.weak_fast_pulse')]) && $circulation[__('layout.weak_fast_pulse')] == __('layout.no')) checked @endif>
</div>
</td>
</tr>
<tr>
<th scope="row">{{ __('layout.neurological') }}</th>
<td>{{ __('layout.coma') }}</td>
<td>
<div class="controls">
<input type="radio" name="coma" value="{{ __('layout.yes') }}" id="coma_0" required @if(!empty($neurological[__('layout.coma')]) && $neurological[__('layout.coma')] == __('layout.yes')) checked @endif>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="coma" value="{{ __('layout.no') }}" id="coma_1" required @if(!empty($neurological[__('layout.coma')]) && $neurological[__('layout.coma')] == __('layout.no')) checked @endif>
</div>
</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>{{ __('layout.convulsing_now') }}</td>
<td>
<div class="controls">
<input type="radio" name="convulsing_now" value="{{ __('layout.yes') }}" id="convulsing_now_0" required @if(!empty($neurological[__('layout.convulsing_now')]) && $neurological[__('layout.convulsing_now')] == __('layout.yes')) checked @endif>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="convulsing_now" value="{{ __('layout.no') }}" id="convulsing_now_1" required @if(!empty($neurological[__('layout.convulsing_now')]) && $neurological[__('layout.convulsing_now')] == __('layout.no')) checked @endif>
</div>
</td>
</tr>
<tr>
<th scope="row">{{ __('layout.dehydration_children_diarrhoea') }}</th>
<td>{{ __('layout.diarrhoea_lethargy_sunken_eyes') }}</td>
<td>
<div class="controls">
<input type="radio" name="lethargy" value="{{ __('layout.yes') }}" id="lethargy_0" required @if(!empty($dehydration[__('layout.diarrhoea_lethargy_sunken_eyes')]) && $dehydration[__('layout.diarrhoea_lethargy_sunken_eyes')] == __('layout.yes')) checked @endif>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="lethargy" value="{{ __('layout.no') }}" id="lethargy_0" required @if(!empty($dehydration[__('layout.diarrhoea_lethargy_sunken_eyes')]) && $dehydration[__('layout.diarrhoea_lethargy_sunken_eyes')] == __('layout.no')) checked @endif>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="alert alert-warning ">
<button type="button" class="close" data-dismiss="alert">×</button>
{{ __('layout.positive_call_for_help') }}
</div>
@@ -1,113 +0,0 @@
<div class="row">
<h4>{{ __('layout.adult_triage') }} </h4>
</div>
<div class="row">
<h5>{{ __('layout.family_planning_questions') }}</h5>
</div>
<div class="row">
<div class="col-sm-4"></div>
<div class="col-sm-4">
<input type="checkbox" class="col-sm-1" name="too_sick" id="too_sick" value="1" @if($triage->fp_too_sick == 1) checked @endif>
<span style="color: maroon; font-weight: bold">{{ __('layout.too_sick') }}</span>
</div>
</div>
<hr>
<table class="too_sick_remove table table-bordered" @if($triage->fp_too_sick == 1) style="display: none" @endif>
@if ($patient->gender == 2)
<tr class="currently_pregnant">
<td>{{ __('layout.currently_pregnant') }}</td>
<td>
<input type="radio" name='pregnant' id='pregnant_yes' class="answer_no" value="1" @if($triage->pregnant == 1) checked @endif>&nbsp;{{ __('layout.yes') }} &nbsp;&nbsp;&nbsp;
<input type="radio" name='pregnant' id='pregnant_no' class="answer_no" value="0" @if($triage->pregnant == 0) checked @endif>&nbsp;{{ __('layout.no') }}
</td>
</tr>
<tr class="menopause" style="display: none">
<td>{{ __('layout.had_menopause') }}</td>
<td>
<input type="radio" name='menopause' id='menopause_yes' class="answer_no" value="1" @if($triage->menopause == 1) checked @endif>&nbsp;{{ __('layout.yes') }} &nbsp;&nbsp;&nbsp;
<input type="radio" name='menopause' id='menopause_no' class="answer_no" value="0" @if($triage->menopause == 0) checked @endif>&nbsp;{{ __('layout.no') }}
</td>
</tr>
@endif
<tr class="sexually_active">
<td>{{ __('layout.sexually_active') }}</td>
<td>
<input type="radio" name='sexually_active' id='sexually_active_yes' class="answer_yes compulsory" value="1" @if($triage->sexually_active == 1) checked @endif>&nbsp;{{ __('layout.yes') }} &nbsp;&nbsp;&nbsp;
<input type="radio" name='sexually_active' id='sexually_active_no' class="answer_yes compulsory" value="0" @if($triage->sexually_active == 0) checked @endif>&nbsp;{{ __('layout.no') }}
</td>
</tr>
<tr class="expect_child" style="display: none">
<td>{{ __('layout.wish_to_have_child') }}</td>
<td>
<input type="radio" name='yes_no_children' id='yes_children' class="answer_no" value="1">&nbsp;{{ __('layout.yes') }} &nbsp;&nbsp;&nbsp;
<input type="radio" name='yes_no_children' id='no_children' class="answer_no" value="0">&nbsp;{{ __('layout.no') }}
</td>
</tr>
<tr class="fp_method" style="display: none">
<td>{{ Form::label('fp_method', __('layout.family_planning_method')) }}</td>
<td>{{ Form::select('fp_method', $family_planning_methods, $triage->fp_method, ['class' => 'form-control col-sm-8']) }}</td>
</tr>
<tr class="fp_action" style="display: none">
<td>{{ __('layout.action') }}</td>
<td>
<select name='fp_action' class="form-control col-sm-8">
<option value="{{ $triage->fp_action }}" selected>{{ $triage->fp_action }}</option>
<option value="{{ __('layout.none') }}">{{ __('layout.none') }}</option>
<option value="{{ __('layout.counseling') }}">{{ __('layout.counseling') }}</option>
<option value="{{ __('layout.referral_to_fp') }}">{{ __('layout.referral_to_fp') }}</option>
</select>
</td>
</tr>
</table>
@push('scripts')
<script>
$("#too_sick").change(function () {
if ($(this).is(':checked')) {
$(".too_sick_remove").hide();
} else {
$(".too_sick_remove").show();
}
});
$("#menopause_yes").change(function () {
$(".sexually_active").hide();
})
$("#menopause_no").change(function () {
$(".sexually_active").show();
})
$("#sexually_active_no").change(function () {
$(".expect_child").hide();
})
$("#sexually_active_yes").change(function () {
$(".expect_child").show();
})
$("#yes_children").change(function () {
$(".fp_method").hide();
$(".fp_action").hide();
})
$("#no_children").change(function () {
$(".fp_method").show();
$(".fp_action").show();
})
$("#pregnant_yes").change(function () {
$(".menopause").hide();
$(".sexually_active").hide();
})
$("#pregnant_no").change(function () {
$(".menopause").show();
$(".sexually_active").show();
})
</script>
@endpush
@@ -1,426 +0,0 @@
@if ($age_group == 1)
@push('scripts')
<script src="{{ asset('js/observations/0_28_days.js') }}"></script>
@endpush
@php $observation_counter = 0; @endphp
@foreach ($observations as $observation)
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->slug}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@if(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" selected>{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->id}}" class="col-sm-12 form-control">
<option value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" selected>{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal }}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@endif
</tr>
@php $observation_counter++; @endphp
@endforeach
@elseif ($age_group == 2)
@push('scripts')
<script src="{{ asset('js/observations/1_12_months.js') }}"></script>
@endpush
@foreach ($observations as $observation)
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->slug}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@if(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" selected>{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->id}}" class="col-sm-12 form-control">
<option value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" selected>{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" class="form-control" value="{{ $observation->option_for_normal }}" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and dispay the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@endif
</tr>
@endforeach
@elseif ($age_group == 3)
@push('scripts')
<script src="{{ asset('js/observations/1_5_years.js') }}"></script>
@endpush
@foreach ($observations as $observation)
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->slug}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@if(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" selected>{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->id}}" class="col-sm-12 form-control">
<option value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" selected>{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal }}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and dispay the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@endif
</tr>
@endforeach
@elseif ($age_group == 4)
@push('scripts')
<script src="{{ asset('js/observations/6_12_years.js') }}"></script>
@endpush
@foreach ($observations as $observation)
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->slug}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check to make appropriate row for BMI if the observation name is weight -->
@if($observation->slug == 'weight')
<td style="width: 20%;" class="center">
<input type="number" step="0.01" name="observationsValues[]" id="weight" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" required class="col-sm-12 compulsory form-control" style="width: 100%"
/>
</td>
<td colspan="3" style="width: 40%">
<input type="hidden" step="0.01" readonly="readonly" name="observationsNames[]" value="BMI" class="col-sm-12"/>
<div class="row">
<div class="col-sm-2" style="margin-top: 5px;">BMI</div>
<div class="col-sm-10">
<input type="number" readonly="readonly" name="observationsValues[]" id="bmi" value="{{ $observations_to_edit[$observation->name] }}" class="col-sm-12 form-control" />
</div>
</div>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@elseif(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" selected>{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->id}}" class="col-sm-12 form-control">
<option value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" selected>{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal }}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and dispay the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal}}" class="form-control" style="color: blue"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
@endif
</tr>
@endforeach
@elseif ($age_group == 5)
@push('scripts')
<script src="{{ asset('js/observations/over_12_years.js') }}"></script>
<script src="{{ asset('js/observations/over_12_years_news.js') }}"></script>
@endpush
@php $observation_counter = 0; @endphp
@foreach ($observations as $observation)
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->slug}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check to make appropriate row for BMI if the observation name is weight -->
@if($observation->slug == 'weight')
<td style="width: 20%;" class="center">
<input type="number" step="0.01" name="observationsValues[]" id="weight" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" required class="col-sm-12 compulsory form-control" style="width: 100%"/>
</td>
<td colspan="3" style="width: 40%">
<input type="hidden" step="0.01" readonly="readonly" name="observationsNames[]" value="BMI" class="col-sm-12"/>
<div class="row">
<div class="col-sm-2" style="margin-top: 5px;">BMI</div>
<div class="col-sm-10">
<input type="number" readonly="readonly" name="observationsValues[]" id="bmi" value="{{ $observations_to_edit[$observation->name] }}" class="col-sm-12 form-control" />
</div>
</div>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@elseif(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}NewsText" class="text-center"></p>
<input type="hidden" id="{{$observation->id}}News" name="{{$observation->id}}News" value="" class="col-sm-12" />
<input type="hidden" name="adult" id="adult" value="adult" class="col-sm-12" />
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" selected>{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->id}}" class="col-sm-12 form-control">
<option value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" selected>{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td colspan="3" style="width: 40%;"></td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and dispay the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ isset($observations_to_edit[$observation->name]) ? $observations_to_edit[$observation->name] : '' }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal }}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}Kews" class="text-center"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->id}}NewsText" class="text-center"></p>
<input type="hidden" id="{{$observation->id}}News" name="{{$observation->id}}News" value="" class="col-sm-12" />
<input type="hidden" name="adult" id="adult" value="adult" class="col-sm-12" />
</td>
@endif
</tr>
@endforeach
@php $observation_counter++; @endphp
@else
<tr>
<td colspan="5" class="text-center" style="width: 100%; color: maroon">{{ __('layout.ensure_correct_dob') }}</td>
</tr>
@endif
@@ -1,47 +0,0 @@
<div class="row">
<h4 class="heading pull-right">{{ __('layout.priority_signs') }}</h4>
</div>
<div class="row">
<table class="table table-bordered table-primary table-blue table-striped table-vertical-center table-condensed">
<tbody>
<tr>
<th scope="row"><div align="left">{{ __('layout.significant_trauma') }}</div></th>
<td><input type="checkbox" name="trauma" id="trauma" value="Yes" @if(in_array("Significant trauma", $priority_signs)) checked @endif></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.severe_pain') }}</div></th>
<td>
<input type="checkbox" name="severe_pain" id="severe_pain" value="yes" @if(in_array("Severe pain", $priority_signs)) checked @endif>
</td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.oedema_both_feet') }}</div></th>
<td><input type="checkbox" name="oedema" id="oedema" value="yes" @if(in_array("Oedema of both feet", $priority_signs)) checked @endif></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.urgent_surgical_condition') }}</div></th>
<td><input type="checkbox" name="surgical_condition" id="surgical_condition" value="yes" @if(in_array("Urgent surgical condition", $priority_signs)) checked @endif></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.restless_irritable') }}</div></th>
<td><input type="checkbox" name="continuously_irritable" id="continuously_irritable" value="yes" @if(in_array("Restless continuously irritable, lethargic", $priority_signs)) checked @endif></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.malnutrition_visible_wasting') }}</div></th>
<td><input type="checkbox" name="severe_wasting" id="severe_wasting" value="yes" @if(in_array("Malnutrition: visible severe wasting", $priority_signs)) checked @endif></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.severe_pallor') }}</div></th>
<td><input type="checkbox" name="severe_pallor" id="severe_pallor" value="yes" @if(in_array("Severe pallor", $priority_signs)) checked @endif></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.burns_major') }}</div></th>
<td><input type="checkbox" name="burns" id="burns" value="yes" @if(in_array("Burns (Major)", $priority_signs)) checked @endif></td>
</tr>
</tbody>
</table>
</div>
<div class="alert alert-warning ">
<button type="button" class="close" data-dismiss="alert">×</button>
{{ __('layout.positive_move_child_first') }}.
</div>
@@ -1,225 +0,0 @@
@extends('layouts.main')
@push('scripts')
<style>
.triage-grade li {
display: inline-block;
}
</style>
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-6 col-md-7 col-sm-7 col-xs-12">
<h4 class="page-title">Admission Triage</h4>
</div>
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">Dashboard</a></li>
<li><a href="{{ route('patient_episodes.index') }}">Patient Home</a></li>
<li class="active">Triage</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('patients::allergies.header')
<br>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('flash::message')
<div class="white-box" style="padding-top: 5px;">
<h5 class="page-title"><strong>Triage ({{ $age_group_display }}) for Episode started on : <font color="blue">{{ streamline_date(get_name($episode_id, 'id', 'created_at', 'patient_episodes')) }}</font></strong></h5>
<hr>
{{ Form::open(['route' => 'triage.save_edits_for_post_discharge' , 'data-toggle' => 'validator']) }}
{{ Form::hidden('episode_id', $episode_id)}}
{{ Form::hidden('patient_id', $patient_id)}}
<div class="row">
<div class="col-md-6">
<div class="table-responsive">
<table class="table table-hover table-striped color-table success-table table-bordered" id="observations_table">
<thead>
<tr>
<th>Observation</th>
<th>Value</th>
<th>Normal Range</th>
</tr>
</thead>
<tbody>
@push('scripts')
<script src="{{ asset('js/observations/1_5_years.js') }}"></script>
@endpush
<tr>
<td>Temperature ( °C)</td>
<td><input value="{{ $temperature }}" type="number" step="0.01" required name="temperature" class="col-sm-12 compulsory form-control" style="width: 100%"/></td>
<td><p style="color: #0000FF" class="text-center"><input type="text" readonly value="36.5 - 37.4" class="form-control" style="color: blue;"></p></td>
</tr>
<tr>
<td>SaO2 (%)</td>
<td><input value="{{ $oxy_sat }}" type="number" step="0.01" required name="oxy_sat" class="col-sm-12 compulsory form-control" style="width: 100%"/></td>
<td><p style="color: #0000FF" class="text-center"><input type="text" readonly value=">94" class="form-control" style="color: blue;"></p></td>
</tr>
<tr>
<td>MUAC (cm)</td>
<td><input value="{{ $muac }}" type="number" step="0.01" required name="muac" class="col-sm-12 compulsory form-control" style="width: 100%"/></td>
<td><p style="color: #0000FF" class="text-center"><input type="text" readonly value="12.5 - 50.0" class="form-control" style="color: blue;"></p></td>
</tr>
<tr>
<td>Height (m)</td>
<td><input value="{{ $height }}" type="number" step="0.01" required name="height" id="height" class="col-sm-12 compulsory form-control" style="width: 100%"/></td>
<td></td>
</tr>
<tr>
<td>Weight (kg)</td>
<td><input value="{{ $weight }}" type="number" step="0.01" required id="weight" name="weight" class="col-sm-12 compulsory form-control" style="width: 100%"/></td>
<td>
<input type="hidden" step="0.01" readonly="readonly" value="BMI" class="col-sm-12"/>
<div class="row">
<div class="col-sm-2" style="margin-top: 5px;">BMI</div>
<div class="col-sm-10">
<input value="{{ $bmi }}" type="number" readonly="readonly" name="bmi" id="bmi" class="col-sm-12 compulsory form-control" required />
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-6">
@if (between($age_diff_months, 0, 5))
<table class="table table-bordered">
<tr>
<td class="text-center" colspan="2"><h4>Social Health Indicators</h4></td>
</tr>
<tr>
<td>{{ Form::label('child_with_proven_infection', 'Does the child have a proven or suspected infection e.g is the child having fever, cough, diarrhoea?') }}</td>
<td>
{{ Form::radio('child_with_proven_infection', 1, $discharge_mortality->child_with_proven_infection == 1) }} Yes
{{ Form::radio('child_with_proven_infection', 0, $discharge_mortality->child_with_proven_infection === 0) }} No
</td>
</tr>
<tr>
<td>{{ Form::label('hospital_travel_duration', 'How long did it take you to travel to the hospital?') }}</td>
<td>
{{ Form::select('hospital_travel_duration', ['' => '-- select --','1' => '< 30 mins','2' => '30 mins 1 hour','3' => '1 - 4 hours','4' => '> 4 hours'], $discharge_mortality->hospital_travel_duration_below_6, ['class' => 'form-control compulsory', 'required']) }}
</td>
</tr>
<tr>
<td>{{ Form::label('illness_duration', 'What is the duration of the present illness at the time of admission?') }}</td>
<td>
{{ Form::select('illness_duration', ['' => '-- select --','1' => '< 48 hours','2' => '48 hours - 7 days','3' => '7 days - 1 month','4' => 'More than a month'], $discharge_mortality->illness_duration_at_admission_below_6, ['class' => 'form-control compulsory', 'required']) }}
</td>
</tr>
<tr>
<td>{{ Form::label('tone_normal_6mo', 'Muscle Tone') }}</td>
<td>
{{ Form::select('tone_normal_6mo', ['' => '-- select --','1' => 'Increased (Stiff)','2' => 'Normal','3' => 'Decreased (floppy)','4' => 'Do not know'], $discharge_mortality->tone_normal_6mo, ['class' => 'form-control']) }}
</td>
</tr>
</table>
@endif
@if (between($age_diff_months, 6, 60))
<div></div>
<table class="table table-bordered">
<tr>
<td class="text-center" colspan="4"><h4>Social Health Indicators</h4></td>
</tr>
<tr>
<td colspan="2">{{ Form::label('child_with_proven_infection', 'Does the child have a proven or suspected infection e.g is the child having fever, cough, diarrhoea?') }}</td>
<td>{{ Form::radio('child_with_proven_infection', 1, $discharge_mortality->child_with_proven_infection == 1, ['required']) }} Yes</td>
<td>{{ Form::radio('child_with_proven_infection', 0, $discharge_mortality->child_with_proven_infection === 0, ['required']) }} No</td>
</tr>
<tr>
<td>
{{ Form::label('last_hospitalization', 'Time since last hospitalization') }}
</td>
<td>
{{ Form::select('last_hospitalization', ['' => '-- select --','1' => 'Less than 7 days ago','2' => '7 to 30 days ago','3' => '30 days to 1 year ago','4' => 'More than 1 year ago','5' => 'Never'], $discharge_mortality->last_hospitalization, ['class' => 'form-control compulsory', 'required']) }}
</td>
<td>
{{ Form::label('water_source', 'Primary water source for drinking water') }}
</td>
<td>
{{ Form::select('water_source', ['' => '-- select --', '1' => 'Protected spring', '2' => 'Bore hole', '3' => 'Municipal water', '4' => 'Open source (unprotected, stagnant water, dam)', '5' => 'Slow running water', '6' => 'Fast running water'], $discharge_mortality->water_source, ['class' => 'form-control compulsory', 'required']) }}
</td>
</tr>
<tr>
<td>
{{ Form::label('safe_water', 'Do you boil, filter (good sand/ceramic) or disinfect (using bleach/waterguard) all drinking water?') }}
</td>
<td>
{{ Form::radio('safe_water', 1, $discharge_mortality->filter_water == 1, ['required']) }} Yes
{{ Form::radio('safe_water', 0, $discharge_mortality->filter_water === 0, ['required']) }} No
</td>
<td>{{ Form::label('child_mosquito_net', 'Does your child sleep under a mosquito net?') }}</td>
<td>
{{ Form::select('child_mosquito_net', ['' => '-- select --','1' => 'Never','2' => 'Sometimes','3' => 'Always'], $discharge_mortality->child_mosquito_net, ['class' => 'form-control compulsory', 'required']) }}
</td>
</tr>
<tr>
<td>{{ Form::label('mother_education_level', 'What is the education level of the childs mother?') }}</td>
<td>
{{ Form::select('mother_education_level', ['' => '-- select --','1' => 'No school','2' => '<= P3','3' => 'P4-P7','4' => 'S1-S6','5' => 'Post secondary (including post S4 technical school)','6' => 'Do not know'], $discharge_mortality->mother_education_level, ['class' => 'form-control compulsory', 'required']) }}
</td>
<td>{{ Form::label('hospital_travel_duration', 'How long did it take you to travel to the hospital?') }}</td>
<td>
{{ Form::select('hospital_travel_duration', ['' => '-- select --','1' => '< 30 mins','2' => '30 mins 1 hour','3' => '1 - 4 hours','4' => '> 4 hours'], $discharge_mortality->hospital_travel_duration, ['class' => 'form-control compulsory', 'required']) }}
</td>
</tr>
<tr>
<td>{{ Form::label('maternal_hiv', 'Maternal HIV') }}</td>
<td>
{{ Form::select('maternal_hiv', ['' => '-- select --', '2' => 'HIV Positive', '1' => 'HIV Negative', '0' => 'HIV Unknown'], $discharge_mortality->maternal_hiv, ['class' => 'form-control compulsory', 'required']) }}
</td>
<td>{{ Form::label('child_hiv', 'Child HIV') }}</td>
<td>{{ Form::select('child_hiv', ['' => '-- select --','1' => 'HIV Positive','0' => 'HIV Negative / Unknown'], $discharge_mortality->child_hiv, ['class' => 'form-control compulsory', 'required']) }}</td>
</tr>
<tr>
<td>{{ Form::label('bcs_eye_movement', 'Eye movement') }}</td>
<td>{{ Form::select('bcs_eye_movement', ['' => '-- select --','1' => 'Watches or follows','0' => 'Fails to watch or follow'], $discharge_mortality->bcs_eye_movement, ['class' => 'form-control compulsory', 'required']) }}</td>
<td>{{ Form::label('bcs_best_mortal', 'Best motor response') }}</td>
<td>{{ Form::select('bcs_best_mortal', ['' => '-- select --','0' => 'No response or inappropriate response','1' => 'Withdraws limb from pain stimulus','2' => 'Localizes painful stimulus'], $discharge_mortality->bcs_best_mortal, ['class' => 'form-control compulsory', 'required']) }}</td>
</tr>
<tr>
<td>{{ Form::label('bcs_best_verbal', 'Best verbal response') }}</td>
<td>{{ Form::select('bcs_best_verbal', ['' => '-- select --','0' => 'No vocal response to pain','1' => 'Moan or abnormal cry with pain','2' => 'Cries appropriately with pain (or speaks if verbal)'], $discharge_mortality->bcs_best_verbal, ['class' => 'form-control compulsory', 'required']) }}</td>
<td>{{ Form::label('maternal_age', 'Mother\'s age') }}</td>
<td>{{ Form::number('maternal_age', $discharge_mortality->maternal_age, ['class' => 'form-control compulsory', 'required']) }}</td>
</tr>
</table>
@endif
</div>
</div>
<br><br>
{{ Form::button('Submit',['type'=>'submit', 'class'=>'btn btn-success col-sm-6']) }}
{{ Form::close() }}
</div>
</div>
</div>
@endsection
@push('scripts')
<script type="text/javascript">
$(document).ready(function () {
//
});
</script>
@endpush
@@ -1,154 +0,0 @@
<div class="row">
<h4>{{ __('layout.triage') }}: {{ __('layout.children') }} </h4>
</div>
<div class="row">
<h5>{{ __('layout.emergency_signs') }} *** </h5>
</div>
<div class="row">
<div class="table-responsive">
<table class="table table-bordered table-striped table-condensed">
<tbody>
<tr>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col" width="2%">{{ __('layout.yes') }}</th>
<th scope="col" width="2%">{{ __('layout.no') }}</th>
</tr>
<tr>
<th scope="row">{{ __('layout.airway_breathing') }}</th>
<td>{{ __('layout.cyanosis') }}</td>
<td>
<div class="controls">
<input type="radio" name="cyanosis" value="{{ __('layout.yes') }}" id="cyanosis_0" required>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="cyanosis" value="{{ __('layout.no') }}" id="cyanosis_0" required>
</div>
</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>{{ __('layout.stridor_breathing_choking') }}</td>
<td>
<div class="controls">
<input type="radio" name="stridor" value="{{ __('layout.yes') }}" id="stridor_0" required>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="stridor" value="{{ __('layout.no') }}" id="stridor_1" required>
</div>
</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>{{ __('layout.severe_resp_distress') }}</td>
<td>
<div class="controls">
<input type="radio" name="severe_distress" value="{{ __('layout.yes') }}" id="severe_distress_0" required>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="severe_distress" value="{{ __('layout.no') }}" id="severe_distress_1" required>
</div>
</td>
</tr>
<tr>
<th scope="row">{{ __('layout.circulation') }}</th>
<td>{{ __('layout.capillary_refill_seconds') }}</td>
<td>
<div class="controls">
<input type="radio" name="refill" value="{{ __('layout.yes') }}" id="refill_0" required>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="refill" value="{{ __('layout.no') }}" id="refill_1" required>
</div>
</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>{{ __('layout.severe_bleeding') }}</td>
<td>
<div class="controls">
<input type="radio" name="severe_bleeding" value="{{ __('layout.yes') }}" id="severe_bleeding_0" required>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="severe_bleeding" value="{{ __('layout.no') }}" id="severe_bleeding_1" required>
</div>
</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>{{ __('layout.weak_fast_pulse') }}</td>
<td>
<div class="controls">
<input type="radio" name="weak_fast_pulse" value="{{ __('layout.yes') }}" id="weak_fast_pulse_0" required>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="weak_fast_pulse" value="{{ __('layout.no') }}" id="weak_fast_pulse_1" required>
</div>
</td>
</tr>
<tr>
<th scope="row">{{ __('layout.neurological') }}</th>
<td>{{ __('layout.coma') }}</td>
<td>
<div class="controls">
<input type="radio" name="coma" value="{{ __('layout.yes') }}" id="coma_0" required>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="coma" value="{{ __('layout.no') }}" id="coma_1" required>
</div>
</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>{{ __('layout.convulsing_now') }}</td>
<td>
<div class="controls">
<input type="radio" name="convulsing_now" value="{{ __('layout.yes') }}" id="convulsing_now_0" required>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="convulsing_now" value="{{ __('layout.no') }}" id="convulsing_now_1" required>
</div>
</td>
</tr>
<tr>
<th scope="row">{{ __('layout.dehydration_children_diarrhoea') }}</th>
<td>{{ __('layout.diarrhoea_lethargy_sunken_eyes') }}</td>
<td>
<div class="controls">
<input type="radio" name="lethargy" value="{{ __('layout.yes') }}" id="lethargy_0" required>
</div>
</td>
<td>
<div class="controls">
<input type="radio" name="lethargy" value="{{ __('layout.no') }}" id="lethargy_0" required>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="alert alert-warning ">
<button type="button" class="close" data-dismiss="alert">×</button>
{{ __('layout.positive_call_for_help') }}
</div>
@@ -1,113 +0,0 @@
<div class="row">
<h4>{{ __('layout.adult_triage') }} </h4>
</div>
<div class="row">
<h5>{{ __('layout.family_planning_questions') }}</h5>
</div>
<div class="row">
<div class="col-sm-4"></div>
<div class="col-sm-4">
<input type="checkbox" class="col-sm-1" name="too_sick" id="too_sick" value="1">
<span style="color: maroon; font-weight: bold">{{ __('layout.too_sick') }}</span>
</div>
</div>
<hr>
<table class="too_sick_remove table table-bordered">
@if ($patient->gender == 2)
<tr class="currently_pregnant">
<td>{{ __('layout.currently_pregnant') }}</td>
<td>
<input type="radio" name='pregnant' id='pregnant_yes' class="answer_no" value="1">&nbsp;{{ __('layout.yes') }} &nbsp;&nbsp;&nbsp;
<input type="radio" name='pregnant' id='pregnant_no' class="answer_no" value="0">&nbsp;{{ __('layout.no') }}
</td>
</tr>
<tr class="menopause" style="display: none">
<td>{{ __('layout.had_menopause') }}</td>
<td>
<input type="radio" name='menopause' id='menopause_yes' class="answer_no" value="1">&nbsp;{{ __('layout.yes') }} &nbsp;&nbsp;&nbsp;
<input type="radio" name='menopause' id='menopause_no' class="answer_no" value="0">&nbsp;{{ __('layout.no') }}
</td>
</tr>
@endif
<tr class="sexually_active">
<td>{{ __('layout.sexually_active') }}</td>
<td>
<input type="radio" name='sexually_active' id='sexually_active_yes' class="answer_yes compulsory" value="1">&nbsp;{{ __('layout.yes') }} &nbsp;&nbsp;&nbsp;
<input type="radio" name='sexually_active' id='sexually_active_no' class="answer_yes compulsory" value="0">&nbsp;{{ __('layout.no') }}
</td>
</tr>
<tr class="expect_child" style="display: none">
<td>{{ __('layout.wish_to_have_child') }}</td>
<td>
<input type="radio" name='yes_no_children' id='yes_children' class="answer_no" value="1">&nbsp;{{ __('layout.yes') }} &nbsp;&nbsp;&nbsp;
<input type="radio" name='yes_no_children' id='no_children' class="answer_no" value="0">&nbsp;{{ __('layout.no') }}
</td>
</tr>
<tr class="fp_method" style="display: none">
<td>{{ Form::label('fp_method', __('layout.family_planning_method')) }}</td>
<td>{{ Form::select('fp_method', $family_planning_methods, '', ['class' => 'form-control col-sm-8']) }}</td>
</tr>
<tr class="fp_action" style="display: none">
<td>{{ __('layout.action') }}</td>
<td>
<select name='fp_action' class="form-control col-sm-8">
<option value="">--{{ __('layout.select') }}--</option>
<option value="{{ __('layout.none') }}">{{ __('layout.none') }}</option>
<option value="{{ __('layout.counseling') }}">{{ __('layout.counseling') }}</option>
<option value="{{ __('layout.referral_to_fp') }}">{{ __('layout.referral_to_fp') }}</option>
</select>
</td>
</tr>
</table>
@push('scripts')
<script>
$("#too_sick").change(function () {
if ($(this).is(':checked')) {
$(".too_sick_remove").hide();
} else {
$(".too_sick_remove").show();
}
});
$("#menopause_yes").change(function () {
$(".sexually_active").hide();
})
$("#menopause_no").change(function () {
$(".sexually_active").show();
})
$("#sexually_active_no").change(function () {
$(".expect_child").hide();
})
$("#sexually_active_yes").change(function () {
$(".expect_child").show();
})
$("#yes_children").change(function () {
$(".fp_method").hide();
$(".fp_action").hide();
})
$("#no_children").change(function () {
$(".fp_method").show();
$(".fp_action").show();
})
$("#pregnant_yes").change(function () {
$(".menopause").hide();
$(".sexually_active").hide();
})
$("#pregnant_no").change(function () {
$(".menopause").show();
$(".sexually_active").show();
})
</script>
@endpush
@@ -1,338 +0,0 @@
<div>
<input type="hidden" name="is_hiv_and_gbv_screening_tool_enabled"
value="{{ is_hiv_and_gbv_screening_tool_enabled() }}">
</div>
@if (between($age_diff_months, 18, 168))
{{-- HIV Screening Tool (18 months to 14 years), show_hiv_positive_questions nolonger needed --}}
@endif
@if ($years >= 15)
{{-- HIV Screening Tool (=>15 years) --}}
<div class="wrapper">
<div>
<div class="pb-3">
<h5 class="font-weight-bold">HIV Screening Tool for adults (=>15 years)</h5>
</div>
<div>
<p>Does the client belong to ANY of these categories?</p>
</div>
<div class="table-responsive">
<table class="table table-striped table-sm w-100 mb-4">
<tbody>
<tr>
<td>Have you tested for HIV in the last 12 months?</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="tested_for_hiv_in_past_12_months" value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="tested_for_hiv_in_past_12_months" value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Have you had TB or presumptive TB (2 weeks' history of cough, night sweats, weight loss,
fever)?</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="had_tb_or_presumptive_tb" value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="had_tb_or_presumptive_tb" value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Do you have symptoms of Sexually Transmitted Infection (blisters, sores, unusual
urethral or vaginal discharge)?</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="sti_symptoms_present" value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="sti_symptoms_present" value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Have you been diagnosed with Hepatitis B or C?</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="diagnosed_with_hepatitis_b_or_c" value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="diagnosed_with_hepatitis_b_or_c" value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Have you experienced or caused Sexual violence (SGBV)?</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="experienced_or_caused_sexual_violence" value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="experienced_or_caused_sexual_violence" value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Do you have a reactive HIV self-test result?</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="reactive_hiv_self_test_result" value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="reactive_hiv_self_test_result" value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Have you been identified through an Index client?</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="identified_through_index_client" value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="identified_through_index_client" value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Have you been exposed to blood or body fluids from a Known HIV positive or unknown HIV
status source?</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="exposed_to_hiv_positive_or_unknown_source"
value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="exposed_to_hiv_positive_or_unknown_source"
value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Have you had signs and symptoms of HIV disease and not had an HIV test in the last 1
month.</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="hiv_symptoms_without_recent_test" value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="hiv_symptoms_without_recent_test" value="0" />
No
</label>
</td>
</tr>
</tbody>
</table>
<hr class="invisibe my-5 text-white border-none" style="border: none;">
<div class="row m-t-10 w-100 mt-4">
<div class="col-md-4 mx-2">
<p>Have you tested for HIV in the last 3 months?</p>
</div>
<div class="col-md-4">
<label for="one" class="pl-5">
{{ Form::radio('tested_for_hiv_last_3_months', 1, false, ['onclick' => 'show_tested_for_hiv_last_3_months_questions()']) }}
Yes
</label>
<label for="one" class="pl-5">
{{ Form::radio('tested_for_hiv_last_3_months', 0, false, ['onclick' => 'hide_tested_for_hiv_last_3_months_questions()']) }}
No
</label>
</div>
</div>
<table class="table table-striped table-sm w-100" id="tested_for_hiv_last_3_months_section">
<tbody>
<tr>
<td>Have you tested for HIV in the last 12 months?</td>
<td class="text-right">
<label for="one11" class="pl-5">
Yes
<input type="radio" id="one11" name="tested_for_hiv_last_12_months"
value="1" />
</label>
<label for="one22" class="pl-5">
No
<input type="radio" id="one22" name="tested_for_hiv_last_12_months"
value="0" />
</label>
</td>
</tr>
<tr>
<td>Have you had unprotected sex with partner(s) of unknown HIV status?</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="unprotected_sex_with_partner_of_unknown_hiv_status"
value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="unprotected_sex_with_partner_of_unknown_hiv_status"
value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Have you had unprotected sex with an HIV positive partner? (includes discordance)</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="unprotected_sex_with_hiv_positive_partner"
value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="unprotected_sex_with_hiv_positive_partner"
value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Have you shared injecting needles or piercing objects with anyone else?</td>
<td class="text-right">
<label for="one" class="pl-5">
<input type="radio" name="shared_needles_or_piercing_objects" value="1" />
Yes
</label>
<label for="one" class="pl-5">
<input type="radio" name="shared_needles_or_piercing_objects" value="0" />
No
</label>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
@elseif ($years >= 1.5 && $years < 15)
<div class="wrapper">
<div class="pb-3">
<h5 class="font-weight-bold">HIV Screening Tool (18 months to 14 years)</h5>
<div class="row m-0">
<div class="col-md p-0 mb-2">Is the child's mother HIV positive?</div>
<div class="col-md p-0 mb-2">
<label for="1_childs_mother_hiv_positive" class="pr-5">
<input type="radio" name="mother_hiv_positive" id="1_childs_mother_hiv_positive"
value="1" />
Yes
</label>
<label for="2_childs_mother_hiv_positive" class="pr-5">
<input type="radio" name="mother_hiv_positive" id="2_childs_mother_hiv_positive"
value="0" />
No / Unknown
</label>
</div>
<div class="col-md p-0 mb-2"></div>
</div>
<div class="row m-0 mt-3 pt-3 d-none child-hiv-status">
<div class="col-md p-0 mb-2"> Ask the following questions to the caregiver or child </div>
</div>
<div class="table-responsive d-none child-hiv-status-questions">
<table class="table table-striped table-sm w-100">
<tbody>
<tr>
<td>Has the child / Have you been sick in the last 3 months?</td>
<td class="text-right">
<label for="1_person_sick_last_3_months" class="pl-5">
<input type="radio" name="has_been_sick_last_3_months"
id="1_person_sick_last_3_months" value="1" />
Yes
</label>
<label for="2_person_sick_last_3_months" class="pl-5">
<input type="radio" name="has_been_sick_last_3_months"
id="2_person_sick_last_3_months" value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Has the child / Have you had a recurring skin problem?</td>
<td class="text-right">
<label for="1_person_had_recurring_skin_problem" class="pl-5">
<input type="radio" name="has_recurring_skin_problem"
id="1_person_had_recurring_skin_problem" value="1" />
Yes
</label>
<label for="2_person_had_recurring_skin_problem" class="pl-5">
<input type="radio" name="has_recurring_skin_problem"
id="2_person_had_recurring_skin_problem" value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Has the child / Have you loast weight in the last 3 months?</td>
<td class="text-right">
<label for="1_person_lost_weight_in_last_3_months" class="pl-5">
<input type="radio" name="has_lost_weight_last_3_months"
id="1_person_lost_weight_in_last_3_months" value="1" />
Yes
</label>
<label for="2_person_lost_weight_in_last_3_months" class="pl-5">
<input type="radio" name="has_lost_weight_last_3_months"
id="2_person_lost_weight_in_last_3_months" value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Has the child / Have you ever had TB?</td>
<td class="text-right">
<label for="1_person_ever_had_tb" class="pl-5">
<input type="radio" name="has_had_tb" id="1_person_ever_had_tb"
value="1" />
Yes
</label>
<label for="2_person_ever_had_tb" class="pl-5">
<input type="radio" name="has_had_tb" id="2_person_ever_had_tb"
value="0" />
No
</label>
</td>
</tr>
<tr>
<td>Is the child / Are you growing well ?</td>
<td class="text-right">
<label for="1_person_growing_well" class="pl-5">
<input type="radio" name="is_growing_well" id="1_person_growing_well"
value="1" />
Yes
</label>
<label for="2_person_growing_well" class="pl-5">
<input type="radio" name="is_growing_well" id="2_person_growing_well"
value="0" />
No
</label>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
@endif
@@ -1,555 +0,0 @@
@if ($age_group == 1)
@push('scripts')
<script src="{{ asset('js/observations/0_28_days.js') }}"></script>
@endpush
@php $observation_counter = 0; @endphp
@foreach ($observations as $observation)
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->id}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@if(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ old('observationsValues.$observation_counter') }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ old('observationsValues.$observation_counter') }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->slug}}" class="col-sm-12 form-control">
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal }}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@endif
</tr>
@php $observation_counter++; @endphp
@endforeach
@elseif ($age_group == 2)
@push('scripts')
<script src="{{ asset('js/observations/1_12_months.js') }}"></script>
@endpush
@foreach ($observations as $observation)
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->id}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@if(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->slug}}" class="col-sm-12 form-control">
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" class="form-control" value="{{ $observation->option_for_normal }}" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and dispay the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@endif
</tr>
@endforeach
@elseif ($age_group == 3)
@push('scripts')
<script src="{{ asset('js/observations/1_5_years.js') }}"></script>
@endpush
@foreach ($observations as $observation)
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->id}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@if($observation->slug=='weight')
<td style="width: 20%;" class="center">
<input type="number" step="0.01" name="observationsValues[]" id="weight" required class="col-sm-12 compulsory form-control" style="width: 100%"
/>
</td>
<td colspan="3" style="width: 40%">
<input type="hidden" step="0.01" readonly="readonly" name="observationsNames[]" value="BMI" class="col-sm-12"/>
<div class="row">
<div class="col-sm-2" style="margin-top: 5px;">BMI</div>
<div class="col-sm-10">
<input type="number" readonly="readonly" name="observationsValues[]" id="bmi" class="col-sm-12 form-control" />
</div>
</div>
</td>
@elseif(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->slug}}" class="col-sm-12 form-control">
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal }}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and dispay the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@endif
</tr>
@endforeach
@elseif ($age_group == 4)
@push('scripts')
<script src="{{ asset('js/observations/6_12_years.js') }}"></script>
@endpush
@foreach ($observations as $observation)
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->id}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check to make appropriate row for BMI if the observation name is weight -->
@if($observation->slug=='weight')
<td style="width: 20%;" class="center">
<input type="number" step="0.01" name="observationsValues[]" id="weight" required class="col-sm-12 compulsory form-control" style="width: 100%"
/>
</td>
<td colspan="3" style="width: 40%">
<input type="hidden" step="0.01" readonly="readonly" name="observationsNames[]" value="BMI" class="col-sm-12"/>
<div class="row">
<div class="col-sm-2" style="margin-top: 5px;">BMI</div>
<div class="col-sm-10">
<input type="number" readonly="readonly" name="observationsValues[]" id="bmi" class="col-sm-12 form-control" />
</div>
</div>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@elseif(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->slug}}" class="col-sm-12 form-control">
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal }}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and dispay the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal}}" class="form-control" style="color: blue"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
@endif
</tr>
@endforeach
@elseif ($age_group == 5)
@push('scripts')
<script src="{{ asset('js/observations/over_12_years.js') }}"></script>
<script src="{{ asset('js/observations/over_12_years_news.js') }}"></script>
@endpush
@php $observation_counter = 0; @endphp
@foreach ($observations as $observation)
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->id}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check to make appropriate row for BMI if the observation name is weight -->
@if($observation->slug=='weight')
<td style="width: 20%;" class="center">
<input type="number" step="0.01" name="observationsValues[]" id="weight" required class="col-sm-12 compulsory form-control" style="width: 100%"
/>
</td>
<td colspan="3" style="width: 40%">
<input type="hidden" step="0.01" readonly="readonly" name="observationsNames[]" value="BMI" class="col-sm-12"/>
<div class="row">
<div class="col-sm-2" style="margin-top: 5px;">BMI</div>
<div class="col-sm-10">
<input type="number" readonly="readonly" name="observationsValues[]" id="bmi" class="col-sm-12 form-control" />
</div>
</div>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@elseif(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ old('observationsValues.{$observation_counter}') }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ old('observationsValues.{$observation_counter}') }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}NewsText" class="text-center"></p>
<input type="hidden" id="{{$observation->slug}}News" name="{{$observation->slug}}News" value="" class="col-sm-12" />
<input type="hidden" name="adult" id="adult" value="adult" class="col-sm-12" />
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->slug}}" class="col-sm-12 form-control">
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td colspan="3" style="width: 40%;"></td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and dispay the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal }}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}NewsText" class="text-center"></p>
<input type="hidden" id="{{$observation->slug}}News" name="{{$observation->slug}}News" value="" class="col-sm-12" />
<input type="hidden" name="adult" id="adult" value="adult" class="col-sm-12" />
</td>
@endif
</tr>
@endforeach
@php $observation_counter++; @endphp
@else
{{-- <tr>
<td colspan="5" class="text-center" style="width: 100%; color: maroon">{{ __('layout.ensure_correct_dob') }}</td>
</tr> --}}
{{-- This section should ideally handle dynamically added age groups --}}
@push('scripts')
<script src="{{ asset('js/observations/over_12_years.js') }}"></script>
<script src="{{ asset('js/observations/over_12_years_news.js') }}"></script>
@endpush
@php $observation_counter = 0; @endphp
@if (count($observations) > 0)
@foreach ($observations as $observation)
@php
$observations_age_groups_array = is_null($observation->age_group) ? [] : explode(",", $observation->age_group);
@endphp
@if (in_array($age_group, $observations_age_groups_array))
<tr>
<td style="width: 25%;">
<input type="hidden" name="observationsNames[]" id="{{$observation->id}}" value="{{$observation->name}}"/>
<h5 class="text-center">{{ $observation->name }} {{ $observation->measurement ? "(".$observation->measurement.")" : "" }} </h5>
</td>
<!-- check to make appropriate row for BMI if the observation name is weight -->
@if($observation->slug=='weight')
<td style="width: 20%;" class="center">
<input type="number" step="0.01" name="observationsValues[]" id="weight" required class="col-sm-12 compulsory form-control" style="width: 100%"
/>
</td>
<td colspan="3" style="width: 40%">
<input type="hidden" step="0.01" readonly="readonly" name="observationsNames[]" value="BMI" class="col-sm-12"/>
<div class="row">
<div class="col-sm-2" style="margin-top: 5px;">BMI</div>
<div class="col-sm-10">
<input type="number" readonly="readonly" name="observationsValues[]" id="bmi" class="col-sm-12 form-control" />
</div>
</div>
</td>
<!-- check whether to bring a selectable drop down or text box -->
@elseif(!is_null($observation->lower_limit) && !is_null($observation->upper_limit))
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and display the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="{{ old('observationsValues.{$observation_counter}') }}" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="{{ old('observationsValues.{$observation_counter}') }}" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->lower_limit}} - {{ $observation->upper_limit}}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}NewsText" class="text-center"></p>
<input type="hidden" id="{{$observation->slug}}News" name="{{$observation->slug}}News" value="" class="col-sm-12" />
<input type="hidden" name="adult" id="adult" value="adult" class="col-sm-12" />
</td>
@elseif(!is_null($observation->options) && $observation->options!="")
<td style="width: 20%;" class="center">
<!-- check if the observation is compulsory or not and display appropriate compulsory class -->
@if($observation->compulsory == 1)
<select name="observationsValues[]" id="{{$observation->slug}}" class="col-sm-12 compulsory form-control" required>
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@else
<select name="observationsValues[]" id="{{ $observation->slug}}" class="col-sm-12 form-control">
<option value="">--select--</option>
@php
$options = explode(',',$observation->options);
for ($i=0; $i < count($options) ; $i++) {
echo '<option value="'.$options[$i].'">'.$options[$i].'</option>';
}
@endphp
</select>
@endif
</td>
<td colspan="3" style="width: 40%;"></td>
@else
<td style="width: 20%;" class="center">
<!-- check if the observation name is compulsory and dispay the appropriate compulsory class -->
@if($observation->compulsory == 1)
<input type="number" step="0.01" required name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 compulsory form-control" style="width: 100%"/>
@else
<input type="number" step="0.01" name="observationsValues[]" id="{{$observation->slug}}" value="" class="col-sm-12 form-control" style="width: 100%"/>
@endif
</td>
<td style="width: 20%;">
<p style="color: #0000FF" class="text-center"><input type="text" readonly="true" value="{{ $observation->option_for_normal }}" class="form-control" style="color: blue;"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}Kews" class="text-center"></p>
</td>
<td style="width: 10%;">
<p id="{{$observation->slug}}NewsText" class="text-center"></p>
<input type="hidden" id="{{$observation->slug}}News" name="{{$observation->slug}}News" value="" class="col-sm-12" />
<input type="hidden" name="adult" id="adult" value="adult" class="col-sm-12" />
</td>
@endif
</tr>
@php $observation_counter++; @endphp
@endif
@endforeach
@endif
@endif
<tr id="nutritional_status_div" style="display: none">
<td class="text-center"><h5>Nutritional Status</h5></td>
<td class="text-center"><h5 style="color: darkorange" id="nutritional_status_text">MAM</h5></td>
<td class="text-center" colspan="2"><h5 style="color: darkorange" id="nutritional_status_reason">BMI 11.83 < 12.7 (BMIz -2SD)</h5></td>
</tr>
@@ -1,47 +0,0 @@
<div class="row">
<h4 class="heading pull-right">{{ __('layout.priority_signs') }}</h4>
</div>
<div class="row">
<table class="table table-bordered table-primary table-blue table-striped table-vertical-center table-condensed">
<tbody>
<tr>
<th scope="row"><div align="left">{{ __('layout.significant_trauma') }}</div></th>
<td><input type="checkbox" name="trauma" id="trauma" value="Yes"></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.severe_pain') }}</div></th>
<td>
<input type="checkbox" name="severe_pain" id="severe_pain" value="yes">
</td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.oedema_both_feet') }}</div></th>
<td><input type="checkbox" name="oedema" id="oedema" value="yes"></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.urgent_surgical_condition') }}</div></th>
<td><input type="checkbox" name="surgical_condition" id="surgical_condition" value="yes"></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.restless_irritable') }}</div></th>
<td><input type="checkbox" name="continuously_irritable" id="continuously_irritable" value="yes"></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.malnutrition_visible_wasting') }}</div></th>
<td><input type="checkbox" name="severe_wasting" id="severe_wasting" value="yes"></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.severe_pallor') }}</div></th>
<td><input type="checkbox" name="severe_pallor" id="severe_pallor" value="yes"></td>
</tr>
<tr>
<th scope="row"><div align="left">{{ __('layout.burns_major') }}</div></th>
<td><input type="checkbox" name="burns" id="burns" value="yes"></td>
</tr>
</tbody>
</table>
</div>
<div class="alert alert-warning ">
<button type="button" class="close" data-dismiss="alert">×</button>
{{ __('layout.positive_move_child_first') }}.
</div>
@@ -1,462 +0,0 @@
@extends('layouts.main')
@section('content')
<div class="row bg-title">
<div class="col-lg-6 col-md-7 col-sm-7 col-xs-12">
<h4 class="page-title">{{ __('triage.triage_started') }}
: {{ streamline_date(get_name($episode_id, 'id', 'created_at', 'patient_episodes')) }}</h4>
</div>
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('triage.dashboard') }}</a></li>
<li><a href="{{ route('patient_episodes.index') }}">{{ __('triage.patient_home') }}</a></li>
<li class="active">{{ __('triage.triage') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<h4>{{ __('triage.patient_details') }}</h4>
<hr>
<div class="row">
<div class="col-md-4">
<div class="table-responsive">
<table class="table table-striped table-bordered">
<tbody>
<tr>
<th>{{ __('triage.patient_number') }}</th>
<td>{{ $patient->number }}</td>
</tr>
<tr>
<th>{{ __('triage.triage_grade') }}</th>
<td><?php echo severe_grade($triage->severe_grade) ?></td>
</tr>
<tr>
<th>{{ __('triage.clinic_allocation') }}</th>
<td>{{ isset($clinics[$triage->clinic_allocation]) ? $clinics[$triage->clinic_allocation] : '' }}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-4">
<div class="table-responsive">
<table class="table table-striped table-bordered">
<tbody>
<tr>
<th>{{ __('triage.referral') }}</th>
<td>{{ isset($referral_hospitals[$triage->referral]) ? $referral_hospitals[$triage->referral] : '' }}</td>
</tr>
<tr>
<th>{{ __('triage.triage_done_by') }}</th>
<td>@php echo get_full_name($triage->created_by, "id", "first_name", "last_name", "users"); @endphp</td>
</tr>
<tr>
<th>{{ __('triage.triage_done_on') }}</th>
<td>{{ $triage->created_at->format('jS M y \a\t g:ia') }}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-4">
<div class="table-responsive">
<table class="table table-striped table-bordered">
<tbody>
<tr>
<th>{{ __('triage.patient_attendance') }}</th>
<td>
@if($triage->new_attendance==1)
{{ __('triage.new_attendance') }}
@elseif($triage->re_attendance==1)
{{ __('triage.re_attendance') }}
@else
{{ __('triage.unknown') }}
@endif
</td>
</tr>
<tr>
<th>{{ __('triage.comment') }}</th>
<td>{{ $triage->comments }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4">
<h4>{{ __('triage.observations') }}</h4>
<hr>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>#</th>
<th>{{ __('triage.observation') }}</th>
<th>{{ __('triage.value') }}</th>
</tr>
</thead>
<tbody>
@php $observation_explode = explode(",", $triage->observations); @endphp
@for ($x = 0; $x < count($observation_explode); $x++)
<tr>
@php $values_explode = explode("=", $observation_explode[$x]); @endphp
<td>{{ $x+1 }}</td>
@foreach ($values_explode as $value)
<td>{{ $value }}</td>
@endforeach
</tr>
@endfor
</tbody>
</table>
</div>
<div class="col-sm-4">
@if(!are_symptoms_on_consultation())
<h4>{{ __('triage.symptoms') }}</h4>
<hr>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>{{ __('triage.symptoms') }}</th>
<th>{{ __('triage.duration') }}</th>
</tr>
</thead>
<tbody>
<tr>
@php
$symptoms_explode = explode(",", $triage->symptoms);
$duration_explode = explode(",", $triage->symptom_duration);
@endphp
@for ($i = 0; $i < count($symptoms_explode); $i++)
<tr>
<td>{{ $symptoms[$symptoms_explode[$i]] ?? '' }}</td>
<td>{{ $duration_explode[$i] ?? '' }}</td>
</tr>
@endfor
</tr>
</tbody>
</table>
@endif
@if ($discharge_mortality && between($age_diff_months, 0, 6) && is_smart_discharge_enabled())
<hr>
<table class="table table-bordered table-striped">
<tr>
<td class="text-center" colspan="2"><h4>Post Discharge Mortality Risk</h4></td>
</tr>
<tr>
<td>{{ Form::label('hospital_travel_duration', 'How long did it take you to travel to the hospital?') }}</td>
<td>
@php $arr = ['1' => '< 30 mins','2' => '30 mins 1 hour','3' => '1 - 4 hours','4' => '> 4 hours']; @endphp
{{ $discharge_mortality->hospital_travel_duration_below_6 ? $arr[$discharge_mortality->hospital_travel_duration_below_6] : "Not Recorded" }}
</td>
</tr>
<tr>
<td>{{ Form::label('illness_duration', 'What is the duration of the present illness at the time of admission?') }}</td>
<td>
@php $arr = ['1' => '< 48 hours','2' => '48 hours - 7 days','3' => '7 days - 1 month','4' => 'More than a month']; @endphp
{{ $discharge_mortality->illness_duration_at_admission_below_6 ? $arr[$discharge_mortality->illness_duration_at_admission_below_6] : "Not Recorded" }}
</td>
</tr>
</table>
@endif
@if ($discharge_mortality && $discharge_mortality->child_with_proven_infection == 1 && between($age_diff_months, 7, 60) && is_smart_discharge_enabled())
<hr>
<table class="table table-bordered table-striped">
<tr>
<td class="text-center" colspan="2"><h4>Post Discharge Mortality Risk</h4></td>
</tr>
<tr>
<td>
{{ Form::label('last_hospitalization', 'Time since last hospitalization') }}
</td>
<td>
@php $arr = ['1' => 'Less than 7 days ago','2' => '7 to 30 days ago','3' => '30 days to 1 year ago','4' => 'More than 1 year ago','5' => 'Never']; @endphp
{{ $discharge_mortality->last_hospitalization ? $arr[$discharge_mortality->last_hospitalization] : "Not Recorded" }}
</td>
</tr>
<tr>
<td>
{{ Form::label('safe_water', 'Do you boil, filter (good sand/ceramic) or disinfect (using bleach/waterguard) all drinking water?') }}
</td>
<td>
@if($discharge_mortality->filter_water == 1)
Yes
@else
No
@endif
</td>
</tr>
<tr>
<td>{{ Form::label('child_mosquito_net', 'Does your child sleep under a mosquito net?') }}</td>
<td>
@php $arr = ['1' => 'Never','2' => 'Sometimes','3' => 'Always']; @endphp
{{ $discharge_mortality->child_mosquito_net ? $arr[$discharge_mortality->child_mosquito_net] : "Not Recorded" }}
</td>
</tr>
<tr>
<td>{{ Form::label('hospital_travel_duration', 'How long did it take you to travel to the hospital?') }}</td>
<td>
@php $arr = ['1' => '< 30 mins','2' => '30 mins 1 hour','3' => '1 - 4 hours','4' => '> 4 hours']; @endphp
{{ $discharge_mortality->hospital_travel_duration ? $arr[$discharge_mortality->hospital_travel_duration] : "Not Recorded" }}
</td>
</tr>
<tr>
<td>{{ Form::label('mother_education_level', 'What is the education level of the childs mother?') }}</td>
<td>
@php $arr = ['1' => 'No school','2' => '<= P3','3' => 'P4-P7','4' => 'S1-S6','5' => 'Post secondary (including post S4 technical school)','6' => 'Do not know']; @endphp
{{ $discharge_mortality->mother_education_level ? $arr[$discharge_mortality->mother_education_level] : "Not Recorded" }}
</td>
</tr>
<tr>
<td>Eye movement</td>
<td>{{ ['1' => 'Watches or follows','0' => 'Fails to watch or follow'][$discharge_mortality->bcs_eye_movement] ?? '' }}</td>
</tr>
<tr>
<td>Best motor response</td>
<td>{{ ['0' => 'No response or inappropriate response','1' => 'Withdraws limb from pain stimulus','2' => 'Localizes painful stimulus'][$discharge_mortality->bcs_best_mortal] ?? '' }}</td>
</tr>
<tr>
<td>Best verbal response</td>
<td>{{ ['0' => 'No vocal response to pain','1' => 'Moan or abnormal cry with pain','2' => 'Cries appropriately with pain (or speaks if verbal)'][$discharge_mortality->bcs_best_verbal] ?? '' }}</td>
</tr>
<tr>
<td>Mother's age</td>
<td>{{ $discharge_mortality->maternal_age }}</td>
</tr>
</table>
@endif
@if ($triage->any_tb_sysmptoms == 1)
<table class="tb_questions_table table table-striped table-bordered">
<tr>
<td class="text-center" colspan="2"><h4>TB SCREENING</h4></td>
</tr>
<tr class="cough_tb_question">
<td>A cough for more than two weeks ?</td>
<td>{{ $triage->cough_for_2_weeks == 1 ? "Yes" : "No" }}</td>
</tr>
<tr class="fever_tb_question">
<td>Persistent fevers for 2 weeks or more ?</td>
<td>{{ $triage->fever_for_2_weeks == 1 ? "Yes" : "No" }}</td>
</tr>
<tr class="weight_loss_tb_question">
<td>Noticable weight loss of more than 3 Kg?</td>
<td>{{ $triage->tb_weight_loss == 1 ? "Yes" : "No" }}</td>
</tr>
<tr class="weight_loss_tb_question">
<td>Poor weight gain in the last one month ?</td>
<td>{{ $triage->tb_poor_weight_gain == 1 ? "Yes" : "No" }}</td>
</tr>
<tr class="excessive_night_sweats_tb_question">
<td>Excessive night sweats for three weeks or more ?</td>
<td>{{ $triage->tb_excessive_night_sweats == 1 ? "Yes" : "No" }}</td>
</tr>
<tr class="excessive_night_sweats_tb_question">
<td>Contact with a person with pulmonary TB or chronic cough ?</td>
<td>{{ $triage->tb_contact_with_tb_person == 1 ? "Yes" : "No" }}</td>
</tr>
</table>
@endif
@if(is_smart_triage_enabled() && $nutrition)
<table class="table table-striped table-bordered">
<tr>
<td class="text-center" colspan="2"><h4>Nutritional Status</h4></td>
</tr>
<tr class="cough_tb_question">
<td>{{ $nutrition->text }}</td>
<td>{{ $nutrition->reason }}</td>
</tr>
</table>
@endif
</div>
<div class="col-sm-4">
@if(!$triage_without_etat)
@if (between($years, 16, 50) && $triage->fp_too_sick == 0)
<h4>{{ __('triage.family_planning') }}</h4>
<table class="table table-striped table-bordered">
<tr>
<td>1</td>
<td>{{ __('triage.too_sick') }}</td>
@if(is_null($triage->fp_too_sick))
<td> N/A</td>
@else
<td>{{ ($triage->fp_too_sick == 1) ? __('triage.yes') : __('triage.no') }}</td>
@endif
</tr>
<tr>
<td>2</td>
<td>{{ __('triage.sexually_active') }}</td>
@if(is_null($triage->sexually_active))
<td> N/A</td>
@else
<td>{{ ($triage->sexually_active == 1) ? __('triage.yes') : __('triage.no') }}</td>
@endif
</tr>
<tr>
<td>3</td>
<td>{{ __('triage.pregnant') }}</td>
@if(is_null($triage->pregnant))
<td> N/A</td>
@else
<td>{{ ($triage->pregnant == 1) ? __('triage.yes') : __('triage.no') }}</td>
@endif
</tr>
<tr>
<td>4</td>
<td>{{ __('triage.menopause') }}</td>
@if(is_null($triage->menopause))
<td> N/A</td>
@else
<td>{{ ($triage->menopause == 1) ? __('triage.yes') : __('triage.no') }}</td>
@endif
</tr>
<tr>
<td>5</td>
<td>{{ __('triage.family_planning_method') }}</td>
<td>{{ isset($triage->fp_method) ? $family_planning_methods[$triage->fp_method] : "N/A" }}</td>
</tr>
<tr>
<td>6</td>
<td>{{ __('triage.action') }}</td>
<td>{{ isset($triage->fp_action) ? $triage->fp_action : "N/A" }}</td>
</tr>
</table>
@endif
@if (between($years, 0, 12))
<h4>{{ __('triage.emergency_signs') }}</h4>
<hr>
<table class="table table-striped table-bordered">
<tbody>
<tr>
<th colspan="2" class="text-center">{{ __('triage.airway') }}</th>
</tr>
@foreach($airway as $key => $value)
<tr>
<th>{{ $key }}</th>
<td>{{ ucfirst($value) }}</td>
</tr>
@endforeach
<tr>
<th colspan="2" class="text-center">{{ __('triage.circulation') }}</th>
</tr>
@foreach($circulation as $key => $value)
<tr>
<th>{{ $key }}</th>
<td>{{ ucfirst($value) }}</td>
</tr>
@endforeach
<tr>
<th colspan="2" class="text-center">{{ __('triage.neurological') }}</th>
</tr>
@foreach($neurological as $key => $value)
<tr>
<th>{{ $key }}</th>
<td>{{ ucfirst($value) }}</td>
</tr>
@endforeach
<tr>
<th colspan="2" class="text-center">{{ __('triage.dehydration') }}</th>
</tr>
@foreach($dehydration as $key => $value)
<tr>
<th>{{ $key }}</th>
<td>{{ ucfirst($value) }}</td>
</tr>
@endforeach
</tbody>
</table>
@endif
@if (between($years, 0, 12) && count($priority_signs) > 0)
<h4>{{ __('layout.priority_signs') }}</h4>
<hr>
<table class="table table-striped table-bordered">
<tbody>
@foreach($priority_signs as $priority_sign)
<tr>
<td>{{ $priority_sign }}</td>
</tr>
@endforeach
</tbody>
</table>
@endif
@else
<h4>Notes</h4>
<hr>
<div class="table-responsive">
<table class="table table-striped table-bordered">
<tbody>
<tr>
<th>{{ __('triage.choose_blood_group') }}</th>
<td>{{ $triage->blood_group }}</td>
</tr>
<tr>
<th>{{ __('triage.rhesus_factor') }}</th>
<td>
@if($triage->rhesus_factor == 1)
{{ __('triage.positive') }}
@elseif($triage->rhesus_factor == 2)
{{ __('triage.negative') }}
@else
{{ __('triage.unknown') }}
@endif
</td>
</tr>
<tr>
<th>{{ __('triage.observation_notes') }}</th>
<td>{{ ($triage->observation_notes) ?? "No notes available" }}</td>
</tr>
<tr>
<th>{{ __('triage.nursing_notes') }}</th>
<td>{{ ($triage->nursing_notes) ?? "No notes available" }}</td>
</tr>
</tbody>
</table>
</div>
@endif
</div>
</div>
<hr>
<div>
@php $clinic_slug = get_name($triage->clinic_allocation, "id", "slug", "clinics"); @endphp
@if($clinic_slug == "diabetes")
{{ Form::open(['route' => 'diabetes_clinic.clinic_registration']) }}
{{ Form::button(__('triage.go_to_diabetes'),['type'=>'submit','class'=>'btn btn-success btn-block']) }}
{{ Form::close() }}
@endif
</div>
@if(Auth::user()->can('edit-patient-triage'))
<a href="/triage/{{ $triage->id }}/edit/" class="btn btn-success"> Modify Triage </a>
@endif
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/js/validator.js') }}"></script>
@endpush

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