feat (kfr): base crud + validation&verification done, no rules set yet
This commit is contained in:
@@ -9,12 +9,13 @@ import (
|
||||
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
pu "simrs-vx/pkg/use-case-helper"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
CreatedBy_Employee_Id *uint `json:"createdBy_employee_id"`
|
||||
Value *string `json:"value"`
|
||||
Type ere.KFRTypeCode `json:"type" gorm:"size:15"`
|
||||
Subjective string `json:"subjective"`
|
||||
Objective string `json:"objective"`
|
||||
@@ -25,7 +26,7 @@ type CreateDto struct {
|
||||
Frequency *uint `json:"frequency"`
|
||||
IntervalUnit_Code *erc.TimeUnitCode `json:"intervalUnit_code" gorm:"size:10"`
|
||||
FollowUpType ere.KFRFollowUpTypeCode `json:"followUpType" gorm:"size:10"`
|
||||
FollowUpNote string `json:"dischargePlanning"`
|
||||
FollowUpNote string `json:"followUpNote"`
|
||||
Status_Code erc.DataVerifiedCode `json:"status_code" gorm:"not null;size:10"`
|
||||
|
||||
pa.AuthInfo
|
||||
@@ -81,7 +82,7 @@ type ResponseDto struct {
|
||||
Frequency *uint `json:"frequency"`
|
||||
IntervalUnit_Code *erc.TimeUnitCode `json:"intervalUnit_code" gorm:"size:10"`
|
||||
FollowUpType ere.KFRFollowUpTypeCode `json:"followUpType" gorm:"size:10"`
|
||||
FollowUpNote string `json:"dischargePlanning"`
|
||||
FollowUpNote string `json:"followUpNote"`
|
||||
Status_Code erc.DataVerifiedCode `json:"status_code" gorm:"not null;size:10"`
|
||||
}
|
||||
|
||||
@@ -115,3 +116,11 @@ func ToResponseList(data []KFR) []ResponseDto {
|
||||
}
|
||||
return resp
|
||||
}
|
||||
|
||||
func (c CreateDto) IsCorrectType() bool {
|
||||
return pu.Contains([]ere.KFRTypeCode{ere.KFRAssessment, ere.KFRTherapy, ere.KFRReAssessment}, c.Type)
|
||||
}
|
||||
|
||||
func (c CreateDto) IsCorrectFollowUpType() bool {
|
||||
return pu.Contains([]ere.KFRFollowUpTypeCode{ere.KFUTCEva, ere.KFUTCRef, ere.KFUTCFin}, c.FollowUpType)
|
||||
}
|
||||
|
||||
@@ -25,6 +25,18 @@ type KFR struct {
|
||||
Frequency *uint `json:"frequency"`
|
||||
IntervalUnit_Code *erc.TimeUnitCode `json:"intervalUnit_code" gorm:"size:10"`
|
||||
FollowUpType ere.KFRFollowUpTypeCode `json:"followUpType" gorm:"size:10"`
|
||||
FollowUpNote string `json:"dischargePlanning"`
|
||||
FollowUpNote string `json:"followUpNote"`
|
||||
Status_Code erc.DataVerifiedCode `json:"status_code" gorm:"not null;size:10"`
|
||||
}
|
||||
|
||||
func (d KFR) IsNew() bool {
|
||||
return d.Status_Code == erc.DVCNew
|
||||
}
|
||||
|
||||
func (d KFR) IsVerified() bool {
|
||||
return d.Status_Code == erc.DVCVerified
|
||||
}
|
||||
|
||||
func (d KFR) IsValidated() bool {
|
||||
return d.Status_Code == erc.DVCValidated
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user