Merge pull request #132 from dikstub-rssa/migration-vanilia
Migration vanilia
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
-- Modify "Ambulatory" table
|
||||
ALTER TABLE "public"."Ambulatory" DROP COLUMN "VisitMode_Code";
|
||||
-- Modify "InternalReference" table
|
||||
ALTER TABLE "public"."InternalReference" ADD COLUMN "Status_Code" text NULL;
|
||||
-- Modify "Rehab" table
|
||||
ALTER TABLE "public"."Rehab" ADD COLUMN "Parent_Encounter_Id" bigint NULL, ADD COLUMN "ExpiredAt" timestamptz NULL, ADD COLUMN "VisitMode_Code" text NULL, ADD COLUMN "Status_Code" text NULL;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- Modify "Rehab" table
|
||||
ALTER TABLE "public"."Rehab" DROP COLUMN "Doctor_Id";
|
||||
@@ -1,4 +1,4 @@
|
||||
h1:69CxJYTc7MIeFR2nLQwjoba/TUnw7lIzVApYkI34yss=
|
||||
h1:VjwYayb6y4kUl9K9WTTwmXExlHijchOCRwnUYcRlhRI=
|
||||
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
|
||||
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
|
||||
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
|
||||
@@ -75,23 +75,25 @@ h1:69CxJYTc7MIeFR2nLQwjoba/TUnw7lIzVApYkI34yss=
|
||||
20251106040137.sql h1:ppcqkVoT0o9jZcjI/TN7LuaPxXhJQhnIXEJtloP/46o=
|
||||
20251106041333.sql h1:2JkxyelQ/EeB+boL5bfpnzefw32ttEGKvKchtQjWmAU=
|
||||
20251106042006.sql h1:ruppYa1kAJQUU3ufQBbKGMcXrGbGJJiRPclT+dNc/YQ=
|
||||
20251106050412.sql h1:MiEMJ1HCFYnalKuq3Z38xJeogfBAMqsTv2sG4EF8dDw=
|
||||
20251106063418.sql h1:y3veDJPjKekOWLCZek/LgQwXPRhZtOppTfUXiqoL95s=
|
||||
20251106071906.sql h1:/TUZA3XpMY23qEJXdkTwlzrNMvSSl6JJniPcgAttBaw=
|
||||
20251106073157.sql h1:78txeibJ602DMD7huD618ZSMt6phSRzDNPTlo0PGyrc=
|
||||
20251106074218.sql h1:8Xz7WywrtUnSxOHhlal53gG9rE7r86LFUt5zBFe/mIs=
|
||||
20251106081846.sql h1:jp91Bf5bxGXMiUB1VIuN6y768vb2iWwow44WfCE5J5k=
|
||||
20251106082844.sql h1:RHYzRO4G1fSWwf+xc/3QezZ/Iil67cZPIgNpNz3TNhQ=
|
||||
20251106090021.sql h1:dFDk6mq+zjbYWmfWIrHf9DiKvvoXHjrr0++zssMTWP8=
|
||||
20251106144745.sql h1:aHcr23iBFqCHer5D/SsPMXBCLjGqUYvWYfRU8jSJgIw=
|
||||
20251107012049.sql h1:hu/7NHhnAkT4xK0RNtqmMDdH1Bo5EZbl7itDRjiCT+g=
|
||||
20251107064812.sql h1:sfCXDQYnMf0ddrQ9oYljWJLLSt9NJjJV6o8VS3p7aZE=
|
||||
20251107064937.sql h1:DlYGJ9LZFwZyR7jBP5zaGB128aIc4HAixBKPYCz9EkY=
|
||||
20251107071420.sql h1:ynCdZAd2utLl+FhtWZwtahNXgIVOvuk3s/rOq7lfXA4=
|
||||
20251107074318.sql h1:WE9cPhibWtZ0dbu1VEGirTeY6ijFYGMNhHdBtM32kOc=
|
||||
20251107075050.sql h1:8tvneruqdynDOaJK1+0z4CH7YXZStZpGdqwIeOMLik4=
|
||||
20251107080604.sql h1:8c4jd4Tql7tcdhbI9NS0tgvN+ADu9FnCf8wMUbmW7A0=
|
||||
20251107081830.sql h1:SAAe3lmsm9vGXuSEsDdl7ad0EAxP5CMmFRDEgp9M7yY=
|
||||
20251107091033.sql h1:JLdX/u7GUdBfjrPrMSNAqc8HtSoj0YA9iW9Vc6FJZdw=
|
||||
20251107091209.sql h1:CzhYtwAwT+GHrbqcagnJE+v3mbl/rObf1IJaLCKlzrs=
|
||||
20251107091541.sql h1:+3ZyWJTftDY2JeWThXuIxGWpUBnyMPyOyY4jBjdWYJI=
|
||||
20251106050412.sql h1:1002KYtHd8AwrQTMewbs/PPHDylHDghigE/3S7PVdMA=
|
||||
20251106063418.sql h1:jPW/gBnbFl4RO39lQ0ZMDtYA6xbhyD6CgQupT50HmaY=
|
||||
20251106071906.sql h1:leYGKxR3EQn794aOehf0sd/ZPmOnvBMZPy5/anGmRB4=
|
||||
20251106073157.sql h1:KASMzjjjk5UB7Zj8lCRtM1utc4ZnDjlnpZbtTe3vONE=
|
||||
20251106074218.sql h1:Z5q5deOvLaZDPhiVTN9st3/s56RepBa2YOyrMXBdj4A=
|
||||
20251106081846.sql h1:P+VsWwhGt60adDIZuE/Aa38JVp/yX1rnsdpXpxASodw=
|
||||
20251106082844.sql h1:Dmi5A8i9frQZvdXYPwc7f8CisZtBH8liSXq1rI6z1iM=
|
||||
20251106090021.sql h1:4JwdKgO8T46YhyWVJUxpRIwudBDlG8QN1brSOYmgQ20=
|
||||
20251106144745.sql h1:nqnQCzGrVJaq8ilOEOGXeRUL1dolj+OPWKuP8A92FRA=
|
||||
20251107012049.sql h1:Pff4UqltGS3clSlGr0qq8CQM56L29wyxY0FC/N/YAhU=
|
||||
20251107064812.sql h1:GB9a0ZfMYTIoGNmKUG+XcYUsTnRMFfT4/dAD71uCPc4=
|
||||
20251107064937.sql h1:IC5pw1Ifj30hiE6dr5NMHXaSHoQI+vRd40N5ABgBHRI=
|
||||
20251107071420.sql h1:9NO3iyLEXEtWa2kSRjM/8LyzuVIk6pdFL2SuheWjB08=
|
||||
20251107074318.sql h1:7fHbSRrdjOmHh/xwnjCLwoiB5cW5zeH+uxLV0vZbkIA=
|
||||
20251107075050.sql h1:np+3uTOnU9QNtK7Knaw8eRMhkyB9AwrtSNHphOBxbHY=
|
||||
20251107080604.sql h1:cXDBLPJDVWLTG6yEJqkJsOQ7p7VYxLM2SY+mwO8qSHo=
|
||||
20251107081830.sql h1:/S7OQZo4ZnK80t28g/JyiOTZtmWG/dP5Wg2zXNMQ/iE=
|
||||
20251107091033.sql h1:/cbkF1nO/IjNSIfDJJx456KJtQ9rWFXOBFAkR/M2xiE=
|
||||
20251107091209.sql h1:jrLQOUeV8ji2fg0pnEcs1bw4ANUxzTSMXC/rrHLIY+M=
|
||||
20251107091541.sql h1:6UqbhQQRmzA2+eKu5lIvkwOkk+lH70QLZC8Pjpjcq68=
|
||||
20251110012217.sql h1:+4ZcAtlZobLY/iTU1hwVEuqCCYtbiDs2N75jTBz1eQM=
|
||||
20251110012306.sql h1:w3ZvpG2IaS4sZ9WxKcaMAjmy1JhsOPg8zmwjDv4tv7Y=
|
||||
|
||||
@@ -50,9 +50,8 @@ type ResponseDto struct {
|
||||
|
||||
func (d Ambulatory) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Encounter_Id: d.Encounter_Id,
|
||||
Class_Code: d.Class_Code,
|
||||
VisitMode_Code: d.VisitMode_Code,
|
||||
Encounter_Id: d.Encounter_Id,
|
||||
Class_Code: d.Class_Code,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
|
||||
@@ -6,8 +6,7 @@ import (
|
||||
)
|
||||
|
||||
type Ambulatory struct {
|
||||
ecore.Main // adjust this according to the needs
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Class_Code ere.AmbulatoryClassCode `json:"class_code" gorm:"size:10"`
|
||||
VisitMode_Code ere.VisitModeCode `json:"visitMode_code"`
|
||||
ecore.Main // adjust this according to the needs
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Class_Code ere.AmbulatoryClassCode `json:"class_code" gorm:"size:10"`
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ type Encounter struct {
|
||||
Emergency *eem.Emergency `json:"emergency,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||
Inpatient *eip.Inpatient `json:"inpatient,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||
Rehab *er.Basic `json:"rehab,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||
RehabChildren *[]er.Basic `json:"rehabChildren,omitempty" gorm:"foreignKey:Parent_Encounter_Id;references:Id"`
|
||||
}
|
||||
|
||||
func (d Encounter) IsDone() bool {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package internal_reference
|
||||
|
||||
import (
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||
eu "simrs-vx/internal/domain/main-entities/unit"
|
||||
@@ -8,9 +10,10 @@ import (
|
||||
|
||||
type InternalReference struct {
|
||||
ecore.Main
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
|
||||
Doctor_Id *uint `json:"doctor_id"`
|
||||
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Id;references:Id"`
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
|
||||
Doctor_Id *uint `json:"doctor_id"`
|
||||
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Id;references:Id"`
|
||||
Status_Code *erc.DataApprovalCode `json:"status_code"`
|
||||
}
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
package base
|
||||
|
||||
import (
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
ere "simrs-vx/internal/domain/references/encounter"
|
||||
"time"
|
||||
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||
)
|
||||
|
||||
type Basic struct {
|
||||
ecore.Main // adjust this according to the needs
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Doctor_Id *uint `json:"doctor_id"`
|
||||
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Id;references:Id"`
|
||||
AllocatedVisitCount *int `json:"allocatedVisitCount"`
|
||||
ecore.Main // adjust this according to the needs
|
||||
Parent_Encounter_Id *uint `json:"parent_encounter_id"`
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
AllocatedVisitCount *int `json:"allocatedVisitCount"`
|
||||
ExpiredAt *time.Time `json:"expiredAt"`
|
||||
VisitMode_Code *ere.VisitModeCode `json:"visitMode_code"`
|
||||
Status_Code *erc.DataStatusCode `json:"status_code"`
|
||||
}
|
||||
|
||||
func (Basic) TableName() string {
|
||||
|
||||
@@ -53,8 +53,6 @@ type ResponseDto struct {
|
||||
func (d Rehab) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Encounter_Id: d.Encounter_Id,
|
||||
Doctor_Id: d.Doctor_Id,
|
||||
Doctor: d.Doctor,
|
||||
AllocatedVisitCount: d.AllocatedVisitCount,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
|
||||
@@ -2,26 +2,26 @@
|
||||
package clinical
|
||||
|
||||
type (
|
||||
SubjectCode string
|
||||
ObjectCode string
|
||||
AssessmentCode string
|
||||
PlanCode string
|
||||
InstructionCode string
|
||||
HeadToToeCode string
|
||||
McuUrgencyLevelCode string
|
||||
SubjectCode string
|
||||
ObjectCode string
|
||||
AssessmentCode string
|
||||
PlanCode string
|
||||
InstructionCode string
|
||||
HeadToToeCode string
|
||||
McuUrgencyLevelCode string
|
||||
McuScopeCode string
|
||||
SoapiTypeCode string
|
||||
MedicalAction string
|
||||
VehicleTypeCode string
|
||||
GeneralEduCode string
|
||||
SpecialEduCode string
|
||||
EduAssessmentCode string
|
||||
AbilityCode string
|
||||
WillCode string
|
||||
MedObstacleCode string
|
||||
LearnMethodCode string
|
||||
LangClassCode string
|
||||
TranslatorSrcCode string
|
||||
SoapiTypeCode string
|
||||
MedicalActionTypeCode string
|
||||
VehicleTypeCode string
|
||||
GeneralEduCode string
|
||||
SpecialEduCode string
|
||||
EduAssessmentCode string
|
||||
AbilityCode string
|
||||
WillCode string
|
||||
MedObstacleCode string
|
||||
LearnMethodCode string
|
||||
LangClassCode string
|
||||
TranslatorSrcCode string
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -124,11 +124,11 @@ const (
|
||||
STCProgress SoapiTypeCode = "progress" // CPPT
|
||||
STCDevRecord SoapiTypeCode = "dev-record" // Catatan Perkembangan
|
||||
|
||||
MAChemo MedicalAction = "chemo"
|
||||
MAHemo MedicalAction = "hemo"
|
||||
MAThalasemia MedicalAction = "thalasemia"
|
||||
MAEchocardio MedicalAction = "echocardio"
|
||||
MASpirometry MedicalAction = "spirometry"
|
||||
MATCChemo MedicalActionTypeCode = "chemo"
|
||||
MATCHemo MedicalActionTypeCode = "hemo"
|
||||
MATCThalasemia MedicalActionTypeCode = "thalasemia"
|
||||
MATCEchocardio MedicalActionTypeCode = "echocardio"
|
||||
MATCSpirometry MedicalActionTypeCode = "spirometry"
|
||||
|
||||
VTCAmbulance VehicleTypeCode = "ambulance" // Ambulans
|
||||
VTCTransport VehicleTypeCode = "transport" // Transport
|
||||
|
||||
@@ -15,6 +15,7 @@ type (
|
||||
DataAvailabilityCode string
|
||||
DataVerifiedCode string
|
||||
CrudCode string
|
||||
DataApprovalCode string
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -96,6 +97,10 @@ const (
|
||||
CCRead CrudCode = "r" // Read
|
||||
CCUpdate CrudCode = "u" // Update
|
||||
CCDelete CrudCode = "d" // Delete
|
||||
|
||||
DACNew DataApprovalCode = "new"
|
||||
DACApproved DataApprovalCode = "approved"
|
||||
DACRejected DataApprovalCode = "rejected"
|
||||
)
|
||||
|
||||
func GetDayCodes() map[DayCode]string {
|
||||
|
||||
@@ -18,6 +18,7 @@ type (
|
||||
AllPaymentMethodCode string
|
||||
SEPRefTypeCode string
|
||||
VisitModeCode string
|
||||
PolySwitchCode string
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -107,6 +108,9 @@ const (
|
||||
|
||||
VMCAdm VisitModeCode = "adm"
|
||||
VMCSeries VisitModeCode = "series"
|
||||
|
||||
PSCConsulPoly PolySwitchCode = "consul-poly" // Konsultasi Poliklinik Lain
|
||||
PSCConsulExecutive PolySwitchCode = "consul-executive" // Konsultasi Antar Dokter Eksekutif
|
||||
)
|
||||
|
||||
func (ec EncounterClassCode) Code() string {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package encounter
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
e "simrs-vx/internal/domain/main-entities/encounter"
|
||||
ere "simrs-vx/internal/domain/references/encounter"
|
||||
@@ -13,42 +12,14 @@ import (
|
||||
const dataValidationFail = "data-validation-fail"
|
||||
|
||||
func validateRequestCheckout(w http.ResponseWriter, i e.DischargeDto) (valid bool) {
|
||||
switch *i.Discharge_Method_Code {
|
||||
case ere.DMCDeath:
|
||||
if i.DeathCause == nil {
|
||||
rw.DataResponse(w, nil, d.FieldError{
|
||||
Code: dataValidationFail,
|
||||
Message: "deathCause required if discharge_method_code is death",
|
||||
})
|
||||
return
|
||||
}
|
||||
case ere.DMCConsulPoly, ere.DMCConsulExecutive:
|
||||
if i.InternalReferences == nil {
|
||||
rw.DataResponse(w, nil, d.FieldError{
|
||||
Code: dataValidationFail,
|
||||
Message: fmt.Sprintf("internalReferences required if discharge_method_code is %s", *i.Discharge_Method_Code),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
for _, v := range *i.InternalReferences {
|
||||
if v.Unit_Id == nil {
|
||||
rw.DataResponse(w, nil, d.FieldError{
|
||||
Code: dataValidationFail,
|
||||
Message: "internalReferences.unit_id required",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if v.Doctor_Id == nil {
|
||||
rw.DataResponse(w, nil, d.FieldError{
|
||||
Code: dataValidationFail,
|
||||
Message: "internalReferences.doctor_id required",
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
if *i.Discharge_Method_Code == ere.DMCDeath && i.DeathCause == nil {
|
||||
rw.DataResponse(w, nil, d.FieldError{
|
||||
Code: dataValidationFail,
|
||||
Message: "deathCause required if discharge_method_code is death",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -506,17 +506,11 @@ func CheckOut(input e.DischargeDto) (*d.Data, error) {
|
||||
return err
|
||||
}
|
||||
|
||||
switch *input.Discharge_Method_Code {
|
||||
case ere.DMCDeath:
|
||||
if *input.Discharge_Method_Code == ere.DMCDeath {
|
||||
// insert data death-cause
|
||||
if _, err = udc.CreateData(edc.CreateDto{Encounter_Id: &input.Id, Value: input.DeathCause}, &event, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
case ere.DMCConsulPoly, ere.DMCConsulExecutive:
|
||||
// bulk insert internal-references
|
||||
if err = createInternalReferences(input, &event, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
pl.SetLogInfo(&event, nil, "complete")
|
||||
|
||||
Reference in New Issue
Block a user