---
# System prepended metadata

title: UML Sistem Manajemen Pasien

---

#    UML Sistem Manajemen Pasien

##    Sequence Diagram

### Flow Login

```plantuml
actor users as u
participant "sistem manajemen pasien" as smp
database database as db

u->smp: request login
smp->db : get user by username
db -->smp : return 
smp->smp: check if user exist
alt if user is not exist
smp-->u : return error (user not found)
else if user exist
smp->smp : validate password
alt if password not valid
smp-->u : return error (invalid password)
else if password valid
smp->smp : redirect to page dashboard
smp-->u : success login
end
end
```

###   Flow of Adding Employee Data
:::info
Note : only superadmin
:::

```plantuml
actor superadmin as sa
participant "sistem manajemen pasien" as smp
database database as db

sa -> smp : request add employee
smp->smp : redirect to page form add employee
smp-->sa : return form add employee
sa->smp : input employee data

smp -> db : get user list
db-->smp : return value

smp->smp: check if user is exist
alt if user is exist
smp --> sa: return error (employee is already registered)
else if user not exist
smp->db: insert new employee data
smp-->sa: success insert new employee
end

```

### Flow of Adding Room Data

```plantuml
actor users as sa
participant "sistem manajemen pasien" as smp
database database as db

sa -> smp : request add room
smp->smp : redirect to page form add room
smp-->sa : return form add room
sa->smp : input new room data

smp -> db : get room list
db-->smp : return value

smp->smp: check if room is exist
alt if room is exist
smp --> sa: return error (room is already adding)
else if room not exist
smp->db: insert new room data
smp-->sa: success insert new room data
end
```

###  Flow booking inpatient room

:::info
Note : this is the flow for patients ordering inpatient room that will be carried out by employee
:::

```plantuml
actor users as us
participant "sistem manajemen pasien" as smp
database database as db

us->smp: request insert inpatient data
smp->smp: redirect to page form inpatient
smp->db: get available inpatient room
db-->smp : return value
smp-->us: return form inpatient
us->smp: input inpatient data
smp->db: get room data by room_id
db-->smp : return value
smp->smp: check if room is available
alt if room is not available 
smp-->us: return error (room is full)
else if room available
smp->db: insert inpatient data
smp-->us: success insert inpatient data
end
```

### Flow of Adding Doctor Data
```plantuml
actor users as us
participant "sistem manajemen pasien" as smp
database database as db

us -> smp : request add doctor
smp->smp : redirect to page form add doctor
smp-->us : return form add doctor
us->smp : input new doctor data

smp -> db : get doctor list
db-->smp : return value

smp->smp: check if doctor is exist
alt if doctor is exist
smp --> us: return error (doctor is already adding)
else if doctor not exist
smp->db: insert new doctor data
smp-->us: success insert new doctor data
end
```

### Flow Patient Check-up

:::info
Note : This is the flow of patient check-up data input that will be carried out by employees
:::

```plantuml
actor users as us
participant "sistem manajemen pasien" as smp
database database as db

us->smp: request insert patient check-up data
smp->smp: redirect to page form patient check-up
smp->db: get available doctor
db-->smp : return value
smp-->us: return form patient check-up
us->smp: input patient check-up data
smp->db: insert patient check-up data
smp-->us: success insert patient check-up data
```