@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public static function getNextDay($month, $day) |
| 67 | 67 | { |
| 68 | - return Utils::getNextDayDate('Y-' . $month . '-' . $day); |
|
| 68 | + return Utils::getNextDayDate('Y-'.$month.'-'.$day); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public static function getNextMonthFirstDay($month, $day) |
| 104 | 104 | { |
| 105 | - return date('Y-m-d', strtotime('+1 month', strtotime(date('Y-' . $month . '-01')))); |
|
| 105 | + return date('Y-m-d', strtotime('+1 month', strtotime(date('Y-'.$month.'-01')))); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -129,10 +129,10 @@ discard block |
||
| 129 | 129 | } else |
| 130 | 130 | if ($day == null) { |
| 131 | 131 | // first day of mnth |
| 132 | - $date = new \DateTime(date('Y-') . $month . '-01'); |
|
| 132 | + $date = new \DateTime(date('Y-').$month.'-01'); |
|
| 133 | 133 | } else { |
| 134 | 134 | // date |
| 135 | - $date = new \DateTime(date('Y-' . $month . '-' . $day)); |
|
| 135 | + $date = new \DateTime(date('Y-'.$month.'-'.$day)); |
|
| 136 | 136 | } |
| 137 | 137 | return $date->format('Y-m-d'); |
| 138 | 138 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | public static function getStartEndDate($dateParam) |
| 172 | 172 | { |
| 173 | - if (empty($dateParam) || ! in_array($dateParam, array( |
|
| 173 | + if (empty($dateParam) || !in_array($dateParam, array( |
|
| 174 | 174 | 0, |
| 175 | 175 | 1, |
| 176 | 176 | 7 |
@@ -55,23 +55,23 @@ discard block |
||
| 55 | 55 | * loading envs |
| 56 | 56 | */ |
| 57 | 57 | private static function _loadEnv() { |
| 58 | - if (getenv ( 'DB_NAME' ) != null && getenv ( 'DB_NAME' ) != "") { |
|
| 58 | + if (getenv('DB_NAME') != null && getenv('DB_NAME') != "") { |
|
| 59 | 59 | return; |
| 60 | 60 | } |
| 61 | - if (defined ( 'ABSPATH' )) { |
|
| 62 | - \Dotenv::load ( ABSPATH ); |
|
| 61 | + if (defined('ABSPATH')) { |
|
| 62 | + \Dotenv::load(ABSPATH); |
|
| 63 | 63 | } else { |
| 64 | - \Dotenv::load ( getenv ( 'HOME' ) ); |
|
| 64 | + \Dotenv::load(getenv('HOME')); |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | private static function getPaths() { |
| 68 | - if (file_exists ( getcwd () . "/src/Entities" )) { |
|
| 69 | - return array ( |
|
| 70 | - getcwd () . "/src/Entities" |
|
| 68 | + if (file_exists(getcwd()."/src/Entities")) { |
|
| 69 | + return array( |
|
| 70 | + getcwd()."/src/Entities" |
|
| 71 | 71 | ); |
| 72 | 72 | } else { |
| 73 | - return array ( |
|
| 74 | - getcwd () . "/vendor/amarcinkowski/hospitalplugin/src/Entities" |
|
| 73 | + return array( |
|
| 74 | + getcwd()."/vendor/amarcinkowski/hospitalplugin/src/Entities" |
|
| 75 | 75 | ); |
| 76 | 76 | } |
| 77 | 77 | } |
@@ -82,21 +82,21 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | private static function _getInstance() { |
| 84 | 84 | $isDevMode = true; |
| 85 | - $config = Setup::createAnnotationMetadataConfiguration ( self::getPaths (), $isDevMode ); |
|
| 86 | - self::_loadEnv (); |
|
| 87 | - $conn = array ( |
|
| 88 | - 'dbname' => getenv ( 'DB_NAME' ), |
|
| 89 | - 'user' => getenv ( 'DB_USER' ), |
|
| 90 | - 'password' => getenv ( 'DB_PASSWORD' ), |
|
| 91 | - 'host' => getenv ( 'DB_HOST' ), |
|
| 85 | + $config = Setup::createAnnotationMetadataConfiguration(self::getPaths(), $isDevMode); |
|
| 86 | + self::_loadEnv(); |
|
| 87 | + $conn = array( |
|
| 88 | + 'dbname' => getenv('DB_NAME'), |
|
| 89 | + 'user' => getenv('DB_USER'), |
|
| 90 | + 'password' => getenv('DB_PASSWORD'), |
|
| 91 | + 'host' => getenv('DB_HOST'), |
|
| 92 | 92 | 'driver' => 'pdo_mysql', |
| 93 | 93 | 'charset' => 'utf8', |
| 94 | - 'driverOptions' => array ( |
|
| 94 | + 'driverOptions' => array( |
|
| 95 | 95 | 1002 => 'SET NAMES utf8' |
| 96 | 96 | ), |
| 97 | 97 | 'mapping_types' => 'enum:string' |
| 98 | 98 | ); |
| 99 | - return EntityManager::create ( $conn, $config ); |
|
| 99 | + return EntityManager::create($conn, $config); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -106,14 +106,14 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public static function getEntityManager() { |
| 108 | 108 | if (self::$_entityManager == null) { |
| 109 | - self::$_entityManager = self::_getInstance (); |
|
| 109 | + self::$_entityManager = self::_getInstance(); |
|
| 110 | 110 | } |
| 111 | 111 | return self::$_entityManager; |
| 112 | 112 | } |
| 113 | 113 | public static function getCli() { |
| 114 | - $em = DoctrineBootstrap::getEntityManager (); |
|
| 115 | - $em->getConnection ()->getDatabasePlatform ()->registerDoctrineTypeMapping ( 'enum', 'string' ); |
|
| 116 | - return ConsoleRunner::createHelperSet ( $em ); |
|
| 114 | + $em = DoctrineBootstrap::getEntityManager(); |
|
| 115 | + $em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); |
|
| 116 | + return ConsoleRunner::createHelperSet($em); |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function hospitalRegisterStyle($file) |
| 83 | 83 | { |
| 84 | - wp_register_style('hospital_admin_style' . $file, $this->path . '/css/' . $file, array(), '1', 'all'); |
|
| 85 | - wp_enqueue_style('hospital_admin_style' . $file); |
|
| 84 | + wp_register_style('hospital_admin_style'.$file, $this->path.'/css/'.$file, array(), '1', 'all'); |
|
| 85 | + wp_enqueue_style('hospital_admin_style'.$file); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function hospitalRegisterScript($file, $required = null, $hook = null) |
| 94 | 94 | { |
| 95 | - wp_enqueue_script('hospital_admin_script' . $file, $this->path . '/js/' . $file, $required); |
|
| 95 | + wp_enqueue_script('hospital_admin_script'.$file, $this->path.'/js/'.$file, $required); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $params = array( |
| 107 | 107 | 'my_arr' => $json_dates |
| 108 | 108 | ); |
| 109 | - wp_localize_script('hospital_admin_script' . $file, 'php_params', $params); |
|
| 109 | + wp_localize_script('hospital_admin_script'.$file, 'php_params', $params); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -14,10 +14,10 @@ discard block |
||
| 14 | 14 | * @param unknown $date |
| 15 | 15 | */ |
| 16 | 16 | public static function getRaport($wardId, $date, $wardType) { |
| 17 | - $startDate = $date . '-01'; |
|
| 18 | - $endDate = date ( "Y-m-t 23:59:59", strtotime ( $startDate ) ); |
|
| 17 | + $startDate = $date.'-01'; |
|
| 18 | + $endDate = date("Y-m-t 23:59:59", strtotime($startDate)); |
|
| 19 | 19 | |
| 20 | - return PatientRaport::getRaportBetweenDates ( $wardId, $wardType, $startDate, $endDate ); |
|
| 20 | + return PatientRaport::getRaportBetweenDates($wardId, $wardType, $startDate, $endDate); |
|
| 21 | 21 | } |
| 22 | 22 | private static function getQuery($type) { |
| 23 | 23 | if ($type == 'POR') { |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $dql2 .= " FROM Hospitalplugin\Entities\PatientPOR p "; |
| 32 | 32 | $dql2 .= " WHERE p.dataKategoryzacji BETWEEN ?1 AND ?2 AND p.oddzialId = ?3 AND (p.iICzas <> 3 OR p.iICzas IS NULL)"; |
| 33 | 33 | $dql2 .= " GROUP BY data, p.kategoriaPacjenta"; |
| 34 | - return array ( |
|
| 34 | + return array( |
|
| 35 | 35 | $dql1, |
| 36 | 36 | $dql2 |
| 37 | 37 | ); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $dql .= " FROM Hospitalplugin\Entities\Patient p "; |
| 42 | 42 | $dql .= " WHERE p.dataKategoryzacji BETWEEN ?1 AND ?2 AND p.oddzialId = ?3"; |
| 43 | 43 | $dql .= " GROUP BY data, p.kategoriaPacjenta"; |
| 44 | - return array ( |
|
| 44 | + return array( |
|
| 45 | 45 | $dql |
| 46 | 46 | ); |
| 47 | 47 | } |
@@ -55,17 +55,17 @@ discard block |
||
| 55 | 55 | * @return array |
| 56 | 56 | */ |
| 57 | 57 | public static function getRaportBetweenDates($wardId, $type, $startDate, $endDate) { |
| 58 | - $em = DoctrineBootstrap::getEntityManager (); |
|
| 59 | - $em->getConfiguration ()->addCustomDatetimeFunction ( 'DATE', 'Hospitalplugin\DQLFunctions\DateFunction' ); |
|
| 60 | - $dql = PatientRaport::getQuery ( $type ); |
|
| 61 | - $allResults = array (); |
|
| 62 | - foreach ( $dql as $query ) { |
|
| 63 | - $result = $em->createQuery ( $query )->setParameter ( 1, $startDate )->setParameter ( 2, $endDate )->setParameter ( 3, $wardId )->getResult (); |
|
| 64 | - $allResults = array_merge ( $result, $allResults ); |
|
| 58 | + $em = DoctrineBootstrap::getEntityManager(); |
|
| 59 | + $em->getConfiguration()->addCustomDatetimeFunction('DATE', 'Hospitalplugin\DQLFunctions\DateFunction'); |
|
| 60 | + $dql = PatientRaport::getQuery($type); |
|
| 61 | + $allResults = array(); |
|
| 62 | + foreach ($dql as $query) { |
|
| 63 | + $result = $em->createQuery($query)->setParameter(1, $startDate)->setParameter(2, $endDate)->setParameter(3, $wardId)->getResult(); |
|
| 64 | + $allResults = array_merge($result, $allResults); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $table = array (); |
|
| 68 | - foreach ( $allResults as $row ) { |
|
| 67 | + $table = array(); |
|
| 68 | + foreach ($allResults as $row) { |
|
| 69 | 69 | $table [$row ['data']] [$row ['kategoria']] = $row ['suma']; |
| 70 | 70 | } |
| 71 | 71 | return $table; |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | static function getColumns($type) { |
| 77 | 77 | if ($type == 'POR') { |
| 78 | - return array ( |
|
| 78 | + return array( |
|
| 79 | 79 | 'N1 naturalny', |
| 80 | 80 | 'N2 naturalny', |
| 81 | 81 | 'N3 naturalny', |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | 'Tpb/dzień' |
| 104 | 104 | ); |
| 105 | 105 | } else { |
| 106 | - return array ( |
|
| 106 | + return array( |
|
| 107 | 107 | 'N1', |
| 108 | 108 | 'N2', |
| 109 | 109 | 'N3', |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | } |
| 126 | 126 | static function getIndexes($type) { |
| 127 | 127 | if ($type == 'POR') { |
| 128 | - return array ( |
|
| 128 | + return array( |
|
| 129 | 129 | '1', |
| 130 | 130 | '2', |
| 131 | 131 | '3', |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | '0' |
| 136 | 136 | ); |
| 137 | 137 | } else { |
| 138 | - return array ( |
|
| 138 | + return array( |
|
| 139 | 139 | '1', |
| 140 | 140 | '2', |
| 141 | 141 | '3', |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | static function getTpb($type) { |
| 155 | 155 | if ($type == 'ZZ' || $type == 'PED') { |
| 156 | - return array ( |
|
| 156 | + return array( |
|
| 157 | 157 | 38, |
| 158 | 158 | 95, |
| 159 | 159 | 159, |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | 2 |
| 162 | 162 | ); |
| 163 | 163 | } else if ($type == 'PSY') { |
| 164 | - return array ( |
|
| 164 | + return array( |
|
| 165 | 165 | 40, |
| 166 | 166 | 100, |
| 167 | 167 | 160, |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | 2 |
| 170 | 170 | ); |
| 171 | 171 | } else if ($type == 'POR') { |
| 172 | - return array ( |
|
| 172 | + return array( |
|
| 173 | 173 | 137, |
| 174 | 174 | 274, |
| 175 | 175 | 328, |
@@ -180,14 +180,14 @@ discard block |
||
| 180 | 180 | 2 |
| 181 | 181 | ); |
| 182 | 182 | } else if ($type == 'DIA') { |
| 183 | - return array ( |
|
| 183 | + return array( |
|
| 184 | 184 | 52, |
| 185 | 185 | 112, |
| 186 | 186 | 0, |
| 187 | 187 | 2 |
| 188 | 188 | ); |
| 189 | 189 | } else if ($type == 'POL') { |
| 190 | - return array ( |
|
| 190 | + return array( |
|
| 191 | 191 | 72, |
| 192 | 192 | 100, |
| 193 | 193 | 98, |