update entity and conslist
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:drtrRtMhlNYK0c9wV3CUkJvXwWgrD8xGPPJy9wlcvNA=
|
||||
h1:KxMvALnpFUI2RXpBZgkJ312FeLtrm9L0o+CqgJbm40U=
|
||||
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
|
||||
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
|
||||
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
|
||||
@@ -68,4 +68,6 @@ h1:drtrRtMhlNYK0c9wV3CUkJvXwWgrD8xGPPJy9wlcvNA=
|
||||
20251104042334.sql h1:7PDMWOhmJywolAPKFZ14XaDBeMvcxShaXFN2IemNtzk=
|
||||
20251104043530.sql h1:qvYVp3ysPf27f1BcoRNCFGovxuVE12lg9d6Xzda6zWU=
|
||||
20251104080952.sql h1:avghpv1n3yaCDR/TA0X+hgxDGoLBQGu/GJUwj4VT/Ic=
|
||||
20251104084135.sql h1:Y4coFrHgDXd/DM8ihEy+qMkOSrO8M4SI4shRCJIiBBA=
|
||||
20251104084135.sql h1:rg+eRE5/5sYWR7z+Xyn0zKw8rr8P/oWxF0xhcNVnNec=
|
||||
20251106054706.sql h1:a17rQ3uAX09BpVFpAFoY8NM6gfsmYVvgNNZaQuWs6T0=
|
||||
20251106054849.sql h1:TU0HU+jAfs5225rggWP5TjPgb272vQoeiLvEoGhKRbs=
|
||||
|
||||
@@ -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"`
|
||||
}
|
||||
|
||||
@@ -68,7 +68,8 @@ type Encounter struct {
|
||||
Ambulatory *eam.Ambulatory `json:"ambulatory,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||
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"`
|
||||
Rehab_Adm *er.Basic `json:"rehab_adm,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||
Rehab_Series *[]er.Basic `json:"rehab_series,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 {
|
||||
|
||||
@@ -2,25 +2,25 @@
|
||||
package clinical
|
||||
|
||||
type (
|
||||
SubjectCode string
|
||||
ObjectCode string
|
||||
AssessmentCode string
|
||||
PlanCode string
|
||||
InstructionCode string
|
||||
HeadToToeCode string
|
||||
McuUrgencyLevelCode 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
|
||||
SubjectCode string
|
||||
ObjectCode string
|
||||
AssessmentCode string
|
||||
PlanCode string
|
||||
InstructionCode string
|
||||
HeadToToeCode string
|
||||
McuUrgencyLevelCode 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 (
|
||||
@@ -120,11 +120,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 {
|
||||
|
||||
@@ -19,6 +19,7 @@ type (
|
||||
AllPaymentMethodCode string
|
||||
SEPRefTypeCode string
|
||||
VisitModeCode string
|
||||
PolySwitchCode string
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -32,18 +33,18 @@ const (
|
||||
QSCCancel QueueStatusCode = "cancel" // Dibatalkan
|
||||
QSCSkip QueueStatusCode = "skip" // Dilewati
|
||||
|
||||
DMCHome DischargeMethodCode = "home" // Pulang
|
||||
DMCHomeReq DischargeMethodCode = "home-request" // Pulang Atas Permintaan Sendiri
|
||||
DMCConsulBack DischargeMethodCode = "consul-back" // Konsultasi Balik / Lanjutan
|
||||
DMCConsulPoly DischargeMethodCode = "consul-poly" // Konsultasi Poliklinik Lain
|
||||
DMCConsulExecutive DischargeMethodCode = "consul-executive" // Konsultasi Antar Dokter Eksekutif
|
||||
DMCConsulChDay DischargeMethodCode = "consul-ch-day" // Konsultasi Hari Lain
|
||||
DMCEmergency DischargeMethodCode = "emergency" // Rujuk IGD
|
||||
DMCEmergencyCovid DischargeMethodCode = "emergency-covid" // Rujuk IGD Covid
|
||||
DMCInpatient DischargeMethodCode = "inpatient" // Rujuk Rawat Inap
|
||||
DMCExtRef DischargeMethodCode = "external" // Rujuk Faskes Lain
|
||||
DMCDeath DischargeMethodCode = "death" // Meninggal
|
||||
DMCDeathOnArrival DischargeMethodCode = "death-on-arrival" // Meninggal Saat Tiba
|
||||
DMCHome DischargeMethodCode = "home" // Pulang
|
||||
DMCHomeReq DischargeMethodCode = "home-request" // Pulang Atas Permintaan Sendiri
|
||||
DMCConsulBack DischargeMethodCode = "consul-back" // Konsultasi Balik / Lanjutan
|
||||
//DMCConsulPoly DischargeMethodCode = "consul-poly" // Konsultasi Poliklinik Lain
|
||||
//DMCConsulExecutive DischargeMethodCode = "consul-executive" // Konsultasi Antar Dokter Eksekutif
|
||||
DMCConsulChDay DischargeMethodCode = "consul-ch-day" // Konsultasi Hari Lain
|
||||
DMCEmergency DischargeMethodCode = "emergency" // Rujuk IGD
|
||||
DMCEmergencyCovid DischargeMethodCode = "emergency-covid" // Rujuk IGD Covid
|
||||
DMCInpatient DischargeMethodCode = "inpatient" // Rujuk Rawat Inap
|
||||
DMCExtRef DischargeMethodCode = "external" // Rujuk Faskes Lain
|
||||
DMCDeath DischargeMethodCode = "death" // Meninggal
|
||||
DMCDeathOnArrival DischargeMethodCode = "death-on-arrival" // Meninggal Saat Tiba
|
||||
|
||||
TCAmbulance TransportationCode = "ambulance" // Ambulans
|
||||
TCCar TransportationCode = "car" // Mobil
|
||||
@@ -112,6 +113,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,41 @@ 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
|
||||
}
|
||||
|
||||
//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
|
||||
// }
|
||||
// }
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -458,19 +458,18 @@ 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
|
||||
}
|
||||
}
|
||||
|
||||
//// bulk insert internal-references
|
||||
//if err = createInternalReferences(input, &event, tx); err != nil {
|
||||
// return err
|
||||
//}
|
||||
|
||||
pl.SetLogInfo(&event, nil, "complete")
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user