Platform operator guide for the shared KSA HMS: create a hospital, give it a subdomain or its own domain, suspend or re-activate it, and export or delete its data when it leaves.
Hospitals and Domains
One installation can serve hundreds of hospitals (shared SaaS) or exactly one (on-premise). Each hospital has its own staff, patients, settings, logo and web address, and nobody signed in at one hospital can see another hospital's data.
How a hospital is found
Every /sa page and API call works out the hospital from the address in the browser:
| Address | Hospital |
|---|---|
The hospital's own domain, e.g. portal.alnoor.sa (once DNS is verified) |
That hospital |
{slug}.letsupdoc.com, e.g. al-noor.letsupdoc.com |
The hospital with that slug |
letsupdoc.com/sa |
The pilot hospital, as before |
| Any other address | Not found (404) |
On a hospital's address, only that hospital's staff and patients can sign in. A person who works in two hospitals uses each hospital's address and sees only that hospital there. A suspended, cancelled or expired-trial hospital shows This hospital's account is not active (حساب هذا المستشفى غير مفعّل) on its pages.
On-premise installs set SA_TENANCY_MODE=single: the one hospital is always used, whatever the address.
Create a hospital
Use the console at /sa/platform (Create hospital) or the command line:
php artisan sa:hospital:create --no-interaction \
--name="Al Noor Hospital" --name-ar="مستشفى النور" --slug=al-noor \
--admin-email=admin@alnoor.sa --admin-name="Noor Admin" \
--branch="Jeddah Main" --city=Jeddah --plan=pro --deployment=saas
This creates the hospital, al-noor.letsupdoc.com, the first branch, the default role privileges, the PDPL vendor list and retention defaults, and the first org admin without a password. The admin receives a set-password link (English and Arabic), valid once for 72 hours. When mail is not configured, the command and the console show the link so you can pass it on safely.
Plan trial starts a 30-day trial. Use --domain=portal.alnoor.sa to add the hospital's own domain at the same time, and --no-subdomain if it should have no letsupdoc.com address.
If the admin did not use the link in time, use Resend invite in the console.
Add the hospital's own domain
php artisan sa:hospital:domain-add al-noor portal.alnoor.sa --primary
The command prints a DNS TXT record. Ask the hospital's IT team to:
- Point
portal.alnoor.saat the platform (CNAME toletsupdoc.comor the load balancer) and issue the TLS certificate for it. - Add the TXT record
_letsupdoc-verify.portal.alnoor.sawith the printed value.
Then run php artisan sa:hospital:domain-verify portal.alnoor.sa. The domain starts working as soon as the record is found. Until then the address shows Not found.
Suspend, cancel or re-activate
| Action | Console | Command |
|---|---|---|
| Suspend (for example unpaid) | Suspend | php artisan sa:hospital:suspend al-noor --reason="Unpaid" |
| Cancel (the hospital is leaving) | — | php artisan sa:hospital:suspend al-noor --cancel |
| Re-activate | Activate | php artisan sa:hospital:activate al-noor |
| List | Hospitals list | php artisan sa:hospital:list |
Changes apply immediately to every page of that hospital. Data is kept.
Export and delete a hospital's data (PDPL offboarding)
- Cancel the hospital:
php artisan sa:hospital:suspend al-noor --cancel. - Export:
php artisan sa:hospital:export al-noor(queued; add--syncto run it now). The archive holds one JSON file per table with only that hospital's rows, its people (without passwords) and a list of stored files; it is saved on the private export disk and its path is written to the platform audit log. - Check what would be deleted:
php artisan sa:hospital:purge al-noor(shows rows per table, deletes nothing). - Delete:
php artisan sa:hospital:purge al-noor --confirm. This only works for a cancelled hospital that has been exported. People who also work at another hospital are kept.
Platform operator accounts
Operators are separate from hospital staff. Create one with php artisan sa:platform:admin-create ops@letsupdoc.com --name="Ops". Signing in at /sa/platform/login needs the password and a 6-digit code sent by email; set SA_PLATFORM_IP_ALLOWLIST to limit where the console can be used from. The console signs out after 15 minutes without activity. Every operator action is kept in the platform audit log.
Sandbox hospital
A hospital can be the public sandbox: the real system on made-up data that visitors enter without a password and that is reset every night. See Sandbox Hospital.