antrian.sql 42.4 KB
Newer Older
1 2 3 4 5 6 7
/*
 Navicat Premium Data Transfer

 Source Server         : localhost_5432
 Source Server Type    : PostgreSQL
 Source Server Version : 110005
 Source Host           : localhost:5432
Indra Raja's avatar
Indra Raja committed
8
 Source Catalog        : antrian
9 10 11 12 13 14
 Source Schema         : public

 Target Server Type    : PostgreSQL
 Target Server Version : 110005
 File Encoding         : 65001

Indra Raja's avatar
Indra Raja committed
15
 Date: 23/09/2020 11:32:54
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
*/


-- ----------------------------
-- Sequence structure for antrian_id_antrian
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."antrian_id_antrian";
CREATE SEQUENCE "public"."antrian_id_antrian" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for dokter\_id_dokter_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."dokter\_id_dokter_seq";
CREATE SEQUENCE "public"."dokter\_id_dokter_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 32767
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for id_antrian_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."id_antrian_seq";
CREATE SEQUENCE "public"."id_antrian_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for id_antrian_seq2
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."id_antrian_seq2";
CREATE SEQUENCE "public"."id_antrian_seq2" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

Indra Raja's avatar
Indra Raja committed
63 64 65 66 67 68 69 70 71 72 73 74
-- ----------------------------
-- Sequence structure for id_dokter_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."id_dokter_seq";
CREATE SEQUENCE "public"."id_dokter_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1
CYCLE ;

Indra Raja's avatar
Indra Raja committed
75 76 77 78 79 80 81 82 83 84 85
-- ----------------------------
-- Sequence structure for id_ruang_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."id_ruang_seq";
CREATE SEQUENCE "public"."id_ruang_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
-- ----------------------------
-- Sequence structure for pasien_id_pasien_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."pasien_id_pasien_seq";
CREATE SEQUENCE "public"."pasien_id_pasien_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for poli_id_poli_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."poli_id_poli_seq";
CREATE SEQUENCE "public"."poli_id_poli_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 32767
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for register_antrian_id_register
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."register_antrian_id_register";
CREATE SEQUENCE "public"."register_antrian_id_register" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for user_data_header_iduser_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."user_data_header_iduser_seq";
CREATE SEQUENCE "public"."user_data_header_iduser_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
CACHE 1;

-- ----------------------------
-- Table structure for antrian
-- ----------------------------
DROP TABLE IF EXISTS "public"."antrian";
CREATE TABLE "public"."antrian" (
  "id_antrian" int2 DEFAULT nextval('antrian_id_antrian'::regclass),
  "no_antrian" int2,
  "kode_antrian" int2,
  "create_date" date
)
;

Indra Raja's avatar
Indra Raja committed
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
-- ----------------------------
-- Records of antrian
-- ----------------------------
INSERT INTO "public"."antrian" VALUES (1770, 1, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1771, 2, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1772, 3, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1773, 4, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1774, 5, 2, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1775, 6, 2, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1776, 7, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1777, 8, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1778, 9, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1779, 10, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1780, 11, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1781, 12, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1782, 13, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1783, 14, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1784, 15, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1785, 1, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1786, 2, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1787, 3, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1788, 4, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1789, 5, 2, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1790, 6, 2, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1791, 7, 2, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1792, 8, 2, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1793, 9, 2, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1794, 10, 2, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1795, 1, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1796, 2, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1797, 3, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1798, 4, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1799, 5, 2, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1800, 6, 2, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1801, 7, 2, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1802, 8, 2, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1803, 9, 2, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1804, 10, 2, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1805, 1, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1806, 2, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1807, 3, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1808, 4, 1, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1809, 5, 2, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1810, 6, 2, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1811, 7, 2, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1812, 8, 2, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1813, 9, 2, '2020-09-22');
INSERT INTO "public"."antrian" VALUES (1814, 10, 2, '2020-09-22');
Indra Raja's avatar
Indra Raja committed
190 191 192 193 194 195 196 197 198 199
INSERT INTO "public"."antrian" VALUES (1815, 1, 1, '2020-09-23');
INSERT INTO "public"."antrian" VALUES (1816, 2, 1, '2020-09-23');
INSERT INTO "public"."antrian" VALUES (1817, 3, 1, '2020-09-23');
INSERT INTO "public"."antrian" VALUES (1818, 4, 1, '2020-09-23');
INSERT INTO "public"."antrian" VALUES (1819, 5, 2, '2020-09-23');
INSERT INTO "public"."antrian" VALUES (1820, 6, 2, '2020-09-23');
INSERT INTO "public"."antrian" VALUES (1821, 7, 2, '2020-09-23');
INSERT INTO "public"."antrian" VALUES (1822, 8, 2, '2020-09-23');
INSERT INTO "public"."antrian" VALUES (1823, 9, 2, '2020-09-23');
INSERT INTO "public"."antrian" VALUES (1824, 10, 2, '2020-09-23');
Indra Raja's avatar
Indra Raja committed
200

201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225
-- ----------------------------
-- Table structure for antrian_pasien
-- ----------------------------
DROP TABLE IF EXISTS "public"."antrian_pasien";
CREATE TABLE "public"."antrian_pasien" (
  "id_pasien" int2,
  "no_antrian" int2,
  "create_date" date,
  "nama" varchar(150) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "tempat_lahir" varchar(100) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "tanggal_lahir" varchar COLLATE "pg_catalog"."default",
  "alamat" varchar(150) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "no_hp" varchar(50) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "id_poli" int2,
  "id_dokter" int2,
  "ktp" varchar(16) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "kode_antrian" varchar(255) COLLATE "pg_catalog"."default",
  "id_register" int2,
  "id_antrian" int2 NOT NULL DEFAULT nextval('id_antrian_seq2'::regclass),
  "status_code" int2,
  "id_ruang" int2,
  "waktu" time(6)
)
;

