mahdahar 31acb6bf33 feat: Implement comprehensive report generation system with role-based access control
Add native CodeIgniter 4 report generation functionality replacing legacy spooler_db system.
Provides centralized report generation with audit logging and multi-language support.

New Features:
- Report generation with Indonesian and English language support
- Role-based access control (Lab, Admin, Superuser: generate; CS: print only)
- Preview mode for validation workflow
- Print audit logging to AUDIT_REQUESTS table
- Multi-page report support with proper pagination
- Dual unit system (Conventional and International units)

Controllers:
- ReportController: Main controller for report generation, preview, and print
  - generate(): Full report with audit logging
  - preview(): Preview mode without audit logging
  - print(): Print-only access for CS role
- Home::printReport(): Route handler redirecting based on user role

Libraries:
- ReportHelper: Comprehensive report data retrieval
  - Patient information (name, MR number, demographics, referral)
  - Test results with reference ranges and unit conversions
  - Collection and reception data with timestamps
  - Validation status and validator information
  - Special handling for pending samples and Chinese translations

Routes:
- /report/(:num) - Generate report (Lab, Admin, Superuser)
- /report/(:num)/preview - Preview without audit logging
- /report/(:num)/eng - English language report
- /report/print/(:num) - Print-only access (CS role)
- /print/(:num) - Redirect based on role (all roles)

Views:
- report/template.php: Professional lab report template with Gleneagles branding
  - Header and footer images
  - Patient information table
  - Test results with dual unit columns
  - Collection and reception timestamps
  - Authorization signature area
  - Preview watermark

Role Index Views:
- Removed dialog_preview.php inclusion from all role dashboards
- Consolidated print button directly linking to new report routes

Assets:
- Report-specific CSS files (normalize.min.css, style.css, pdf.css, style_qr.css)
- Gleneagles header and footer images
- Legacy spooler_db files preserved in public/spooler_db/ for reference

Tests:
- ReportTest.php: Unit tests for report generation functionality

Database:
- Uses existing tables: REQUESTS, TESTS, DICT_TESTS, SP_REQUESTS, PATIENTS
- Inserts print audit records into AUDIT_REQUESTS table

Security:
- Parameterized queries throughout (SQL injection prevention)
- Role-based access control enforced at route level
- Proper output escaping with esc() in views
2026-02-02 16:54:22 +07:00

23 lines
3.6 KiB
PHP

<?php
$_chinese = array(
"HBSAG" => "B型肝炎抗原", "GGT" => "丙种谷氨酰转肽酶", "NEUT" => "中性粒细胞", "HBSAT" => "乙肝表面抗体", "AHBS" => "乙肝表面抗体", "AHBST" => "乙肝表面抗体效价", "LDH" => "乳酸脱氢酶",
"LDL" => "<br/>低密度脂蛋白", "PROLA" => "促乳素", "TPHCG" => "促绒毛膜性激素测验", "PSA" => "前列腺特异性抗原", "MONO" => "单核细胞", "HSV1G" => "单纯疱疹病毒抗体1IgG",
"HSV1M" => "单纯疱疹病毒抗体1IgM", "HSV2G" => "单纯疱疹病毒抗体2IgG", "HSV2M" => "单纯疱疹病毒抗体2IgM", "CRPQN" => "反应蛋白质量", "2SWTH" => "咽喉", "2DIPT" => "咽喉",
"BASO" => "嗜性粒血球数", "EOS" => "嗜酸性粒血球", "EOSC" => "嗜酸性粒血球", "PBF" => "<br/>外周血沈淀率", "UA" => "尿酸", "CMVG" => "巨细胞病毒IgG", "CMVM" => "巨细胞病毒IgM",
"MCHC" => "平均含血红素浓度", "MCH" => "平均含血红素量", "ACAG" => "异常冠状动脉IgG", "ACAM" => "异常冠状动脉IgM", "GDS" => "当时", "VDRL" => "性病研究实验试验",
"CHOL" => "总胆固醇", "UBIL" => "总胆红素", "TP" => "总蛋白质(量)", "EBVEA" => "抗EB病毒定量免疫A", "EBVVA" => "抗EB病毒滴度免疫A", "SALMG" => "抗沙门菌IgG",
"SALMM" => "抗沙门菌IgM", "DENGG" => "抗登革热IgG", "DENGR" => "抗登革热IgG/IgM快速", "DENGM" => "抗登革热IgM", "ICTTB" => "抗结核菌抗体线测试",
"ASTO" => "抗链球菌", "AMUBA" => "抗阿米巴", "TPHA" => "梅毒螺旋体血凝集测定", "PAPS" => "涂片", "LYM" => "淋巴细胞", "1GO" => "淋病", "FPSA" => "游离前列腺特异性抗原",
"GLOB" => "球蛋白", "TG" => "甘油三脂", "GROW" => "生长荷尔蒙", "PTH" => "甲状旁腺激素", "TPO" => "甲状腺过氧化物酶抗体", "AFP" => "甲胎蛋白", "CA125" => "癌抗体125",
"CA153" => "癌抗体15-3", "CA199" => "癌抗体19-9", "CA724" => "癌抗体72-4", "CEA" => "癌胚抗原", "1NEIS" => "白喉(咽)", "2DIPN" => "白喉(鼻)", "WBC" => "白细胞",
"FWBC" => "白细胞", "ULEUX" => "白细胞数目", "ALB" => "白蛋白", "CORPG" => "皮质醇", "CORSR" => "皮质醇", "DBIL" => "直接", "TESTO" => "睾酮", "ALP" => "<br/>碱性磷酸",
"NSE" => "神经原特异性烯醇化酶", "GLUP" => "空腹", "HBA1C" => "空腹与餐后血糖水平", "2SPER" => "精虫", "SPERM" => "精虫", "RBC" => "红细胞", "FRBC" => "红细胞",
"UERY" => "红细胞数目", "LED" => "红细胞沈降率", "MCV" => "红血球平均体积", "PCV" => "红血球积压", "PASMS" => "组织学 病理", "CYSMS" => "细胞学", "CKMB" => "细胞角蛋白",
"CREA" => "肌酸酐,肌酸内酰胺酸", "BTGN" => "肾石化验", "BATU" => "胆石化验", "CHE" => "胆碱酯酶", "INSL" => "胰岛素", "CYSTC" => "胱硫醚", "APN" => "脂联素",
"LIPO" => "脂蛋白", "2PUS" => "", "DHEAS" => "脱氢表雄酮硫酸酯", "UGLU" => "葡萄糖", "UPROT" => "蛋白", "GOLRH" => "血型", "PLT" => "血小板", "BUN" => "血尿素氮",
"TBIL" => "血清谷丙转氨酶", "SGPT" => "血清谷丙转氨酶", "SGOT" => "血清谷草转氨酶", "HB" => "血红素", "CHLAA" => "衣原体素", "CHLAG" => "衣原体素IgG", "CHLAM" => "衣原体素IgM",
"HSCRP" => "赵敏反应蛋白", "APOA1" => "载脂蛋白", "APOB" => "载脂蛋白", "APOR" => "载脂蛋白比率", "SDLDL" => "载脂蛋白比率", "ALDO" => "醛固酮", "DIFF" => "鉴别",
"ESTRI" => "雌三醇", "FESTR" => "雌三醇", "RUBG" => "风疹IgG", "RUBM" => "风疹IgM", "GLU2P" => "餐后两个小时", "HDL" => "高密度脂蛋白");
$_italic = array("UTRI","ITALIC","PLSFC", "PLSOV", "PLSML", "PLSVI");
?>