@@ -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=false) |
|
| 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=false) |
|
| 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 | } |