endpoint table antrian per subspesialis
This commit is contained in:
@@ -379,6 +379,47 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/dashboard/table-antrian-per-subspesialis/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"Dashboard"
|
||||||
|
],
|
||||||
|
"summary": "Get Table Antrian per Sub Spesialis",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "tahun dalam int",
|
||||||
|
"name": "year",
|
||||||
|
"in": "query",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "bulan dalam int",
|
||||||
|
"name": "month",
|
||||||
|
"in": "query",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/dashboard.TableAntreanPerSubSpesialis"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/shared.BaseErrorResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/reference/diagnosa/": {
|
"/reference/diagnosa/": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
@@ -1018,6 +1059,32 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"dashboard.TableAntreanPerSubSpesialis": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"batal": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"belum": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"selesai": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"spesialis": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"subSpesialis": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"total": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"tunda": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"diagnosa.DiagnosaResponse": {
|
"diagnosa.DiagnosaResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
@@ -373,6 +373,47 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/dashboard/table-antrian-per-subspesialis/": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"Dashboard"
|
||||||
|
],
|
||||||
|
"summary": "Get Table Antrian per Sub Spesialis",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "tahun dalam int",
|
||||||
|
"name": "year",
|
||||||
|
"in": "query",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "bulan dalam int",
|
||||||
|
"name": "month",
|
||||||
|
"in": "query",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/dashboard.TableAntreanPerSubSpesialis"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/shared.BaseErrorResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/reference/diagnosa/": {
|
"/reference/diagnosa/": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
@@ -1012,6 +1053,32 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"dashboard.TableAntreanPerSubSpesialis": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"batal": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"belum": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"selesai": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"spesialis": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"subSpesialis": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"total": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"tunda": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"diagnosa.DiagnosaResponse": {
|
"diagnosa.DiagnosaResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
@@ -259,6 +259,23 @@ definitions:
|
|||||||
tunda:
|
tunda:
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
|
dashboard.TableAntreanPerSubSpesialis:
|
||||||
|
properties:
|
||||||
|
batal:
|
||||||
|
type: integer
|
||||||
|
belum:
|
||||||
|
type: integer
|
||||||
|
selesai:
|
||||||
|
type: integer
|
||||||
|
spesialis:
|
||||||
|
type: string
|
||||||
|
subSpesialis:
|
||||||
|
type: string
|
||||||
|
total:
|
||||||
|
type: integer
|
||||||
|
tunda:
|
||||||
|
type: integer
|
||||||
|
type: object
|
||||||
diagnosa.DiagnosaResponse:
|
diagnosa.DiagnosaResponse:
|
||||||
properties:
|
properties:
|
||||||
keterangan:
|
keterangan:
|
||||||
@@ -634,6 +651,33 @@ paths:
|
|||||||
summary: Get Table Antrian per Spesialis
|
summary: Get Table Antrian per Spesialis
|
||||||
tags:
|
tags:
|
||||||
- Dashboard
|
- Dashboard
|
||||||
|
/dashboard/table-antrian-per-subspesialis/:
|
||||||
|
get:
|
||||||
|
parameters:
|
||||||
|
- description: tahun dalam int
|
||||||
|
in: query
|
||||||
|
name: year
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
- description: bulan dalam int
|
||||||
|
in: query
|
||||||
|
name: month
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/dashboard.TableAntreanPerSubSpesialis'
|
||||||
|
type: array
|
||||||
|
"500":
|
||||||
|
description: Internal Server Error
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/shared.BaseErrorResponse'
|
||||||
|
summary: Get Table Antrian per Sub Spesialis
|
||||||
|
tags:
|
||||||
|
- Dashboard
|
||||||
/reference/diagnosa/:
|
/reference/diagnosa/:
|
||||||
get:
|
get:
|
||||||
parameters:
|
parameters:
|
||||||
|
|||||||
@@ -186,3 +186,44 @@ func (h DashboardHandler) GetTableAntrianPerSpesialis(c *gin.Context) {
|
|||||||
|
|
||||||
c.JSON(http.StatusOK, response)
|
c.JSON(http.StatusOK, response)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetTableAntrianPerSubSpesialis godoc
|
||||||
|
// @Summary Get Table Antrian per Sub Spesialis
|
||||||
|
// @Tags Dashboard
|
||||||
|
// @Param year query int true "tahun dalam int"
|
||||||
|
// @Param month query int true "bulan dalam int"
|
||||||
|
// @Success 200 {object} []TableAntreanPerSubSpesialis
|
||||||
|
// @Failure 500 {object} shared.BaseErrorResponse
|
||||||
|
// @Router /dashboard/table-antrian-per-subspesialis/ [get]
|
||||||
|
func (h DashboardHandler) GetTableAntrianPerSubSpesialis(c *gin.Context) {
|
||||||
|
var req PeriodeDashboardRequest
|
||||||
|
if err := c.ShouldBindQuery(&req); err != nil {
|
||||||
|
c.JSON(400, shared.BaseErrorResponse{
|
||||||
|
Success: false,
|
||||||
|
Code: 400,
|
||||||
|
Message: "error bind json",
|
||||||
|
Errors: shared.ValidationError(err),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
data, err := h.repo.GetTableAntrianPerSubSpesialis(c, req)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
errorResponse := baseResponse.BaseErrorResponse{
|
||||||
|
Success: false,
|
||||||
|
Code: 500,
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
c.JSON(http.StatusInternalServerError, errorResponse)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
response := baseResponse.ToBaseResponse(
|
||||||
|
data,
|
||||||
|
true,
|
||||||
|
200,
|
||||||
|
"success get table antrean per spesialis")
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, response)
|
||||||
|
}
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ type TableAntreanPerSubSpesialis struct {
|
|||||||
Belum int `db:"belum"`
|
Belum int `db:"belum"`
|
||||||
Selesai int `db:"selesai"`
|
Selesai int `db:"selesai"`
|
||||||
Tunda int `db:"tunda"`
|
Tunda int `db:"tunda"`
|
||||||
|
Batal int `db:"batal"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ListModelAntrianPerSpesialis []AntrianPerSpesialisModel
|
type ListModelAntrianPerSpesialis []AntrianPerSpesialisModel
|
||||||
|
|||||||
@@ -293,5 +293,65 @@ func (r dashboardRepo) GetTableAntrianPerSpesialis(c *gin.Context, req PeriodeDa
|
|||||||
func (r dashboardRepo) GetTableAntrianPerSubSpesialis(c *gin.Context, req PeriodeDashboardRequest) ([]TableAntreanPerSubSpesialis, error) {
|
func (r dashboardRepo) GetTableAntrianPerSubSpesialis(c *gin.Context, req PeriodeDashboardRequest) ([]TableAntreanPerSubSpesialis, error) {
|
||||||
var result []TableAntreanPerSubSpesialis
|
var result []TableAntreanPerSubSpesialis
|
||||||
|
|
||||||
|
startDate, endDate := GenerateStartEndDate(req)
|
||||||
|
|
||||||
|
query := queryUtils.DynamicQuery{
|
||||||
|
From: TBL_NAME,
|
||||||
|
Aliases: "dpo",
|
||||||
|
Fields: []queryUtils.SelectField{
|
||||||
|
{Expression: "ds.Spesialis", Alias: "spesialis"},
|
||||||
|
{Expression: "dss.Subspesialis", Alias: "sub_spesialis"},
|
||||||
|
{Expression: "count(dpo.id) as total"},
|
||||||
|
{Expression: "count(dpo.id) filter (where dpo.\"Status_operasi\" = ('1')) as belum"},
|
||||||
|
{Expression: "count(dpo.id) filter (where dpo.\"Status_operasi\" = ('2')) as selesai"},
|
||||||
|
{Expression: "count(dpo.id) filter (where dpo.\"Status_operasi\" = ('3')) as tunda"},
|
||||||
|
{Expression: "count(dpo.id) filter (where dpo.\"Status_operasi\" = ('4')) as batal"},
|
||||||
|
},
|
||||||
|
Filters: []queryUtils.FilterGroup{
|
||||||
|
{
|
||||||
|
Filters: []queryUtils.DynamicFilter{
|
||||||
|
{Column: "dpo.Tanggal_daftar", Operator: queryUtils.OpBetween, Value: []string{startDate, endDate}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Joins: []queryUtils.Join{
|
||||||
|
{
|
||||||
|
Type: "LEFT",
|
||||||
|
Table: "daftar_spesialis",
|
||||||
|
Alias: "ds",
|
||||||
|
OnConditions: queryUtils.FilterGroup{
|
||||||
|
Filters: []queryUtils.DynamicFilter{
|
||||||
|
{Column: "dpo.Spesialis", Operator: queryUtils.OpEqual, Value: "ds.id"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Type: "LEFT",
|
||||||
|
Table: "daftar_subspesialis",
|
||||||
|
Alias: "dss",
|
||||||
|
OnConditions: queryUtils.FilterGroup{
|
||||||
|
Filters: []queryUtils.DynamicFilter{
|
||||||
|
{Column: "dpo.Sub_spesialis", Operator: queryUtils.OpEqual, Value: "dss.id"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
GroupBy: []string{"ds.Spesialis", "dss.Subspesialis"},
|
||||||
|
Sort: []queryUtils.SortField{
|
||||||
|
{Column: "ds.Spesialis", Order: "ASC"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
dbconn, err := r.db.GetSQLXDB(DB_NAME)
|
||||||
|
if err != nil {
|
||||||
|
return result, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = r.queryBuilder.ExecuteQuery(
|
||||||
|
c, dbconn, query, &result)
|
||||||
|
if err != nil {
|
||||||
|
return result, err
|
||||||
|
}
|
||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ func RegisterRoutes(r *gin.RouterGroup, dbService database.Service) {
|
|||||||
r.GET("/perbandingan-status-antrian", dashboardHandler.GetPerbandinganStatusAntrean)
|
r.GET("/perbandingan-status-antrian", dashboardHandler.GetPerbandinganStatusAntrean)
|
||||||
r.GET("/perbandingan-kategori-antrian", dashboardHandler.GetPerbandinganKategoriAntrean)
|
r.GET("/perbandingan-kategori-antrian", dashboardHandler.GetPerbandinganKategoriAntrean)
|
||||||
r.GET("/table-antrian-per-spesialis", dashboardHandler.GetTableAntrianPerSpesialis)
|
r.GET("/table-antrian-per-spesialis", dashboardHandler.GetTableAntrianPerSpesialis)
|
||||||
|
r.GET("/table-antrian-per-subspesialis", dashboardHandler.GetTableAntrianPerSubSpesialis)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user