doctor all ids into code

This commit is contained in:
dpurbosakti
2025-11-06 11:04:40 +07:00
parent d1d63b7bb3
commit 42265e95f7
6 changed files with 39 additions and 22 deletions
@@ -0,0 +1,4 @@
-- Modify "Doctor" table
ALTER TABLE "public"."Doctor" ADD COLUMN "SIP_ExpiredDate" timestamptz NULL, ADD COLUMN "Unit_Code" character varying(10) NULL, ADD COLUMN "Specialist_Code" character varying(10) NULL, ADD COLUMN "Subspecialist_Code" character varying(10) NULL, ADD CONSTRAINT "uni_Doctor_Specialist_Code" UNIQUE ("Specialist_Code"), ADD CONSTRAINT "uni_Doctor_Subspecialist_Code" UNIQUE ("Subspecialist_Code"), ADD CONSTRAINT "uni_Doctor_Unit_Code" UNIQUE ("Unit_Code");
-- Modify "Employee" table
ALTER TABLE "public"."Employee" ADD COLUMN "Contract_ExpiredDate" timestamptz NULL;
@@ -0,0 +1,2 @@
-- Modify "Doctor" table
ALTER TABLE "public"."Doctor" DROP CONSTRAINT "uni_Doctor_Specialist_Code", DROP CONSTRAINT "uni_Doctor_Subspecialist_Code", DROP CONSTRAINT "uni_Doctor_Unit_Code";
+4 -2
View File
@@ -1,4 +1,4 @@
h1:c6psxONIBPkfVLCpAnWAm81SgT25UQT6hgO8KAG6O5M=
h1:yLtZj2e+mxp2L0eRUjFUIrC1GID4BB3/8x6LaHS+v10=
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
@@ -70,4 +70,6 @@ h1:c6psxONIBPkfVLCpAnWAm81SgT25UQT6hgO8KAG6O5M=
20251104080952.sql h1:avghpv1n3yaCDR/TA0X+hgxDGoLBQGu/GJUwj4VT/Ic=
20251104084135.sql h1:rg+eRE5/5sYWR7z+Xyn0zKw8rr8P/oWxF0xhcNVnNec=
20251105044629.sql h1:4NU27HeKUNFsV82LacnwmnCSAH0pSbZR9J9/ZESRs6M=
20251105121808.sql h1:uPFEHJ6pZbuo8+3giskNg4I91MrNRgrR1dMIe7kL+4g=
20251105121808.sql h1:fii6LjqWYjrm/pEIqttfvJI6QEUL49gque8wYHh1+yI=
20251106035305.sql h1:hRkWZYLQvjmROqlu9xvuXrPQcBKf6yUGTTbSd0lKbmI=
20251106040137.sql h1:ifT65MV7h0sws5EGBOGefRqxSaZqapEeupuhHMJipyw=
+18 -12
View File
@@ -6,19 +6,25 @@ import (
es "simrs-vx/internal/domain/main-entities/specialist"
ess "simrs-vx/internal/domain/main-entities/subspecialist"
eu "simrs-vx/internal/domain/main-entities/unit"
"time"
)
type Doctor struct {
ecore.Main // adjust this according to the needs
Code *string `json:"code" gorm:"unique;size:20"`
Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
IHS_Number *string `json:"ihs_number" gorm:"unique;size:20"`
SIP_Number *string `json:"sip_number" gorm:"unique;size:20"`
Unit_Id *uint16 `json:"unit_id"`
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
Specialist_Id *uint16 `json:"specialist_id"`
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id"`
Subspecialist_Id *uint16 `json:"subspecialist_id"`
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id"`
ecore.Main // adjust this according to the needs
Code *string `json:"code" gorm:"unique;size:20"`
Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
IHS_Number *string `json:"ihs_number" gorm:"unique;size:20"`
SIP_Number *string `json:"sip_number" gorm:"unique;size:20"`
SIP_ExpiredDate *time.Time `json:"sip_expiredDate"`
Unit_Id *uint16 `json:"unit_id"`
Unit_Code *string `json:"unit_code" gorm:"size:10"`
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
// Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Code;references:Code"`
Specialist_Id *uint16 `json:"specialist_id"`
Specialist_Code *string `json:"specialist_code" gorm:"size:10"`
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id"`
Subspecialist_Id *uint16 `json:"subspecialist_id"`
Subspecialist_Code *string `json:"subspecialist_code" gorm:"size:10"`
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id"`
}
@@ -6,15 +6,17 @@ import (
eu "simrs-vx/internal/domain/main-entities/user"
erc "simrs-vx/internal/domain/references/common"
erg "simrs-vx/internal/domain/references/organization"
"time"
)
type Employee struct {
ecore.Main // adjust this according to the needs
User_Id *uint `json:"user_id"`
User *eu.User `json:"user,omitempty" gorm:"foreignKey:User_Id;references:Id"`
Person_Id *uint `json:"person_id"`
Person *ep.Person `json:"person,omitempty" gorm:"foreignKey:Person_Id;references:Id"`
Position_Code *erg.EmployeePositionCode `json:"position_code" gorm:"size:20"`
Number *string `json:"number" gorm:"size:20"`
Status_Code erc.ActiveStatusCode `json:"status_code" gorm:"not null;size:10"`
ecore.Main // adjust this according to the needs
User_Id *uint `json:"user_id"`
User *eu.User `json:"user,omitempty" gorm:"foreignKey:User_Id;references:Id"`
Person_Id *uint `json:"person_id"`
Person *ep.Person `json:"person,omitempty" gorm:"foreignKey:Person_Id;references:Id"`
Position_Code *erg.EmployeePositionCode `json:"position_code" gorm:"size:20"`
Number *string `json:"number" gorm:"size:20"`
Contract_ExpiredDate *time.Time `json:"contract_expiredDate"`
Status_Code erc.ActiveStatusCode `json:"status_code" gorm:"not null;size:10"`
}
@@ -43,6 +43,7 @@ const (
DMCExtRef DischargeMethodCode = "external" // Rujuk Faskes Lain
DMCDeath DischargeMethodCode = "death" // Meninggal
DMCDeathOnArrival DischargeMethodCode = "death-on-arrival" // Meninggal Saat Tiba
DMCRunAway DischargeMethodCode = "run-away" // Melarikan Diri
TCAmbulance TransportationCode = "ambulance" // Ambulans
TCCar TransportationCode = "car" // Mobil