diff --git a/handlers/dev/kesimpulan.handlers.go b/handlers/dev/kesimpulan.handlers.go
index aa30944..516e3a1 100644
--- a/handlers/dev/kesimpulan.handlers.go
+++ b/handlers/dev/kesimpulan.handlers.go
@@ -13,6 +13,7 @@ import (
type KesimpulanService interface {
GetListKesimpulanLab(id string) ([]models.ModelKesimpulanLab, error)
GetListKesimpulanNonLab(id string) ([]models.ModelKesimpulanLab, error)
+ GetListKesimpulanFisik(id string) ([]models.ModelKesimpulanLab, error)
}
func NewKesimpulanHandler(us KesimpulanService) *KesimpulanHandler {
@@ -30,6 +31,7 @@ func (h *KesimpulanHandler) HandleShowKesimpulanScreen(c echo.Context) error {
tableID := utils.GenerateRandomID("tablebody")
tableIDNonLab := utils.GenerateRandomID("tablebody")
+ tableIDFisik := utils.GenerateRandomID("tablebody")
id := c.Param("id")
// table component
@@ -63,10 +65,27 @@ func (h *KesimpulanHandler) HandleShowKesimpulanScreen(c echo.Context) error {
zap.Any("data lab", dataNonLab))
tableComponentNonLab := dev_kesimpulan.CardTableKesimpulanNonLab("3 Kelainan Pemeriksaan Non Lab terbesar :", dataNonLab, tableIDNonLab)
+ // table component fisik
+ dataFisik, err := h.KesimpulanService.GetListKesimpulanFisik(id)
+ if err != nil {
+ defer logger.Sync()
+ logger.Info("ERROR GET LIST FISIK",
+ zap.Any("error", err),
+ )
+ fmt.Println(dataFisik)
+ return err
+ }
+
+ logger.Info("CEK DATA",
+ zap.Any("data lab", dataFisik))
+ tableComponentFisik := dev_kesimpulan.CardTableKesimpulanFisik("3 Kelainan Pemeriksaan Fisik terbesar :", dataFisik, tableIDFisik)
+
content := dev_kesimpulan.MainKesimpulan(tableID,
tableIDNonLab,
+ tableIDFisik,
tableComponentLab,
- tableComponentNonLab)
+ tableComponentNonLab,
+ tableComponentFisik)
view := dev_kesimpulan.ShowKesimpulan("KESIMPULAN", content, dev_kesimpulan.CssKesimpulan(), dev_kesimpulan.JsKesimpulan())
return utils.View(c, view)
diff --git a/services/dev/kesimpulan.services.go b/services/dev/kesimpulan.services.go
index b4c6e80..95a4dc9 100644
--- a/services/dev/kesimpulan.services.go
+++ b/services/dev/kesimpulan.services.go
@@ -162,3 +162,71 @@ func (k *KesimpulanServices) GetListKesimpulanNonLab(id string) ([]models.ModelK
)
return listNonLab, nil
}
+
+func (k *KesimpulanServices) GetListKesimpulanFisik(id string) ([]models.ModelKesimpulanLab, error) {
+ logger, _ := zap.NewProduction()
+ var listFisik []models.ModelKesimpulanLab
+ var dataTot []models.ModelKesimpulanLab
+
+ qryTot := `select '' as nomor,
+ '' as Test, sum(total) as total
+ from(
+ select count(*) as total
+ FROM mgm_header
+ join mgm_detail on Mgm_DetailMgm_HeaderID = Mgm_HeaderID and Mgm_DetailIsActive = 'Y'
+ join mcu_kelainan on Mgm_DetailMcu_KelainanID = Mcu_KelainanID
+ join mcu_kelainangroup on Mgm_DetailMcu_KelainanGroupID = Mcu_KelainanGroupID
+ left join nat_test on Nat_TestCode = Mgm_HeaderNat_TestCode
+
+ where Mgm_HeaderIsActive = 'Y' and Mgm_HeaderMgm_McuID = ? AND Mgm_HeaderType = 'F'
+ and Mgm_HeaderIsNormal = 'N'
+ group by Mgm_DetailMcu_KelainanID, Mgm_HeaderType ) x`
+
+ err := dbx.Handlex.Select(&dataTot, qryTot, id)
+ if err != nil {
+ defer logger.Sync()
+ logger.Error("Error get total",
+ zap.Any("id", id),
+ zap.Any("total data", dataTot),
+ )
+ // return dataTot, fmt.Errorf("QUERY_FAILED")
+ }
+
+ // Extracting the Total value
+ var totalFisik string
+ if len(dataTot) > 0 {
+ totalFisik = dataTot[0].Total
+ }
+
+ logger.Info("data",
+ zap.Any("id", id),
+ zap.Any("cek total", totalFisik),
+ )
+ query := `SELECT ROW_NUMBER() OVER () AS nomor,
+ ifnull(Nat_TestName ,Mcu_KelainanGroupName) as Test,
+ cast(count(Mgm_HeaderT_OrderHeaderID)/?*100 as decimal(2,0)) as total
+
+ FROM mgm_header
+ join mgm_detail on Mgm_DetailMgm_HeaderID = Mgm_HeaderID and Mgm_DetailIsActive = 'Y'
+ join mcu_kelainan on Mgm_DetailMcu_KelainanID = Mcu_KelainanID
+ join mcu_kelainangroup on Mgm_DetailMcu_KelainanGroupID = Mcu_KelainanGroupID
+ left join nat_test on Nat_TestCode = Mgm_HeaderNat_TestCode
+
+ where Mgm_HeaderIsActive = 'Y' and Mgm_HeaderMgm_McuID = ? AND Mgm_HeaderType = 'F'
+ and Mgm_HeaderIsNormal = 'N'
+ group by Mgm_DetailMcu_KelainanID, Mgm_HeaderType ORDER BY count(Mgm_HeaderT_OrderHeaderID) DESC
+ LIMIT 3`
+
+ err = dbx.Handlex.Select(&listFisik, query, totalFisik, id)
+
+ if err != nil {
+ defer logger.Sync()
+ logger.Error("Error get data fisik",
+ zap.Any("id", id),
+ zap.Any("list data", listFisik),
+ )
+ return listFisik, fmt.Errorf("QUERY_FAILED")
+ }
+
+ return listFisik, nil
+}
diff --git a/views/dev/kesimpulan/kesimpulan.templ b/views/dev/kesimpulan/kesimpulan.templ
index 1a6566a..c31cc97 100644
--- a/views/dev/kesimpulan/kesimpulan.templ
+++ b/views/dev/kesimpulan/kesimpulan.templ
@@ -9,8 +9,10 @@ import (
templ MainKesimpulan(
tableID string,
tableIDNonLab string,
+ tableIDFisik string,
tablecontent templ.Component,
tablecontentnonlab templ.Component,
+ tablecontentfisik templ.Component,
) {
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "tableID",
@@ -21,11 +23,16 @@ templ MainKesimpulan(
Name: "tableIDNonLab",
Type: "hidden",
Value: tableIDNonLab})
+ @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "tableIDFisik",
+ Name: "tableIDFisik",
+ Type: "hidden",
+ Value: tableIDFisik})
Kesimpulan
@tablecontent
@tablecontentnonlab
+ @tablecontentfisik
}
diff --git a/views/dev/kesimpulan/kesimpulan_templ.go b/views/dev/kesimpulan/kesimpulan_templ.go
index 057d393..810a23e 100644
--- a/views/dev/kesimpulan/kesimpulan_templ.go
+++ b/views/dev/kesimpulan/kesimpulan_templ.go
@@ -19,8 +19,10 @@ import (
func MainKesimpulan(
tableID string,
tableIDNonLab string,
+ tableIDFisik string,
tablecontent templ.Component,
tablecontentnonlab templ.Component,
+ tablecontentfisik templ.Component,
) templ.Component {
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
@@ -52,6 +54,13 @@ func MainKesimpulan(
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
+ templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "tableIDFisik",
+ Name: "tableIDFisik",
+ Type: "hidden",
+ Value: tableIDFisik}).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Kesimpulan
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
@@ -64,6 +73,10 @@ func MainKesimpulan(
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
+ templ_7745c5c3_Err = tablecontentfisik.Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
diff --git a/views/dev/kesimpulan/tablekesimpulanfisik.templ b/views/dev/kesimpulan/tablekesimpulanfisik.templ
new file mode 100644
index 0000000..faedc0b
--- /dev/null
+++ b/views/dev/kesimpulan/tablekesimpulanfisik.templ
@@ -0,0 +1,46 @@
+package dev_kesimpulan
+
+import (
+ "cpone/component/table"
+ "cpone/models"
+)
+
+templ CardTableKesimpulanFisik(title string, data []models.ModelKesimpulanLab, tableIDFisik string) {
+
+
+
+ { title }
+
+
+
+
+ @TableKesimpulanFisik(data, tableIDFisik)
+
+
+
+}
+
+templ TableKesimpulanFisik(data []models.ModelKesimpulanLab,
+ tableIDFisik string) {
+
+ @tablecomponent.TableV3([]string{"NO", "PEMERIKSAAN", "PERSENTASE"},
+ []string{"5%", "70%", "25%"},
+ RowKesimpulanFisik(data),
+ )
+
+}
+
+templ RowKesimpulanFisik(data []models.ModelKesimpulanLab) {
+ if len(data) == 0 {
+
+ | Data Tidak Ditemukan |
+
+ }
+ for _, v := range data {
+
+ | { v.Nomor } |
+ { v.Test } |
+ { v.Total } % |
+
+ }
+}
diff --git a/views/dev/kesimpulan/tablekesimpulanfisik_templ.go b/views/dev/kesimpulan/tablekesimpulanfisik_templ.go
new file mode 100644
index 0000000..bdf9fd0
--- /dev/null
+++ b/views/dev/kesimpulan/tablekesimpulanfisik_templ.go
@@ -0,0 +1,181 @@
+// Code generated by templ - DO NOT EDIT.
+
+// templ: version: v0.2.663
+package dev_kesimpulan
+
+//lint:file-ignore SA4006 This context is only used if a nested component is present.
+
+import "github.com/a-h/templ"
+import "context"
+import "io"
+import "bytes"
+
+import (
+ "cpone/component/table"
+ "cpone/models"
+)
+
+func CardTableKesimpulanFisik(title string, data []models.ModelKesimpulanLab, tableIDFisik string) templ.Component {
+ return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Var1 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var1 == nil {
+ templ_7745c5c3_Var1 = templ.NopComponent
+ }
+ ctx = templ.ClearChildren(ctx)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var2 string
+ templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kesimpulan\tablekesimpulanfisik.templ`, Line: 12, Col: 11}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = TableKesimpulanFisik(data, tableIDFisik).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func TableKesimpulanFisik(data []models.ModelKesimpulanLab,
+ tableIDFisik string) templ.Component {
+ return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Var3 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var3 == nil {
+ templ_7745c5c3_Var3 = templ.NopComponent
+ }
+ ctx = templ.ClearChildren(ctx)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = tablecomponent.TableV3([]string{"NO", "PEMERIKSAAN", "PERSENTASE"},
+ []string{"5%", "70%", "25%"},
+ RowKesimpulanFisik(data),
+ ).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func RowKesimpulanFisik(data []models.ModelKesimpulanLab) templ.Component {
+ return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Var5 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var5 == nil {
+ templ_7745c5c3_Var5 = templ.NopComponent
+ }
+ ctx = templ.ClearChildren(ctx)
+ if len(data) == 0 {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("| Data Tidak Ditemukan |
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ for _, v := range data {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("| ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var6 string
+ templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(v.Nomor)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kesimpulan\tablekesimpulanfisik.templ`, Line: 41, Col: 16}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" | ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var7 string
+ templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(v.Test)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kesimpulan\tablekesimpulanfisik.templ`, Line: 42, Col: 15}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" | ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var8 string
+ templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(v.Total)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kesimpulan\tablekesimpulanfisik.templ`, Line: 43, Col: 16}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" % |
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}