تحليل النسخة الثانية المكتشفة من النظام (med.greennature.com.sa) المنشورة على المسار /home/medgreennatureco/public_html/med. هذه نسخة أحدث وأوسع مهيأة كـ«مركز/مستشفى» وليست عيادة نسائية واحدة. تم استخراج معرفة المخطط (الجداول والحقول) من الكود فقط — عبر استدعاءات RedBeanPHP (R::dispense / R::find / R::load / R::getAll) وجمل SQL الخام داخل المتحكمات والقوالب — دون أي اتصال بقاعدة البيانات الحية. تمت مقارنة كل جدول بقائمة الـ 312 جدولاً الأصلية في obgy_12-7-2024.sql لتصنيفه «جديد» أو «معروف».
المصدر: مسح grep على المتحكمات والقوالب في المسارات med/{core,board,pharmacy,vote}/controllers وmed/core/views، ثم تطبيع الأسماء ومقارنتها بمخرجات grep CREATE TABLE من ملف obgy_12-7-2024.sql. ملاحظة: الوحدتان board (مجلس الإدارة) وpharmacy (الصيدلية) تستخدمان جداول معروفة بالكامل (bsession, brequests, councilstaff, drugs, importbill, pharmacystore…) — التوسّع الحقيقي يتركّز في وحدة core الخاصة بالمركز/المستشفى.
الكود يربط عدة قواعد بيانات عبر R::addDatabase() وR::selectDatabase()، أبرزها قاعدة باسم erpDB يُقرأ اسمها من إعداد programesetting->erpdb (استنتاج: تكامل مالي/مخزني مع نظام ERP منفصل)، إضافة إلى قواعد old وnew وobor وroyalDb (استنتاج: ترحيل بيانات بين نشرات/فروع متعددة). هذا يؤكد أن MED ليست تطبيقاً بقاعدة واحدة بل طبقة موحِّدة فوق عدة قواعد.
| الجدول | جديد/معروف | الغرض | أهم الحقول المستنتجة | العلاقات |
|---|---|---|---|---|
التصويت / استبيان رضا العملاء (Kiosk Voting) — وحدة vote | ||||
votes | جديد | تعريف استبيان/تصويت | id, title, status (استنتاج) | ← vote_questions |
vote_questions | جديد | أسئلة الاستبيان | vote_id, question_text | votes ← vote_answers |
vote_answers | جديد | إجابات/خيارات السؤال | question_id, answer_text, answer_face | → vote_questions |
vote_devices | جديد | أجهزة الكشك (Kiosk) | id, name (استنتاج) | → clients_votes |
clients_votes / client_votes | جديد | سجل تصويت العميل | vote_id, vote_device_id, user_id, voter_name, voter_phone, ip, local_ip, remote_ip, user_agent, created_at | → votes, vote_devices |
clients_votes_answers | جديد | تفاصيل إجابات العميل | client_vote_id, question_id, answer_id, answer_text, answer_face, user_id, created_at | → clients_votes |
| الهيكل التنظيمي والجغرافي (Center / Organizations / Geo) | ||||
organizations | جديد | الجهات/الشركات المتعاقدة (تأمين/شركات) | id, name, deleted, patient_no | ← organization_discount, organizations_patient_no, visit |
organization_discount | جديد | خصومات الجهة المتعاقدة | organization_id, discount_type, value (استنتاج) | → organizations |
organizations_patient_no | جديد | أرقام منتسبي الجهة | organization_id, patient_no | → organizations |
governorate / governorate_centers | جديد | المحافظات والمراكز التابعة | id, name | ← regions / sub_regions |
regions / sub_regions | جديد | المناطق والمناطق الفرعية | id, name, region_id, deleted | → visit.subregion |
nationality / hnationality / religion / hreligion / husstatus | جديد | قوائم مرجعية للمريضة والزوج (h = husband) | id, name | → بيانات المريض |
| الزيارة المركزية والحجز (Visit / Reception / Reservation) | ||||
visit | جديد | سجل الزيارة المركزي للمركز (يحل محل أوراق العيادة القديمة) | patientid, branch_id, branch_name, for_department, for_doctor, for_husband, visitdate, visit_time, original_price, contract_price, discount, organization_id, organization_discount, center_discount, detectionvalue_cash, detectionvalue_visa, dr_salary, is_redirect, enc_id, user_id, printserial | → organizations, patients, branches |
visit_services | جديد | خدمات الزيارة (بنود فاتورة) | visit_id, service, price (استنتاج) | → visit |
visit_hours / day_times | جديد | ساعات/أوقات العمل للحجز | day_no, hour, room_id (استنتاج) | → clinic_rooms |
clinic_reserves / doctors_reserves / reserve_clinic | جديد | حجوزات العيادات والأطباء | visit_id, doctor_id, room_id, reserve_day_no, reserve_hour, start_date, is_active, cancel_date, user_id | → clinic_rooms, visit |
clinic_rooms / operation_room | جديد | غرف العيادات والعمليات | id, name, floor_no | ← الحجوزات |
advance_payment | جديد | دفعات مقدّمة | patient_id, amount, date (استنتاج) | → patients/visit |
| التنويم والإقامة (Residence / Admission) | ||||
residence_rooms / residence_room | جديد | غرف التنويم/الإقامة | name, floor_no, start_time, end_time, create_date, deleted | ← residence_reserves |
residence_reserves | جديد | حجوزات التنويم | room_id, patient_id, start, end (استنتاج) | → residence_rooms |
exit_summary | جديد | ملخص الخروج (Discharge) | visit_id/patient_id, summary (استنتاج) | → visit/patients |
| مختبر الأجنّة والحقن المجهري (IVF / Embryology Lab) — أكبر نطاق جديد | ||||
embryoslab | جديد | دورة معمل الأجنة | date, visit_id, patient_id, clinician_id, embryologist_id_tb, referred_dr_id, create_date | ← embryo, tankcells |
embryo | جديد | الجنين المفرد | embryoslab_id, embryologist_id_tb, icsi_by_tb, freeze_embryologist_id_tb, cancelled_user | → embryoslab, embryotype |
embryofreezing / embryothawing / embryofreezingreport | جديد | تجميد/إذابة الأجنة والتقارير | embryofreezing_id, embryologist, date, protocol | → embryo, tankcells |
embryotransfer / embryotransferovum / ovumpickup | جديد | الإرجاع وسحب البويضات | clinician_name, embryologist_name, date | → embryoslab |
embryologist / embryologyreport / embryoscoring / embryotype / embryodifficulty / embryojetplace | جديد | قوائم مرجعية ودرجات الأجنة | id, name, grade | → embryo |
oocytequality / oocytecytoplasm / oocytezona / oocytepvs / oocyteother | جديد | تقييم جودة البويضات | id, name | → ovumpickup |
tanks / tanks_general / tankcells / tankcellhistory / embryoslab_tank_cells | جديد | خزانات النيتروجين وخلايا التخزين وسجل حركتها | embryoslab_id, tank_cell, cell_no, row_no, col_no, btn_no, color_name, location, date_add, user_id, deleted | → tanks, embryofreezing |
growthmedia / growthincubator / growthco2 / growthoil / freezingmedia / freezingprotocol | جديد | قوائم مرجعية لبيئة الزراعة والتجميد | id, name | → embryoslab |
ivf_records / ivf_report | جديد | سجلات وتقارير دورات الحقن المجهري | patient_id, date (استنتاج) | → embryoslab |
الحيوانات المنوية والذكورة (Andrology / Semen) — وحدة and* | ||||
andvisits | جديد | زيارة عيادة الذكورة | patientid, doctorid, doctorname, date, complaintid, diagnosisid | ← andvisits* |
andvisitssemen / andvisitsus / andvisitsrays / andvisitsinvestigation / andvisitsficils / andvisitsgenetictesting / andvisitsdrugs | جديد | تفاصيل زيارة الذكورة (سائل منوي/سونار/أشعة/تحاليل/أدوية/فحص جيني) | andvisitsusid, azf, chromosome, length, width, volume, name, type, sysdate | → andvisits |
andexamination / andhistory / andejaculation / anderection / andcontraception / andmedicalproblems / anddiagnosis / andcomplaint | جديد | الفحص والتاريخ الذكوري وقوائمه | id, name, deleted | → andvisits |
andcontratype / erectiondisease / ejaculationdisease | جديد | قوائم مرجعية للذكورة | id, name | قوائم |
semen_analysis / semen_process / semen_processing / semen_cryopreservation / sperm_extract / spermfreezingreport / sperum_source | جديد | تحليل ومعالجة وتجميد السائل المنوي | patient_id, source, date (استنتاج) | → andvisits/embryoslab |
| المنظار (Endoscopy / Colonoscopy) | ||||
endoscopy / colonoscopy | جديد | تقرير منظار علوي/سفلي | patient_id, exam_date, indication, findings, conclusion, plan, esophagus, stomach, duodenum, pylorus, cardio_esophageal_junction, dre, anesthesia, instrument, preparation, consent, signature, created_at | ← *_images, *_template |
endoscopy_images / colonoscopy_images | جديد | صور المنظار | endoscopy_id / colonoscopy_id, image | → التقرير الأب |
endoscopy_template / colonoscopy_template | جديد | قوالب جاهزة للتقارير | name, findings, conclusion (استنتاج) | قوالب |
oscopic_report / oscopic_operations / oscopic_specimens / oscopic_required_examinations | جديد | تقارير وعمليات وعينات المنظار العامة | patient_id, specimen, date (استنتاج) | → التقارير |
| العمليات وغرفها والتخدير (Operations / OR / Anaesthesia) | ||||
operations_main / operation_data / operation_form / operationgyna | جديد | سجل العمليات وبياناتها | patient_id, operation_type, date, room_id (استنتاج) | → operation_room, operations_rooms |
operations_rooms / operations_rooms_cal | جديد | غرف العمليات وتقويم حجزها | room_id, date, status (استنتاج) | → operation_room |
operationinstructions / operationotherth / followup_operation / manual_operation / manual_operation_updates | جديد | تعليمات ومتابعة العمليات | operation_id, text (استنتاج) | → العمليات |
pre_anaesthetic / intra_anaesthetic / anasthesa | جديد | تقييم التخدير قبل/أثناء العملية | operation_id, notes (استنتاج) | → العمليات |
| نتائج المختبر التفصيلية (Lab Investigation Results) | ||||
investigationresults | جديد | رأس نتيجة تحليل | patient_id, invest_id, sampletype, date, value (استنتاج) | ← الجداول الفرعية أدناه |
investigationresults_blood / _urine / _stool / _semen / _culture / _cross / _cross_donners / _lipid / _egfr / _esr / _pt / _aborh / _custom / _times | جديد | نتائج مفصّلة حسب نوع العينة | investigationresults_id, parameter, value, normal_range (استنتاج) | → investigationresults |
stool_rbc / stool_rbc2 / stool_wbc / stool_wbc2 / urine_pus / urine_pus2 / urine_pbcs / urine_pbcs2 | جديد | قوائم خيارات نتائج البول والبراز (مجهري) | id, name | قوائم |
invest_elements / inv_ranges / sampletype / esr_ | جديد | عناصر التحاليل والمعدلات الطبيعية وأنواع العينات | invest_id, element, min, max, sampletype (استنتاج) | → investigationresults |
lab_devices / lab_devices_ranges / saveresultslog / external_labs | جديد | أجهزة المختبر ومعدلاتها وسجل الحفظ والمختبرات الخارجية | device, range_min, range_max (استنتاج) | → النتائج |
| الأشعة (Radiology) | ||||
rays / rayscats / raysresults / raysresults_img / gynarays / mainantenentalrays | جديد | طلبات وفئات ونتائج وصور الأشعة | name, patient_id, result, image (استنتاج) | → visit/patients |
| الصيدلية والوصفات والمخزن (Pharmacy / Prescriptions / Store) | ||||
prescription / prescription_details | جديد | وصفة طبية وتفاصيلها | patient_id, drugname, drugtype, drugdos | → patients |
prepared_prescriptions / prepared_prescriptions_drugs | جديد | الوصفات المُحضّرة بالصيدلية | prescription_id, drug_id, qty (استنتاج) | → prescription, drugs |
stores / storedrugs / storedrugsvalidation | جديد | المخازن وأدويتها وصلاحياتها | store_id, drug_id, qty, expiry (استنتاج) | → drugs |
drugmovements / recorddrugs / importdrugs / followupdrugs | جديد | حركة وتوريد ومتابعة الأدوية | drug_id, amountbefore, amountafter, amountvary, optype, opdate | → drugs, stores |
drug_sensitivity / drug_therapy / antibiotic_sensitivity | جديد | حساسية الأدوية والمضادات والعلاج | drug_id, result (استنتاج) | → drugs |
supplies / suppliescats / invests_supplies / invoffer / invofferdetails | جديد | المستلزمات والعروض المرتبطة بالتحاليل | id, name, cat, price (استنتاج) | → المخزن/التحاليل |
| تاريخ المريض والنماذج العامة (Patient History / Forms / Misc) | ||||
pasthistorymedical / pasthistorysurgical / pasthistoryart / pasthistorygynencological | جديد | التاريخ المرضي/الجراحي/المساعد على الإنجاب/النسائي | patient_id, text (استنتاج) | → patients |
phpersonal / phsexual / phsexualtypes / phpasthx / phpasthxtypes / phpastartresult / phdrugs | جديد | ملف العقم الشخصي/الجنسي/التاريخ السابق | patient_id, type, result (استنتاج) | → patients |
obstetric_case / obstetric_case_ex / obstetrichistorydetails / summary_obstetric / summary_obstetric_abortion / previous_pregnancies / previous_puerperium | جديد | التاريخ الولادي وملخصاته | patient_id, pregnancy_no, outcome (استنتاج) | → patients |
menstural*: mensturalhistory / mensamount / mensdysmo / mensregularity | جديد | تاريخ الدورة الشهرية وقوائمها | patient_id, amount, regularity (استنتاج) | → patients |
patientinformation / patientdecleration / patients_childs / patients_complaints / patients_notify / relative | جديد | بيانات وأقارب وأبناء وشكاوى وإشعارات المريض | patient_id, name, relation, complaint (استنتاج) | → patients |
patient_hystroscopic / patient_laparoscopic / hystroscopic / laparoscopic | جديد | مناظير الرحم والبطن للمريضة | patient_id, findings (استنتاج) | → patients |
vital_sign / fetal_pulse / blood_transfusion / bltype / dna_results / complaint_analysis / decleration / patientdecleration | جديد | علامات حيوية ونقل دم وفحوص متفرقة وإقرارات | patient_id, value, type, date (استنتاج) | → patients/visit |
| المتابعة والأرشيف والإعدادات والبنية التحتية (Follow-up / Archive / Settings / Infra) | ||||
follow_drugs / follow_drain / follow_post / follow_pre / follow_rout / follow_semen / follow_uop / follow_vpack / follow_instruction / visits_follows | جديد | بطاقات متابعة ما بعد العملية/الزيارة | visit_id/patient_id, note, date (استنتاج) | → visit |
archive_request / archive_tracking | جديد | طلب وتتبّع ملفات الأرشيف الورقي | patient_id, in_date, out_date, in_time, out_time, deleted | → patients |
programesetting2 / programesettingex / programesettinglab | جديد | إعدادات إضافية للنظام والمختبر والـERP (erpdb, tanks_view, visit_phones…) | key, value, erpdb | إعدادات عامة |
sms_control / sms_control_setting / login_tacking | جديد | تحكم الرسائل النصية وتتبّع تسجيلات الدخول | user_id, ip, date, sms_template (استنتاج) | → المستخدمين |
short_urls / index_redirect | جديد | اختصار الروابط وإعادة التوجيه (للروابط المرسلة بالرسائل) | code, target_url (استنتاج) | عام |
awusermenu / device / visibility / colors / fastoptions / custom_select / doc_instruction / recommend / refer / knownfrom / symptoms / disease / diseasefamily / medicaldisease | جديد | قوائم مرجعية وإعدادات واجهة وقوائم تشخيصية | id, name, deleted | قوائم/إعدادات |
beauty_visits | جديد | زيارات التجميل (وحدة beauty في المركز) | patient_id, date (استنتاج) | → patients |
ملاحظة منهجية: الحقول الموسومة «(استنتاج)» مُستنبطة من سياق الكود (أسماء الأعمدة في جمل SQL أو خصائص beans في RedBeanPHP) دون رؤية تعريف الجدول الفعلي، إذ لم يتم الاتصال بقاعدة البيانات الحية. القوائم المرجعية الكثيرة (id, name, deleted) موحّدة النمط في كامل النظام.
erpDB منفصلة (اسمها من programesetting->erpdb) مع علامات مثل iserppayment وenterordered في جدول visit — أي أن جسر مالي/مخزني نحو نظام ERP قائم بالفعل ويجب استيعابه بدل إعادة بنائه من الصفر.old/new/obor/royalDb عبر R::addDatabase يعني سيناريوهات ترحيل/دمج بين فروع ونشرات. خطة الـHIS يجب أن تتعامل مع توحيد هذه القواعد (Master Patient Index) لا قاعدة واحدة.visit أصبح القلب المالي والتشغيلي (تسعير، خصومات جهات تعاقد، تحويل بين أقسام/أطباء، توجيه استقبال). يجب أن يكون كيان الـ Encounter المركزي في نموذج الـHIS.organizations + organization_discount + organizations_patient_no تضيف بُعد التأمين/الشركات المتعاقدة المفقود من المخطط الأصلي — أساسي لوحدة الفوترة (Billing/Claims).drugmovements / storedrugs / storedrugsvalidation بحقول amountbefore/after/vary, optype, opdate توفّر دفتر أستاذ حركي للمخزون يجب ربطه مباشرة بوحدة المخزون في الـERP.SHOW CREATE TABLE على قاعدة MED الحية (بإذن وخارج نطاق هذا التحليل القائم على الكود فقط) لتأكيد الأنواع والمفاتيح قبل تصميم خرائط الترحيل.