feat (generate-file): resume table is done
This commit is contained in:
No files matched your search
@@ -96,7 +96,7 @@ type Assessment struct {
|
||||
StartedAt *time.Time `json:"startedAt`
|
||||
FinishedAt *time.Time `json:"finishedAt`
|
||||
Doctor_Code string `json:"doctor_code`
|
||||
DiagnosisIn string `json:"diagnosesIn`
|
||||
DiagnosisIn string `json:"diagnosisIn`
|
||||
AmbulatoryIndication string `json:"ambulatoryIndication"`
|
||||
MainComplaint string `json:"mainComplaint"`
|
||||
PhysicalExamination string `json:"physicalExamination"`
|
||||
@@ -106,13 +106,13 @@ type Assessment struct {
|
||||
|
||||
type Diagnosis struct {
|
||||
PrimaryDiagnosis DiagnosisEntry `json:"primaryDiagnosis"`
|
||||
SecondaryDiagnoses []DiagnosisEntry `json:"secondaryDiagnoses"`
|
||||
SecondaryDiagnosis []DiagnosisEntry `json:"secondaryDiagnosis"`
|
||||
}
|
||||
|
||||
type DiagnosisEntry struct {
|
||||
Diagnosis string `json:"diagnosis"`
|
||||
ICD10 string `json:"icd_10"`
|
||||
Basis string `json:"basis"` // Clinical basis of diagnosis / dasar diagnosa
|
||||
DiagnosisName string `json:"diagnosis"`
|
||||
ICD10 string `json:"icd_10"`
|
||||
Basis string `json:"basis"` // Clinical basis of diagnosis / dasar diagnosa
|
||||
}
|
||||
|
||||
type Action struct {
|
||||
|
||||
@@ -52,6 +52,10 @@ func GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func Update(w http.ResponseWriter, r *http.Request) {
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
@@ -62,11 +66,16 @@ func Update(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
dto.Id = uint(id)
|
||||
dto.AuthInfo = *authInfo
|
||||
res, err := u.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func Delete(w http.ResponseWriter, r *http.Request) {
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
@@ -74,6 +83,7 @@ func Delete(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint(id)
|
||||
dto.AuthInfo = *authInfo
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -250,8 +250,28 @@ func generateResume(input GenerateDto, event pl.Event, tx *gorm.DB) (*ResponseDt
|
||||
}
|
||||
}
|
||||
|
||||
templateData, err := generateResumeTemplateData(*r, event, tx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
input.FormatType = erc.DFTCPDF
|
||||
input.TemplateName = TDNR
|
||||
input.Encounter_Id = r.Encounter_Id
|
||||
|
||||
// generate file
|
||||
urlPub, err := generateFile(input, templateData)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
r.FileUrl = &urlPub
|
||||
if err := tx.Save(&r).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response := ResponseDto{
|
||||
FileUrl: "",
|
||||
FileUrl: urlPub,
|
||||
}
|
||||
|
||||
return &response, nil
|
||||
@@ -264,7 +284,6 @@ func generateResumeTemplateData(resume er.Resume, event pl.Event, tx *gorm.DB) (
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fmt.Println(encounter)
|
||||
|
||||
// map template data
|
||||
rData := er.ValueDto{}
|
||||
@@ -293,6 +312,24 @@ func generateResumeTemplateData(resume er.Resume, event pl.Event, tx *gorm.DB) (
|
||||
templateData.Doctor_Name = resume.Doctor.Employee.Person.FullName()
|
||||
templateData.StartedAt = *pc.TimeToStringWithFormat(encounter.StartedAt, "")
|
||||
templateData.FinishedAt = *pc.TimeToStringWithFormat(encounter.FinishedAt, "")
|
||||
templateData.DiagnosisIn = rData.Assessment.DiagnosisIn
|
||||
templateData.Diagnosis = rData.Diagnosis.SecondaryDiagnosis
|
||||
templateData.MainComplaint = rData.Assessment.MainComplaint
|
||||
templateData.MedicalHistory = rData.Assessment.MedicalHistory
|
||||
templateData.PhysicalExamination = rData.Assessment.PhysicalExamination
|
||||
templateData.SupportingExamination = rData.Supporting.Notes
|
||||
templateData.MedicalActions = rData.Action.AdditionalActions
|
||||
templateData.MedicalAction = rData.Action.MedicalActions
|
||||
templateData.Consultations = rData.Consultation.Consultations
|
||||
templateData.Allergy = rData.Pharmacy.AllergySpecialConditions
|
||||
templateData.ConsciousnessLevel = rData.Discharge.ConsciousnessLevel
|
||||
templateData.BloodPressure = fmt.Sprintf("%.0f/%.0f", rData.Discharge.BloodPressureSystolic, rData.Discharge.BloodPressureDiastolic)
|
||||
templateData.BodyTemperature = rData.Discharge.BodyTemperature
|
||||
templateData.RespirationRate = rData.Discharge.RespirationRate
|
||||
templateData.HeartRate = rData.Discharge.HeartRate
|
||||
templateData.PainScale = rData.Discharge.PainScale
|
||||
templateData.ConditionOnDischarge = rData.Management.ConditionOnDischarge
|
||||
templateData.DischargeMethod = rData.Management.DischargeMethod
|
||||
|
||||
return &templateData, nil
|
||||
}
|
||||
@@ -57,6 +57,18 @@ type ResumePDF struct {
|
||||
MedicalAction string
|
||||
Consultations []er.ConsultationEntry
|
||||
Allergy string
|
||||
ConsciousnessLevel string
|
||||
BloodPressure string
|
||||
BodyTemperature float64
|
||||
RespirationRate float64
|
||||
HeartRate float64
|
||||
PainScale int
|
||||
ConditionOnDischarge string
|
||||
DischargeMethod string
|
||||
// fasyankes
|
||||
// date
|
||||
// klinik
|
||||
Date string
|
||||
}
|
||||
|
||||
type GenerateDto struct {
|
||||
@@ -110,6 +122,7 @@ type TemplateDocsName string
|
||||
const (
|
||||
TDNGC TemplateDocsName = "general-consent.html"
|
||||
TDNCL TemplateDocsName = "control-letter.html"
|
||||
TDNR TemplateDocsName = "resume.html"
|
||||
)
|
||||
|
||||
func (v VclaimControlLetter) generateTemplateData() ControlLetterPDF {
|
||||
|
||||
Reference in New Issue
Block a user