🗄️

ملحق: الجداول الجديدة المستخرجة من الكود (MED: New Tables Extracted from Code)

تحليل النسخة الثانية المكتشفة من النظام (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 لتصنيفه «جديد» أو «معروف».

الأرقام الإجمالية (Quantification)

413جدول مُشار إليه في كود MED
137معروف (ضمن الـ 312 الأصلية)
276جدول جديد (غير موجود بالنسخة الأصلية)
4وحدات تم مسحها: core / board / pharmacy / vote
6+قواعد بيانات مُتحدة (erpDB / old / new / obor / royalDb / default)

المصدر: مسح 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 الخاصة بالمركز/المستشفى.

اكتشاف معماري: قاعدة بيانات ERP مخصّصة وربط متعدد القواعد (Multi-DB Federation)

الكود يربط عدة قواعد بيانات عبر R::addDatabase() وR::selectDatabase()، أبرزها قاعدة باسم erpDB يُقرأ اسمها من إعداد programesetting->erpdb (استنتاج: تكامل مالي/مخزني مع نظام ERP منفصل)، إضافة إلى قواعد old وnew وobor وroyalDb (استنتاج: ترحيل بيانات بين نشرات/فروع متعددة). هذا يؤكد أن MED ليست تطبيقاً بقاعدة واحدة بل طبقة موحِّدة فوق عدة قواعد.

الجداول الجديدة مجمّعة حسب النطاق (New Entities by Domain)

الجدولجديد/معروفالغرضأهم الحقول المستنتجةالعلاقات
التصويت / استبيان رضا العملاء (Kiosk Voting) — وحدة vote
votesجديدتعريف استبيان/تصويتid, title, status (استنتاج)vote_questions
vote_questionsجديدأسئلة الاستبيانvote_id, question_textvotesvote_answers
vote_answersجديدإجابات/خيارات السؤالquestion_id, answer_text, answer_facevote_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_atvotes, vote_devices
clients_votes_answersجديدتفاصيل إجابات العميلclient_vote_id, question_id, answer_id, answer_text, answer_face, user_id, created_atclients_votes
الهيكل التنظيمي والجغرافي (Center / Organizations / Geo)
organizationsجديدالجهات/الشركات المتعاقدة (تأمين/شركات)id, name, deleted, patient_noorganization_discount, organizations_patient_no, visit
organization_discountجديدخصومات الجهة المتعاقدةorganization_id, discount_type, value (استنتاج)organizations
organizations_patient_noجديدأرقام منتسبي الجهةorganization_id, patient_noorganizations
governorate / governorate_centersجديدالمحافظات والمراكز التابعةid, nameregions / sub_regions
regions / sub_regionsجديدالمناطق والمناطق الفرعيةid, name, region_id, deletedvisit.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, printserialorganizations, 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_idclinic_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, deletedresidence_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_dateembryo, tankcells
embryoجديدالجنين المفردembryoslab_id, embryologist_id_tb, icsi_by_tb, freeze_embryologist_id_tb, cancelled_userembryoslab, embryotype
embryofreezing / embryothawing / embryofreezingreportجديدتجميد/إذابة الأجنة والتقاريرembryofreezing_id, embryologist, date, protocolembryo, tankcells
embryotransfer / embryotransferovum / ovumpickupجديدالإرجاع وسحب البويضاتclinician_name, embryologist_name, dateembryoslab
embryologist / embryologyreport / embryoscoring / embryotype / embryodifficulty / embryojetplaceجديدقوائم مرجعية ودرجات الأجنةid, name, gradeembryo
oocytequality / oocytecytoplasm / oocytezona / oocytepvs / oocyteotherجديدتقييم جودة البويضاتid, nameovumpickup
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, deletedtanks, embryofreezing
growthmedia / growthincubator / growthco2 / growthoil / freezingmedia / freezingprotocolجديدقوائم مرجعية لبيئة الزراعة والتجميدid, nameembryoslab
ivf_records / ivf_reportجديدسجلات وتقارير دورات الحقن المجهريpatient_id, date (استنتاج)embryoslab
الحيوانات المنوية والذكورة (Andrology / Semen) — وحدة and*
andvisitsجديدزيارة عيادة الذكورةpatientid, doctorid, doctorname, date, complaintid, diagnosisidandvisits*
andvisitssemen / andvisitsus / andvisitsrays / andvisitsinvestigation / andvisitsficils / andvisitsgenetictesting / andvisitsdrugsجديدتفاصيل زيارة الذكورة (سائل منوي/سونار/أشعة/تحاليل/أدوية/فحص جيني)andvisitsusid, azf, chromosome, length, width, volume, name, type, sysdateandvisits
andexamination / andhistory / andejaculation / anderection / andcontraception / andmedicalproblems / anddiagnosis / andcomplaintجديدالفحص والتاريخ الذكوري وقوائمهid, name, deletedandvisits
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, drugdospatients
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, opdatedrugs, 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, deletedpatients
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) موحّدة النمط في كامل النظام.

التأثير على خطة الـ ERP/HIS (Impact on ERP/HIS Plan)