@@ -25,8 +25,6 @@ |
||
| 25 | 25 | namespace Hospitalplugin\Entities; |
| 26 | 26 | |
| 27 | 27 | use Hospitalplugin\DB\DoctrineBootstrap; |
| 28 | -use Hospitalplugin\utils\Utils; |
|
| 29 | -use Hospitalplugin\Twig\EscapePLCharsExtension; |
|
| 30 | 28 | use Hospitalplugin\Entities\WardCRUD; |
| 31 | 29 | use Hospitalplugin\Twig\PLTwig; |
| 32 | 30 | |
@@ -31,30 +31,30 @@ |
||
| 31 | 31 | use Hospitalplugin\Twig\PLTwig; |
| 32 | 32 | |
| 33 | 33 | class HospitalForm { |
| 34 | - public static function load($yaml, $class, $dir) { |
|
| 35 | - try { |
|
| 36 | - $em = DoctrineBootstrap::getEntityManager (); |
|
| 34 | + public static function load($yaml, $class, $dir) { |
|
| 35 | + try { |
|
| 36 | + $em = DoctrineBootstrap::getEntityManager (); |
|
| 37 | 37 | |
| 38 | - $userId = $userId = wp_get_current_user ()->ID; |
|
| 39 | - $ward = WardCRUD::getWardForUser ( $userId ); |
|
| 40 | - $user = $em->find ( "\Hospitalplugin\Entities\User", $userId ); |
|
| 38 | + $userId = $userId = wp_get_current_user ()->ID; |
|
| 39 | + $ward = WardCRUD::getWardForUser ( $userId ); |
|
| 40 | + $user = $em->find ( "\Hospitalplugin\Entities\User", $userId ); |
|
| 41 | 41 | |
| 42 | - if (! empty ( $_POST )) { |
|
| 43 | - $args = $_POST; |
|
| 44 | - $i = new $class ( $args ); |
|
| 45 | - $i->setWard ( $ward ); |
|
| 46 | - $i->setUser ( $user ); |
|
| 47 | - $em->persist ( $i ); |
|
| 48 | - $em->flush (); |
|
| 49 | - } else { |
|
| 50 | - $object = \Hospitalplugin\utils\YAML2Object::getObject ( $yaml ); |
|
| 51 | - echo PLTwig::load ( $dir )->render ( 'form.twig', array ( |
|
| 52 | - 'infections' => $object |
|
| 53 | - ) ); |
|
| 54 | - } |
|
| 55 | - } catch ( Exception $e ) { |
|
| 56 | - echo "ERR: " . $e; |
|
| 57 | - } |
|
| 58 | - } |
|
| 42 | + if (! empty ( $_POST )) { |
|
| 43 | + $args = $_POST; |
|
| 44 | + $i = new $class ( $args ); |
|
| 45 | + $i->setWard ( $ward ); |
|
| 46 | + $i->setUser ( $user ); |
|
| 47 | + $em->persist ( $i ); |
|
| 48 | + $em->flush (); |
|
| 49 | + } else { |
|
| 50 | + $object = \Hospitalplugin\utils\YAML2Object::getObject ( $yaml ); |
|
| 51 | + echo PLTwig::load ( $dir )->render ( 'form.twig', array ( |
|
| 52 | + 'infections' => $object |
|
| 53 | + ) ); |
|
| 54 | + } |
|
| 55 | + } catch ( Exception $e ) { |
|
| 56 | + echo "ERR: " . $e; |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | 59 | } |
| 60 | 60 | ?> |
| 61 | 61 | \ No newline at end of file |
@@ -33,27 +33,27 @@ |
||
| 33 | 33 | class HospitalForm { |
| 34 | 34 | public static function load($yaml, $class, $dir) { |
| 35 | 35 | try { |
| 36 | - $em = DoctrineBootstrap::getEntityManager (); |
|
| 36 | + $em = DoctrineBootstrap::getEntityManager(); |
|
| 37 | 37 | |
| 38 | - $userId = $userId = wp_get_current_user ()->ID; |
|
| 39 | - $ward = WardCRUD::getWardForUser ( $userId ); |
|
| 40 | - $user = $em->find ( "\Hospitalplugin\Entities\User", $userId ); |
|
| 38 | + $userId = $userId = wp_get_current_user()->ID; |
|
| 39 | + $ward = WardCRUD::getWardForUser($userId); |
|
| 40 | + $user = $em->find("\Hospitalplugin\Entities\User", $userId); |
|
| 41 | 41 | |
| 42 | - if (! empty ( $_POST )) { |
|
| 42 | + if (!empty ($_POST)) { |
|
| 43 | 43 | $args = $_POST; |
| 44 | - $i = new $class ( $args ); |
|
| 45 | - $i->setWard ( $ward ); |
|
| 46 | - $i->setUser ( $user ); |
|
| 47 | - $em->persist ( $i ); |
|
| 48 | - $em->flush (); |
|
| 44 | + $i = new $class($args); |
|
| 45 | + $i->setWard($ward); |
|
| 46 | + $i->setUser($user); |
|
| 47 | + $em->persist($i); |
|
| 48 | + $em->flush(); |
|
| 49 | 49 | } else { |
| 50 | - $object = \Hospitalplugin\utils\YAML2Object::getObject ( $yaml ); |
|
| 51 | - echo PLTwig::load ( $dir )->render ( 'form.twig', array ( |
|
| 50 | + $object = \Hospitalplugin\utils\YAML2Object::getObject($yaml); |
|
| 51 | + echo PLTwig::load($dir)->render('form.twig', array( |
|
| 52 | 52 | 'infections' => $object |
| 53 | - ) ); |
|
| 53 | + )); |
|
| 54 | 54 | } |
| 55 | - } catch ( Exception $e ) { |
|
| 56 | - echo "ERR: " . $e; |
|
| 55 | + } catch (Exception $e) { |
|
| 56 | + echo "ERR: ".$e; |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | /** |
| 87 | 87 | * getId |
| 88 | 88 | * |
| 89 | - * @return id |
|
| 89 | + * @return integer |
|
| 90 | 90 | */ |
| 91 | 91 | public function getId() { |
| 92 | 92 | return $this->id; |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @param int $id |
| 99 | 99 | * ID |
| 100 | 100 | * |
| 101 | - * @return \Hospitalplugin\Entities\Patient |
|
| 101 | + * @return InfectionRaport |
|
| 102 | 102 | */ |
| 103 | 103 | public function setId($id) { |
| 104 | 104 | $this->id = $id; |
@@ -39,116 +39,116 @@ |
||
| 39 | 39 | */ |
| 40 | 40 | class InfectionRaport { |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * id |
|
| 44 | - * @Id @Column(type="integer") @GeneratedValue |
|
| 45 | - */ |
|
| 46 | - public $id; |
|
| 42 | + /** |
|
| 43 | + * id |
|
| 44 | + * @Id @Column(type="integer") @GeneratedValue |
|
| 45 | + */ |
|
| 46 | + public $id; |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * $dataRaportu datetime |
|
| 50 | - * @Column(type="datetime") * |
|
| 51 | - */ |
|
| 52 | - public $dataRaportu; |
|
| 48 | + /** |
|
| 49 | + * $dataRaportu datetime |
|
| 50 | + * @Column(type="datetime") * |
|
| 51 | + */ |
|
| 52 | + public $dataRaportu; |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * $dataPrzeslania datetime |
|
| 56 | - * @Column(type="datetime") * |
|
| 57 | - */ |
|
| 58 | - public $dataPrzeslania; |
|
| 54 | + /** |
|
| 55 | + * $dataPrzeslania datetime |
|
| 56 | + * @Column(type="datetime") * |
|
| 57 | + */ |
|
| 58 | + public $dataPrzeslania; |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @ManyToOne(targetEntity="Hospitalplugin\Entities\Ward") |
|
| 62 | - * @JoinColumn(name="oddzialId", referencedColumnName="id") |
|
| 63 | - */ |
|
| 64 | - public $ward; |
|
| 60 | + /** |
|
| 61 | + * @ManyToOne(targetEntity="Hospitalplugin\Entities\Ward") |
|
| 62 | + * @JoinColumn(name="oddzialId", referencedColumnName="id") |
|
| 63 | + */ |
|
| 64 | + public $ward; |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * @ManyToOne(targetEntity="Hospitalplugin\Entities\User") |
|
| 68 | - * @JoinColumn(name="userId", referencedColumnName="id") |
|
| 69 | - */ |
|
| 70 | - protected $user; |
|
| 66 | + /** |
|
| 67 | + * @ManyToOne(targetEntity="Hospitalplugin\Entities\User") |
|
| 68 | + * @JoinColumn(name="userId", referencedColumnName="id") |
|
| 69 | + */ |
|
| 70 | + protected $user; |
|
| 71 | 71 | |
| 72 | - function __construct($args) { |
|
| 73 | - foreach ( $args as $key => $value ) { |
|
| 74 | - if ($key == 'dataRaportu') { |
|
| 75 | - $value = new \DateTime ( $value ); |
|
| 76 | - } |
|
| 77 | - call_user_func ( array ( |
|
| 78 | - $this, |
|
| 79 | - 'set' . $key |
|
| 80 | - ), $value ); |
|
| 81 | - } |
|
| 82 | - $this->dataPrzeslania = new \DateTime (); |
|
| 83 | - echo '<h3><div class="alert alert-primary">Dziękuję za przesłanie raportu!</div></h3>'; |
|
| 84 | - } |
|
| 72 | + function __construct($args) { |
|
| 73 | + foreach ( $args as $key => $value ) { |
|
| 74 | + if ($key == 'dataRaportu') { |
|
| 75 | + $value = new \DateTime ( $value ); |
|
| 76 | + } |
|
| 77 | + call_user_func ( array ( |
|
| 78 | + $this, |
|
| 79 | + 'set' . $key |
|
| 80 | + ), $value ); |
|
| 81 | + } |
|
| 82 | + $this->dataPrzeslania = new \DateTime (); |
|
| 83 | + echo '<h3><div class="alert alert-primary">Dziękuję za przesłanie raportu!</div></h3>'; |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - /** |
|
| 87 | - * getId |
|
| 88 | - * |
|
| 89 | - * @return id |
|
| 90 | - */ |
|
| 91 | - public function getId() { |
|
| 92 | - return $this->id; |
|
| 93 | - } |
|
| 86 | + /** |
|
| 87 | + * getId |
|
| 88 | + * |
|
| 89 | + * @return id |
|
| 90 | + */ |
|
| 91 | + public function getId() { |
|
| 92 | + return $this->id; |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - /** |
|
| 96 | - * sets id |
|
| 97 | - * |
|
| 98 | - * @param int $id |
|
| 99 | - * ID |
|
| 100 | - * |
|
| 101 | - * @return \Hospitalplugin\Entities\Patient |
|
| 102 | - */ |
|
| 103 | - public function setId($id) { |
|
| 104 | - $this->id = $id; |
|
| 105 | - return $this; |
|
| 106 | - } |
|
| 95 | + /** |
|
| 96 | + * sets id |
|
| 97 | + * |
|
| 98 | + * @param int $id |
|
| 99 | + * ID |
|
| 100 | + * |
|
| 101 | + * @return \Hospitalplugin\Entities\Patient |
|
| 102 | + */ |
|
| 103 | + public function setId($id) { |
|
| 104 | + $this->id = $id; |
|
| 105 | + return $this; |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * toString |
|
| 110 | - * |
|
| 111 | - * @return string |
|
| 112 | - */ |
|
| 113 | - public function toString() { |
|
| 114 | - $txt = $this->getId (); |
|
| 115 | - $data = $this->getDataRaportu (); |
|
| 116 | - if ($data instanceof \DateTime) { |
|
| 117 | - $txt .= $this->getDataRaportu ()->format ( "Y-m-d" ); |
|
| 118 | - } else { |
|
| 119 | - $txt .= $this->getDataRaportu (); |
|
| 120 | - } |
|
| 121 | - return $txt; |
|
| 122 | - } |
|
| 123 | - public function getDataRaportu() { |
|
| 124 | - return $this->dataRaportu; |
|
| 125 | - } |
|
| 126 | - public function setDataRaportu($dataRaportu) { |
|
| 127 | - $this->dataRaportu = $dataRaportu; |
|
| 128 | - return $this; |
|
| 129 | - } |
|
| 108 | + /** |
|
| 109 | + * toString |
|
| 110 | + * |
|
| 111 | + * @return string |
|
| 112 | + */ |
|
| 113 | + public function toString() { |
|
| 114 | + $txt = $this->getId (); |
|
| 115 | + $data = $this->getDataRaportu (); |
|
| 116 | + if ($data instanceof \DateTime) { |
|
| 117 | + $txt .= $this->getDataRaportu ()->format ( "Y-m-d" ); |
|
| 118 | + } else { |
|
| 119 | + $txt .= $this->getDataRaportu (); |
|
| 120 | + } |
|
| 121 | + return $txt; |
|
| 122 | + } |
|
| 123 | + public function getDataRaportu() { |
|
| 124 | + return $this->dataRaportu; |
|
| 125 | + } |
|
| 126 | + public function setDataRaportu($dataRaportu) { |
|
| 127 | + $this->dataRaportu = $dataRaportu; |
|
| 128 | + return $this; |
|
| 129 | + } |
|
| 130 | 130 | |
| 131 | - public function getDataPrzeslania() { |
|
| 132 | - return $this->dataPrzeslania; |
|
| 133 | - } |
|
| 134 | - public function setDataPrzeslania($dataPrzeslania) { |
|
| 135 | - $this->dataPrzeslania = $dataPrzeslania; |
|
| 136 | - return $this; |
|
| 137 | - } |
|
| 138 | - public function getWard() { |
|
| 139 | - return $this->ward; |
|
| 140 | - } |
|
| 141 | - public function setWard($ward) { |
|
| 142 | - $this->ward = $ward; |
|
| 143 | - return $this; |
|
| 144 | - } |
|
| 145 | - public function getUser() { |
|
| 146 | - return $this->user; |
|
| 147 | - } |
|
| 148 | - public function setUser($user) { |
|
| 149 | - $this->user = $user; |
|
| 150 | - return $this; |
|
| 151 | - } |
|
| 131 | + public function getDataPrzeslania() { |
|
| 132 | + return $this->dataPrzeslania; |
|
| 133 | + } |
|
| 134 | + public function setDataPrzeslania($dataPrzeslania) { |
|
| 135 | + $this->dataPrzeslania = $dataPrzeslania; |
|
| 136 | + return $this; |
|
| 137 | + } |
|
| 138 | + public function getWard() { |
|
| 139 | + return $this->ward; |
|
| 140 | + } |
|
| 141 | + public function setWard($ward) { |
|
| 142 | + $this->ward = $ward; |
|
| 143 | + return $this; |
|
| 144 | + } |
|
| 145 | + public function getUser() { |
|
| 146 | + return $this->user; |
|
| 147 | + } |
|
| 148 | + public function setUser($user) { |
|
| 149 | + $this->user = $user; |
|
| 150 | + return $this; |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | 153 | |
| 154 | 154 | } |
@@ -70,16 +70,16 @@ discard block |
||
| 70 | 70 | protected $user; |
| 71 | 71 | |
| 72 | 72 | function __construct($args) { |
| 73 | - foreach ( $args as $key => $value ) { |
|
| 73 | + foreach ($args as $key => $value) { |
|
| 74 | 74 | if ($key == 'dataRaportu') { |
| 75 | - $value = new \DateTime ( $value ); |
|
| 75 | + $value = new \DateTime($value); |
|
| 76 | 76 | } |
| 77 | - call_user_func ( array ( |
|
| 77 | + call_user_func(array( |
|
| 78 | 78 | $this, |
| 79 | - 'set' . $key |
|
| 80 | - ), $value ); |
|
| 79 | + 'set'.$key |
|
| 80 | + ), $value); |
|
| 81 | 81 | } |
| 82 | - $this->dataPrzeslania = new \DateTime (); |
|
| 82 | + $this->dataPrzeslania = new \DateTime(); |
|
| 83 | 83 | echo '<h3><div class="alert alert-primary">Dziękuję za przesłanie raportu!</div></h3>'; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -111,12 +111,12 @@ discard block |
||
| 111 | 111 | * @return string |
| 112 | 112 | */ |
| 113 | 113 | public function toString() { |
| 114 | - $txt = $this->getId (); |
|
| 115 | - $data = $this->getDataRaportu (); |
|
| 114 | + $txt = $this->getId(); |
|
| 115 | + $data = $this->getDataRaportu(); |
|
| 116 | 116 | if ($data instanceof \DateTime) { |
| 117 | - $txt .= $this->getDataRaportu ()->format ( "Y-m-d" ); |
|
| 117 | + $txt .= $this->getDataRaportu()->format("Y-m-d"); |
|
| 118 | 118 | } else { |
| 119 | - $txt .= $this->getDataRaportu (); |
|
| 119 | + $txt .= $this->getDataRaportu(); |
|
| 120 | 120 | } |
| 121 | 121 | return $txt; |
| 122 | 122 | } |
@@ -28,6 +28,12 @@ |
||
| 28 | 28 | use Hospitalplugin\utils\Utils; |
| 29 | 29 | |
| 30 | 30 | class InfectionsCRUD { |
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * @param string $from |
|
| 34 | + * @param string $to |
|
| 35 | + * @param string $class |
|
| 36 | + */ |
|
| 31 | 37 | public static function getInfections($from, $to, $wardId, $class) { |
| 32 | 38 | $em = ( object ) DoctrineBootstrap::getEntityManager (); |
| 33 | 39 | $qb = $em->createQueryBuilder (); |
@@ -25,7 +25,6 @@ |
||
| 25 | 25 | namespace Hospitalplugin\Entities; |
| 26 | 26 | |
| 27 | 27 | use Hospitalplugin\DB\DoctrineBootstrap; |
| 28 | -use Hospitalplugin\utils\Utils; |
|
| 29 | 28 | |
| 30 | 29 | class InfectionsCRUD { |
| 31 | 30 | public static function getInfections($from, $to, $wardId, $class) { |
@@ -28,44 +28,44 @@ |
||
| 28 | 28 | use Hospitalplugin\utils\Utils; |
| 29 | 29 | |
| 30 | 30 | class InfectionsCRUD { |
| 31 | - public static function getInfections($from, $to, $wardId, $class) { |
|
| 32 | - $em = ( object ) DoctrineBootstrap::getEntityManager (); |
|
| 33 | - $qb = $em->createQueryBuilder (); |
|
| 34 | - $qb->select ( 'i' )->from ( 'Hospitalplugin\Entities\\' . $class, 'i' ) /* */ |
|
| 31 | + public static function getInfections($from, $to, $wardId, $class) { |
|
| 32 | + $em = ( object ) DoctrineBootstrap::getEntityManager (); |
|
| 33 | + $qb = $em->createQueryBuilder (); |
|
| 34 | + $qb->select ( 'i' )->from ( 'Hospitalplugin\Entities\\' . $class, 'i' ) /* */ |
|
| 35 | 35 | ->addOrderBy ( 'i.dataRaportu', 'DESC' ) /* */ |
| 36 | 36 | ->addOrderBy ( 'i.dataPrzeslania ', 'DESC' ) /* */ |
| 37 | 37 | ->where ( /* */ |
| 38 | - $qb->expr ()->between ( 'i.dataRaportu', ':from', ':to' ) ) /* */ |
|
| 39 | - ->setParameters ( array ( |
|
| 40 | - 'from' => $from, |
|
| 41 | - 'to' => $to |
|
| 42 | - ) ); |
|
| 43 | - if ($wardId != 'all') { |
|
| 44 | - $qb->andWhere ( $qb->expr ()->eq ( 'i.ward', ':ward' ) ) /* */ |
|
| 45 | - ->setParameter ( 'ward', $wardId ); |
|
| 46 | - } |
|
| 38 | + $qb->expr ()->between ( 'i.dataRaportu', ':from', ':to' ) ) /* */ |
|
| 39 | + ->setParameters ( array ( |
|
| 40 | + 'from' => $from, |
|
| 41 | + 'to' => $to |
|
| 42 | + ) ); |
|
| 43 | + if ($wardId != 'all') { |
|
| 44 | + $qb->andWhere ( $qb->expr ()->eq ( 'i.ward', ':ward' ) ) /* */ |
|
| 45 | + ->setParameter ( 'ward', $wardId ); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - $query = $qb->getQuery (); |
|
| 49 | - $infections = $query->getResult (); |
|
| 48 | + $query = $qb->getQuery (); |
|
| 49 | + $infections = $query->getResult (); |
|
| 50 | 50 | |
| 51 | - return $infections; |
|
| 52 | - } |
|
| 53 | - public static function updateVerification($id, $weryfikacja) { |
|
| 54 | - if ($id != null && $weryfikacja != null) { |
|
| 55 | - $em = ( object ) DoctrineBootstrap::getEntityManager (); |
|
| 56 | - $infection = $em->getRepository ( 'Hospitalplugin\Entities\Infections' )->find ( $id ); |
|
| 57 | - $infection->setWeryfikacja ( $weryfikacja ); |
|
| 58 | - $em->flush (); |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - public static function obj2DB($obj) { |
|
| 62 | - $id = $obj->id; |
|
| 63 | - $em = DoctrineBootstrap::getEntityManager(); |
|
| 64 | - $infection = $em->getRepository('Hospitalplugin\Entities\Infections')->find($id); |
|
| 65 | - $infection->setWeryfikacja($obj->value); |
|
| 66 | - $em->persist($infection); |
|
| 67 | - $em->flush(); |
|
| 68 | - echo $id; |
|
| 69 | - } |
|
| 51 | + return $infections; |
|
| 52 | + } |
|
| 53 | + public static function updateVerification($id, $weryfikacja) { |
|
| 54 | + if ($id != null && $weryfikacja != null) { |
|
| 55 | + $em = ( object ) DoctrineBootstrap::getEntityManager (); |
|
| 56 | + $infection = $em->getRepository ( 'Hospitalplugin\Entities\Infections' )->find ( $id ); |
|
| 57 | + $infection->setWeryfikacja ( $weryfikacja ); |
|
| 58 | + $em->flush (); |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + public static function obj2DB($obj) { |
|
| 62 | + $id = $obj->id; |
|
| 63 | + $em = DoctrineBootstrap::getEntityManager(); |
|
| 64 | + $infection = $em->getRepository('Hospitalplugin\Entities\Infections')->find($id); |
|
| 65 | + $infection->setWeryfikacja($obj->value); |
|
| 66 | + $em->persist($infection); |
|
| 67 | + $em->flush(); |
|
| 68 | + echo $id; |
|
| 69 | + } |
|
| 70 | 70 | } |
| 71 | 71 | ?> |
| 72 | 72 | \ No newline at end of file |
@@ -29,33 +29,33 @@ |
||
| 29 | 29 | |
| 30 | 30 | class InfectionsCRUD { |
| 31 | 31 | public static function getInfections($from, $to, $wardId, $class) { |
| 32 | - $em = ( object ) DoctrineBootstrap::getEntityManager (); |
|
| 33 | - $qb = $em->createQueryBuilder (); |
|
| 34 | - $qb->select ( 'i' )->from ( 'Hospitalplugin\Entities\\' . $class, 'i' ) /* */ |
|
| 35 | - ->addOrderBy ( 'i.dataRaportu', 'DESC' ) /* */ |
|
| 36 | - ->addOrderBy ( 'i.dataPrzeslania ', 'DESC' ) /* */ |
|
| 37 | - ->where ( /* */ |
|
| 38 | - $qb->expr ()->between ( 'i.dataRaportu', ':from', ':to' ) ) /* */ |
|
| 39 | - ->setParameters ( array ( |
|
| 32 | + $em = (object) DoctrineBootstrap::getEntityManager(); |
|
| 33 | + $qb = $em->createQueryBuilder(); |
|
| 34 | + $qb->select('i')->from('Hospitalplugin\Entities\\'.$class, 'i') /* */ |
|
| 35 | + ->addOrderBy('i.dataRaportu', 'DESC') /* */ |
|
| 36 | + ->addOrderBy('i.dataPrzeslania ', 'DESC') /* */ |
|
| 37 | + ->where( /* */ |
|
| 38 | + $qb->expr()->between('i.dataRaportu', ':from', ':to') ) /* */ |
|
| 39 | + ->setParameters(array( |
|
| 40 | 40 | 'from' => $from, |
| 41 | 41 | 'to' => $to |
| 42 | - ) ); |
|
| 42 | + )); |
|
| 43 | 43 | if ($wardId != 'all') { |
| 44 | - $qb->andWhere ( $qb->expr ()->eq ( 'i.ward', ':ward' ) ) /* */ |
|
| 45 | - ->setParameter ( 'ward', $wardId ); |
|
| 44 | + $qb->andWhere($qb->expr()->eq('i.ward', ':ward')) /* */ |
|
| 45 | + ->setParameter('ward', $wardId); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - $query = $qb->getQuery (); |
|
| 49 | - $infections = $query->getResult (); |
|
| 48 | + $query = $qb->getQuery(); |
|
| 49 | + $infections = $query->getResult(); |
|
| 50 | 50 | |
| 51 | 51 | return $infections; |
| 52 | 52 | } |
| 53 | 53 | public static function updateVerification($id, $weryfikacja) { |
| 54 | 54 | if ($id != null && $weryfikacja != null) { |
| 55 | - $em = ( object ) DoctrineBootstrap::getEntityManager (); |
|
| 56 | - $infection = $em->getRepository ( 'Hospitalplugin\Entities\Infections' )->find ( $id ); |
|
| 57 | - $infection->setWeryfikacja ( $weryfikacja ); |
|
| 58 | - $em->flush (); |
|
| 55 | + $em = (object) DoctrineBootstrap::getEntityManager(); |
|
| 56 | + $infection = $em->getRepository('Hospitalplugin\Entities\Infections')->find($id); |
|
| 57 | + $infection->setWeryfikacja($weryfikacja); |
|
| 58 | + $em->flush(); |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | public static function obj2DB($obj) { |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | /** |
| 111 | 111 | * Constructor |
| 112 | 112 | * |
| 113 | - * @param unknown $args |
|
| 113 | + * @param integer $args |
|
| 114 | 114 | */ |
| 115 | 115 | function __construct($args) { |
| 116 | 116 | if (! isset ( $args ) || empty ( $args )) { |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | /** |
| 131 | 131 | * getId |
| 132 | 132 | * |
| 133 | - * @return id |
|
| 133 | + * @return integer |
|
| 134 | 134 | */ |
| 135 | 135 | public function getId() { |
| 136 | 136 | return $this->id; |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | /** |
| 153 | 153 | * getName |
| 154 | 154 | * |
| 155 | - * @return name |
|
| 155 | + * @return string |
|
| 156 | 156 | */ |
| 157 | 157 | public function getName() { |
| 158 | 158 | return $this->name; |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | /** |
| 197 | 197 | * getOddzialId |
| 198 | 198 | * |
| 199 | - * @return oddzialId |
|
| 199 | + * @return integer |
|
| 200 | 200 | */ |
| 201 | 201 | public function getOddzialId() { |
| 202 | 202 | return $this->oddzialId; |
@@ -236,8 +236,6 @@ discard block |
||
| 236 | 236 | /** |
| 237 | 237 | * setOddzialId |
| 238 | 238 | * |
| 239 | - * @param int $oddzialId |
|
| 240 | - * oddzial id |
|
| 241 | 239 | * |
| 242 | 240 | * @return Patient |
| 243 | 241 | */ |
@@ -249,7 +247,7 @@ discard block |
||
| 249 | 247 | /** |
| 250 | 248 | * getPesel |
| 251 | 249 | * |
| 252 | - * @return pesel |
|
| 250 | + * @return string |
|
| 253 | 251 | */ |
| 254 | 252 | public function getPesel() { |
| 255 | 253 | return $this->pesel; |
@@ -271,7 +269,7 @@ discard block |
||
| 271 | 269 | /** |
| 272 | 270 | * getKategoriaPacjenta |
| 273 | 271 | * |
| 274 | - * @return kategoriaPacjenta |
|
| 272 | + * @return integer |
|
| 275 | 273 | */ |
| 276 | 274 | public function getKategoriaPacjenta() { |
| 277 | 275 | return $this->kategoriaPacjenta; |
@@ -293,7 +291,7 @@ discard block |
||
| 293 | 291 | /** |
| 294 | 292 | * getTyp |
| 295 | 293 | * |
| 296 | - * @return typ |
|
| 294 | + * @return string |
|
| 297 | 295 | */ |
| 298 | 296 | public function getTyp() { |
| 299 | 297 | return $this->typ; |
@@ -396,7 +394,6 @@ discard block |
||
| 396 | 394 | * String with comma separated values. |
| 397 | 395 | * |
| 398 | 396 | * @deprecated JSON used |
| 399 | - * @param unknown $patient |
|
| 400 | 397 | * |
| 401 | 398 | * @return string |
| 402 | 399 | */ |
@@ -113,17 +113,17 @@ discard block |
||
| 113 | 113 | * @param unknown $args |
| 114 | 114 | */ |
| 115 | 115 | function __construct($args) { |
| 116 | - if (! isset ( $args ) || empty ( $args )) { |
|
| 116 | + if (!isset ($args) || empty ($args)) { |
|
| 117 | 117 | return; |
| 118 | 118 | } |
| 119 | - foreach ( $args as $key => $value ) { |
|
| 119 | + foreach ($args as $key => $value) { |
|
| 120 | 120 | if ($key == 'dataKategoryzacji') { |
| 121 | - $value = new \DateTime ( $value . ' 12:00:00' ); |
|
| 121 | + $value = new \DateTime($value.' 12:00:00'); |
|
| 122 | 122 | } |
| 123 | - call_user_func ( array ( |
|
| 123 | + call_user_func(array( |
|
| 124 | 124 | $this, |
| 125 | - 'set' . $key |
|
| 126 | - ), $value ); |
|
| 125 | + 'set'.$key |
|
| 126 | + ), $value); |
|
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | |
@@ -333,23 +333,23 @@ discard block |
||
| 333 | 333 | * @return string |
| 334 | 334 | */ |
| 335 | 335 | public function toString() { |
| 336 | - $txt = $this->getName (); |
|
| 337 | - $txt .= $this->getPesel (); |
|
| 336 | + $txt = $this->getName(); |
|
| 337 | + $txt .= $this->getPesel(); |
|
| 338 | 338 | $txt .= "id:"; |
| 339 | - $txt .= $this->getId (); |
|
| 339 | + $txt .= $this->getId(); |
|
| 340 | 340 | $txt .= "oid:"; |
| 341 | - $txt .= $this->getOddzialId (); |
|
| 341 | + $txt .= $this->getOddzialId(); |
|
| 342 | 342 | $txt .= "d:"; |
| 343 | - $data = $this->getDataKategoryzacji (); |
|
| 343 | + $data = $this->getDataKategoryzacji(); |
|
| 344 | 344 | if ($data instanceof \DateTime) { |
| 345 | - $txt .= $this->getDataKategoryzacji ()->format ( "Y-m-d" ); |
|
| 345 | + $txt .= $this->getDataKategoryzacji()->format("Y-m-d"); |
|
| 346 | 346 | } else { |
| 347 | - $txt .= $this->getDataKategoryzacji (); |
|
| 347 | + $txt .= $this->getDataKategoryzacji(); |
|
| 348 | 348 | } |
| 349 | 349 | return $txt; |
| 350 | 350 | } |
| 351 | 351 | public function __toString() { |
| 352 | - return $this->toString (); |
|
| 352 | + return $this->toString(); |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | /** |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | * @return multitype:string |
| 359 | 359 | */ |
| 360 | 360 | protected static function getFields() { |
| 361 | - $fields = array ( |
|
| 361 | + $fields = array( |
|
| 362 | 362 | "id", |
| 363 | 363 | "name", |
| 364 | 364 | "pesel", |
@@ -375,21 +375,21 @@ discard block |
||
| 375 | 375 | * @return string |
| 376 | 376 | */ |
| 377 | 377 | public function toDatatablesJSONString() { |
| 378 | - $return_object_array = [ ]; |
|
| 379 | - $fields = $this->getFields (); |
|
| 380 | - foreach ( $fields as $field ) { |
|
| 381 | - $value = call_user_func ( array ( |
|
| 378 | + $return_object_array = []; |
|
| 379 | + $fields = $this->getFields(); |
|
| 380 | + foreach ($fields as $field) { |
|
| 381 | + $value = call_user_func(array( |
|
| 382 | 382 | $this, |
| 383 | - 'get' . $field |
|
| 384 | - ) ); |
|
| 383 | + 'get'.$field |
|
| 384 | + )); |
|
| 385 | 385 | if ($value instanceof \DateTime) { |
| 386 | - $value = $value->format ( 'Y-m-d' ); |
|
| 386 | + $value = $value->format('Y-m-d'); |
|
| 387 | 387 | } |
| 388 | - array_push ( $return_object_array, array ( |
|
| 388 | + array_push($return_object_array, array( |
|
| 389 | 389 | $field => $value |
| 390 | - ) ); |
|
| 390 | + )); |
|
| 391 | 391 | } |
| 392 | - return json_encode ( $this ); |
|
| 392 | + return json_encode($this); |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | /** |
@@ -402,19 +402,19 @@ discard block |
||
| 402 | 402 | */ |
| 403 | 403 | public function toDatatablesString() { |
| 404 | 404 | $string = ""; |
| 405 | - $fields = $this::getFields (); |
|
| 406 | - foreach ( $fields as $field ) { |
|
| 407 | - $value = call_user_func ( array ( |
|
| 405 | + $fields = $this::getFields(); |
|
| 406 | + foreach ($fields as $field) { |
|
| 407 | + $value = call_user_func(array( |
|
| 408 | 408 | $this, |
| 409 | - 'get' . $field |
|
| 410 | - ) ); |
|
| 409 | + 'get'.$field |
|
| 410 | + )); |
|
| 411 | 411 | if ($value instanceof \DateTime) { |
| 412 | - $value = $value->format ( 'Y-m-d' ); |
|
| 412 | + $value = $value->format('Y-m-d'); |
|
| 413 | 413 | } |
| 414 | - $string .= $value . ","; |
|
| 414 | + $string .= $value.","; |
|
| 415 | 415 | } |
| 416 | - $string = trim ( $string, "," ); |
|
| 417 | - $string = str_replace ( "\n", "", $string ); |
|
| 416 | + $string = trim($string, ","); |
|
| 417 | + $string = str_replace("\n", "", $string); |
|
| 418 | 418 | return $string; |
| 419 | 419 | } |
| 420 | 420 | } |
@@ -57,365 +57,365 @@ |
||
| 57 | 57 | */ |
| 58 | 58 | class Patient { |
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * |
|
| 62 | - * @var string $typ typ pacjenta |
|
| 63 | - */ |
|
| 64 | - protected $typ = ""; |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * id |
|
| 68 | - * @Id @Column(type="integer") @GeneratedValue |
|
| 69 | - */ |
|
| 70 | - public $id; |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * name |
|
| 74 | - * @Column(type="string", length=50) |
|
| 75 | - */ |
|
| 76 | - public $name; |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * @Column(type="string", length=11) |
|
| 80 | - */ |
|
| 81 | - public $pesel; |
|
| 82 | - |
|
| 83 | - /** |
|
| 84 | - * @Column(type="integer") * |
|
| 85 | - */ |
|
| 86 | - public $numerHistorii; |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * $dataKategoryzacji datetime |
|
| 90 | - * @Column(type="datetime") * |
|
| 91 | - */ |
|
| 92 | - public $dataKategoryzacji; |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * @Column(type="integer") * |
|
| 96 | - */ |
|
| 97 | - protected $oddzialId; |
|
| 98 | - |
|
| 99 | - /** |
|
| 100 | - * @Column(columnDefinition="TINYINT(4) NOT NULL DEFAULT 0") |
|
| 101 | - */ |
|
| 102 | - public $kategoriaPacjenta = 0; |
|
| 103 | - |
|
| 104 | - /** |
|
| 105 | - * @ManyToOne(targetEntity="Hospitalplugin\Entities\User") |
|
| 106 | - * @JoinColumn(name="userId", referencedColumnName="id", nullable=true) |
|
| 107 | - * @Column(columnDefinition="INT(11) NOT NULL DEFAULT 0") |
|
| 108 | - */ |
|
| 109 | - public $user; |
|
| 110 | - |
|
| 111 | - /** |
|
| 112 | - * Constructor |
|
| 113 | - * |
|
| 114 | - * @param unknown $args |
|
| 115 | - */ |
|
| 116 | - function __construct($args) { |
|
| 117 | - if (! isset ( $args ) || empty ( $args )) { |
|
| 118 | - return; |
|
| 119 | - } |
|
| 120 | - foreach ( $args as $key => $value ) { |
|
| 121 | - if ($key == 'dataKategoryzacji') { |
|
| 122 | - $value = new \DateTime ( $value . ' 12:00:00' ); |
|
| 123 | - } |
|
| 124 | - call_user_func ( array ( |
|
| 125 | - $this, |
|
| 126 | - 'set' . $key |
|
| 127 | - ), $value ); |
|
| 128 | - } |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - /** |
|
| 132 | - * getId |
|
| 133 | - * |
|
| 134 | - * @return id |
|
| 135 | - */ |
|
| 136 | - public function getId() { |
|
| 137 | - return $this->id; |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - /** |
|
| 141 | - * sets id |
|
| 142 | - * |
|
| 143 | - * @param int $id |
|
| 144 | - * ID |
|
| 145 | - * |
|
| 146 | - * @return \Hospitalplugin\Entities\Patient |
|
| 147 | - */ |
|
| 148 | - public function setId($id) { |
|
| 149 | - $this->id = $id; |
|
| 150 | - return $this; |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * getName |
|
| 155 | - * |
|
| 156 | - * @return name |
|
| 157 | - */ |
|
| 158 | - public function getName() { |
|
| 159 | - return $this->name; |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * setName |
|
| 164 | - * |
|
| 165 | - * @param string $name |
|
| 166 | - * string name |
|
| 167 | - * |
|
| 168 | - * @return Patient |
|
| 169 | - */ |
|
| 170 | - public function setName($name) { |
|
| 171 | - $this->name = $name; |
|
| 172 | - return $this; |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - /** |
|
| 176 | - * getDataKategoryzacji |
|
| 177 | - * |
|
| 178 | - * @return \DateTime dataKategoryzacji |
|
| 179 | - */ |
|
| 180 | - public function getDataKategoryzacji() { |
|
| 181 | - return $this->dataKategoryzacji; |
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - /** |
|
| 185 | - * setDataKategoryzacji |
|
| 186 | - * |
|
| 187 | - * @param \DateTime $dataKategoryzacji |
|
| 188 | - * data kategoryzyzacji |
|
| 189 | - * |
|
| 190 | - * @return Patient |
|
| 191 | - */ |
|
| 192 | - public function setDataKategoryzacji(\DateTime $dataKategoryzacji) { |
|
| 193 | - $this->dataKategoryzacji = $dataKategoryzacji; |
|
| 194 | - return $this; |
|
| 195 | - } |
|
| 196 | - |
|
| 197 | - /** |
|
| 198 | - * getOddzialId |
|
| 199 | - * |
|
| 200 | - * @return oddzialId |
|
| 201 | - */ |
|
| 202 | - public function getOddzialId() { |
|
| 203 | - return $this->oddzialId; |
|
| 204 | - } |
|
| 205 | - |
|
| 206 | - /** |
|
| 207 | - * setOddzialId |
|
| 208 | - * |
|
| 209 | - * @param int $oddzialId |
|
| 210 | - * oddzial id |
|
| 211 | - * |
|
| 212 | - * @return Patient |
|
| 213 | - */ |
|
| 214 | - public function setOddzialId($oddzialId) { |
|
| 215 | - $this->oddzialId = $oddzialId; |
|
| 216 | - return $this; |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - /** |
|
| 220 | - * |
|
| 221 | - * @param Ward $ward |
|
| 222 | - */ |
|
| 223 | - public function setWard($ward) { |
|
| 224 | - $this->oddzialId = $ward->id; |
|
| 225 | - return $this; |
|
| 226 | - } |
|
| 227 | - |
|
| 228 | - /** |
|
| 229 | - * getOddzialId |
|
| 230 | - * |
|
| 231 | - * @return oddzialId |
|
| 232 | - */ |
|
| 233 | - public function getNumerHistorii() { |
|
| 234 | - return $this->numerHistorii; |
|
| 235 | - } |
|
| 236 | - |
|
| 237 | - /** |
|
| 238 | - * setOddzialId |
|
| 239 | - * |
|
| 240 | - * @param int $oddzialId |
|
| 241 | - * oddzial id |
|
| 242 | - * |
|
| 243 | - * @return Patient |
|
| 244 | - */ |
|
| 245 | - public function setNumerHistorii($numerHistorii) { |
|
| 246 | - $this->numerHistorii = $numerHistorii; |
|
| 247 | - return $this; |
|
| 248 | - } |
|
| 249 | - |
|
| 250 | - /** |
|
| 251 | - * getPesel |
|
| 252 | - * |
|
| 253 | - * @return pesel |
|
| 254 | - */ |
|
| 255 | - public function getPesel() { |
|
| 256 | - return $this->pesel; |
|
| 257 | - } |
|
| 258 | - |
|
| 259 | - /** |
|
| 260 | - * setPesel |
|
| 261 | - * |
|
| 262 | - * @param string $pesel |
|
| 263 | - * nr pesel |
|
| 264 | - * |
|
| 265 | - * @return Patient |
|
| 266 | - */ |
|
| 267 | - public function setPesel($pesel) { |
|
| 268 | - $this->pesel = $pesel; |
|
| 269 | - return $this; |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - /** |
|
| 273 | - * getKategoriaPacjenta |
|
| 274 | - * |
|
| 275 | - * @return kategoriaPacjenta |
|
| 276 | - */ |
|
| 277 | - public function getKategoriaPacjenta() { |
|
| 278 | - return $this->kategoriaPacjenta; |
|
| 279 | - } |
|
| 280 | - |
|
| 281 | - /** |
|
| 282 | - * setKategoriaPacjenta |
|
| 283 | - * |
|
| 284 | - * @param int $kategoriaPacjenta |
|
| 285 | - * kategoriaPacjenta |
|
| 286 | - * |
|
| 287 | - * @return Patient |
|
| 288 | - */ |
|
| 289 | - public function setKategoriaPacjenta($kategoriaPacjenta) { |
|
| 290 | - $this->kategoriaPacjenta = $kategoriaPacjenta; |
|
| 291 | - return $this; |
|
| 292 | - } |
|
| 293 | - |
|
| 294 | - /** |
|
| 295 | - * getTyp |
|
| 296 | - * |
|
| 297 | - * @return typ |
|
| 298 | - */ |
|
| 299 | - public function getTyp() { |
|
| 300 | - return $this->typ; |
|
| 301 | - } |
|
| 302 | - |
|
| 303 | - /** |
|
| 304 | - * setTyp |
|
| 305 | - * |
|
| 306 | - * @param string $typ |
|
| 307 | - * |
|
| 308 | - * @return \Hospitalplugin\Entities\Patient |
|
| 309 | - */ |
|
| 310 | - public function setTyp($typ) { |
|
| 311 | - $this->typ = $typ; |
|
| 312 | - return $this; |
|
| 313 | - } |
|
| 314 | - |
|
| 315 | - /** |
|
| 316 | - * getUser |
|
| 317 | - */ |
|
| 318 | - public function getUser() { |
|
| 319 | - return $this->user; |
|
| 320 | - } |
|
| 321 | - |
|
| 322 | - /** |
|
| 323 | - * |
|
| 324 | - * @param User $user |
|
| 325 | - */ |
|
| 326 | - public function setUser($user) { |
|
| 327 | - $this->user = $user; |
|
| 328 | - return $this; |
|
| 329 | - } |
|
| 330 | - |
|
| 331 | - /** |
|
| 332 | - * toString |
|
| 333 | - * |
|
| 334 | - * @return string |
|
| 335 | - */ |
|
| 336 | - public function toString() { |
|
| 337 | - $txt = $this->getName (); |
|
| 338 | - $txt .= $this->getPesel (); |
|
| 339 | - $txt .= "id:"; |
|
| 340 | - $txt .= $this->getId (); |
|
| 341 | - $txt .= "oid:"; |
|
| 342 | - $txt .= $this->getOddzialId (); |
|
| 343 | - $txt .= "d:"; |
|
| 344 | - $data = $this->getDataKategoryzacji (); |
|
| 345 | - if ($data instanceof \DateTime) { |
|
| 346 | - $txt .= $this->getDataKategoryzacji ()->format ( "Y-m-d" ); |
|
| 347 | - } else { |
|
| 348 | - $txt .= $this->getDataKategoryzacji (); |
|
| 349 | - } |
|
| 350 | - return $txt; |
|
| 351 | - } |
|
| 352 | - public function __toString() { |
|
| 353 | - return $this->toString (); |
|
| 354 | - } |
|
| 355 | - |
|
| 356 | - /** |
|
| 357 | - * getFields |
|
| 358 | - * |
|
| 359 | - * @return multitype:string |
|
| 360 | - */ |
|
| 361 | - protected static function getFields() { |
|
| 362 | - $fields = array ( |
|
| 363 | - "id", |
|
| 364 | - "name", |
|
| 365 | - "pesel", |
|
| 366 | - "numerHistorii", |
|
| 367 | - "dataKategoryzacji", |
|
| 368 | - "kategoriaPacjenta" |
|
| 369 | - ); |
|
| 370 | - return $fields; |
|
| 371 | - } |
|
| 372 | - |
|
| 373 | - /** |
|
| 374 | - * toDatatablesJSONString |
|
| 375 | - * |
|
| 376 | - * @return string |
|
| 377 | - */ |
|
| 378 | - public function toDatatablesJSONString() { |
|
| 379 | - $return_object_array = [ ]; |
|
| 380 | - $fields = $this->getFields (); |
|
| 381 | - foreach ( $fields as $field ) { |
|
| 382 | - $value = call_user_func ( array ( |
|
| 383 | - $this, |
|
| 384 | - 'get' . $field |
|
| 385 | - ) ); |
|
| 386 | - if ($value instanceof \DateTime) { |
|
| 387 | - $value = $value->format ( 'Y-m-d' ); |
|
| 388 | - } |
|
| 389 | - array_push ( $return_object_array, array ( |
|
| 390 | - $field => $value |
|
| 391 | - ) ); |
|
| 392 | - } |
|
| 393 | - return json_encode ( $this ); |
|
| 394 | - } |
|
| 395 | - |
|
| 396 | - /** |
|
| 397 | - * String with comma separated values. |
|
| 398 | - * |
|
| 399 | - * @deprecated JSON used |
|
| 400 | - * @param unknown $patient |
|
| 401 | - * |
|
| 402 | - * @return string |
|
| 403 | - */ |
|
| 404 | - public function toDatatablesString() { |
|
| 405 | - $string = ""; |
|
| 406 | - $fields = $this::getFields (); |
|
| 407 | - foreach ( $fields as $field ) { |
|
| 408 | - $value = call_user_func ( array ( |
|
| 409 | - $this, |
|
| 410 | - 'get' . $field |
|
| 411 | - ) ); |
|
| 412 | - if ($value instanceof \DateTime) { |
|
| 413 | - $value = $value->format ( 'Y-m-d' ); |
|
| 414 | - } |
|
| 415 | - $string .= $value . ","; |
|
| 416 | - } |
|
| 417 | - $string = trim ( $string, "," ); |
|
| 418 | - $string = str_replace ( "\n", "", $string ); |
|
| 419 | - return $string; |
|
| 420 | - } |
|
| 60 | + /** |
|
| 61 | + * |
|
| 62 | + * @var string $typ typ pacjenta |
|
| 63 | + */ |
|
| 64 | + protected $typ = ""; |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * id |
|
| 68 | + * @Id @Column(type="integer") @GeneratedValue |
|
| 69 | + */ |
|
| 70 | + public $id; |
|
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * name |
|
| 74 | + * @Column(type="string", length=50) |
|
| 75 | + */ |
|
| 76 | + public $name; |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * @Column(type="string", length=11) |
|
| 80 | + */ |
|
| 81 | + public $pesel; |
|
| 82 | + |
|
| 83 | + /** |
|
| 84 | + * @Column(type="integer") * |
|
| 85 | + */ |
|
| 86 | + public $numerHistorii; |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * $dataKategoryzacji datetime |
|
| 90 | + * @Column(type="datetime") * |
|
| 91 | + */ |
|
| 92 | + public $dataKategoryzacji; |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * @Column(type="integer") * |
|
| 96 | + */ |
|
| 97 | + protected $oddzialId; |
|
| 98 | + |
|
| 99 | + /** |
|
| 100 | + * @Column(columnDefinition="TINYINT(4) NOT NULL DEFAULT 0") |
|
| 101 | + */ |
|
| 102 | + public $kategoriaPacjenta = 0; |
|
| 103 | + |
|
| 104 | + /** |
|
| 105 | + * @ManyToOne(targetEntity="Hospitalplugin\Entities\User") |
|
| 106 | + * @JoinColumn(name="userId", referencedColumnName="id", nullable=true) |
|
| 107 | + * @Column(columnDefinition="INT(11) NOT NULL DEFAULT 0") |
|
| 108 | + */ |
|
| 109 | + public $user; |
|
| 110 | + |
|
| 111 | + /** |
|
| 112 | + * Constructor |
|
| 113 | + * |
|
| 114 | + * @param unknown $args |
|
| 115 | + */ |
|
| 116 | + function __construct($args) { |
|
| 117 | + if (! isset ( $args ) || empty ( $args )) { |
|
| 118 | + return; |
|
| 119 | + } |
|
| 120 | + foreach ( $args as $key => $value ) { |
|
| 121 | + if ($key == 'dataKategoryzacji') { |
|
| 122 | + $value = new \DateTime ( $value . ' 12:00:00' ); |
|
| 123 | + } |
|
| 124 | + call_user_func ( array ( |
|
| 125 | + $this, |
|
| 126 | + 'set' . $key |
|
| 127 | + ), $value ); |
|
| 128 | + } |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + /** |
|
| 132 | + * getId |
|
| 133 | + * |
|
| 134 | + * @return id |
|
| 135 | + */ |
|
| 136 | + public function getId() { |
|
| 137 | + return $this->id; |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + /** |
|
| 141 | + * sets id |
|
| 142 | + * |
|
| 143 | + * @param int $id |
|
| 144 | + * ID |
|
| 145 | + * |
|
| 146 | + * @return \Hospitalplugin\Entities\Patient |
|
| 147 | + */ |
|
| 148 | + public function setId($id) { |
|
| 149 | + $this->id = $id; |
|
| 150 | + return $this; |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * getName |
|
| 155 | + * |
|
| 156 | + * @return name |
|
| 157 | + */ |
|
| 158 | + public function getName() { |
|
| 159 | + return $this->name; |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * setName |
|
| 164 | + * |
|
| 165 | + * @param string $name |
|
| 166 | + * string name |
|
| 167 | + * |
|
| 168 | + * @return Patient |
|
| 169 | + */ |
|
| 170 | + public function setName($name) { |
|
| 171 | + $this->name = $name; |
|
| 172 | + return $this; |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + /** |
|
| 176 | + * getDataKategoryzacji |
|
| 177 | + * |
|
| 178 | + * @return \DateTime dataKategoryzacji |
|
| 179 | + */ |
|
| 180 | + public function getDataKategoryzacji() { |
|
| 181 | + return $this->dataKategoryzacji; |
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + /** |
|
| 185 | + * setDataKategoryzacji |
|
| 186 | + * |
|
| 187 | + * @param \DateTime $dataKategoryzacji |
|
| 188 | + * data kategoryzyzacji |
|
| 189 | + * |
|
| 190 | + * @return Patient |
|
| 191 | + */ |
|
| 192 | + public function setDataKategoryzacji(\DateTime $dataKategoryzacji) { |
|
| 193 | + $this->dataKategoryzacji = $dataKategoryzacji; |
|
| 194 | + return $this; |
|
| 195 | + } |
|
| 196 | + |
|
| 197 | + /** |
|
| 198 | + * getOddzialId |
|
| 199 | + * |
|
| 200 | + * @return oddzialId |
|
| 201 | + */ |
|
| 202 | + public function getOddzialId() { |
|
| 203 | + return $this->oddzialId; |
|
| 204 | + } |
|
| 205 | + |
|
| 206 | + /** |
|
| 207 | + * setOddzialId |
|
| 208 | + * |
|
| 209 | + * @param int $oddzialId |
|
| 210 | + * oddzial id |
|
| 211 | + * |
|
| 212 | + * @return Patient |
|
| 213 | + */ |
|
| 214 | + public function setOddzialId($oddzialId) { |
|
| 215 | + $this->oddzialId = $oddzialId; |
|
| 216 | + return $this; |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + /** |
|
| 220 | + * |
|
| 221 | + * @param Ward $ward |
|
| 222 | + */ |
|
| 223 | + public function setWard($ward) { |
|
| 224 | + $this->oddzialId = $ward->id; |
|
| 225 | + return $this; |
|
| 226 | + } |
|
| 227 | + |
|
| 228 | + /** |
|
| 229 | + * getOddzialId |
|
| 230 | + * |
|
| 231 | + * @return oddzialId |
|
| 232 | + */ |
|
| 233 | + public function getNumerHistorii() { |
|
| 234 | + return $this->numerHistorii; |
|
| 235 | + } |
|
| 236 | + |
|
| 237 | + /** |
|
| 238 | + * setOddzialId |
|
| 239 | + * |
|
| 240 | + * @param int $oddzialId |
|
| 241 | + * oddzial id |
|
| 242 | + * |
|
| 243 | + * @return Patient |
|
| 244 | + */ |
|
| 245 | + public function setNumerHistorii($numerHistorii) { |
|
| 246 | + $this->numerHistorii = $numerHistorii; |
|
| 247 | + return $this; |
|
| 248 | + } |
|
| 249 | + |
|
| 250 | + /** |
|
| 251 | + * getPesel |
|
| 252 | + * |
|
| 253 | + * @return pesel |
|
| 254 | + */ |
|
| 255 | + public function getPesel() { |
|
| 256 | + return $this->pesel; |
|
| 257 | + } |
|
| 258 | + |
|
| 259 | + /** |
|
| 260 | + * setPesel |
|
| 261 | + * |
|
| 262 | + * @param string $pesel |
|
| 263 | + * nr pesel |
|
| 264 | + * |
|
| 265 | + * @return Patient |
|
| 266 | + */ |
|
| 267 | + public function setPesel($pesel) { |
|
| 268 | + $this->pesel = $pesel; |
|
| 269 | + return $this; |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + /** |
|
| 273 | + * getKategoriaPacjenta |
|
| 274 | + * |
|
| 275 | + * @return kategoriaPacjenta |
|
| 276 | + */ |
|
| 277 | + public function getKategoriaPacjenta() { |
|
| 278 | + return $this->kategoriaPacjenta; |
|
| 279 | + } |
|
| 280 | + |
|
| 281 | + /** |
|
| 282 | + * setKategoriaPacjenta |
|
| 283 | + * |
|
| 284 | + * @param int $kategoriaPacjenta |
|
| 285 | + * kategoriaPacjenta |
|
| 286 | + * |
|
| 287 | + * @return Patient |
|
| 288 | + */ |
|
| 289 | + public function setKategoriaPacjenta($kategoriaPacjenta) { |
|
| 290 | + $this->kategoriaPacjenta = $kategoriaPacjenta; |
|
| 291 | + return $this; |
|
| 292 | + } |
|
| 293 | + |
|
| 294 | + /** |
|
| 295 | + * getTyp |
|
| 296 | + * |
|
| 297 | + * @return typ |
|
| 298 | + */ |
|
| 299 | + public function getTyp() { |
|
| 300 | + return $this->typ; |
|
| 301 | + } |
|
| 302 | + |
|
| 303 | + /** |
|
| 304 | + * setTyp |
|
| 305 | + * |
|
| 306 | + * @param string $typ |
|
| 307 | + * |
|
| 308 | + * @return \Hospitalplugin\Entities\Patient |
|
| 309 | + */ |
|
| 310 | + public function setTyp($typ) { |
|
| 311 | + $this->typ = $typ; |
|
| 312 | + return $this; |
|
| 313 | + } |
|
| 314 | + |
|
| 315 | + /** |
|
| 316 | + * getUser |
|
| 317 | + */ |
|
| 318 | + public function getUser() { |
|
| 319 | + return $this->user; |
|
| 320 | + } |
|
| 321 | + |
|
| 322 | + /** |
|
| 323 | + * |
|
| 324 | + * @param User $user |
|
| 325 | + */ |
|
| 326 | + public function setUser($user) { |
|
| 327 | + $this->user = $user; |
|
| 328 | + return $this; |
|
| 329 | + } |
|
| 330 | + |
|
| 331 | + /** |
|
| 332 | + * toString |
|
| 333 | + * |
|
| 334 | + * @return string |
|
| 335 | + */ |
|
| 336 | + public function toString() { |
|
| 337 | + $txt = $this->getName (); |
|
| 338 | + $txt .= $this->getPesel (); |
|
| 339 | + $txt .= "id:"; |
|
| 340 | + $txt .= $this->getId (); |
|
| 341 | + $txt .= "oid:"; |
|
| 342 | + $txt .= $this->getOddzialId (); |
|
| 343 | + $txt .= "d:"; |
|
| 344 | + $data = $this->getDataKategoryzacji (); |
|
| 345 | + if ($data instanceof \DateTime) { |
|
| 346 | + $txt .= $this->getDataKategoryzacji ()->format ( "Y-m-d" ); |
|
| 347 | + } else { |
|
| 348 | + $txt .= $this->getDataKategoryzacji (); |
|
| 349 | + } |
|
| 350 | + return $txt; |
|
| 351 | + } |
|
| 352 | + public function __toString() { |
|
| 353 | + return $this->toString (); |
|
| 354 | + } |
|
| 355 | + |
|
| 356 | + /** |
|
| 357 | + * getFields |
|
| 358 | + * |
|
| 359 | + * @return multitype:string |
|
| 360 | + */ |
|
| 361 | + protected static function getFields() { |
|
| 362 | + $fields = array ( |
|
| 363 | + "id", |
|
| 364 | + "name", |
|
| 365 | + "pesel", |
|
| 366 | + "numerHistorii", |
|
| 367 | + "dataKategoryzacji", |
|
| 368 | + "kategoriaPacjenta" |
|
| 369 | + ); |
|
| 370 | + return $fields; |
|
| 371 | + } |
|
| 372 | + |
|
| 373 | + /** |
|
| 374 | + * toDatatablesJSONString |
|
| 375 | + * |
|
| 376 | + * @return string |
|
| 377 | + */ |
|
| 378 | + public function toDatatablesJSONString() { |
|
| 379 | + $return_object_array = [ ]; |
|
| 380 | + $fields = $this->getFields (); |
|
| 381 | + foreach ( $fields as $field ) { |
|
| 382 | + $value = call_user_func ( array ( |
|
| 383 | + $this, |
|
| 384 | + 'get' . $field |
|
| 385 | + ) ); |
|
| 386 | + if ($value instanceof \DateTime) { |
|
| 387 | + $value = $value->format ( 'Y-m-d' ); |
|
| 388 | + } |
|
| 389 | + array_push ( $return_object_array, array ( |
|
| 390 | + $field => $value |
|
| 391 | + ) ); |
|
| 392 | + } |
|
| 393 | + return json_encode ( $this ); |
|
| 394 | + } |
|
| 395 | + |
|
| 396 | + /** |
|
| 397 | + * String with comma separated values. |
|
| 398 | + * |
|
| 399 | + * @deprecated JSON used |
|
| 400 | + * @param unknown $patient |
|
| 401 | + * |
|
| 402 | + * @return string |
|
| 403 | + */ |
|
| 404 | + public function toDatatablesString() { |
|
| 405 | + $string = ""; |
|
| 406 | + $fields = $this::getFields (); |
|
| 407 | + foreach ( $fields as $field ) { |
|
| 408 | + $value = call_user_func ( array ( |
|
| 409 | + $this, |
|
| 410 | + 'get' . $field |
|
| 411 | + ) ); |
|
| 412 | + if ($value instanceof \DateTime) { |
|
| 413 | + $value = $value->format ( 'Y-m-d' ); |
|
| 414 | + } |
|
| 415 | + $string .= $value . ","; |
|
| 416 | + } |
|
| 417 | + $string = trim ( $string, "," ); |
|
| 418 | + $string = str_replace ( "\n", "", $string ); |
|
| 419 | + return $string; |
|
| 420 | + } |
|
| 421 | 421 | } |
@@ -51,11 +51,9 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * TODO(AM) testy na przypadki graniczne - pacjenci z data przed polnoca, po polnocy, godzina przed obecna, po obecnej |
| 53 | 53 | * |
| 54 | - * @param int $day |
|
| 55 | - * dayOfTheMonth |
|
| 56 | - * @param int $month |
|
| 57 | - * month |
|
| 58 | 54 | * |
| 55 | + * @param string $date1 |
|
| 56 | + * @param string $date2 |
|
| 59 | 57 | * @return Patient array |
| 60 | 58 | */ |
| 61 | 59 | public static function getPatientsDateRange($date1, $date2, $wardId = 0) { |
@@ -73,7 +71,7 @@ discard block |
||
| 73 | 71 | /** |
| 74 | 72 | * getPatient |
| 75 | 73 | * |
| 76 | - * @param $id $id |
|
| 74 | + * @param integer $id |
|
| 77 | 75 | * int |
| 78 | 76 | * |
| 79 | 77 | * @return Patient Patient |
@@ -111,7 +109,6 @@ discard block |
||
| 111 | 109 | /** |
| 112 | 110 | * setPatientCategories |
| 113 | 111 | * |
| 114 | - * @param Patient $obj |
|
| 115 | 112 | * |
| 116 | 113 | * @return Patient |
| 117 | 114 | */ |
@@ -27,7 +27,6 @@ |
||
| 27 | 27 | use Hospitalplugin\DB\DoctrineBootstrap; |
| 28 | 28 | use Hospitalplugin\Entities\Patient; |
| 29 | 29 | use Hospitalplugin\Entities\PatientDeleted; |
| 30 | -use Hospitalplugin\Entities\PatientFactory; |
|
| 31 | 30 | use Hospitalplugin\utils\Utils; |
| 32 | 31 | |
| 33 | 32 | class PatientCRUD { |
@@ -32,120 +32,120 @@ |
||
| 32 | 32 | |
| 33 | 33 | class PatientCRUD { |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * getPatients |
|
| 37 | - * |
|
| 38 | - * @param int $day |
|
| 39 | - * dayOfTheMonth |
|
| 40 | - * @param int $month |
|
| 41 | - * month |
|
| 42 | - * |
|
| 43 | - * @return Patient array |
|
| 44 | - */ |
|
| 45 | - public static function getPatients($month = null, $day = null, $wardId = 0) { |
|
| 46 | - return PatientCRUD::getPatientsDateRange ( Utils::getStartDate ( $month, $day ), Utils::getEndDate ( $month, $day ), $wardId ); |
|
| 47 | - } |
|
| 35 | + /** |
|
| 36 | + * getPatients |
|
| 37 | + * |
|
| 38 | + * @param int $day |
|
| 39 | + * dayOfTheMonth |
|
| 40 | + * @param int $month |
|
| 41 | + * month |
|
| 42 | + * |
|
| 43 | + * @return Patient array |
|
| 44 | + */ |
|
| 45 | + public static function getPatients($month = null, $day = null, $wardId = 0) { |
|
| 46 | + return PatientCRUD::getPatientsDateRange ( Utils::getStartDate ( $month, $day ), Utils::getEndDate ( $month, $day ), $wardId ); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * getPatientsDateRange |
|
| 51 | - * |
|
| 52 | - * TODO(AM) testy na przypadki graniczne - pacjenci z data przed polnoca, po polnocy, godzina przed obecna, po obecnej |
|
| 53 | - * |
|
| 54 | - * @param int $day |
|
| 55 | - * dayOfTheMonth |
|
| 56 | - * @param int $month |
|
| 57 | - * month |
|
| 58 | - * |
|
| 59 | - * @return Patient array |
|
| 60 | - */ |
|
| 61 | - public static function getPatientsDateRange($date1, $date2, $wardId = 0) { |
|
| 62 | - $entityManager = ( object ) DoctrineBootstrap::getEntityManager (); |
|
| 63 | - $params = array ( |
|
| 64 | - 'from' => $date1, |
|
| 65 | - 'to' => $date2, |
|
| 66 | - 'oddzialId' => $wardId |
|
| 67 | - ); |
|
| 68 | - $q = $entityManager->createQuery ( 'select p FROM Hospitalplugin\Entities\Patient p WHERE p.dataKategoryzacji BETWEEN :from AND :to and p.oddzialId = :oddzialId ORDER BY p.name' )->setParameters ( $params )->setFirstResult ( 0 )->setMaxResults ( 1000 ); |
|
| 69 | - $patients = $q->getResult (); |
|
| 70 | - return $patients; |
|
| 71 | - } |
|
| 49 | + /** |
|
| 50 | + * getPatientsDateRange |
|
| 51 | + * |
|
| 52 | + * TODO(AM) testy na przypadki graniczne - pacjenci z data przed polnoca, po polnocy, godzina przed obecna, po obecnej |
|
| 53 | + * |
|
| 54 | + * @param int $day |
|
| 55 | + * dayOfTheMonth |
|
| 56 | + * @param int $month |
|
| 57 | + * month |
|
| 58 | + * |
|
| 59 | + * @return Patient array |
|
| 60 | + */ |
|
| 61 | + public static function getPatientsDateRange($date1, $date2, $wardId = 0) { |
|
| 62 | + $entityManager = ( object ) DoctrineBootstrap::getEntityManager (); |
|
| 63 | + $params = array ( |
|
| 64 | + 'from' => $date1, |
|
| 65 | + 'to' => $date2, |
|
| 66 | + 'oddzialId' => $wardId |
|
| 67 | + ); |
|
| 68 | + $q = $entityManager->createQuery ( 'select p FROM Hospitalplugin\Entities\Patient p WHERE p.dataKategoryzacji BETWEEN :from AND :to and p.oddzialId = :oddzialId ORDER BY p.name' )->setParameters ( $params )->setFirstResult ( 0 )->setMaxResults ( 1000 ); |
|
| 69 | + $patients = $q->getResult (); |
|
| 70 | + return $patients; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * getPatient |
|
| 75 | - * |
|
| 76 | - * @param $id $id |
|
| 77 | - * int |
|
| 78 | - * |
|
| 79 | - * @return Patient Patient |
|
| 80 | - */ |
|
| 81 | - public static function getPatient($id, $type = '') { |
|
| 82 | - $entityManager = ( object ) DoctrineBootstrap::getEntityManager (); |
|
| 83 | - $type = 'Hospitalplugin\Entities\Patient' . $type; |
|
| 84 | - $patient = $entityManager->getRepository ( $type )->findOneBy ( array ( |
|
| 85 | - 'id' => $id |
|
| 86 | - ) ); |
|
| 87 | - return Utils::cast ( $type, ( object ) $patient, 0 ); |
|
| 88 | - } |
|
| 73 | + /** |
|
| 74 | + * getPatient |
|
| 75 | + * |
|
| 76 | + * @param $id $id |
|
| 77 | + * int |
|
| 78 | + * |
|
| 79 | + * @return Patient Patient |
|
| 80 | + */ |
|
| 81 | + public static function getPatient($id, $type = '') { |
|
| 82 | + $entityManager = ( object ) DoctrineBootstrap::getEntityManager (); |
|
| 83 | + $type = 'Hospitalplugin\Entities\Patient' . $type; |
|
| 84 | + $patient = $entityManager->getRepository ( $type )->findOneBy ( array ( |
|
| 85 | + 'id' => $id |
|
| 86 | + ) ); |
|
| 87 | + return Utils::cast ( $type, ( object ) $patient, 0 ); |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * setPatientCategories |
|
| 92 | - * |
|
| 93 | - * @param Patient $obj |
|
| 94 | - * |
|
| 95 | - * @return Patient |
|
| 96 | - */ |
|
| 97 | - public static function setPatientCategories($obj, $type) { |
|
| 98 | - $entityManager = DoctrineBootstrap::getEntityManager (); |
|
| 99 | - $patient = PatientCRUD::getPatient ( $obj->id, $type ); |
|
| 100 | - foreach ( get_object_vars ( $obj ) as $key => $value ) { |
|
| 101 | - call_user_func ( array ( |
|
| 102 | - $patient, |
|
| 103 | - 'set' . ucwords ( $key ) |
|
| 104 | - ), $value ); |
|
| 105 | - } |
|
| 106 | - $entityManager->merge ( $patient ); |
|
| 107 | - $entityManager->flush (); |
|
| 108 | - return $patient; |
|
| 109 | - } |
|
| 90 | + /** |
|
| 91 | + * setPatientCategories |
|
| 92 | + * |
|
| 93 | + * @param Patient $obj |
|
| 94 | + * |
|
| 95 | + * @return Patient |
|
| 96 | + */ |
|
| 97 | + public static function setPatientCategories($obj, $type) { |
|
| 98 | + $entityManager = DoctrineBootstrap::getEntityManager (); |
|
| 99 | + $patient = PatientCRUD::getPatient ( $obj->id, $type ); |
|
| 100 | + foreach ( get_object_vars ( $obj ) as $key => $value ) { |
|
| 101 | + call_user_func ( array ( |
|
| 102 | + $patient, |
|
| 103 | + 'set' . ucwords ( $key ) |
|
| 104 | + ), $value ); |
|
| 105 | + } |
|
| 106 | + $entityManager->merge ( $patient ); |
|
| 107 | + $entityManager->flush (); |
|
| 108 | + return $patient; |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | - /** |
|
| 112 | - * setPatientCategories |
|
| 113 | - * |
|
| 114 | - * @param Patient $obj |
|
| 115 | - * |
|
| 116 | - * @return Patient |
|
| 117 | - */ |
|
| 118 | - public static function createPatient($type, $name, $pesel) { |
|
| 119 | - $entityManager = DoctrineBootstrap::getEntityManager (); |
|
| 120 | - $type = 'Hospitalplugin\Entities\Patient' . $type; |
|
| 121 | - $patient = new $type (); |
|
| 122 | - $patient->setName ( $name ); |
|
| 123 | - $patient->setPesel ( $pesel ); |
|
| 124 | - $entityManager->persist ( $patient ); |
|
| 125 | - $entityManager->flush (); |
|
| 126 | - return $patient; |
|
| 127 | - } |
|
| 111 | + /** |
|
| 112 | + * setPatientCategories |
|
| 113 | + * |
|
| 114 | + * @param Patient $obj |
|
| 115 | + * |
|
| 116 | + * @return Patient |
|
| 117 | + */ |
|
| 118 | + public static function createPatient($type, $name, $pesel) { |
|
| 119 | + $entityManager = DoctrineBootstrap::getEntityManager (); |
|
| 120 | + $type = 'Hospitalplugin\Entities\Patient' . $type; |
|
| 121 | + $patient = new $type (); |
|
| 122 | + $patient->setName ( $name ); |
|
| 123 | + $patient->setPesel ( $pesel ); |
|
| 124 | + $entityManager->persist ( $patient ); |
|
| 125 | + $entityManager->flush (); |
|
| 126 | + return $patient; |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | - /** |
|
| 130 | - * deletePatient |
|
| 131 | - * |
|
| 132 | - * @param $id $id |
|
| 133 | - * int |
|
| 134 | - */ |
|
| 135 | - public static function deletePatient($id, $userId = 0) { |
|
| 136 | - $entityManager = ( object ) DoctrineBootstrap::getEntityManager (); |
|
| 137 | - $type = 'Hospitalplugin\Entities\Patient'; |
|
| 138 | - $patient = $entityManager->getRepository ( $type )->findOneBy ( array ( |
|
| 139 | - 'id' => $id |
|
| 140 | - ) ); |
|
| 141 | - $entityManager->remove ( $patient ); |
|
| 142 | - $log = strval($patient); |
|
| 143 | - $audit = new PatientDeleted(); |
|
| 144 | - $audit->deletedAt = new \DateTime (); |
|
| 145 | - $audit->deletedByUserId = $userId; |
|
| 146 | - $audit->log = $log; |
|
| 147 | - $entityManager->persist ( $audit ); |
|
| 148 | - $entityManager->flush (); |
|
| 149 | - } |
|
| 129 | + /** |
|
| 130 | + * deletePatient |
|
| 131 | + * |
|
| 132 | + * @param $id $id |
|
| 133 | + * int |
|
| 134 | + */ |
|
| 135 | + public static function deletePatient($id, $userId = 0) { |
|
| 136 | + $entityManager = ( object ) DoctrineBootstrap::getEntityManager (); |
|
| 137 | + $type = 'Hospitalplugin\Entities\Patient'; |
|
| 138 | + $patient = $entityManager->getRepository ( $type )->findOneBy ( array ( |
|
| 139 | + 'id' => $id |
|
| 140 | + ) ); |
|
| 141 | + $entityManager->remove ( $patient ); |
|
| 142 | + $log = strval($patient); |
|
| 143 | + $audit = new PatientDeleted(); |
|
| 144 | + $audit->deletedAt = new \DateTime (); |
|
| 145 | + $audit->deletedByUserId = $userId; |
|
| 146 | + $audit->log = $log; |
|
| 147 | + $entityManager->persist ( $audit ); |
|
| 148 | + $entityManager->flush (); |
|
| 149 | + } |
|
| 150 | 150 | } |
| 151 | 151 | ?> |
| 152 | 152 | \ No newline at end of file |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * @return Patient array |
| 44 | 44 | */ |
| 45 | 45 | public static function getPatients($month = null, $day = null, $wardId = 0) { |
| 46 | - return PatientCRUD::getPatientsDateRange ( Utils::getStartDate ( $month, $day ), Utils::getEndDate ( $month, $day ), $wardId ); |
|
| 46 | + return PatientCRUD::getPatientsDateRange(Utils::getStartDate($month, $day), Utils::getEndDate($month, $day), $wardId); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -59,14 +59,14 @@ discard block |
||
| 59 | 59 | * @return Patient array |
| 60 | 60 | */ |
| 61 | 61 | public static function getPatientsDateRange($date1, $date2, $wardId = 0) { |
| 62 | - $entityManager = ( object ) DoctrineBootstrap::getEntityManager (); |
|
| 63 | - $params = array ( |
|
| 62 | + $entityManager = (object) DoctrineBootstrap::getEntityManager(); |
|
| 63 | + $params = array( |
|
| 64 | 64 | 'from' => $date1, |
| 65 | 65 | 'to' => $date2, |
| 66 | 66 | 'oddzialId' => $wardId |
| 67 | 67 | ); |
| 68 | - $q = $entityManager->createQuery ( 'select p FROM Hospitalplugin\Entities\Patient p WHERE p.dataKategoryzacji BETWEEN :from AND :to and p.oddzialId = :oddzialId ORDER BY p.name' )->setParameters ( $params )->setFirstResult ( 0 )->setMaxResults ( 1000 ); |
|
| 69 | - $patients = $q->getResult (); |
|
| 68 | + $q = $entityManager->createQuery('select p FROM Hospitalplugin\Entities\Patient p WHERE p.dataKategoryzacji BETWEEN :from AND :to and p.oddzialId = :oddzialId ORDER BY p.name')->setParameters($params)->setFirstResult(0)->setMaxResults(1000); |
|
| 69 | + $patients = $q->getResult(); |
|
| 70 | 70 | return $patients; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -79,12 +79,12 @@ discard block |
||
| 79 | 79 | * @return Patient Patient |
| 80 | 80 | */ |
| 81 | 81 | public static function getPatient($id, $type = '') { |
| 82 | - $entityManager = ( object ) DoctrineBootstrap::getEntityManager (); |
|
| 83 | - $type = 'Hospitalplugin\Entities\Patient' . $type; |
|
| 84 | - $patient = $entityManager->getRepository ( $type )->findOneBy ( array ( |
|
| 82 | + $entityManager = (object) DoctrineBootstrap::getEntityManager(); |
|
| 83 | + $type = 'Hospitalplugin\Entities\Patient'.$type; |
|
| 84 | + $patient = $entityManager->getRepository($type)->findOneBy(array( |
|
| 85 | 85 | 'id' => $id |
| 86 | - ) ); |
|
| 87 | - return Utils::cast ( $type, ( object ) $patient, 0 ); |
|
| 86 | + )); |
|
| 87 | + return Utils::cast($type, (object) $patient, 0); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -95,16 +95,16 @@ discard block |
||
| 95 | 95 | * @return Patient |
| 96 | 96 | */ |
| 97 | 97 | public static function setPatientCategories($obj, $type) { |
| 98 | - $entityManager = DoctrineBootstrap::getEntityManager (); |
|
| 99 | - $patient = PatientCRUD::getPatient ( $obj->id, $type ); |
|
| 100 | - foreach ( get_object_vars ( $obj ) as $key => $value ) { |
|
| 101 | - call_user_func ( array ( |
|
| 98 | + $entityManager = DoctrineBootstrap::getEntityManager(); |
|
| 99 | + $patient = PatientCRUD::getPatient($obj->id, $type); |
|
| 100 | + foreach (get_object_vars($obj) as $key => $value) { |
|
| 101 | + call_user_func(array( |
|
| 102 | 102 | $patient, |
| 103 | - 'set' . ucwords ( $key ) |
|
| 104 | - ), $value ); |
|
| 103 | + 'set'.ucwords($key) |
|
| 104 | + ), $value); |
|
| 105 | 105 | } |
| 106 | - $entityManager->merge ( $patient ); |
|
| 107 | - $entityManager->flush (); |
|
| 106 | + $entityManager->merge($patient); |
|
| 107 | + $entityManager->flush(); |
|
| 108 | 108 | return $patient; |
| 109 | 109 | } |
| 110 | 110 | |
@@ -116,13 +116,13 @@ discard block |
||
| 116 | 116 | * @return Patient |
| 117 | 117 | */ |
| 118 | 118 | public static function createPatient($type, $name, $pesel) { |
| 119 | - $entityManager = DoctrineBootstrap::getEntityManager (); |
|
| 120 | - $type = 'Hospitalplugin\Entities\Patient' . $type; |
|
| 121 | - $patient = new $type (); |
|
| 122 | - $patient->setName ( $name ); |
|
| 123 | - $patient->setPesel ( $pesel ); |
|
| 124 | - $entityManager->persist ( $patient ); |
|
| 125 | - $entityManager->flush (); |
|
| 119 | + $entityManager = DoctrineBootstrap::getEntityManager(); |
|
| 120 | + $type = 'Hospitalplugin\Entities\Patient'.$type; |
|
| 121 | + $patient = new $type(); |
|
| 122 | + $patient->setName($name); |
|
| 123 | + $patient->setPesel($pesel); |
|
| 124 | + $entityManager->persist($patient); |
|
| 125 | + $entityManager->flush(); |
|
| 126 | 126 | return $patient; |
| 127 | 127 | } |
| 128 | 128 | |
@@ -133,19 +133,19 @@ discard block |
||
| 133 | 133 | * int |
| 134 | 134 | */ |
| 135 | 135 | public static function deletePatient($id, $userId = 0) { |
| 136 | - $entityManager = ( object ) DoctrineBootstrap::getEntityManager (); |
|
| 136 | + $entityManager = (object) DoctrineBootstrap::getEntityManager(); |
|
| 137 | 137 | $type = 'Hospitalplugin\Entities\Patient'; |
| 138 | - $patient = $entityManager->getRepository ( $type )->findOneBy ( array ( |
|
| 138 | + $patient = $entityManager->getRepository($type)->findOneBy(array( |
|
| 139 | 139 | 'id' => $id |
| 140 | - ) ); |
|
| 141 | - $entityManager->remove ( $patient ); |
|
| 140 | + )); |
|
| 141 | + $entityManager->remove($patient); |
|
| 142 | 142 | $log = strval($patient); |
| 143 | 143 | $audit = new PatientDeleted(); |
| 144 | - $audit->deletedAt = new \DateTime (); |
|
| 144 | + $audit->deletedAt = new \DateTime(); |
|
| 145 | 145 | $audit->deletedByUserId = $userId; |
| 146 | 146 | $audit->log = $log; |
| 147 | - $entityManager->persist ( $audit ); |
|
| 148 | - $entityManager->flush (); |
|
| 147 | + $entityManager->persist($audit); |
|
| 148 | + $entityManager->flush(); |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | ?> |
| 152 | 152 | \ No newline at end of file |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | public $edukacjaZdrowotnaIOpiekaPsychospoleczna; |
| 82 | 82 | // |
| 83 | 83 | /** |
| 84 | - * @return aktywnoscFizyczna |
|
| 84 | + * @return integer |
|
| 85 | 85 | */ |
| 86 | 86 | public function getAktywnoscFizyczna() |
| 87 | 87 | { |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * @param int $aktywnoscFizyczna int aktywnoscFizyczna |
| 93 | - * @return PatientZZ |
|
| 93 | + * @return PatientDIA |
|
| 94 | 94 | */ |
| 95 | 95 | public function setAktywnoscFizyczna($aktywnoscFizyczna) |
| 96 | 96 | { |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | - * @return higiena |
|
| 102 | + * @return integer |
|
| 103 | 103 | */ |
| 104 | 104 | public function getHigiena() |
| 105 | 105 | { |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | 110 | * @param int $higiena int higiena |
| 111 | - * @return PatientZZ |
|
| 111 | + * @return PatientDIA |
|
| 112 | 112 | */ |
| 113 | 113 | public function setHigiena($higiena) |
| 114 | 114 | { |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | - * @return odzywianie |
|
| 120 | + * @return integer |
|
| 121 | 121 | */ |
| 122 | 122 | public function getOdzywianie() |
| 123 | 123 | { |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | /** |
| 128 | 128 | * @param int $odzywianie int odzywianie |
| 129 | - * @return PatientZZ |
|
| 129 | + * @return PatientDIA |
|
| 130 | 130 | */ |
| 131 | 131 | public function setOdzywianie($odzywianie) |
| 132 | 132 | { |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
| 138 | - * @return wydalanie |
|
| 138 | + * @return integer |
|
| 139 | 139 | */ |
| 140 | 140 | public function getWydalanie() |
| 141 | 141 | { |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | 146 | * @param int $wydalanie int wydalanie |
| 147 | - * @return PatientZZ |
|
| 147 | + * @return PatientDIA |
|
| 148 | 148 | */ |
| 149 | 149 | public function setWydalanie($wydalanie) |
| 150 | 150 | { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
| 156 | - * @return pomiarParametrowZyciowych |
|
| 156 | + * @return integer |
|
| 157 | 157 | */ |
| 158 | 158 | public function getPomiarParametrowZyciowych() |
| 159 | 159 | { |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | 164 | * @param int $pomiarParametrowZyciowych int pomiarParametrowZyciowych |
| 165 | - * @return PatientZZ |
|
| 165 | + * @return PatientDIA |
|
| 166 | 166 | */ |
| 167 | 167 | public function setPomiarParametrowZyciowych($pomiarParametrowZyciowych) |
| 168 | 168 | { |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
| 174 | - * @return leczenie |
|
| 174 | + * @return integer |
|
| 175 | 175 | */ |
| 176 | 176 | public function getLeczenie() |
| 177 | 177 | { |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | /** |
| 182 | 182 | * @param int $leczenie int leczenie |
| 183 | - * @return PatientZZ |
|
| 183 | + * @return PatientDIA |
|
| 184 | 184 | */ |
| 185 | 185 | public function setLeczenie($leczenie) |
| 186 | 186 | { |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | /** |
| 200 | 200 | * @param int $edukacjaZdrowotnaIOpiekaPsychospoleczna int edukacjaZdrowotnaIOpiekaPsychospoleczna |
| 201 | - * @return PatientZZ |
|
| 201 | + * @return PatientDIA |
|
| 202 | 202 | */ |
| 203 | 203 | public function setEdukacjaZdrowotnaIOpiekaPsychospoleczna($edukacjaZdrowotnaIOpiekaPsychospoleczna) |
| 204 | 204 | { |
@@ -1,26 +1,26 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PatientZZ |
|
| 4 | - * |
|
| 5 | - * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED |
|
| 6 | - * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. |
|
| 7 | - * |
|
| 8 | - * Permission is hereby granted to use or copy this program |
|
| 9 | - * for any purpose, provided the above notices are retained on all copies. |
|
| 10 | - * Permission to modify the code and to distribute modified code is granted, |
|
| 11 | - * provided the above notices are retained, and a notice that the code was |
|
| 12 | - * modified is included with the above copyright notice. |
|
| 13 | - * |
|
| 14 | - * @category Wp |
|
| 15 | - * @package Punction |
|
| 16 | - * @author Andrzej Marcinkowski <[email protected]> |
|
| 17 | - * @copyright 2014 Wojewódzki Szpital Zespolony, Kalisz |
|
| 18 | - * @license MIT http://opensource.org/licenses/MIT |
|
| 19 | - * @version 1.0 $Format:%H$ |
|
| 20 | - * @link http:// |
|
| 21 | - * @since File available since Release 1.0.0 |
|
| 22 | - * PHP Version 5 |
|
| 23 | - */ |
|
| 3 | + * PatientZZ |
|
| 4 | + * |
|
| 5 | + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED |
|
| 6 | + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. |
|
| 7 | + * |
|
| 8 | + * Permission is hereby granted to use or copy this program |
|
| 9 | + * for any purpose, provided the above notices are retained on all copies. |
|
| 10 | + * Permission to modify the code and to distribute modified code is granted, |
|
| 11 | + * provided the above notices are retained, and a notice that the code was |
|
| 12 | + * modified is included with the above copyright notice. |
|
| 13 | + * |
|
| 14 | + * @category Wp |
|
| 15 | + * @package Punction |
|
| 16 | + * @author Andrzej Marcinkowski <[email protected]> |
|
| 17 | + * @copyright 2014 Wojewódzki Szpital Zespolony, Kalisz |
|
| 18 | + * @license MIT http://opensource.org/licenses/MIT |
|
| 19 | + * @version 1.0 $Format:%H$ |
|
| 20 | + * @link http:// |
|
| 21 | + * @since File available since Release 1.0.0 |
|
| 22 | + * PHP Version 5 |
|
| 23 | + */ |
|
| 24 | 24 | namespace Hospitalplugin\Entities; |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | /** |
| 84 | 84 | * getaktywnoscFizyczna |
| 85 | 85 | * |
| 86 | - * @return aktywnoscFizyczna int |
|
| 86 | + * @return integer int |
|
| 87 | 87 | */ |
| 88 | 88 | public function getAktywnoscFizyczna() |
| 89 | 89 | { |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | /** |
| 107 | 107 | * getHigiena |
| 108 | 108 | * |
| 109 | - * @return Higiena int Higiena |
|
| 109 | + * @return integer int Higiena |
|
| 110 | 110 | */ |
| 111 | 111 | public function getHigiena() |
| 112 | 112 | { |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | /** |
| 117 | 117 | * setHigiena |
| 118 | 118 | * |
| 119 | - * @param int $Higiena int higiena |
|
| 119 | + * @param int $higiena int higiena |
|
| 120 | 120 | * |
| 121 | 121 | * @return PatientPED |
| 122 | 122 | */ |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | /** |
| 130 | 130 | * getKarmienieIOdzywianie |
| 131 | 131 | * |
| 132 | - * @return KarmienieIOdzywianie |
|
| 132 | + * @return integer |
|
| 133 | 133 | */ |
| 134 | 134 | public function getKarmienieIOdzywianie() |
| 135 | 135 | { |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | /** |
| 140 | 140 | * setKarmienieIOdzywianie |
| 141 | 141 | * |
| 142 | - * @param int $KarmienieIOdzywianie itn karmienieIOdzywianie |
|
| 142 | + * @param int $karmienieIOdzywianie itn karmienieIOdzywianie |
|
| 143 | 143 | * |
| 144 | 144 | * @return PatientPED |
| 145 | 145 | */ |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | /** |
| 153 | 153 | * getWydalanie |
| 154 | 154 | * |
| 155 | - * @return Wydalanie |
|
| 155 | + * @return integer |
|
| 156 | 156 | */ |
| 157 | 157 | public function getWydalanie() |
| 158 | 158 | { |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | /** |
| 163 | 163 | * PatientPED |
| 164 | 164 | * |
| 165 | - * @param int $Wydalanie Wydalanie |
|
| 165 | + * @param int $wydalanie Wydalanie |
|
| 166 | 166 | * |
| 167 | 167 | * @return PatientPED |
| 168 | 168 | */ |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | /** |
| 176 | 176 | * getPomiarParametrowZyciowych |
| 177 | 177 | * |
| 178 | - * @return PomiarParametrowZyciowych |
|
| 178 | + * @return integer |
|
| 179 | 179 | */ |
| 180 | 180 | public function getPomiarParametrowZyciowych() |
| 181 | 181 | { |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | /** |
| 186 | 186 | * setPomiarParametrowZyciowych |
| 187 | 187 | * |
| 188 | - * @param int $PomiarParametrowZyciowych int PomiarParametrowZyciowych |
|
| 188 | + * @param int $pomiarParametrowZyciowych int PomiarParametrowZyciowych |
|
| 189 | 189 | * |
| 190 | 190 | * @return PatientPED |
| 191 | 191 | */ |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | /** |
| 199 | 199 | * getLeczenie |
| 200 | 200 | * |
| 201 | - * @return Leczenie |
|
| 201 | + * @return integer |
|
| 202 | 202 | */ |
| 203 | 203 | public function getLeczenie() |
| 204 | 204 | { |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | /** |
| 222 | 222 | * getEdukacjaZdrowotnaOrazWsparcieDzieckaIRodzicow |
| 223 | 223 | * |
| 224 | - * @return EdukacjaZdrowotnaOrazWsparcieDzieckaIRodzicow |
|
| 224 | + * @return integer |
|
| 225 | 225 | */ |
| 226 | 226 | public function getEdukacjaZdrowotnaOrazWsparcieDzieckaIRodzicow() |
| 227 | 227 | { |
@@ -1,26 +1,26 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PatientPED |
|
| 4 | - * |
|
| 5 | - * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED |
|
| 6 | - * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. |
|
| 7 | - * |
|
| 8 | - * Permission is hereby granted to use or copy this program |
|
| 9 | - * for any purpose, provided the above notices are retained on all copies. |
|
| 10 | - * Permission to modify the code and to distribute modified code is granted, |
|
| 11 | - * provided the above notices are retained, and a notice that the code was |
|
| 12 | - * modified is included with the above copyright notice. |
|
| 13 | - * |
|
| 14 | - * @category Wp |
|
| 15 | - * @package Punction |
|
| 16 | - * @author Andrzej Marcinkowski <[email protected]> |
|
| 17 | - * @copyright 2014 Wojewódzki Szpital Zespolony, Kalisz |
|
| 18 | - * @license MIT http://opensource.org/licenses/MIT |
|
| 19 | - * @version 1.0 $Format:%H$ |
|
| 20 | - * @link http:// |
|
| 21 | - * @since File available since Release 1.0.0 |
|
| 22 | - * PHP Version 5 |
|
| 23 | - */ |
|
| 3 | + * PatientPED |
|
| 4 | + * |
|
| 5 | + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED |
|
| 6 | + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. |
|
| 7 | + * |
|
| 8 | + * Permission is hereby granted to use or copy this program |
|
| 9 | + * for any purpose, provided the above notices are retained on all copies. |
|
| 10 | + * Permission to modify the code and to distribute modified code is granted, |
|
| 11 | + * provided the above notices are retained, and a notice that the code was |
|
| 12 | + * modified is included with the above copyright notice. |
|
| 13 | + * |
|
| 14 | + * @category Wp |
|
| 15 | + * @package Punction |
|
| 16 | + * @author Andrzej Marcinkowski <[email protected]> |
|
| 17 | + * @copyright 2014 Wojewódzki Szpital Zespolony, Kalisz |
|
| 18 | + * @license MIT http://opensource.org/licenses/MIT |
|
| 19 | + * @version 1.0 $Format:%H$ |
|
| 20 | + * @link http:// |
|
| 21 | + * @since File available since Release 1.0.0 |
|
| 22 | + * PHP Version 5 |
|
| 23 | + */ |
|
| 24 | 24 | namespace Hospitalplugin\Entities; |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | public $edukacjaIWsparciePsychiczne; |
| 82 | 82 | // |
| 83 | 83 | /** |
| 84 | - * @return aktywnoscFizyczna |
|
| 84 | + * @return integer |
|
| 85 | 85 | */ |
| 86 | 86 | public function getAktywnoscFizyczna() |
| 87 | 87 | { |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * @param int $aktywnoscFizyczna int aktywnoscFizyczna |
| 93 | - * @return PatientZZ |
|
| 93 | + * @return PatientPOL |
|
| 94 | 94 | */ |
| 95 | 95 | public function setAktywnoscFizyczna($aktywnoscFizyczna) |
| 96 | 96 | { |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | - * @return higiena |
|
| 102 | + * @return integer |
|
| 103 | 103 | */ |
| 104 | 104 | public function getHigiena() |
| 105 | 105 | { |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | 110 | * @param int $higiena int higiena |
| 111 | - * @return PatientZZ |
|
| 111 | + * @return PatientPOL |
|
| 112 | 112 | */ |
| 113 | 113 | public function setHigiena($higiena) |
| 114 | 114 | { |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | - * @return odzywianie |
|
| 120 | + * @return integer |
|
| 121 | 121 | */ |
| 122 | 122 | public function getOdzywianie() |
| 123 | 123 | { |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | /** |
| 128 | 128 | * @param int $odzywianie int odzywianie |
| 129 | - * @return PatientZZ |
|
| 129 | + * @return PatientPOL |
|
| 130 | 130 | */ |
| 131 | 131 | public function setOdzywianie($odzywianie) |
| 132 | 132 | { |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
| 138 | - * @return wydalanie |
|
| 138 | + * @return integer |
|
| 139 | 139 | */ |
| 140 | 140 | public function getWydalanie() |
| 141 | 141 | { |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | 146 | * @param int $wydalanie int wydalanie |
| 147 | - * @return PatientZZ |
|
| 147 | + * @return PatientPOL |
|
| 148 | 148 | */ |
| 149 | 149 | public function setWydalanie($wydalanie) |
| 150 | 150 | { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
| 156 | - * @return pomiarParametrowZyciowych |
|
| 156 | + * @return integer |
|
| 157 | 157 | */ |
| 158 | 158 | public function getPomiarParametrowZyciowych() |
| 159 | 159 | { |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | 164 | * @param int $pomiarParametrowZyciowych int pomiarParametrowZyciowych |
| 165 | - * @return PatientZZ |
|
| 165 | + * @return PatientPOL |
|
| 166 | 166 | */ |
| 167 | 167 | public function setPomiarParametrowZyciowych($pomiarParametrowZyciowych) |
| 168 | 168 | { |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
| 174 | - * @return leczenie |
|
| 174 | + * @return integer |
|
| 175 | 175 | */ |
| 176 | 176 | public function getLeczenie() |
| 177 | 177 | { |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | /** |
| 182 | 182 | * @param int $leczenie int leczenie |
| 183 | - * @return PatientZZ |
|
| 183 | + * @return PatientPOL |
|
| 184 | 184 | */ |
| 185 | 185 | public function setLeczenie($leczenie) |
| 186 | 186 | { |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | - * @return edukacjaIWsparciePsychiczne |
|
| 192 | + * @return integer |
|
| 193 | 193 | */ |
| 194 | 194 | public function getEdukacjaIWsparciePsychiczne() |
| 195 | 195 | { |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | /** |
| 200 | 200 | * @param int $edukacjaIWsparciePsychiczne int edukacjaIWsparciePsychiczne |
| 201 | - * @return PatientZZ |
|
| 201 | + * @return PatientPOL |
|
| 202 | 202 | */ |
| 203 | 203 | public function setEdukacjaIWsparciePsychiczne($edukacjaIWsparciePsychiczne) |
| 204 | 204 | { |
@@ -1,26 +1,26 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PatientZZ |
|
| 4 | - * |
|
| 5 | - * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED |
|
| 6 | - * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. |
|
| 7 | - * |
|
| 8 | - * Permission is hereby granted to use or copy this program |
|
| 9 | - * for any purpose, provided the above notices are retained on all copies. |
|
| 10 | - * Permission to modify the code and to distribute modified code is granted, |
|
| 11 | - * provided the above notices are retained, and a notice that the code was |
|
| 12 | - * modified is included with the above copyright notice. |
|
| 13 | - * |
|
| 14 | - * @category Wp |
|
| 15 | - * @package Punction |
|
| 16 | - * @author Andrzej Marcinkowski <[email protected]> |
|
| 17 | - * @copyright 2014 Wojewódzki Szpital Zespolony, Kalisz |
|
| 18 | - * @license MIT http://opensource.org/licenses/MIT |
|
| 19 | - * @version 1.0 $Format:%H$ |
|
| 20 | - * @link http:// |
|
| 21 | - * @since File available since Release 1.0.0 |
|
| 22 | - * PHP Version 5 |
|
| 23 | - */ |
|
| 3 | + * PatientZZ |
|
| 4 | + * |
|
| 5 | + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED |
|
| 6 | + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. |
|
| 7 | + * |
|
| 8 | + * Permission is hereby granted to use or copy this program |
|
| 9 | + * for any purpose, provided the above notices are retained on all copies. |
|
| 10 | + * Permission to modify the code and to distribute modified code is granted, |
|
| 11 | + * provided the above notices are retained, and a notice that the code was |
|
| 12 | + * modified is included with the above copyright notice. |
|
| 13 | + * |
|
| 14 | + * @category Wp |
|
| 15 | + * @package Punction |
|
| 16 | + * @author Andrzej Marcinkowski <[email protected]> |
|
| 17 | + * @copyright 2014 Wojewódzki Szpital Zespolony, Kalisz |
|
| 18 | + * @license MIT http://opensource.org/licenses/MIT |
|
| 19 | + * @version 1.0 $Format:%H$ |
|
| 20 | + * @link http:// |
|
| 21 | + * @since File available since Release 1.0.0 |
|
| 22 | + * PHP Version 5 |
|
| 23 | + */ |
|
| 24 | 24 | namespace Hospitalplugin\Entities; |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -50,8 +50,8 @@ |
||
| 50 | 50 | * |
| 51 | 51 | * @param unknown $wardId |
| 52 | 52 | * @param unknown $type |
| 53 | - * @param unknown $startDate |
|
| 54 | - * @param unknown $endDate |
|
| 53 | + * @param string $startDate |
|
| 54 | + * @param string $endDate |
|
| 55 | 55 | * @return array |
| 56 | 56 | */ |
| 57 | 57 | public static function getRaportBetweenDates($wardId, $type, $startDate, $endDate) { |
@@ -8,185 +8,185 @@ |
||
| 8 | 8 | use Doctrine\ORM\Query\ResultSetMapping; |
| 9 | 9 | |
| 10 | 10 | class PatientRaport { |
| 11 | - /** |
|
| 12 | - * |
|
| 13 | - * @param unknown $wardId |
|
| 14 | - * @param unknown $date |
|
| 15 | - */ |
|
| 16 | - public static function getRaport($wardId, $date, $wardType) { |
|
| 17 | - $startDate = $date . '-01'; |
|
| 18 | - $endDate = date ( "Y-m-t 23:59:59", strtotime ( $startDate ) ); |
|
| 11 | + /** |
|
| 12 | + * |
|
| 13 | + * @param unknown $wardId |
|
| 14 | + * @param unknown $date |
|
| 15 | + */ |
|
| 16 | + public static function getRaport($wardId, $date, $wardType) { |
|
| 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 ); |
|
| 21 | - } |
|
| 22 | - private static function getQuery($type) { |
|
| 23 | - if ($type == 'POR') { |
|
| 24 | - // poród zabiegowy |
|
| 25 | - $dql1 = " SELECT p.kategoriaPacjenta + 3 as kategoria, DATE(p.dataKategoryzacji) as data, COUNT(p.kategoriaPacjenta) as suma "; |
|
| 26 | - $dql1 .= " FROM Hospitalplugin\Entities\PatientPOR p "; |
|
| 27 | - $dql1 .= " WHERE p.dataKategoryzacji BETWEEN ?1 AND ?2 AND p.oddzialId = ?3 AND p.iICzas = 3"; |
|
| 28 | - $dql1 .= " GROUP BY data, p.kategoriaPacjenta"; |
|
| 29 | - // poród siłami natury |
|
| 30 | - $dql2 = " SELECT p.kategoriaPacjenta as kategoria, DATE(p.dataKategoryzacji) as data, COUNT(p.kategoriaPacjenta) as suma "; |
|
| 31 | - $dql2 .= " FROM Hospitalplugin\Entities\PatientPOR p "; |
|
| 32 | - $dql2 .= " WHERE p.dataKategoryzacji BETWEEN ?1 AND ?2 AND p.oddzialId = ?3 AND (p.iICzas <> 3 OR p.iICzas IS NULL)"; |
|
| 33 | - $dql2 .= " GROUP BY data, p.kategoriaPacjenta"; |
|
| 34 | - return array ( |
|
| 35 | - $dql1, |
|
| 36 | - $dql2 |
|
| 37 | - ); |
|
| 38 | - } else { |
|
| 39 | - // pozostałe typy |
|
| 40 | - $dql = " SELECT p.kategoriaPacjenta as kategoria, DATE(p.dataKategoryzacji) as data, COUNT(p.kategoriaPacjenta) as suma "; |
|
| 41 | - $dql .= " FROM Hospitalplugin\Entities\Patient p "; |
|
| 42 | - $dql .= " WHERE p.dataKategoryzacji BETWEEN ?1 AND ?2 AND p.oddzialId = ?3"; |
|
| 43 | - $dql .= " GROUP BY data, p.kategoriaPacjenta"; |
|
| 44 | - return array ( |
|
| 45 | - $dql |
|
| 46 | - ); |
|
| 47 | - } |
|
| 48 | - } |
|
| 49 | - /** |
|
| 50 | - * |
|
| 51 | - * @param unknown $wardId |
|
| 52 | - * @param unknown $type |
|
| 53 | - * @param unknown $startDate |
|
| 54 | - * @param unknown $endDate |
|
| 55 | - * @return array |
|
| 56 | - */ |
|
| 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 ); |
|
| 65 | - } |
|
| 20 | + return PatientRaport::getRaportBetweenDates ( $wardId, $wardType, $startDate, $endDate ); |
|
| 21 | + } |
|
| 22 | + private static function getQuery($type) { |
|
| 23 | + if ($type == 'POR') { |
|
| 24 | + // poród zabiegowy |
|
| 25 | + $dql1 = " SELECT p.kategoriaPacjenta + 3 as kategoria, DATE(p.dataKategoryzacji) as data, COUNT(p.kategoriaPacjenta) as suma "; |
|
| 26 | + $dql1 .= " FROM Hospitalplugin\Entities\PatientPOR p "; |
|
| 27 | + $dql1 .= " WHERE p.dataKategoryzacji BETWEEN ?1 AND ?2 AND p.oddzialId = ?3 AND p.iICzas = 3"; |
|
| 28 | + $dql1 .= " GROUP BY data, p.kategoriaPacjenta"; |
|
| 29 | + // poród siłami natury |
|
| 30 | + $dql2 = " SELECT p.kategoriaPacjenta as kategoria, DATE(p.dataKategoryzacji) as data, COUNT(p.kategoriaPacjenta) as suma "; |
|
| 31 | + $dql2 .= " FROM Hospitalplugin\Entities\PatientPOR p "; |
|
| 32 | + $dql2 .= " WHERE p.dataKategoryzacji BETWEEN ?1 AND ?2 AND p.oddzialId = ?3 AND (p.iICzas <> 3 OR p.iICzas IS NULL)"; |
|
| 33 | + $dql2 .= " GROUP BY data, p.kategoriaPacjenta"; |
|
| 34 | + return array ( |
|
| 35 | + $dql1, |
|
| 36 | + $dql2 |
|
| 37 | + ); |
|
| 38 | + } else { |
|
| 39 | + // pozostałe typy |
|
| 40 | + $dql = " SELECT p.kategoriaPacjenta as kategoria, DATE(p.dataKategoryzacji) as data, COUNT(p.kategoriaPacjenta) as suma "; |
|
| 41 | + $dql .= " FROM Hospitalplugin\Entities\Patient p "; |
|
| 42 | + $dql .= " WHERE p.dataKategoryzacji BETWEEN ?1 AND ?2 AND p.oddzialId = ?3"; |
|
| 43 | + $dql .= " GROUP BY data, p.kategoriaPacjenta"; |
|
| 44 | + return array ( |
|
| 45 | + $dql |
|
| 46 | + ); |
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | + /** |
|
| 50 | + * |
|
| 51 | + * @param unknown $wardId |
|
| 52 | + * @param unknown $type |
|
| 53 | + * @param unknown $startDate |
|
| 54 | + * @param unknown $endDate |
|
| 55 | + * @return array |
|
| 56 | + */ |
|
| 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 ); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - $table = array (); |
|
| 68 | - foreach ( $allResults as $row ) { |
|
| 69 | - $table [$row ['data']] [$row ['kategoria']] = $row ['suma']; |
|
| 70 | - } |
|
| 71 | - return $table; |
|
| 72 | - } |
|
| 73 | - /** |
|
| 74 | - * @param unknown $type |
|
| 75 | - */ |
|
| 76 | - static function getColumns($type) { |
|
| 77 | - if ($type == 'POR') { |
|
| 78 | - return array ( |
|
| 79 | - 'N1 naturalny', |
|
| 80 | - 'N2 naturalny', |
|
| 81 | - 'N3 naturalny', |
|
| 82 | - 'N1 zabiegowy', |
|
| 83 | - 'N2 zabiegowy', |
|
| 84 | - 'N3 zabiegowy', |
|
| 85 | - 'brak kat.', |
|
| 86 | - 'N', |
|
| 87 | - 'Tpb1', |
|
| 88 | - 'Tpb2', |
|
| 89 | - 'Tpb3', |
|
| 90 | - 'Tpb1z', |
|
| 91 | - 'Tpb2z', |
|
| 92 | - 'Tpb3z', |
|
| 93 | - 'Tpb0', |
|
| 94 | - '2', |
|
| 95 | - 'Tpb1*N1', |
|
| 96 | - 'Tpb2*N2', |
|
| 97 | - 'Tpb3*N3', |
|
| 98 | - 'Tpb1z*N1z', |
|
| 99 | - 'Tpb2z*N2z', |
|
| 100 | - 'Tpb3z*N3z', |
|
| 101 | - 'Tpb0', |
|
| 102 | - '2*N', |
|
| 103 | - 'Tpb/dzień' |
|
| 104 | - ); |
|
| 105 | - } else { |
|
| 106 | - return array ( |
|
| 107 | - 'N1', |
|
| 108 | - 'N2', |
|
| 109 | - 'N3', |
|
| 110 | - 'brak kat.', |
|
| 111 | - 'N', |
|
| 112 | - 'Tpb1', |
|
| 113 | - 'Tpb2', |
|
| 114 | - 'Tpb3', |
|
| 115 | - 'Tpb0', |
|
| 116 | - '2', |
|
| 117 | - 'Tpb1*N1', |
|
| 118 | - 'Tpb2*N2', |
|
| 119 | - 'Tpb3*N3', |
|
| 120 | - 'Tpb0', |
|
| 121 | - '2*N', |
|
| 122 | - 'Tpb/dzień' |
|
| 123 | - ); |
|
| 124 | - } |
|
| 125 | - } |
|
| 126 | - static function getIndexes($type) { |
|
| 127 | - if ($type == 'POR') { |
|
| 128 | - return array ( |
|
| 129 | - '1', |
|
| 130 | - '2', |
|
| 131 | - '3', |
|
| 132 | - '4', |
|
| 133 | - '5', |
|
| 134 | - '6', |
|
| 135 | - '0' |
|
| 136 | - ); |
|
| 137 | - } else { |
|
| 138 | - return array ( |
|
| 139 | - '1', |
|
| 140 | - '2', |
|
| 141 | - '3', |
|
| 142 | - '0' |
|
| 143 | - ); |
|
| 144 | - } |
|
| 145 | - } |
|
| 146 | - /** |
|
| 147 | - * based on |
|
| 148 | - * Zalecenie Konsultanta Krajowego w dz. |
|
| 149 | - * pielęgniarstwa w sprawie realizacji przepisów rozporządzenia Ministra Zdrowia z dnia 28 grudnia 2012 roku w sprawie sposobu ustalenia minimalnych norm zatrudnienia pielęgniarek i położnych w podmiotach leczniczych niebędących przedsiębiorcami. |
|
| 150 | - * http://www.nipip.pl/index.php/prawo/opiniekk/w-dz-pielegniarstwa/konsultant-krajowy-dr-hab-n-hum-maria-kozka/2265-zalecenie-konsultanta-krajowego-w-dz-pielegniarstwa-w-sprawie-realizacji-przepisow-rozporzadzenia-ministra-zdrowia-z-dnia-28-grudnia-2012-roku-w-sprawie-sposobu-ustalenia-minimalnych-norm-zatrudnienia-pielegniarek-i-poloznych-w-podmiotach-leczniczych-nieb |
|
| 151 | - * |
|
| 152 | - * @param unknown $type |
|
| 153 | - */ |
|
| 154 | - static function getTpb($type) { |
|
| 155 | - if ($type == 'ZZ' || $type == 'PED') { |
|
| 156 | - return array ( |
|
| 157 | - 38, |
|
| 158 | - 95, |
|
| 159 | - 159, |
|
| 160 | - 0, |
|
| 161 | - 2 |
|
| 162 | - ); |
|
| 163 | - } else if ($type == 'PSY') { |
|
| 164 | - return array ( |
|
| 165 | - 40, |
|
| 166 | - 100, |
|
| 167 | - 160, |
|
| 168 | - 0, |
|
| 169 | - 2 |
|
| 170 | - ); |
|
| 171 | - } else if ($type == 'POR') { |
|
| 172 | - return array ( |
|
| 173 | - 137, |
|
| 174 | - 274, |
|
| 175 | - 328, |
|
| 176 | - 53, |
|
| 177 | - 53, |
|
| 178 | - 120, |
|
| 179 | - 0, |
|
| 180 | - 2 |
|
| 181 | - ); |
|
| 182 | - } else if ($type == 'POL') { |
|
| 183 | - return array ( |
|
| 184 | - 72, |
|
| 185 | - 100, |
|
| 186 | - 98, |
|
| 187 | - 0, |
|
| 188 | - 2 |
|
| 189 | - ); |
|
| 190 | - } |
|
| 191 | - } |
|
| 67 | + $table = array (); |
|
| 68 | + foreach ( $allResults as $row ) { |
|
| 69 | + $table [$row ['data']] [$row ['kategoria']] = $row ['suma']; |
|
| 70 | + } |
|
| 71 | + return $table; |
|
| 72 | + } |
|
| 73 | + /** |
|
| 74 | + * @param unknown $type |
|
| 75 | + */ |
|
| 76 | + static function getColumns($type) { |
|
| 77 | + if ($type == 'POR') { |
|
| 78 | + return array ( |
|
| 79 | + 'N1 naturalny', |
|
| 80 | + 'N2 naturalny', |
|
| 81 | + 'N3 naturalny', |
|
| 82 | + 'N1 zabiegowy', |
|
| 83 | + 'N2 zabiegowy', |
|
| 84 | + 'N3 zabiegowy', |
|
| 85 | + 'brak kat.', |
|
| 86 | + 'N', |
|
| 87 | + 'Tpb1', |
|
| 88 | + 'Tpb2', |
|
| 89 | + 'Tpb3', |
|
| 90 | + 'Tpb1z', |
|
| 91 | + 'Tpb2z', |
|
| 92 | + 'Tpb3z', |
|
| 93 | + 'Tpb0', |
|
| 94 | + '2', |
|
| 95 | + 'Tpb1*N1', |
|
| 96 | + 'Tpb2*N2', |
|
| 97 | + 'Tpb3*N3', |
|
| 98 | + 'Tpb1z*N1z', |
|
| 99 | + 'Tpb2z*N2z', |
|
| 100 | + 'Tpb3z*N3z', |
|
| 101 | + 'Tpb0', |
|
| 102 | + '2*N', |
|
| 103 | + 'Tpb/dzień' |
|
| 104 | + ); |
|
| 105 | + } else { |
|
| 106 | + return array ( |
|
| 107 | + 'N1', |
|
| 108 | + 'N2', |
|
| 109 | + 'N3', |
|
| 110 | + 'brak kat.', |
|
| 111 | + 'N', |
|
| 112 | + 'Tpb1', |
|
| 113 | + 'Tpb2', |
|
| 114 | + 'Tpb3', |
|
| 115 | + 'Tpb0', |
|
| 116 | + '2', |
|
| 117 | + 'Tpb1*N1', |
|
| 118 | + 'Tpb2*N2', |
|
| 119 | + 'Tpb3*N3', |
|
| 120 | + 'Tpb0', |
|
| 121 | + '2*N', |
|
| 122 | + 'Tpb/dzień' |
|
| 123 | + ); |
|
| 124 | + } |
|
| 125 | + } |
|
| 126 | + static function getIndexes($type) { |
|
| 127 | + if ($type == 'POR') { |
|
| 128 | + return array ( |
|
| 129 | + '1', |
|
| 130 | + '2', |
|
| 131 | + '3', |
|
| 132 | + '4', |
|
| 133 | + '5', |
|
| 134 | + '6', |
|
| 135 | + '0' |
|
| 136 | + ); |
|
| 137 | + } else { |
|
| 138 | + return array ( |
|
| 139 | + '1', |
|
| 140 | + '2', |
|
| 141 | + '3', |
|
| 142 | + '0' |
|
| 143 | + ); |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | + /** |
|
| 147 | + * based on |
|
| 148 | + * Zalecenie Konsultanta Krajowego w dz. |
|
| 149 | + * pielęgniarstwa w sprawie realizacji przepisów rozporządzenia Ministra Zdrowia z dnia 28 grudnia 2012 roku w sprawie sposobu ustalenia minimalnych norm zatrudnienia pielęgniarek i położnych w podmiotach leczniczych niebędących przedsiębiorcami. |
|
| 150 | + * http://www.nipip.pl/index.php/prawo/opiniekk/w-dz-pielegniarstwa/konsultant-krajowy-dr-hab-n-hum-maria-kozka/2265-zalecenie-konsultanta-krajowego-w-dz-pielegniarstwa-w-sprawie-realizacji-przepisow-rozporzadzenia-ministra-zdrowia-z-dnia-28-grudnia-2012-roku-w-sprawie-sposobu-ustalenia-minimalnych-norm-zatrudnienia-pielegniarek-i-poloznych-w-podmiotach-leczniczych-nieb |
|
| 151 | + * |
|
| 152 | + * @param unknown $type |
|
| 153 | + */ |
|
| 154 | + static function getTpb($type) { |
|
| 155 | + if ($type == 'ZZ' || $type == 'PED') { |
|
| 156 | + return array ( |
|
| 157 | + 38, |
|
| 158 | + 95, |
|
| 159 | + 159, |
|
| 160 | + 0, |
|
| 161 | + 2 |
|
| 162 | + ); |
|
| 163 | + } else if ($type == 'PSY') { |
|
| 164 | + return array ( |
|
| 165 | + 40, |
|
| 166 | + 100, |
|
| 167 | + 160, |
|
| 168 | + 0, |
|
| 169 | + 2 |
|
| 170 | + ); |
|
| 171 | + } else if ($type == 'POR') { |
|
| 172 | + return array ( |
|
| 173 | + 137, |
|
| 174 | + 274, |
|
| 175 | + 328, |
|
| 176 | + 53, |
|
| 177 | + 53, |
|
| 178 | + 120, |
|
| 179 | + 0, |
|
| 180 | + 2 |
|
| 181 | + ); |
|
| 182 | + } else if ($type == 'POL') { |
|
| 183 | + return array ( |
|
| 184 | + 72, |
|
| 185 | + 100, |
|
| 186 | + 98, |
|
| 187 | + 0, |
|
| 188 | + 2 |
|
| 189 | + ); |
|
| 190 | + } |
|
| 191 | + } |
|
| 192 | 192 | } |
| 193 | 193 | \ No newline at end of file |
@@ -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,7 +180,7 @@ discard block |
||
| 180 | 180 | 2 |
| 181 | 181 | ); |
| 182 | 182 | } else if ($type == 'POL') { |
| 183 | - return array ( |
|
| 183 | + return array( |
|
| 184 | 184 | 72, |
| 185 | 185 | 100, |
| 186 | 186 | 98, |
@@ -3,9 +3,6 @@ |
||
| 3 | 3 | namespace Hospitalplugin\Entities; |
| 4 | 4 | |
| 5 | 5 | use Hospitalplugin\DB\DoctrineBootstrap; |
| 6 | -use Hospitalplugin\utils\Utils; |
|
| 7 | -use Doctrine\DBAL\Schema\View; |
|
| 8 | -use Doctrine\ORM\Query\ResultSetMapping; |
|
| 9 | 6 | |
| 10 | 7 | class PatientRaportOptimized { |
| 11 | 8 | /** |