Membuat Aplikasi Klinik #01 – Pendahuluan

Dalam kesempatan kali saya akan memberikan sebuah tutorial bagaimana membuat sebuah aplikasi klinik berbasis web php, pembuatan aplikasi ini akan dibantu oleh framework php yaitu zeel php. Rencananya aplikasi ini nantinya digunakan untuk melakukan manajemen sebuah klinik seperti manajemen data pasien beserta riwayat penyakitnya, data obat atau seputar pengadministrasian yang umum dilakukan pada sebuah klinik.

Sebelum melangkah lebih jauh, disini saya akan membuat desai atau struktur table MySQL untuk menampung data pasien beserta riwayat penyakitnya. Nanti Anda bisa membuatnya seperti contoh berikut


-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Oct 27, 2023 at 12:36 PM
-- Server version: 10.4.28-MariaDB
-- PHP Version: 8.2.4

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `klinik`
--

-- --------------------------------------------------------

--
-- Table structure for table `pasien`
--

CREATE TABLE `pasien` (
  `pasien_id` bigint(20) UNSIGNED NOT NULL,
  `pasien_nik` varchar(16) DEFAULT NULL,
  `pasien_nama` varchar(65) DEFAULT NULL,
  `pasien_alamat` text NOT NULL,
  `pasien_kontak` varchar(12) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------

--
-- Table structure for table `pasien_riwayat`
--

CREATE TABLE `pasien_riwayat` (
  `riwayat_id` bigint(20) UNSIGNED NOT NULL,
  `pasien_id` bigint(20) UNSIGNED NOT NULL,
  `riwayat_penyakit` text DEFAULT NULL,
  `tanggal_berobat` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `pasien`
--
ALTER TABLE `pasien`
  ADD PRIMARY KEY (`pasien_id`),
  ADD UNIQUE KEY `pasien_nik` (`pasien_nik`);

--
-- Indexes for table `pasien_riwayat`
--
ALTER TABLE `pasien_riwayat`
  ADD PRIMARY KEY (`riwayat_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `pasien`
--
ALTER TABLE `pasien`
  MODIFY `pasien_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `pasien_riwayat`
--
ALTER TABLE `pasien_riwayat`
  MODIFY `riwayat_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;


Desain database diatas bersifat sementara, nantinya mungkin ada beberapa penambahan atau perubahan

Selanjutnya Anda perlu melakukan konfigurasi atau menghubungkan aplikasi php anda ke database MySQL. Anda bisa membuka file Settings.php yang terdapat pada folder database seperti berikut


<?php

$databases = array (
  'default' => 
  array (
    'default' => 
    array (
      'database' => 'klinik',
      'username' => 'root',
      'password' => '',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);

//echo $databases['default']['default']['database'];
date_default_timezone_set('Asia/Jakarta');

$salt = 'BtGiGg90tkNFHP6i20EI1tvpzZdmYOsa_67kEk0VfuA';

/**
 * PHP settings:
 *
 * To see what PHP settings are possible, including whether they can be set at
 * runtime (by using ini_set()), read the PHP documentation:
 * http://www.php.net/manual/ini.list.php
 * See drupal_environment_initialize() in includes/bootstrap.inc for required
 * runtime settings and the .htaccess file for non-runtime settings. Settings
 * defined there should not be duplicated here so as to avoid conflict issues.
 */

/**
 * Some distributions of Linux (most notably Debian) ship their PHP
 * installations with garbage collection (gc) disabled. Since Drupal depends on
 * PHP's garbage collection for clearing sessions, ensure that garbage
 * collection occurs by using the most common settings.
 */
ini_set('session.gc_probability', 1);
ini_set('session.gc_divisor', 100);

/**
 * Set session lifetime (in seconds), i.e. the time from the user's last visit
 * to the active session may be deleted by the session garbage collector. When
 * a session is deleted, authenticated users are logged out, and the contents
 * of the user's $_SESSION variable is discarded.
 */
ini_set('session.gc_maxlifetime', 200000);

/**
 * Set session cookie lifetime (in seconds), i.e. the time from the session is
 * created to the cookie expires, i.e. when the browser is expected to discard
 * the cookie. The value 0 means "until the browser is closed".
 */
ini_set('session.cookie_lifetime', 2000000);

/**
 * If you encounter a situation where users post a large amount of text, and
 * the result is stripped out upon viewing but can still be edited, Drupal's
 * output filter may not have sufficient memory to process it.  If you
 * experience this issue, you may wish to uncomment the following two lines
 * and increase the limits of these variables.  For more information, see
 * http://php.net/manual/pcre.configuration.php.
 */
# ini_set('pcre.backtrack_limit', 200000);
# ini_set('pcre.recursion_limit', 200000);


?>



0 Response to "Membuat Aplikasi Klinik #01 – Pendahuluan"

Post a Comment

Komentar yang Anda kirim akan terlebih dahulu di moderasi oleh Admin