This commit is contained in:
dpurbosakti
2025-12-02 13:37:26 +07:00
parent 7e454b0a2d
commit 5adb4e5666
8 changed files with 361 additions and 43 deletions
@@ -84,3 +84,39 @@ func ToResponseList(data []Screening) []ResponseDto {
}
return resp
}
type FormA struct {
AgeAtRisk bool `json:"ageAtRisk"` // Usia Dengan Risiko
LowCognitiveFunction bool `json:"lowCognitiveFunction"` // Pasien Dengan Fungsi Kognitif Rendah
HighRiskPatient bool `json:"highRiskPatient"` // Pasien Dengan Risiko Tinggi
HighComplaintPotential bool `json:"highComplaintPotential"` // Potensi Komplain Tinggi (Medik dan Non Medik)
ChronicOrCatastrophicOrTerminal bool `json:"chronicOrCatastrophicOrTerminal"` // Kasus Dengan Penyakit Kronis, Katastropik, Terminal
LowFunctionalStatus bool `json:"lowFunctionalStatus"` // Status Fungsional Rendah, Kebutuhan Bantuan ADL Tinggi
HistoryOfMedicalDeviceUse bool `json:"historyOfMedicalDeviceUse"` // Pasien Dengan Riwayat Penggunaan Peralatan Medis Masa Lalu
MentalOrSocialIssues bool `json:"mentalOrSocialIssues"` // Riwayat Gangguan Mental, Bunuh Diri, Krisis Keluarga, Isu Sosial
FrequentERVisitsOrReadmission bool `json:"frequentERVisitsOrReadmission"` // Sering Masuk IGD, Readmisi RS
HighCareCostEstimate bool `json:"highCareCostEstimate"` // Perkiraan Asuhan Dengan Biaya Tinggi
ComplexFinancingSystem bool `json:"complexFinancingSystem"` // Kemungkinan Sistem Pembiayaan Yang Kompleks
AboveAverageLengthOfStay bool `json:"aboveAverageLengthOfStay"` // Kasus Yang Melebihi Rata-Rata Lama Dirawat
ImportantOrHighRiskDischargePlanning bool `json:"importantOrHighRiskDischargePlanning"` // Rencana Pemulangan Penting / Kontinuitas Pelayanan
Stagnation bool `json:"stagnation"` // Stagnasi
}
type ProblemIdentification struct {
CareNotFollowingGuidelines bool `json:"careNotFollowingGuidelines"` // Tingkat Asuhan Tidak Sesuai Panduan/ Norma
OverUtilization bool `json:"overUtilization"` // Over Utilization Pelayanan
UnderUtilization bool `json:"underUtilization"` // Under Utilization Pelayanan
PatientNonCompliance bool `json:"patientNonCompliance"` // Ketidakpatuhan Pasien
InadequateEducation bool `json:"inadequateEducation"` // Edukasi Kurang Memadai
LackOfFamilySupport bool `json:"lackOfFamilySupport"` // Kurang Dukungan Keluarga
DecreasedDetermination bool `json:"decreasedDetermination"` // Penurunan Determinasi Ketika Komplikasi Meningkat
FinancialDifficultyDuringComplications bool `json:"financialDifficultyDuringComplications"` // Kendala Keuangan Ketika Komplikasi Meningkat
DischargeCriteriaNotMetOrDelayed bool `json:"dischargeCriteriaNotMetOrDelayed"` // Pemulangan/ Rujukan Belum Memenuhi Kriteria/ Ditunda
}
type AssessmentForm struct {
Screening Screening `json:"screening"`
AssessmentDetail string `json:"assessmentDetail"` // Masukkan detail assesmen
ProblemIdentification ProblemIdentification `json:"problemIdentification"`
PlanningDetail string `json:"planningDetail"` // Masukkan detail perencanaan
}
@@ -18,3 +18,5 @@ type Screening struct {
Value *string `json:"value"`
FileUrl *string `json:"fileUrl" gorm:"size:1024"`
}
// func (d Screening) UnMarshal(data []byte) (error {}
@@ -4,7 +4,7 @@ import (
"net/http"
rw "github.com/karincake/risoles"
sf "github.com/karincake/semprit"
// sf "github.com/karincake/semprit"
// ua "github.com/karincake/tumpeng/auth/svc"
@@ -34,47 +34,47 @@ func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
rw.DataResponse(w, res, err)
}
func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
dto := e.ReadListDto{}
sf.UrlQueryParam(&dto, *r.URL)
res, err := u.ReadList(dto)
rw.DataResponse(w, res, err)
}
// func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
// dto := e.ReadListDto{}
// sf.UrlQueryParam(&dto, *r.URL)
// res, err := u.ReadList(dto)
// rw.DataResponse(w, res, err)
// }
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id"))
if id <= 0 {
return
}
dto := e.ReadDetailDto{}
dto.Id = uint16(id)
res, err := u.ReadDetail(dto)
rw.DataResponse(w, res, err)
}
// func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
// id := rw.ValidateInt(w, "id", r.PathValue("id"))
// if id <= 0 {
// return
// }
// dto := e.ReadDetailDto{}
// dto.Id = uint16(id)
// res, err := u.ReadDetail(dto)
// rw.DataResponse(w, res, err)
// }
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id"))
if id <= 0 {
return
}
// func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
// id := rw.ValidateInt(w, "id", r.PathValue("id"))
// if id <= 0 {
// return
// }
dto := e.UpdateDto{}
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
return
}
dto.Id = uint16(id)
res, err := u.Update(dto)
rw.DataResponse(w, res, err)
}
// dto := e.UpdateDto{}
// if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
// return
// }
// dto.Id = uint16(id)
// res, err := u.Update(dto)
// rw.DataResponse(w, res, err)
// }
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
id := rw.ValidateInt(w, "id", r.PathValue("id"))
if id <= 0 {
return
}
// func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
// id := rw.ValidateInt(w, "id", r.PathValue("id"))
// if id <= 0 {
// return
// }
dto := e.DeleteDto{}
dto.Id = uint16(id)
res, err := u.Delete(dto)
rw.DataResponse(w, res, err)
}
// dto := e.DeleteDto{}
// dto.Id = uint16(id)
// res, err := u.Delete(dto)
// rw.DataResponse(w, res, err)
// }
+7
View File
@@ -65,6 +65,13 @@ func (a AuthInfo) IsPharmacist() bool {
return *a.Employee_Position_Code == string(ero.EPCPha)
}
func (a AuthInfo) IsScreener() bool { // MPP, petugas skrining
if a.Employee_Position_Code == nil {
return false
}
return *a.Employee_Position_Code == string(ero.EPCScr)
}
// func (a AuthInfo) IsPayment() bool {
// if a.Employee_Position_Code == nil {
// return false
@@ -38,7 +38,11 @@ func Create(input e.CreateDto) (*d.Data, error) {
return err
}
if !input.AuthInfo.IsDoctor() && !input.AuthInfo.IsNurse() {
if !pu.Contains([]erc.ScreeningFormTypeCode{erc.SFTCB, erc.SFTCA}, input.Type) {
return errors.New("invalid screening form type")
}
if !input.AuthInfo.IsScreener() {
event.Status = "failed"
event.ErrInfo = pl.ErrorInfo{
Code: "auth-forbidden",
@@ -55,12 +59,21 @@ func Create(input e.CreateDto) (*d.Data, error) {
input.Employee_Id = nil
}
if input.Type == erc.SFTCB {
switch input.Type {
case erc.SFTCA:
s, _, err := ReadListData(e.ReadListDto{FilterDto: e.FilterDto{Type: erc.SFTCA}}, &event, tx)
if err != nil {
return err
}
if len(s) != 0 {
if len(s) > 0 {
return errors.New("screening form type A is already created for this encounter")
}
case erc.SFTCB:
s, _, err := ReadListData(e.ReadListDto{FilterDto: e.FilterDto{Type: erc.SFTCA}}, &event, tx)
if err != nil {
return err
}
if len(s) < 1 {
return errors.New("screening form type A is not created yet, please create it first")
}
}
@@ -6,12 +6,14 @@ package screening
import (
e "simrs-vx/internal/domain/main-entities/screening"
erc "simrs-vx/internal/domain/references/common"
)
func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Screening) {
var inputSrc *e.CreateDto
if inputT, ok := any(input).(*e.CreateDto); ok {
inputSrc = inputT
data.Status = erc.DVCValidated
} else {
inputTemp := any(input).(*e.UpdateDto)
inputSrc = &inputTemp.CreateDto