add label data tidak ditemukan

This commit is contained in:
2024-08-07 16:56:25 +07:00
parent 55a2e1bbfd
commit 02d5f2e39e
5 changed files with 191 additions and 5 deletions

View File

@@ -91,6 +91,16 @@ type Barchart struct {
Type string `json:"type"`
} `json:"axisPointer"`
} `json:"tooltip"`
Graphic struct {
Type string `json:"type"`
Left string `json:"left"`
Top string `json:"top"`
Style struct {
Text string `json:"text"`
FontSize string `json:"fontSize"`
FontWeight string `json:"fontWeight"`
} `json:"style"`
} `json:"graphic"`
}
type BarDataset struct {
@@ -152,4 +162,14 @@ type BarchartV2 struct {
Type string `json:"type"`
} `json:"axisPointer"`
} `json:"tooltip"`
Graphic struct {
Type string `json:"type"`
Left string `json:"left"`
Top string `json:"top"`
Style struct {
Text string `json:"text"`
FontSize string `json:"fontSize"`
FontWeight string `json:"fontWeight"`
} `json:"style"`
} `json:"graphic"`
}

View File

@@ -95,6 +95,11 @@ func (tkf *TabKelainanFisikServices) GetPieChartConf(title string, subtext strin
}
func (tkf *TabKelainanFisikServices) GetBarChartConf(title string, data models.BarDataset) (models.Barchart, error) {
isEmpty := ""
if len(data.Source) <= 1 {
isEmpty = "Data tidak ditemukan"
}
option := models.Barchart{}
option.Title = struct {
Text string "json:\"text\""
@@ -155,6 +160,29 @@ func (tkf *TabKelainanFisikServices) GetBarChartConf(title string, data models.B
Type: "shadow",
},
}
option.Graphic = struct {
Type string "json:\"type\""
Left string "json:\"left\""
Top string "json:\"top\""
Style struct {
Text string "json:\"text\""
FontSize string "json:\"fontSize\""
FontWeight string "json:\"fontWeight\""
} "json:\"style\""
}{
Type: "text",
Left: "center",
Top: "middle",
Style: struct {
Text string "json:\"text\""
FontSize string "json:\"fontSize\""
FontWeight string "json:\"fontWeight\""
}{
Text: isEmpty,
FontSize: "15",
FontWeight: "bold",
},
}
return option, nil
}
@@ -242,7 +270,7 @@ func (tkf *TabKelainanFisikServices) GetKelainanFisikBMI(mcuID string) (models.P
UNION
SELECT 'Normal' as test,
'asia_pacific' as Mcu_KelainanClasification,
count(distinct T_OrderHeaderID) - summary_total_kelainan_bmi(?) as total
ifnull(count(distinct T_OrderHeaderID) - summary_total_kelainan_bmi(?), 0) as total
FROM t_orderheader
WHERE
T_OrderHeaderMgm_McuID = ? AND T_OrderHeaderIsActive = 'Y'
@@ -300,7 +328,7 @@ func (tkf *TabKelainanFisikServices) GetKelainanFisikHipertensi(mcuID string) (m
UNION
SELECT 'Normal' as test,
'JNC-VII' as Mcu_KelainanClasification,
COUNT(T_OrderHeaderID) - summary_total_kelainan_hipertensi(?) as total
IFNULL(COUNT(T_OrderHeaderID) - summary_total_kelainan_hipertensi(?), 0) as total
FROM t_orderheader
WHERE
T_OrderHeaderMgm_McuID = ? AND T_OrderHeaderIsActive = 'Y'
@@ -355,7 +383,7 @@ func (tkf *TabKelainanFisikServices) GetKelainanFisikRefraksi(mcuID string) (mod
group by Mcu_KelainanID
UNION
SELECT 'Normal' as test,
count(distinct T_OrderHeaderID) - summary_total_kelainan_visus(?) as total
IFNULL(count(distinct T_OrderHeaderID) - summary_total_kelainan_visus(?), 0) as total
FROM t_orderheader
WHERE
T_OrderHeaderMgm_McuID = ? AND T_OrderHeaderIsActive = 'Y'

View File

@@ -22,6 +22,11 @@ func NewTabKelainanGlobalServices(store db.AppStore) *TabKelainanGlobalServices
}
func (tkg *TabKelainanGlobalServices) GetBarChartConf(title string, data models.BarDataset) (models.Barchart, error) {
isEmpty := ""
if len(data.Source) <= 1 {
isEmpty = "Data tidak ditemukan"
}
option := models.Barchart{}
option.Title = struct {
Text string "json:\"text\""
@@ -82,6 +87,29 @@ func (tkg *TabKelainanGlobalServices) GetBarChartConf(title string, data models.
Type: "shadow",
},
}
option.Graphic = struct {
Type string "json:\"type\""
Left string "json:\"left\""
Top string "json:\"top\""
Style struct {
Text string "json:\"text\""
FontSize string "json:\"fontSize\""
FontWeight string "json:\"fontWeight\""
} "json:\"style\""
}{
Type: "text",
Left: "center",
Top: "middle",
Style: struct {
Text string "json:\"text\""
FontSize string "json:\"fontSize\""
FontWeight string "json:\"fontWeight\""
}{
Text: isEmpty,
FontSize: "15",
FontWeight: "bold",
},
}
return option, nil
}

View File

@@ -22,8 +22,12 @@ func NewTabKelainanLabServices(store db.AppStore) *TabKelainanLabServices {
}
func (tkl *TabKelainanLabServices) ConfBarchart(title string, data models.BarDataset) (models.Barchart, error) {
option := models.Barchart{}
isEmpty := ""
if len(data.Source) <= 1 {
isEmpty = "Data tidak ditemukan"
}
option := models.Barchart{}
option.Title = struct {
Text string "json:\"text\""
}{title}
@@ -83,18 +87,45 @@ func (tkl *TabKelainanLabServices) ConfBarchart(title string, data models.BarDat
Type: "shadow",
},
}
option.Graphic = struct {
Type string "json:\"type\""
Left string "json:\"left\""
Top string "json:\"top\""
Style struct {
Text string "json:\"text\""
FontSize string "json:\"fontSize\""
FontWeight string "json:\"fontWeight\""
} "json:\"style\""
}{
Type: "text",
Left: "center",
Top: "middle",
Style: struct {
Text string "json:\"text\""
FontSize string "json:\"fontSize\""
FontWeight string "json:\"fontWeight\""
}{
Text: isEmpty,
FontSize: "15",
FontWeight: "bold",
},
}
return option, nil
}
func (tkl *TabKelainanLabServices) ConfBarchartVertical(title string, data []models.KelainanLabModel) (models.BarchartV2, error) {
chartData := models.BarDataset{
Source: [][]interface{}{
{"score", "amount", "product"},
},
}
isEmpty := ""
if len(data) == 0 {
isEmpty = "Data tidak ditemukan"
}
cnt := len(data)
for idx, d := range data {
chartData.Source = append(chartData.Source, []interface{}{
@@ -215,6 +246,29 @@ func (tkl *TabKelainanLabServices) ConfBarchartVertical(title string, data []mod
Type: "shadow",
},
},
Graphic: struct {
Type string "json:\"type\""
Left string "json:\"left\""
Top string "json:\"top\""
Style struct {
Text string "json:\"text\""
FontSize string "json:\"fontSize\""
FontWeight string "json:\"fontWeight\""
} "json:\"style\""
}{
Type: "text",
Left: "center",
Top: "middle",
Style: struct {
Text string "json:\"text\""
FontSize string "json:\"fontSize\""
FontWeight string "json:\"fontWeight\""
}{
Text: isEmpty,
FontSize: "15",
FontWeight: "bold",
},
},
}
return option, nil

View File

@@ -22,6 +22,11 @@ func NewTabKelainanNonLabServices(store db.AppStore) *TabKelainanNonLabServices
}
func (tknl *TabKelainanNonLabServices) GetBarChartConf(title string, data models.BarDataset) (models.Barchart, error) {
isEmpty := ""
if len(data.Source) <= 1 {
isEmpty = "Data tidak ditemukan"
}
option := models.Barchart{}
option.Title = struct {
Text string "json:\"text\""
@@ -82,6 +87,29 @@ func (tknl *TabKelainanNonLabServices) GetBarChartConf(title string, data models
Type: "shadow",
},
}
option.Graphic = struct {
Type string "json:\"type\""
Left string "json:\"left\""
Top string "json:\"top\""
Style struct {
Text string "json:\"text\""
FontSize string "json:\"fontSize\""
FontWeight string "json:\"fontWeight\""
} "json:\"style\""
}{
Type: "text",
Left: "center",
Top: "middle",
Style: struct {
Text string "json:\"text\""
FontSize string "json:\"fontSize\""
FontWeight string "json:\"fontWeight\""
}{
Text: isEmpty,
FontSize: "15",
FontWeight: "bold",
},
}
return option, nil
}
@@ -93,6 +121,11 @@ func (tknl *TabKelainanNonLabServices) ConfBarchartVertical(title string, data [
},
}
isEmpty := ""
if len(data) == 0 {
isEmpty = "Data tidak ditemukan"
}
cnt := len(data)
for idx, d := range data {
if len(d.Test) > 30 {
@@ -220,6 +253,29 @@ func (tknl *TabKelainanNonLabServices) ConfBarchartVertical(title string, data [
Type: "shadow",
},
},
Graphic: struct {
Type string "json:\"type\""
Left string "json:\"left\""
Top string "json:\"top\""
Style struct {
Text string "json:\"text\""
FontSize string "json:\"fontSize\""
FontWeight string "json:\"fontWeight\""
} "json:\"style\""
}{
Type: "text",
Left: "center",
Top: "middle",
Style: struct {
Text string "json:\"text\""
FontSize string "json:\"fontSize\""
FontWeight string "json:\"fontWeight\""
}{
Text: isEmpty,
FontSize: "15",
FontWeight: "bold",
},
},
}
return option, nil