@@ -9,133 +9,133 @@ |
||
| 9 | 9 | |
| 10 | 10 | class ExcelExportPunction { |
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * |
|
| 14 | - * @param unknown $id |
|
| 15 | - */ |
|
| 16 | - private static function getData($id, $type) { |
|
| 17 | - $raport = PatientRaport::getRaportBetweenDates ( $id, $type, '2014-06-01', (new \DateTime ())->format ( "Y-m-d" ) ); |
|
| 18 | - return $raport; |
|
| 19 | - } |
|
| 20 | - /** |
|
| 21 | - * |
|
| 22 | - * @param unknown $objPHPExcel |
|
| 23 | - * @param unknown $cols |
|
| 24 | - */ |
|
| 25 | - private static function printHeaders($objPHPExcel, $cols) { |
|
| 26 | - $count = 1; |
|
| 27 | - $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, 2, "Data" ); |
|
| 28 | - foreach ( $cols as $col ) { |
|
| 29 | - $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, 2, sprintf ( "%7s", $col ) ); |
|
| 30 | - } |
|
| 31 | - } |
|
| 32 | - /** |
|
| 33 | - */ |
|
| 34 | - private static function printData($objPHPExcel, $data, $type) { |
|
| 35 | - $row = 3; |
|
| 36 | - $lastColumn = 1; |
|
| 37 | - $colNumberOfPatients = ExcelExport::getColumnLetter ( 1 ); |
|
| 38 | - $indexes = PatientRaport::getIndexes ( $type ); |
|
| 39 | - foreach ( $data as $rowKey => $rowValue ) { |
|
| 40 | - // 1 col: date |
|
| 41 | - $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, $row, json_encode ( $rowKey ) ); |
|
| 42 | - $count = 1; |
|
| 43 | - // 2-5 cols: N1 N2 N3 N0 |
|
| 44 | - foreach ( $indexes as $index ) { |
|
| 45 | - $value = isset ( $rowValue [$index] ) ? $rowValue [$index] : "0"; |
|
| 46 | - $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, $value ); |
|
| 47 | - } |
|
| 48 | - // 6 col: num of categorized (N = N1+N2+N3) |
|
| 49 | - $colHighestCategory = ExcelExport::getColumnLetter ( $count - 2 ); |
|
| 50 | - $colNumberOfPatients = ExcelExport::getColumnLetter ( $count ); |
|
| 51 | - $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, '=SUM(B' . $row . ':' . $colHighestCategory . $row . ')' ); |
|
| 52 | - $tpb = PatientRaport::getTpb ( $type ); |
|
| 53 | - // 7-11 tpb1, tpb2, tpb3, 0 (no-cat), 2 (add) |
|
| 54 | - foreach ( $tpb as $tpbn ) { |
|
| 55 | - $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, $tpbn ); |
|
| 56 | - } |
|
| 57 | - // 9-11: Tpb1*N1,Tpb2*N2,Tpb3*N3+2xN |
|
| 58 | - $tpbSize = count ( $tpb ); |
|
| 59 | - foreach ( $tpb as $tpbn ) { |
|
| 60 | - $col1Letter = ExcelExport::getColumnLetter ( $count - 2 * $tpbSize ); |
|
| 61 | - $col2Letter = ExcelExport::getColumnLetter ( $count - $tpbSize ); |
|
| 62 | - $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, '=' . $col1Letter . $row . "*" . $col2Letter . $row ); |
|
| 63 | - } |
|
| 64 | - // SUM Tpb |
|
| 65 | - $col3Letter = ExcelExport::getColumnLetter ( $count - $tpbSize ); |
|
| 66 | - $col4Letter = ExcelExport::getColumnLetter ( $count - 1 ); |
|
| 67 | - $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, '=SUM(' . $col3Letter . $row . ":" . $col4Letter . $row . ")" ); |
|
| 68 | - $row ++; |
|
| 69 | - $lastColumn = $count - 1; |
|
| 70 | - } |
|
| 71 | - // number of categorization days |
|
| 72 | - $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 1, 1, '=COUNTIFS(' . $colNumberOfPatients . '3:' . $colNumberOfPatients . ($row - 1) . ',">0")' ); |
|
| 73 | - // sum |
|
| 74 | - $col5Letter = ExcelExport::getColumnLetter ( $lastColumn ); |
|
| 75 | - $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 2, 1, '=SUM(' . $col5Letter . '3:' . $col5Letter . ($row - 1) . ')/60' ); |
|
| 76 | - return $row; |
|
| 77 | - } |
|
| 12 | + /** |
|
| 13 | + * |
|
| 14 | + * @param unknown $id |
|
| 15 | + */ |
|
| 16 | + private static function getData($id, $type) { |
|
| 17 | + $raport = PatientRaport::getRaportBetweenDates ( $id, $type, '2014-06-01', (new \DateTime ())->format ( "Y-m-d" ) ); |
|
| 18 | + return $raport; |
|
| 19 | + } |
|
| 20 | + /** |
|
| 21 | + * |
|
| 22 | + * @param unknown $objPHPExcel |
|
| 23 | + * @param unknown $cols |
|
| 24 | + */ |
|
| 25 | + private static function printHeaders($objPHPExcel, $cols) { |
|
| 26 | + $count = 1; |
|
| 27 | + $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, 2, "Data" ); |
|
| 28 | + foreach ( $cols as $col ) { |
|
| 29 | + $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, 2, sprintf ( "%7s", $col ) ); |
|
| 30 | + } |
|
| 31 | + } |
|
| 32 | + /** |
|
| 33 | + */ |
|
| 34 | + private static function printData($objPHPExcel, $data, $type) { |
|
| 35 | + $row = 3; |
|
| 36 | + $lastColumn = 1; |
|
| 37 | + $colNumberOfPatients = ExcelExport::getColumnLetter ( 1 ); |
|
| 38 | + $indexes = PatientRaport::getIndexes ( $type ); |
|
| 39 | + foreach ( $data as $rowKey => $rowValue ) { |
|
| 40 | + // 1 col: date |
|
| 41 | + $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, $row, json_encode ( $rowKey ) ); |
|
| 42 | + $count = 1; |
|
| 43 | + // 2-5 cols: N1 N2 N3 N0 |
|
| 44 | + foreach ( $indexes as $index ) { |
|
| 45 | + $value = isset ( $rowValue [$index] ) ? $rowValue [$index] : "0"; |
|
| 46 | + $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, $value ); |
|
| 47 | + } |
|
| 48 | + // 6 col: num of categorized (N = N1+N2+N3) |
|
| 49 | + $colHighestCategory = ExcelExport::getColumnLetter ( $count - 2 ); |
|
| 50 | + $colNumberOfPatients = ExcelExport::getColumnLetter ( $count ); |
|
| 51 | + $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, '=SUM(B' . $row . ':' . $colHighestCategory . $row . ')' ); |
|
| 52 | + $tpb = PatientRaport::getTpb ( $type ); |
|
| 53 | + // 7-11 tpb1, tpb2, tpb3, 0 (no-cat), 2 (add) |
|
| 54 | + foreach ( $tpb as $tpbn ) { |
|
| 55 | + $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, $tpbn ); |
|
| 56 | + } |
|
| 57 | + // 9-11: Tpb1*N1,Tpb2*N2,Tpb3*N3+2xN |
|
| 58 | + $tpbSize = count ( $tpb ); |
|
| 59 | + foreach ( $tpb as $tpbn ) { |
|
| 60 | + $col1Letter = ExcelExport::getColumnLetter ( $count - 2 * $tpbSize ); |
|
| 61 | + $col2Letter = ExcelExport::getColumnLetter ( $count - $tpbSize ); |
|
| 62 | + $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, '=' . $col1Letter . $row . "*" . $col2Letter . $row ); |
|
| 63 | + } |
|
| 64 | + // SUM Tpb |
|
| 65 | + $col3Letter = ExcelExport::getColumnLetter ( $count - $tpbSize ); |
|
| 66 | + $col4Letter = ExcelExport::getColumnLetter ( $count - 1 ); |
|
| 67 | + $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, '=SUM(' . $col3Letter . $row . ":" . $col4Letter . $row . ")" ); |
|
| 68 | + $row ++; |
|
| 69 | + $lastColumn = $count - 1; |
|
| 70 | + } |
|
| 71 | + // number of categorization days |
|
| 72 | + $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 1, 1, '=COUNTIFS(' . $colNumberOfPatients . '3:' . $colNumberOfPatients . ($row - 1) . ',">0")' ); |
|
| 73 | + // sum |
|
| 74 | + $col5Letter = ExcelExport::getColumnLetter ( $lastColumn ); |
|
| 75 | + $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 2, 1, '=SUM(' . $col5Letter . '3:' . $col5Letter . ($row - 1) . ')/60' ); |
|
| 76 | + return $row; |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * |
|
| 81 | - * @param unknown $objPHPExcel |
|
| 82 | - */ |
|
| 83 | - static function fillSummary($objPHPExcel) { |
|
| 84 | - ExcelExport::newSheet ( $objPHPExcel, 0 ); |
|
| 85 | - ExcelExport::printTitle ( $objPHPExcel, "Raport" ); |
|
| 86 | - $sheetCount = $objPHPExcel->getSheetCount (); |
|
| 87 | - $objPHPExcel->getActiveSheet ()->setCellValue ( 'A2', 'Oddz.' ); |
|
| 88 | - $objPHPExcel->getActiveSheet ()->setCellValue ( 'B2', 'Dni' ); |
|
| 89 | - $objPHPExcel->getActiveSheet ()->setCellValue ( 'C2', 'Tpb' ); |
|
| 90 | - $objPHPExcel->getActiveSheet ()->setCellValue ( 'D2', 'Tśpb' ); |
|
| 91 | - $objPHPExcel->getActiveSheet ()->setCellValue ( 'E2', 'Tśpc*' ); |
|
| 92 | - $objPHPExcel->getActiveSheet ()->setCellValue ( 'F2', 'Tśpc**' ); |
|
| 93 | - $objPHPExcel->getActiveSheet ()->setCellValue ( 'G2', 'Td***' ); |
|
| 94 | - $objPHPExcel->getActiveSheet ()->setCellValue ( 'H2', 'Le*' ); |
|
| 95 | - $objPHPExcel->getActiveSheet ()->setCellValue ( 'I2', 'Le**' ); |
|
| 96 | - for($i = 1; $i < $sheetCount; $i ++) { |
|
| 97 | - $loadedSheetNames = $objPHPExcel->getSheetNames (); |
|
| 98 | - foreach ( $loadedSheetNames as $sheetIndex => $loadedSheetName ) { |
|
| 99 | - if ($sheetIndex == 0) { |
|
| 100 | - continue; |
|
| 101 | - } |
|
| 102 | - $row = $sheetIndex + 2; |
|
| 103 | - $objPHPExcel->getActiveSheet ()->setCellValue ( 'A' . $row, "='" . $loadedSheetName . "'!A1" ); |
|
| 104 | - $objPHPExcel->getActiveSheet ()->setCellValue ( 'B' . $row, "='" . $loadedSheetName . "'!B1" ); |
|
| 105 | - $objPHPExcel->getActiveSheet ()->setCellValue ( 'C' . $row, "='" . $loadedSheetName . "'!C1" ); |
|
| 106 | - $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 3, $row, "=IF(C" . $row . ">0,C" . $row . "/B" . $row . ",0)" ); |
|
| 107 | - $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 4, $row, "=D" . $row . "*110%" ); |
|
| 108 | - $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 5, $row, "=D" . $row . "*125%" ); |
|
| 109 | - $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 6, $row, "1531" ); |
|
| 110 | - $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 7, $row, "=IF(E" . $row . ">0,E" . $row . "*365/G" . $row . ",\"-\")" ); |
|
| 111 | - $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 8, $row, "=IF(F" . $row . ">0,F" . $row . "*365/G" . $row . ",\"-\")" ); |
|
| 112 | - } |
|
| 113 | - $objPHPExcel->getActiveSheet ()->getStyle ( 'C3:I100' )->getNumberFormat ()->setFormatCode ( '#,##0.0' ); |
|
| 114 | - $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, $row + 1, "* Czas pielęgnacji pośredniej jako 10% czasu pielęgnacji bezpośredniej" ); |
|
| 115 | - $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, $row + 2, "** Czas pielęgnacji pośredniej jako 25% czasu pielęgnacji bezpośredniej" ); |
|
| 116 | - $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, $row + 3, "*** Czas dyspozycyjny - propozycja z Rozporządzenia MZ: 202 dni x 7,58 h" ); |
|
| 117 | - ExcelExport::styleActiveSheet ( $objPHPExcel ); |
|
| 118 | - } |
|
| 119 | - } |
|
| 120 | - static function fillData($objPHPExcel) { |
|
| 121 | - // no time limit for this script |
|
| 122 | - set_time_limit ( 0 ); |
|
| 123 | - $time_start = microtime ( true ); |
|
| 124 | - // remove first default sheet |
|
| 125 | - $objPHPExcel->removeSheetByIndex ( 0 ); |
|
| 126 | - // get wards |
|
| 127 | - $wards = WardCRUD::getWardsArray (); |
|
| 128 | - foreach ( $wards as $ward ) { |
|
| 129 | - ExcelExport::newSheet ( $objPHPExcel ); |
|
| 130 | - $wardName = $ward->name . " (" . $ward->getTypOddzialu () . ")"; |
|
| 131 | - ExcelExport::printTitle ( $objPHPExcel, $wardName ); |
|
| 132 | - $data = ExcelExportPunction::getData ( $ward->id, $ward->getTypOddzialu () ); |
|
| 133 | - $cols = PatientRaport::getColumns ( $ward->getTypOddzialu () ); |
|
| 134 | - ExcelExportPunction::printHeaders ( $objPHPExcel, $cols ); |
|
| 135 | - ExcelExportPunction::printData ( $objPHPExcel, $data, $ward->getTypOddzialu () ); |
|
| 136 | - ExcelExport::styleActiveSheet ( $objPHPExcel ); |
|
| 137 | - } |
|
| 138 | - ExcelExportPunction::fillSummary ( $objPHPExcel ); |
|
| 139 | - $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, 100, "summary " . ($time_start - microtime ( true )) . " s" ); |
|
| 140 | - } |
|
| 79 | + /** |
|
| 80 | + * |
|
| 81 | + * @param unknown $objPHPExcel |
|
| 82 | + */ |
|
| 83 | + static function fillSummary($objPHPExcel) { |
|
| 84 | + ExcelExport::newSheet ( $objPHPExcel, 0 ); |
|
| 85 | + ExcelExport::printTitle ( $objPHPExcel, "Raport" ); |
|
| 86 | + $sheetCount = $objPHPExcel->getSheetCount (); |
|
| 87 | + $objPHPExcel->getActiveSheet ()->setCellValue ( 'A2', 'Oddz.' ); |
|
| 88 | + $objPHPExcel->getActiveSheet ()->setCellValue ( 'B2', 'Dni' ); |
|
| 89 | + $objPHPExcel->getActiveSheet ()->setCellValue ( 'C2', 'Tpb' ); |
|
| 90 | + $objPHPExcel->getActiveSheet ()->setCellValue ( 'D2', 'Tśpb' ); |
|
| 91 | + $objPHPExcel->getActiveSheet ()->setCellValue ( 'E2', 'Tśpc*' ); |
|
| 92 | + $objPHPExcel->getActiveSheet ()->setCellValue ( 'F2', 'Tśpc**' ); |
|
| 93 | + $objPHPExcel->getActiveSheet ()->setCellValue ( 'G2', 'Td***' ); |
|
| 94 | + $objPHPExcel->getActiveSheet ()->setCellValue ( 'H2', 'Le*' ); |
|
| 95 | + $objPHPExcel->getActiveSheet ()->setCellValue ( 'I2', 'Le**' ); |
|
| 96 | + for($i = 1; $i < $sheetCount; $i ++) { |
|
| 97 | + $loadedSheetNames = $objPHPExcel->getSheetNames (); |
|
| 98 | + foreach ( $loadedSheetNames as $sheetIndex => $loadedSheetName ) { |
|
| 99 | + if ($sheetIndex == 0) { |
|
| 100 | + continue; |
|
| 101 | + } |
|
| 102 | + $row = $sheetIndex + 2; |
|
| 103 | + $objPHPExcel->getActiveSheet ()->setCellValue ( 'A' . $row, "='" . $loadedSheetName . "'!A1" ); |
|
| 104 | + $objPHPExcel->getActiveSheet ()->setCellValue ( 'B' . $row, "='" . $loadedSheetName . "'!B1" ); |
|
| 105 | + $objPHPExcel->getActiveSheet ()->setCellValue ( 'C' . $row, "='" . $loadedSheetName . "'!C1" ); |
|
| 106 | + $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 3, $row, "=IF(C" . $row . ">0,C" . $row . "/B" . $row . ",0)" ); |
|
| 107 | + $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 4, $row, "=D" . $row . "*110%" ); |
|
| 108 | + $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 5, $row, "=D" . $row . "*125%" ); |
|
| 109 | + $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 6, $row, "1531" ); |
|
| 110 | + $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 7, $row, "=IF(E" . $row . ">0,E" . $row . "*365/G" . $row . ",\"-\")" ); |
|
| 111 | + $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 8, $row, "=IF(F" . $row . ">0,F" . $row . "*365/G" . $row . ",\"-\")" ); |
|
| 112 | + } |
|
| 113 | + $objPHPExcel->getActiveSheet ()->getStyle ( 'C3:I100' )->getNumberFormat ()->setFormatCode ( '#,##0.0' ); |
|
| 114 | + $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, $row + 1, "* Czas pielęgnacji pośredniej jako 10% czasu pielęgnacji bezpośredniej" ); |
|
| 115 | + $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, $row + 2, "** Czas pielęgnacji pośredniej jako 25% czasu pielęgnacji bezpośredniej" ); |
|
| 116 | + $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, $row + 3, "*** Czas dyspozycyjny - propozycja z Rozporządzenia MZ: 202 dni x 7,58 h" ); |
|
| 117 | + ExcelExport::styleActiveSheet ( $objPHPExcel ); |
|
| 118 | + } |
|
| 119 | + } |
|
| 120 | + static function fillData($objPHPExcel) { |
|
| 121 | + // no time limit for this script |
|
| 122 | + set_time_limit ( 0 ); |
|
| 123 | + $time_start = microtime ( true ); |
|
| 124 | + // remove first default sheet |
|
| 125 | + $objPHPExcel->removeSheetByIndex ( 0 ); |
|
| 126 | + // get wards |
|
| 127 | + $wards = WardCRUD::getWardsArray (); |
|
| 128 | + foreach ( $wards as $ward ) { |
|
| 129 | + ExcelExport::newSheet ( $objPHPExcel ); |
|
| 130 | + $wardName = $ward->name . " (" . $ward->getTypOddzialu () . ")"; |
|
| 131 | + ExcelExport::printTitle ( $objPHPExcel, $wardName ); |
|
| 132 | + $data = ExcelExportPunction::getData ( $ward->id, $ward->getTypOddzialu () ); |
|
| 133 | + $cols = PatientRaport::getColumns ( $ward->getTypOddzialu () ); |
|
| 134 | + ExcelExportPunction::printHeaders ( $objPHPExcel, $cols ); |
|
| 135 | + ExcelExportPunction::printData ( $objPHPExcel, $data, $ward->getTypOddzialu () ); |
|
| 136 | + ExcelExport::styleActiveSheet ( $objPHPExcel ); |
|
| 137 | + } |
|
| 138 | + ExcelExportPunction::fillSummary ( $objPHPExcel ); |
|
| 139 | + $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, 100, "summary " . ($time_start - microtime ( true )) . " s" ); |
|
| 140 | + } |
|
| 141 | 141 | } |
| 142 | 142 | \ No newline at end of file |
@@ -1,26 +1,26 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PersonGenerator |
|
| 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 $Id: a88997670673063e272ee5666aa86ed1ec9a1561 $ $Format:%H$ |
|
| 20 | - * @link http:// |
|
| 21 | - * @since File available since Release 1.0.0 |
|
| 22 | - * PHP Version 5 |
|
| 23 | - */ |
|
| 3 | + * PersonGenerator |
|
| 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 $Id: a88997670673063e272ee5666aa86ed1ec9a1561 $ $Format:%H$ |
|
| 20 | + * @link http:// |
|
| 21 | + * @since File available since Release 1.0.0 |
|
| 22 | + * PHP Version 5 |
|
| 23 | + */ |
|
| 24 | 24 | namespace Hospitalplugin\utils; |
| 25 | 25 | |
| 26 | 26 | use Hospitalplugin\Entities\Patient; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * @return \Hospitalplugin\Entities\Patient |
| 53 | - */ |
|
| 53 | + */ |
|
| 54 | 54 | public static function getRandomPerson() |
| 55 | 55 | { |
| 56 | 56 | // TODO extract paths |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | - * |
|
| 97 | - * @param $date |
|
| 98 | - * @param $sex |
|
| 99 | - * 'm' / 'f' |
|
| 100 | - */ |
|
| 96 | + * |
|
| 97 | + * @param $date |
|
| 98 | + * @param $sex |
|
| 99 | + * 'm' / 'f' |
|
| 100 | + */ |
|
| 101 | 101 | public static function getRandomPesel($date, $sex = 'm') |
| 102 | 102 | { |
| 103 | 103 | $datetime = new \DateTime($date); |
@@ -125,8 +125,8 @@ discard block |
||
| 125 | 125 | $intSum = 0; |
| 126 | 126 | for ($i = 0; $i < 10; $i ++) { |
| 127 | 127 | $intSum += $arrSteps[$i] * $x[$i]; // mnożymy każdy ze znaków |
| 128 | - // przez wagć i sumujemy |
|
| 129 | - // wszystko |
|
| 128 | + // przez wagć i sumujemy |
|
| 129 | + // wszystko |
|
| 130 | 130 | } |
| 131 | 131 | $int = 10 - $intSum % 10; // obliczamy sumć kontrolną |
| 132 | 132 | $intControlNr = ($int == 10) ? 0 : $int; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * |
| 140 | 140 | * @param unknown $arr |
| 141 | 141 | * @return string random element |
| 142 | - */ |
|
| 142 | + */ |
|
| 143 | 143 | public static function getRandom($arr) |
| 144 | 144 | { |
| 145 | 145 | return implode('', $arr[array_rand($arr)]); |
@@ -44,76 +44,76 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | class DoctrineBootstrap { |
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * entity manager |
|
| 49 | - * |
|
| 50 | - * @var _entityManager EnitytManager |
|
| 51 | - */ |
|
| 52 | - private static $_entityManager; |
|
| 47 | + /** |
|
| 48 | + * entity manager |
|
| 49 | + * |
|
| 50 | + * @var _entityManager EnitytManager |
|
| 51 | + */ |
|
| 52 | + private static $_entityManager; |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * loading envs |
|
| 56 | - */ |
|
| 57 | - private static function _loadEnv() { |
|
| 58 | - if (getenv ( 'DB_NAME' ) != null && getenv ( 'DB_NAME' ) != "") { |
|
| 59 | - return; |
|
| 60 | - } |
|
| 61 | - if (defined ( 'ABSPATH' )) { |
|
| 62 | - \Dotenv::load ( ABSPATH ); |
|
| 63 | - } else { |
|
| 64 | - \Dotenv::load ( getenv ( 'HOME' ) ); |
|
| 65 | - } |
|
| 66 | - } |
|
| 67 | - private static function getPaths() { |
|
| 68 | - if (file_exists ( getcwd () . "/src/Entities" )) { |
|
| 69 | - return array ( |
|
| 70 | - getcwd () . "/src/Entities" |
|
| 71 | - ); |
|
| 72 | - } else { |
|
| 73 | - return array ( |
|
| 74 | - getcwd () . "/vendor/amarcinkowski/hospitalplugin/src/Entities" |
|
| 75 | - ); |
|
| 76 | - } |
|
| 77 | - } |
|
| 54 | + /** |
|
| 55 | + * loading envs |
|
| 56 | + */ |
|
| 57 | + private static function _loadEnv() { |
|
| 58 | + if (getenv ( 'DB_NAME' ) != null && getenv ( 'DB_NAME' ) != "") { |
|
| 59 | + return; |
|
| 60 | + } |
|
| 61 | + if (defined ( 'ABSPATH' )) { |
|
| 62 | + \Dotenv::load ( ABSPATH ); |
|
| 63 | + } else { |
|
| 64 | + \Dotenv::load ( getenv ( 'HOME' ) ); |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | + private static function getPaths() { |
|
| 68 | + if (file_exists ( getcwd () . "/src/Entities" )) { |
|
| 69 | + return array ( |
|
| 70 | + getcwd () . "/src/Entities" |
|
| 71 | + ); |
|
| 72 | + } else { |
|
| 73 | + return array ( |
|
| 74 | + getcwd () . "/vendor/amarcinkowski/hospitalplugin/src/Entities" |
|
| 75 | + ); |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * |
|
| 81 | - * @return entityManager EntityManager |
|
| 82 | - */ |
|
| 83 | - private static function _getInstance() { |
|
| 84 | - $isDevMode = true; |
|
| 85 | - $config = Setup::createAnnotationMetadataConfiguration ( self::getPaths (), $isDevMode ); |
|
| 86 | - self::_loadEnv (); |
|
| 87 | - $conn = array ( |
|
| 88 | - 'dbname' => getenv ( 'DB_NAME' ), |
|
| 89 | - 'user' => getenv ( 'DB_USER' ), |
|
| 90 | - 'password' => getenv ( 'DB_PASSWORD' ), |
|
| 91 | - 'host' => getenv ( 'DB_HOST' ), |
|
| 92 | - 'driver' => 'pdo_mysql', |
|
| 93 | - 'charset' => 'utf8', |
|
| 94 | - 'driverOptions' => array ( |
|
| 95 | - 1002 => 'SET NAMES utf8' |
|
| 96 | - ), |
|
| 97 | - 'mapping_types' => 'enum:string' |
|
| 98 | - ); |
|
| 99 | - return EntityManager::create ( $conn, $config ); |
|
| 100 | - } |
|
| 79 | + /** |
|
| 80 | + * |
|
| 81 | + * @return entityManager EntityManager |
|
| 82 | + */ |
|
| 83 | + private static function _getInstance() { |
|
| 84 | + $isDevMode = true; |
|
| 85 | + $config = Setup::createAnnotationMetadataConfiguration ( self::getPaths (), $isDevMode ); |
|
| 86 | + self::_loadEnv (); |
|
| 87 | + $conn = array ( |
|
| 88 | + 'dbname' => getenv ( 'DB_NAME' ), |
|
| 89 | + 'user' => getenv ( 'DB_USER' ), |
|
| 90 | + 'password' => getenv ( 'DB_PASSWORD' ), |
|
| 91 | + 'host' => getenv ( 'DB_HOST' ), |
|
| 92 | + 'driver' => 'pdo_mysql', |
|
| 93 | + 'charset' => 'utf8', |
|
| 94 | + 'driverOptions' => array ( |
|
| 95 | + 1002 => 'SET NAMES utf8' |
|
| 96 | + ), |
|
| 97 | + 'mapping_types' => 'enum:string' |
|
| 98 | + ); |
|
| 99 | + return EntityManager::create ( $conn, $config ); |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - /** |
|
| 103 | - * returns enitytManager |
|
| 104 | - * |
|
| 105 | - * @return EntityManager |
|
| 106 | - */ |
|
| 107 | - public static function getEntityManager() { |
|
| 108 | - if (self::$_entityManager == null) { |
|
| 109 | - self::$_entityManager = self::_getInstance (); |
|
| 110 | - } |
|
| 111 | - return self::$_entityManager; |
|
| 112 | - } |
|
| 113 | - public static function getCli() { |
|
| 114 | - $em = DoctrineBootstrap::getEntityManager (); |
|
| 115 | - $em->getConnection ()->getDatabasePlatform ()->registerDoctrineTypeMapping ( 'enum', 'string' ); |
|
| 116 | - return ConsoleRunner::createHelperSet ( $em ); |
|
| 117 | - } |
|
| 102 | + /** |
|
| 103 | + * returns enitytManager |
|
| 104 | + * |
|
| 105 | + * @return EntityManager |
|
| 106 | + */ |
|
| 107 | + public static function getEntityManager() { |
|
| 108 | + if (self::$_entityManager == null) { |
|
| 109 | + self::$_entityManager = self::_getInstance (); |
|
| 110 | + } |
|
| 111 | + return self::$_entityManager; |
|
| 112 | + } |
|
| 113 | + public static function getCli() { |
|
| 114 | + $em = DoctrineBootstrap::getEntityManager (); |
|
| 115 | + $em->getConnection ()->getDatabasePlatform ()->registerDoctrineTypeMapping ( 'enum', 'string' ); |
|
| 116 | + return ConsoleRunner::createHelperSet ( $em ); |
|
| 117 | + } |
|
| 118 | 118 | } |
| 119 | 119 | |
@@ -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 | } |
@@ -1,26 +1,26 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Utils |
|
| 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 $Id: 654aa9ca96042e8f8814f3d117791957e31d6088 $ $Format:%H$ |
|
| 20 | - * @link http:// |
|
| 21 | - * @since File available since Release 1.0.0 |
|
| 22 | - * PHP Version 5 |
|
| 23 | - */ |
|
| 3 | + * Utils |
|
| 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 $Id: 654aa9ca96042e8f8814f3d117791957e31d6088 $ $Format:%H$ |
|
| 20 | + * @link http:// |
|
| 21 | + * @since File available since Release 1.0.0 |
|
| 22 | + * PHP Version 5 |
|
| 23 | + */ |
|
| 24 | 24 | namespace Hospitalplugin\utils; |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | |
| 331 | 331 | // ź |
| 332 | 332 | chr(0x9F) => 'ź', |
| 333 | - chr(0xBC) => 'ź' |
|
| 333 | + chr(0xBC) => 'ź' |
|
| 334 | 334 | ); |
| 335 | 335 | return html_entity_decode(mb_convert_encoding(strtr($text, $map), 'UTF-8', 'ISO-8859-2'), ENT_QUOTES, 'UTF-8'); |
| 336 | 336 | } |
@@ -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 | /** |
@@ -1,26 +1,26 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PatientDeleted |
|
| 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 | + * PatientDeleted |
|
| 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 | /** |
@@ -39,11 +39,11 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | class PatientDeleted |
| 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 | 48 | /** |
| 49 | 49 | * @ORM\Column(name="order_timestamp", type="datetime") |
@@ -8,192 +8,192 @@ |
||
| 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 == 'DIA') { |
|
| 183 | - return array ( |
|
| 184 | - 52, |
|
| 185 | - 112, |
|
| 186 | - 0, |
|
| 187 | - 2 |
|
| 188 | - ); |
|
| 189 | - } else if ($type == 'POL') { |
|
| 190 | - return array ( |
|
| 191 | - 72, |
|
| 192 | - 100, |
|
| 193 | - 98, |
|
| 194 | - 0, |
|
| 195 | - 2 |
|
| 196 | - ); |
|
| 197 | - } |
|
| 198 | - } |
|
| 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 == 'DIA') { |
|
| 183 | + return array ( |
|
| 184 | + 52, |
|
| 185 | + 112, |
|
| 186 | + 0, |
|
| 187 | + 2 |
|
| 188 | + ); |
|
| 189 | + } else if ($type == 'POL') { |
|
| 190 | + return array ( |
|
| 191 | + 72, |
|
| 192 | + 100, |
|
| 193 | + 98, |
|
| 194 | + 0, |
|
| 195 | + 2 |
|
| 196 | + ); |
|
| 197 | + } |
|
| 198 | + } |
|
| 199 | 199 | } |
| 200 | 200 | \ No newline at end of file |