Indra Raja's avatar
Indra Raja committed
226 227 228 229
-- ----------------------------
-- Records of antrian_pasien
-- ----------------------------
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 9, '2020-09-22', NULL, NULL, NULL, NULL, NULL, 5, 17, NULL, '2', 218, 1813, 10, 9, NULL);
Indra Raja's avatar
Indra Raja committed
230 231 232 233 234 235 236 237
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 1, '2020-09-23', NULL, NULL, NULL, NULL, NULL, 5, 7, NULL, '1', 219, 1815, NULL, 8, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 3, '2020-09-23', NULL, NULL, NULL, NULL, NULL, 5, 7, NULL, '1', 219, 1817, NULL, 8, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 5, '2020-09-23', NULL, NULL, NULL, NULL, NULL, 5, 7, NULL, '2', 219, 1819, NULL, 8, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 6, '2020-09-23', NULL, NULL, NULL, NULL, NULL, 5, 7, NULL, '2', 219, 1820, NULL, 8, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 7, '2020-09-23', NULL, NULL, NULL, NULL, NULL, 5, 7, NULL, '2', 219, 1821, NULL, 8, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 8, '2020-09-23', NULL, NULL, NULL, NULL, NULL, 5, 7, NULL, '2', 219, 1822, NULL, 8, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 9, '2020-09-23', NULL, NULL, NULL, NULL, NULL, 5, 7, NULL, '2', 219, 1823, NULL, 8, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 10, '2020-09-23', NULL, NULL, NULL, NULL, NULL, 5, 7, NULL, '2', 219, 1824, NULL, 8, NULL);
Indra Raja's avatar
Indra Raja committed
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
INSERT INTO "public"."antrian_pasien" VALUES (2, 1, '2020-09-22', '', '', '', '', '', 5, 17, '', '1', 218, 1805, 10, 9, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (3, 2, '2020-09-22', '', '', '', '', '', 5, 17, '', '1', 218, 1806, 10, 9, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (4, 5, '2020-09-22', '', '', '', '', '', 5, 17, '', '2', 218, 1809, 10, 9, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (5, 6, '2020-09-22', '', '', '', '', '', 5, 17, '', '2', 218, 1810, 10, 9, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 10, '2020-09-22', NULL, NULL, NULL, NULL, NULL, 5, 17, NULL, '2', 218, 1814, 10, 9, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 2, '2020-09-22', NULL, NULL, NULL, NULL, NULL, 5, 15, NULL, '1', 216, 1786, 10, 7, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 3, '2020-09-22', NULL, NULL, NULL, NULL, NULL, 5, 15, NULL, '1', 216, 1787, 10, 7, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 4, '2020-09-22', NULL, NULL, NULL, NULL, NULL, 5, 15, NULL, '1', 216, 1788, 10, 7, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 5, '2020-09-22', NULL, NULL, NULL, NULL, NULL, 5, 15, NULL, '2', 216, 1789, 10, 7, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 6, '2020-09-22', NULL, NULL, NULL, NULL, NULL, 5, 15, NULL, '2', 216, 1790, 10, 7, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 7, '2020-09-22', NULL, NULL, NULL, NULL, NULL, 5, 15, NULL, '2', 216, 1791, 10, 7, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 8, '2020-09-22', NULL, NULL, NULL, NULL, NULL, 5, 15, NULL, '2', 216, 1792, 10, 7, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 9, '2020-09-22', NULL, NULL, NULL, NULL, NULL, 5, 15, NULL, '2', 216, 1793, 10, 7, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 10, '2020-09-22', NULL, NULL, NULL, NULL, NULL, 5, 15, NULL, '2', 216, 1794, 10, 7, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 6, '2020-09-22', NULL, NULL, NULL, NULL, NULL, 5, 16, NULL, '2', 217, 1800, 10, 8, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 7, '2020-09-22', NULL, NULL, NULL, NULL, NULL, 5, 16, NULL, '2', 217, 1801, 10, 8, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 8, '2020-09-22', NULL, NULL, NULL, NULL, NULL, 5, 16, NULL, '2', 217, 1802, 10, 8, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 9, '2020-09-22', NULL, NULL, NULL, NULL, NULL, 5, 16, NULL, '2', 217, 1803, 10, 8, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 10, '2020-09-22', NULL, NULL, NULL, NULL, NULL, 5, 16, NULL, '2', 217, 1804, 10, 8, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (1, 1, '2020-09-22', '', '', '', '', '', 5, 15, '', '1', 216, 1785, 10, 7, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 3, '2020-09-22', NULL, NULL, NULL, NULL, NULL, 5, 17, NULL, '1', 218, 1807, 10, 9, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 4, '2020-09-22', NULL, NULL, NULL, NULL, NULL, 5, 17, NULL, '1', 218, 1808, 10, 9, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 7, '2020-09-22', NULL, NULL, NULL, NULL, NULL, 5, 17, NULL, '2', 218, 1811, 10, 9, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (NULL, 8, '2020-09-22', NULL, NULL, NULL, NULL, NULL, 5, 17, NULL, '2', 218, 1812, 10, 9, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (6, 1, '2020-09-22', '', '', '', '', '', 5, 16, '', '1', 217, 1795, 10, 8, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (7, 2, '2020-09-22', '', '', '', '', '', 5, 16, '', '1', 217, 1796, 10, 8, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (8, 3, '2020-09-22', '', '', '', '', '', 5, 16, '', '1', 217, 1797, 10, 8, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (9, 4, '2020-09-22', '', '', '', '', '', 5, 16, '', '1', 217, 1798, 10, 8, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (10, 5, '2020-09-22', '', '', '', '', '', 5, 16, '', '2', 217, 1799, 10, 8, NULL);
Indra Raja's avatar
Indra Raja committed
267 268
INSERT INTO "public"."antrian_pasien" VALUES (11, 2, '2020-09-23', '', '', '', '', '', 5, 7, '', '1', 219, 1816, 50, 8, NULL);
INSERT INTO "public"."antrian_pasien" VALUES (12, 4, '2020-09-23', '', '', '', '', '', 5, 7, '', '1', 219, 1818, 50, 8, NULL);
Indra Raja's avatar
Indra Raja committed
269

270 271 272 273 274 275 276 277 278 279 280
-- ----------------------------
-- Table structure for counter_status
-- ----------------------------
DROP TABLE IF EXISTS "public"."counter_status";
CREATE TABLE "public"."counter_status" (
  "id_status" int2 NOT NULL,
  "status_code" int2,
  "status_name" varchar(255) COLLATE "pg_catalog"."default"
)
;

Indra Raja's avatar
Indra Raja committed
281 282 283 284 285 286 287 288 289 290
-- ----------------------------
-- Records of counter_status
-- ----------------------------
INSERT INTO "public"."counter_status" VALUES (1, 10, 'Queue');
INSERT INTO "public"."counter_status" VALUES (2, 20, 'Next');
INSERT INTO "public"."counter_status" VALUES (3, 30, 'Call');
INSERT INTO "public"."counter_status" VALUES (4, 40, 'Served');
INSERT INTO "public"."counter_status" VALUES (5, 50, 'Done');
INSERT INTO "public"."counter_status" VALUES (6, 60, 'Missed');

291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307
-- ----------------------------
-- Table structure for divisi_witel
-- ----------------------------
DROP TABLE IF EXISTS "public"."divisi_witel";
CREATE TABLE "public"."divisi_witel" (
  "divisi_witel_id" varchar(3) COLLATE "pg_catalog"."default" NOT NULL,
  "divisi_witel_name" varchar(32) COLLATE "pg_catalog"."default",
  "id_dmaco" int4,
  "witel_imon" varchar(100) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for dokter
-- ----------------------------
DROP TABLE IF EXISTS "public"."dokter";
CREATE TABLE "public"."dokter" (
Indra Raja's avatar
Indra Raja committed
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323
  "id_dokter" int2 NOT NULL DEFAULT nextval('id_dokter_seq'::regclass),
  "nama_dokter" varchar(30) COLLATE "pg_catalog"."default",
  "kode_dokter" varchar(255) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Records of dokter
-- ----------------------------
INSERT INTO "public"."dokter" VALUES (3, 'Indra', 'AZ');

-- ----------------------------
-- Table structure for dokter_to_poli
-- ----------------------------
DROP TABLE IF EXISTS "public"."dokter_to_poli";
CREATE TABLE "public"."dokter_to_poli" (
324 325 326 327
  "id_dokter" int2 NOT NULL DEFAULT nextval('"dokter\_id_dokter_seq"'::regclass),
  "nama_dokter" varchar(30) COLLATE "pg_catalog"."default",
  "id_poli" int2,
  "id_condition" int2,
Indra Raja's avatar
Indra Raja committed
328 329
  "kode_dokter" varchar(255) COLLATE "pg_catalog"."default",
  "create_date" date
330 331 332
)
;

Indra Raja's avatar
Indra Raja committed
333
-- ----------------------------
Indra Raja's avatar
Indra Raja committed
334
-- Records of dokter_to_poli
Indra Raja's avatar
Indra Raja committed
335
-- ----------------------------
Indra Raja's avatar
Indra Raja committed
336
INSERT INTO "public"."dokter_to_poli" VALUES (3, 'Indra', 5, 1, 'AZ', '2020-09-23');
Indra Raja's avatar
Indra Raja committed
337

338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353
-- ----------------------------
-- Table structure for master_parameter
-- ----------------------------
DROP TABLE IF EXISTS "public"."master_parameter";
CREATE TABLE "public"."master_parameter" (
  "idm_parameter" int4 NOT NULL,
  "param_type" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "param_val1" varchar(500) COLLATE "pg_catalog"."default",
  "param_val2" varchar(500) COLLATE "pg_catalog"."default",
  "param_val3" varchar(500) COLLATE "pg_catalog"."default",
  "param_desc" varchar(1000) COLLATE "pg_catalog"."default",
  "param_parent" int4
)
;
COMMENT ON TABLE "public"."master_parameter" IS 'master parameter';

Indra Raja's avatar
Indra Raja committed
354 355 356 357 358 359 360 361 362 363 364 365 366
-- ----------------------------
-- Records of master_parameter
-- ----------------------------
INSERT INTO "public"."master_parameter" VALUES (1, 'USER_STATUS', 'ACTIVE', '10', NULL, 'USER ACTIVE GANS', NULL);
INSERT INTO "public"."master_parameter" VALUES (2, 'USER_STATUS', 'NOT ACTIVE', '20', NULL, 'USER NOT ACTIVE GANS', NULL);
INSERT INTO "public"."master_parameter" VALUES (3, 'USER_STATUS', 'BLOCKED', '30', NULL, 'USER NA DIBLOCK', NULL);
INSERT INTO "public"."master_parameter" VALUES (4, 'INPUT_TYPE', 'INPUT', '1', NULL, NULL, NULL);
INSERT INTO "public"."master_parameter" VALUES (5, 'INPUT_TYPE', 'TEXTAREA', '2', NULL, NULL, NULL);
INSERT INTO "public"."master_parameter" VALUES (6, 'INPUT_OPTION', 'SELECT_OPTION', '3', NULL, NULL, NULL);
INSERT INTO "public"."master_parameter" VALUES (7, 'INPUT_RADIO', 'RADION_BUTTON', '4', NULL, NULL, NULL);
INSERT INTO "public"."master_parameter" VALUES (8, 'TYPE_DATA', 'I_VARCHAR', '1', NULL, 'JENIS INPUTAN VARCHAR', NULL);
INSERT INTO "public"."master_parameter" VALUES (9, 'TYPE_DATA', 'I_NUMBER', '2', NULL, 'JENIS INPUTAN NUMBER', NULL);

367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382
-- ----------------------------
-- Table structure for pasien
-- ----------------------------
DROP TABLE IF EXISTS "public"."pasien";
CREATE TABLE "public"."pasien" (
  "id_pasien" int2,
  "nama" varchar(255) COLLATE "pg_catalog"."default",
  "tempat_lahir" varchar(255) COLLATE "pg_catalog"."default",
  "tanggal_lahir" varchar(255) COLLATE "pg_catalog"."default",
  "alamat" varchar(255) COLLATE "pg_catalog"."default",
  "no_hp" varchar(255) COLLATE "pg_catalog"."default",
  "ktp" varchar(255) COLLATE "pg_catalog"."default",
  "create_date" date
)
;

Indra Raja's avatar
Indra Raja committed
383 384 385 386 387 388 389 390 391 392 393 394 395
-- ----------------------------
-- Records of pasien
-- ----------------------------
INSERT INTO "public"."pasien" VALUES (NULL, '', '', '', '', '', '', '2020-09-22');
INSERT INTO "public"."pasien" VALUES (NULL, '', '', '', '', '', '', '2020-09-22');
INSERT INTO "public"."pasien" VALUES (NULL, '', '', '', '', '', '', '2020-09-22');
INSERT INTO "public"."pasien" VALUES (NULL, '', '', '', '', '', '', '2020-09-22');
INSERT INTO "public"."pasien" VALUES (NULL, '', '', '', '', '', '', '2020-09-22');
INSERT INTO "public"."pasien" VALUES (NULL, '', '', '', '', '', '', '2020-09-22');
INSERT INTO "public"."pasien" VALUES (NULL, '', '', '', '', '', '', '2020-09-22');
INSERT INTO "public"."pasien" VALUES (NULL, '', '', '', '', '', '', '2020-09-22');
INSERT INTO "public"."pasien" VALUES (NULL, '', '', '', '', '', '', '2020-09-22');
INSERT INTO "public"."pasien" VALUES (NULL, '', '', '', '', '', '', '2020-09-22');
Indra Raja's avatar
Indra Raja committed
396 397
INSERT INTO "public"."pasien" VALUES (NULL, '', '', '', '', '', '', '2020-09-23');
INSERT INTO "public"."pasien" VALUES (NULL, '', '', '', '', '', '', '2020-09-23');
Indra Raja's avatar
Indra Raja committed
398

399 400 401 402 403 404 405
-- ----------------------------
-- Table structure for poli
-- ----------------------------
DROP TABLE IF EXISTS "public"."poli";
CREATE TABLE "public"."poli" (
  "id_poli" int2 NOT NULL DEFAULT nextval('poli_id_poli_seq'::regclass),
  "nama_poli" varchar(255) COLLATE "pg_catalog"."default",
Indra Raja's avatar
Indra Raja committed
406 407
  "kode_poli" varchar(5) COLLATE "pg_catalog"."default",
  "deskripsi_poli" varchar(255) COLLATE "pg_catalog"."default"
408 409 410
)
;

Indra Raja's avatar
Indra Raja committed
411 412 413
-- ----------------------------
-- Records of poli
-- ----------------------------
Indra Raja's avatar
Indra Raja committed
414 415
INSERT INTO "public"."poli" VALUES (5, 'Umum', 'UM', 'ad');
INSERT INTO "public"."poli" VALUES (8, 'Poli Gigi', 'PG', 'adada');
Indra Raja's avatar
Indra Raja committed
416

417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441
-- ----------------------------
-- Table structure for regional
-- ----------------------------
DROP TABLE IF EXISTS "public"."regional";
CREATE TABLE "public"."regional" (
  "id_regional" int4 NOT NULL,
  "regional_name" varchar(30) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for register_antrian
-- ----------------------------
DROP TABLE IF EXISTS "public"."register_antrian";
CREATE TABLE "public"."register_antrian" (
  "id_register" int2 DEFAULT nextval('register_antrian_id_register'::regclass),
  "antrian_all" int2,
  "antrian_awal" int2,
  "antrian_akhir" int2,
  "create_date" date,
  "jam_mulai" varchar(6) COLLATE "pg_catalog"."default",
  "waktu_antrian" varchar(6) COLLATE "pg_catalog"."default"
)
;

Indra Raja's avatar
Indra Raja committed
442 443 444 445 446 447 448
-- ----------------------------
-- Records of register_antrian
-- ----------------------------
INSERT INTO "public"."register_antrian" VALUES (210, 15, 5, 6, '2020-09-22', '6:15', '0:14');
INSERT INTO "public"."register_antrian" VALUES (211, 10, 5, 10, '2020-09-22', '6:59', '0:16');
INSERT INTO "public"."register_antrian" VALUES (212, 10, 5, 10, '2020-09-22', '12:26', '0:20');
INSERT INTO "public"."register_antrian" VALUES (213, 10, 5, 10, '2020-09-22', '6:10', '0:10');
Indra Raja's avatar
Indra Raja committed
449
INSERT INTO "public"."register_antrian" VALUES (214, 10, 5, 10, '2020-09-23', '12:20', '0:11');
Indra Raja's avatar
Indra Raja committed
450

451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469
-- ----------------------------
-- Table structure for register_dokter
-- ----------------------------
DROP TABLE IF EXISTS "public"."register_dokter";
CREATE TABLE "public"."register_dokter" (
  "id_register" int2 DEFAULT nextval('id_antrian_seq'::regclass),
  "id_poli" int2,
  "id_dokter" int2,
  "id_ruang" int2,
  "antrian_all" int2,
  "antrian_awal" int2,
  "antrian_akhir" int2,
  "create_date" date,
  "id_condition" int2,
  "jam_mulai" varchar(6) COLLATE "pg_catalog"."default",
  "waktu_antrian" varchar(6) COLLATE "pg_catalog"."default"
)
;

Indra Raja's avatar
Indra Raja committed
470 471 472 473 474 475
-- ----------------------------
-- Records of register_dokter
-- ----------------------------
INSERT INTO "public"."register_dokter" VALUES (217, 5, 16, 8, 10, 5, 10, '2020-09-22', 1, '12:26', '0:20');
INSERT INTO "public"."register_dokter" VALUES (218, 5, 17, 9, 10, 5, 10, '2020-09-22', 1, '6:10', '0:10');
INSERT INTO "public"."register_dokter" VALUES (216, 5, 15, 7, 10, 5, 10, '2020-09-22', 1, '6:23', '0:16');
Indra Raja's avatar
Indra Raja committed
476
INSERT INTO "public"."register_dokter" VALUES (219, 5, 7, 8, 10, 5, 10, '2020-09-23', 1, '12:20', '0:11');
Indra Raja's avatar
Indra Raja committed
477

478 479 480 481 482
-- ----------------------------
-- Table structure for ruang
-- ----------------------------
DROP TABLE IF EXISTS "public"."ruang";
CREATE TABLE "public"."ruang" (
Indra Raja's avatar
Indra Raja committed
483
  "id_ruang" int2 NOT NULL DEFAULT nextval('id_ruang_seq'::regclass),
484 485 486 487 488 489
  "nama_ruang" varchar(255) COLLATE "pg_catalog"."default",
  "id_poli" int2,
  "id_condition" int2
)
;

Indra Raja's avatar
Indra Raja committed
490 491 492
-- ----------------------------
-- Records of ruang
-- ----------------------------
Indra Raja's avatar
Indra Raja committed
493
INSERT INTO "public"."ruang" VALUES (8, 'R 1.5', 5, 2);
Indra Raja's avatar
Indra Raja committed
494

495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511
-- ----------------------------
-- Table structure for user_data_access
-- ----------------------------
DROP TABLE IF EXISTS "public"."user_data_access";
CREATE TABLE "public"."user_data_access" (
  "access_id" int4 NOT NULL,
  "access_name" varchar(50) COLLATE "pg_catalog"."default",
  "access_type" varchar(255) COLLATE "pg_catalog"."default",
  "access_code" numeric(10),
  "access_desc" varchar(100) COLLATE "pg_catalog"."default",
  "access_action" varchar(100) COLLATE "pg_catalog"."default",
  "access_controller" varchar(100) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."user_data_access"."access_action" IS 'NAMA FUNGSI PHP';
COMMENT ON COLUMN "public"."user_data_access"."access_controller" IS 'NAMA CONTROLLERNYA';

Indra Raja's avatar
Indra Raja committed
512 513 514 515 516 517 518
-- ----------------------------
-- Records of user_data_access
-- ----------------------------
INSERT INTO "public"."user_data_access" VALUES (1, 'DELETE TEST DATA', 'ACTION', 10, 'TEST FUNCTION', NULL, NULL);
INSERT INTO "public"."user_data_access" VALUES (2, 'MENU TEST DATA', 'MENU', 20, 'TEST MENU', NULL, NULL);
INSERT INTO "public"."user_data_access" VALUES (3, 'USER MANAGEMENT', 'MENU', 30, 'MENU USER MANAMEGENT', 'usermanagement', 'UserController');

519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552
-- ----------------------------
-- Table structure for user_data_header
-- ----------------------------
DROP TABLE IF EXISTS "public"."user_data_header";
CREATE TABLE "public"."user_data_header" (
  "iduser" int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY (
INCREMENT 1
MINVALUE  1
MAXVALUE 2147483647
START 1
),
  "username" varchar(100) COLLATE "pg_catalog"."default",
  "password" varchar(100) COLLATE "pg_catalog"."default",
  "name" varchar(100) COLLATE "pg_catalog"."default",
  "role" int4,
  "status" int4,
  "deviceid" varchar(255) COLLATE "pg_catalog"."default",
  "accessToken" varchar(255) COLLATE "pg_catalog"."default",
  "create_dtm" timestamp(6),
  "retries" varchar(10) COLLATE "pg_catalog"."default",
  "update_date" timestamp(6),
  "email" varchar(50) COLLATE "pg_catalog"."default",
  "authKey" varchar(255) COLLATE "pg_catalog"."default",
  "nik" varchar(100) COLLATE "pg_catalog"."default",
  "lokasi_p" varchar(100) COLLATE "pg_catalog"."default",
  "domain_p" varchar(100) COLLATE "pg_catalog"."default",
  "regional_id" int2,
  "witel_id" varchar(50) COLLATE "pg_catalog"."default",
  "last_update" timestamp(6)
)
;
COMMENT ON COLUMN "public"."user_data_header"."role" IS 'RELATION WITH TB: USER_DATA_ROLE';
COMMENT ON COLUMN "public"."user_data_header"."status" IS 'SET STATUS USER: ';

Indra Raja's avatar
Indra Raja committed
553 554 555 556 557 558 559 560 561 562 563 564 565
-- ----------------------------
-- Records of user_data_header
-- ----------------------------
INSERT INTO "public"."user_data_header" VALUES (5, '930159', NULL, 'Ratna Wulan Sari', 30, 10, NULL, '$2y$10$e5IlkVkq/7zxhuVgORVH6uY850T5NiY.MZzoVk8ASnEfRr.6ooira', '2020-01-14 01:16:32', NULL, NULL, 'ratna.sari@telkom.co.id', 'a0e3e79e631b49115bd0cb927120f9eb', '930159', 'JAKARTA', 'Telkom', NULL, NULL, NULL);
INSERT INTO "public"."user_data_header" VALUES (9, 'witels', '758a27752fa96f0e612e8c75b0d619a9', 'witels', 20, 10, NULL, NULL, '2020-06-21 22:50:03', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 3, '351', NULL);
INSERT INTO "public"."user_data_header" VALUES (6, 'test1', '5a105e8b9d40e1329780d62ea2265d8a', 'test1', 10, 30, NULL, NULL, '2020-06-21 21:57:41', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO "public"."user_data_header" VALUES (7, 'test1', '5a105e8b9d40e1329780d62ea2265d8a', 'test1', 10, 20, NULL, NULL, '2020-06-21 21:57:44', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO "public"."user_data_header" VALUES (8, 'test2', 'ad0234829205b9033196ba818f7a872b', 'test2', 20, 10, NULL, NULL, '2020-06-21 21:59:39', 'NULL', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO "public"."user_data_header" VALUES (1, 'danirusdanx', '5036592afd6e403097c37eef12ad8285', 'danirusdan', 10, 10, NULL, NULL, '2017-07-09 22:30:23', 'NULL', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO "public"."user_data_header" VALUES (4, 'adminx', '$2y$10$7NnmhGtMZJTbS7gRVl/c0OIrCK29/rurfhBdZAKlgN8y/WcV8nbRa', 'Saya Karyawan', 30, 30, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO "public"."user_data_header" VALUES (3, 'danirusdan', '$2y$10$7NnmhGtMZJTbS7gRVl/c0OIrCK29/rurfhBdZAKlgN8y/WcV8nbRa', 'danirusdan', 10, 10, NULL, '$2y$10$zDNOrVtdYYGE3yBINaDDb.2506QHLSvGHn/hMxtqAkl21dWKEWsAG', NULL, '2', NULL, NULL, 'c46714daa0d91976579686bcad938849', NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO "public"."user_data_header" VALUES (2, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'Atang', 10, 10, NULL, NULL, '2017-08-10 10:29:40', 'NULL', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

566 567 568 569 570 571 572 573 574 575 576 577 578
-- ----------------------------
-- Table structure for user_data_map
-- ----------------------------
DROP TABLE IF EXISTS "public"."user_data_map";
CREATE TABLE "public"."user_data_map" (
  "map_id" int4 NOT NULL,
  "access_code" int4,
  "role_code" int4,
  "access_status" varchar(255) COLLATE "pg_catalog"."default",
  "last_update" timestamp(6)
)
;

Indra Raja's avatar
Indra Raja committed
579 580 581 582 583 584 585 586 587 588
-- ----------------------------
-- Records of user_data_map
-- ----------------------------
INSERT INTO "public"."user_data_map" VALUES (4, 10, 20, 'TRUE', '2020-06-21 21:12:51.219377');
INSERT INTO "public"."user_data_map" VALUES (5, 20, 20, 'TRUE', '2020-06-21 21:13:06.007902');
INSERT INTO "public"."user_data_map" VALUES (1, 10, 10, 'TRUE', '2020-06-21 21:14:13.680576');
INSERT INTO "public"."user_data_map" VALUES (3, 30, 10, 'TRUE', '2020-06-21 21:14:22.116003');
INSERT INTO "public"."user_data_map" VALUES (2, 20, 10, 'FALSE', '2020-06-21 21:47:09.580874');
INSERT INTO "public"."user_data_map" VALUES (6, 30, 20, 'FALSE', '2020-06-23 17:10:04.467554');

589 590 591 592 593 594 595 596 597 598 599 600
-- ----------------------------
-- Table structure for user_data_role
-- ----------------------------
DROP TABLE IF EXISTS "public"."user_data_role";
CREATE TABLE "public"."user_data_role" (
  "access_role_id" int4 NOT NULL,
  "name" varchar(50) COLLATE "pg_catalog"."default",
  "access_role_code" int4,
  "description" varchar(50) COLLATE "pg_catalog"."default"
)
;

Indra Raja's avatar
Indra Raja committed
601 602 603 604 605 606 607 608
-- ----------------------------
-- Records of user_data_role
-- ----------------------------
INSERT INTO "public"."user_data_role" VALUES (1, 'MASTER', 10, 'BISA SAGALA EDANS');
INSERT INTO "public"."user_data_role" VALUES (2, 'ADMIN', 20, 'ADMIN');
INSERT INTO "public"."user_data_role" VALUES (3, 'REGIONAL', 30, 'EDAN1');
INSERT INTO "public"."user_data_role" VALUES (4, 'WITEL', 40, 'UWU');

609 610 611 612 613 614 615 616 617 618 619 620 621 622 623
-- ----------------------------
-- Table structure for user_data_session
-- ----------------------------
DROP TABLE IF EXISTS "public"."user_data_session";
CREATE TABLE "public"."user_data_session" (
  "session_id" varchar(500) COLLATE "pg_catalog"."default" NOT NULL,
  "name" varchar(200) COLLATE "pg_catalog"."default",
  "modified" numeric(20),
  "lifetime" numeric(20),
  "data" varchar(4000) COLLATE "pg_catalog"."default",
  "owner" varchar(200) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
Indra Raja's avatar
Indra Raja committed
624
-- Records of user_data_session
625
-- ----------------------------
Indra Raja's avatar
Indra Raja committed
626
INSERT INTO "public"."user_data_session" VALUES ('it28rc4rbdnt4l9qrrvicandnn', 'KHANSIA', 1600745683, 86400, '__ZF|a:5:{s:20:"_REQUEST_ACCESS_TIME";d:1600745683.935894;s:6:"_VALID";a:1:{s:25:"Zend\Session\Validator\Id";s:26:"it28rc4rbdnt4l9qrrvicandnn";}s:3:"_LT";i:86400;s:3:"_LA";i:1600745683;s:6:"_OWNER";s:1:"2";}__KHANSIA|a:14:{s:14:"token_keamanan";s:32:"271be47d8b807ba70ee152ec1acb20b0";s:7:"baseurl";s:18:"//skeleton16.indra";s:7:"user_id";s:1:"2";s:9:"usernamed";s:5:"admin";s:6:"passwd";s:32:"21232f297a57a5a743894a0e4a801fc3";s:4:"name";s:5:"Atang";s:4:"role";s:2:"10";s:6:"status";s:2:"10";s:8:"deviceid";N;s:5:"token";N;s:7:"retries";s:4:"NULL";s:10:"create_dtm";s:19:"2017-08-10 10:29:40";s:6:"access";a:0:{}s:9:"role_code";s:1:"E";}', '2');
Indra Raja's avatar
Indra Raja committed
627 628
INSERT INTO "public"."user_data_session" VALUES ('77j0vj9vahnbu84i2sb5ceo41s', 'KHANSIA', 1600835021, 86400, '__ZF|a:5:{s:20:"_REQUEST_ACCESS_TIME";d:1600835021.393551;s:6:"_VALID";a:1:{s:25:"Zend\Session\Validator\Id";s:26:"77j0vj9vahnbu84i2sb5ceo41s";}s:3:"_LT";i:86400;s:3:"_LA";i:1600835021;s:6:"_OWNER";s:1:"2";}__KHANSIA|a:14:{s:14:"token_keamanan";s:32:"c363b022db85dffca75134250114aaf8";s:7:"baseurl";s:16:"//frontend.indra";s:7:"user_id";s:1:"2";s:9:"usernamed";s:5:"admin";s:6:"passwd";s:32:"21232f297a57a5a743894a0e4a801fc3";s:4:"name";s:5:"Atang";s:4:"role";s:2:"10";s:6:"status";s:2:"10";s:8:"deviceid";N;s:5:"token";N;s:7:"retries";s:4:"NULL";s:10:"create_dtm";s:19:"2017-08-10 10:29:40";s:6:"access";a:0:{}s:9:"role_code";s:1:"E";}', '2');
INSERT INTO "public"."user_data_session" VALUES ('8e7im25fc6a2i57hc5mee01ugp', 'KHANSIA', 1600833370, 86400, '__ZF|a:5:{s:20:"_REQUEST_ACCESS_TIME";d:1600833370.930789;s:6:"_VALID";a:1:{s:25:"Zend\Session\Validator\Id";s:26:"8e7im25fc6a2i57hc5mee01ugp";}s:3:"_LT";i:86400;s:3:"_LA";i:1600833370;s:6:"_OWNER";s:1:"2";}__KHANSIA|a:14:{s:14:"token_keamanan";s:32:"cfa97a952b0b994a6264a4ac1f5c6ced";s:7:"baseurl";s:16:"//frontend.indra";s:7:"user_id";s:1:"2";s:9:"usernamed";s:5:"admin";s:6:"passwd";s:32:"21232f297a57a5a743894a0e4a801fc3";s:4:"name";s:5:"Atang";s:4:"role";s:2:"10";s:6:"status";s:2:"10";s:8:"deviceid";N;s:5:"token";N;s:7:"retries";s:4:"NULL";s:10:"create_dtm";s:19:"2017-08-10 10:29:40";s:6:"access";a:0:{}s:9:"role_code";s:1:"E";}', '2');
629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769

-- ----------------------------
-- Function structure for get_antrian_self
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."get_antrian_self"();
CREATE OR REPLACE FUNCTION "public"."get_antrian_self"()
  RETURNS "pg_catalog"."int4" AS $BODY$
declare
   antrian_count integer;
begin

SELECT antrian.no_antrian
 into antrian_count FROM antrian 
INNER JOIN pasien 
ON antrian.id_pasien = pasien.id_pasien
WHERE pasien.create_date= CURRENT_DATE AND pasien.kode_antrian ='1' ORDER BY no_antrian DESC;

   
   return antrian_count;
end;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for get_antriann
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."get_antriann"("kode_antrian" int4);
CREATE OR REPLACE FUNCTION "public"."get_antriann"("kode_antrian" int4)
  RETURNS "pg_catalog"."int4" AS $BODY$
declare
   antrian_count integer;
begin

	INSERT INTO antrian(no_antrian,kode_antrian) VALUES ($1, $2);

   select count(*) 
   into antrian_count
   from antrian;
   
   return antrian_count;
end;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for get_film_count
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."get_film_count"("len_from" int4, "len_to" int4);
CREATE OR REPLACE FUNCTION "public"."get_film_count"("len_from" int4, "len_to" int4)
  RETURNS "pg_catalog"."int4" AS $BODY$
declare
   film_count integer;
begin
   select count(*) 
   into film_count
   from film
   where length between len_from and len_to;
   
   return film_count;
end;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for get_no_mobile
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."get_no_mobile"();
CREATE OR REPLACE FUNCTION "public"."get_no_mobile"()
  RETURNS "pg_catalog"."int4" AS $BODY$
declare
   antrian_count integer;
begin

SELECT count(antrian.no_antrian)
 into antrian_count FROM antrian 
INNER JOIN pasien 
ON antrian.id_pasien = pasien.id_pasien
WHERE pasien.create_date= CURRENT_DATE AND pasien.kode_antrian ='2' ;

   
   return antrian_count;
end;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for get_no_web
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."get_no_web"();
CREATE OR REPLACE FUNCTION "public"."get_no_web"()
  RETURNS "pg_catalog"."int4" AS $BODY$
declare
   antrian_count integer;
begin

SELECT count(antrian.no_antrian)
 into antrian_count FROM antrian 
INNER JOIN pasien 
ON antrian.id_pasien = pasien.id_pasien
WHERE pasien.create_date= CURRENT_DATE AND pasien.kode_antrian ='1' ;

   
   return antrian_count;
end;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for insert_data
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."insert_data"("input_id_pasien" int4, "input_id_poli" int4);
CREATE OR REPLACE FUNCTION "public"."insert_data"("input_id_pasien" int4, "input_id_poli" int4)
  RETURNS "pg_catalog"."int4" AS $BODY$
declare
   antrian_count integer;
	 input_id_pasien INTEGER ;
	 input_id_poli INTEGER;
	 
begin

SELECT no_antrian into antrian_count FROM antrian WHERE "id_poli" = input_id_poli AND "id_pasien" IS NULL LIMIT 1 ;

UPDATE antrian SET id_pasien=input_id_pasien , kode_antrian='1' WHERE no_antrian=antrian_count AND id_poli=input_id_poli ;

   
   return antrian_count;
end;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."antrian_id_antrian"
OWNED BY "public"."antrian"."id_antrian";
Indra Raja's avatar
Indra Raja committed
770
SELECT setval('"public"."antrian_id_antrian"', 1825, true);
771 772 773 774 775

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."dokter\_id_dokter_seq"
Indra Raja's avatar
Indra Raja committed
776 777
OWNED BY "public"."dokter_to_poli"."id_dokter";
SELECT setval('"public"."dokter\_id_dokter_seq"', 4, true);
778 779 780 781 782 783

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."id_antrian_seq"
OWNED BY "public"."register_dokter"."id_register";
Indra Raja's avatar
Indra Raja committed
784
SELECT setval('"public"."id_antrian_seq"', 220, true);
785 786 787 788 789 790

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."id_antrian_seq2"
OWNED BY "public"."antrian_pasien"."id_antrian";
Indra Raja's avatar
Indra Raja committed
791 792 793 794 795 796 797 798
SELECT setval('"public"."id_antrian_seq2"', 1825, true);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."id_dokter_seq"
OWNED BY "public"."dokter"."id_dokter";
SELECT setval('"public"."id_dokter_seq"', 4, true);
Indra Raja's avatar
Indra Raja committed
799 800 801 802 803 804

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."id_ruang_seq"
OWNED BY "public"."ruang"."id_ruang";
Indra Raja's avatar
Indra Raja committed
805
SELECT setval('"public"."id_ruang_seq"', 13, true);
806 807 808 809 810 811

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."pasien_id_pasien_seq"
OWNED BY "public"."antrian_pasien"."id_pasien";
Indra Raja's avatar
Indra Raja committed
812
SELECT setval('"public"."pasien_id_pasien_seq"', 34, true);
813 814 815 816 817 818

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."poli_id_poli_seq"
OWNED BY "public"."poli"."id_poli";
Indra Raja's avatar
Indra Raja committed
819
SELECT setval('"public"."poli_id_poli_seq"', 9, true);
820 821 822 823 824 825

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."register_antrian_id_register"
OWNED BY "public"."register_antrian"."id_register";
Indra Raja's avatar
Indra Raja committed
826
SELECT setval('"public"."register_antrian_id_register"', 215, true);
827 828 829 830 831 832

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."user_data_header_iduser_seq"
OWNED BY "public"."user_data_header"."iduser";
Indra Raja's avatar
Indra Raja committed
833
SELECT setval('"public"."user_data_header_iduser_seq"', 2, false);
834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854

-- ----------------------------
-- Primary Key structure for table counter_status
-- ----------------------------
ALTER TABLE "public"."counter_status" ADD CONSTRAINT "counter_status_pkey" PRIMARY KEY ("id_status");

-- ----------------------------
-- Indexes structure for table divisi_witel
-- ----------------------------
CREATE INDEX "idx_divisi_witel" ON "public"."divisi_witel" USING btree (
  "divisi_witel_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table divisi_witel
-- ----------------------------
ALTER TABLE "public"."divisi_witel" ADD CONSTRAINT "divisi_witel_pkey" PRIMARY KEY ("divisi_witel_id");

-- ----------------------------
-- Primary Key structure for table dokter
-- ----------------------------
Indra Raja's avatar
Indra Raja committed
855 856 857 858 859 860
ALTER TABLE "public"."dokter" ADD CONSTRAINT "dokter_to_poli_copy1_pkey" PRIMARY KEY ("id_dokter");

-- ----------------------------
-- Primary Key structure for table dokter_to_poli
-- ----------------------------
ALTER TABLE "public"."dokter_to_poli" ADD CONSTRAINT "dokter\_pkey" PRIMARY KEY ("id_dokter");
861 862

-- ----------------------------
Indra Raja's avatar
Indra Raja committed
863
-- Foreign Keys structure for table dokter_to_poli
864
-- ----------------------------
Indra Raja's avatar
Indra Raja committed
865
ALTER TABLE "public"."dokter_to_poli" ADD CONSTRAINT "dokter to poli" FOREIGN KEY ("id_poli") REFERENCES "public"."poli" ("id_poli") ON DELETE NO ACTION ON UPDATE NO ACTION;
866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947

-- ----------------------------
-- Indexes structure for table master_parameter
-- ----------------------------
CREATE INDEX "index2" ON "public"."master_parameter" USING btree (
  "idm_parameter" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "index3" ON "public"."master_parameter" USING btree (
  "param_type" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "index4" ON "public"."master_parameter" USING btree (
  "param_val1" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "index5" ON "public"."master_parameter" USING btree (
  "param_val2" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "index6" ON "public"."master_parameter" USING btree (
  "param_val3" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
CREATE INDEX "index7" ON "public"."master_parameter" USING btree (
  "param_parent" "pg_catalog"."int4_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table master_parameter
-- ----------------------------
ALTER TABLE "public"."master_parameter" ADD CONSTRAINT "master_parameter_pkey" PRIMARY KEY ("idm_parameter");

-- ----------------------------
-- Foreign Keys structure for table master_parameter
-- ----------------------------
ALTER TABLE "public"."master_parameter" ADD CONSTRAINT "master_parameter_ibfk_1" FOREIGN KEY ("param_parent") REFERENCES "public"."master_parameter" ("idm_parameter") ON DELETE NO ACTION ON UPDATE NO ACTION;

-- ----------------------------
-- Primary Key structure for table poli
-- ----------------------------
ALTER TABLE "public"."poli" ADD CONSTRAINT "poli_pkey" PRIMARY KEY ("id_poli");

-- ----------------------------
-- Primary Key structure for table regional
-- ----------------------------
ALTER TABLE "public"."regional" ADD CONSTRAINT "regional_pkey" PRIMARY KEY ("id_regional");

-- ----------------------------
-- Primary Key structure for table ruang
-- ----------------------------
ALTER TABLE "public"."ruang" ADD CONSTRAINT "ruang_pkey" PRIMARY KEY ("id_ruang");

-- ----------------------------
-- Primary Key structure for table user_data_access
-- ----------------------------
ALTER TABLE "public"."user_data_access" ADD CONSTRAINT "user_data_access_pkey" PRIMARY KEY ("access_id");

-- ----------------------------
-- Indexes structure for table user_data_header
-- ----------------------------
CREATE INDEX "xiduser" ON "public"."user_data_header" USING btree (
  "iduser" "pg_catalog"."int4_ops" ASC NULLS LAST
);
CREATE INDEX "xrole" ON "public"."user_data_header" USING btree (
  "role" "pg_catalog"."int4_ops" ASC NULLS LAST
);

-- ----------------------------
-- Primary Key structure for table user_data_header
-- ----------------------------
ALTER TABLE "public"."user_data_header" ADD CONSTRAINT "user_data_header_pkey" PRIMARY KEY ("iduser");

-- ----------------------------
-- Primary Key structure for table user_data_map
-- ----------------------------
ALTER TABLE "public"."user_data_map" ADD CONSTRAINT "user_data_map_pkey" PRIMARY KEY ("map_id");

-- ----------------------------
-- Primary Key structure for table user_data_role
-- ----------------------------
ALTER TABLE "public"."user_data_role" ADD CONSTRAINT "user_data_role_pkey" PRIMARY KEY ("access_role_id");

-- ----------------------------
-- Primary Key structure for table user_data_session
-- ----------------------------
ALTER TABLE "public"."user_data_session" ADD CONSTRAINT "user_data_session_pkey" PRIMARY KEY ("session_id");