From 773b6589bc76685be904b2c2ec6a8868bc9da0a9 Mon Sep 17 00:00:00 2001 From: Meninjar Date: Wed, 20 Aug 2025 04:29:48 +0700 Subject: [PATCH] Perbaikan SEP --- go.mod | 1 + go.sum | 2 + internal/handlers/bpjs/vclaim/sep.go | 164 ++++++++++++++++++++ internal/helpers/bpjs/lz-string.go | 137 +++++------------ internal/models/bpjs/vclaim/sep.go | 135 ++++++++++++++++ internal/routes/v1/routes.go | 14 +- internal/services/bpjs/response.go | 31 ++-- internal/utils/sep | 220 +++++++++++++++++++++++++++ 8 files changed, 576 insertions(+), 128 deletions(-) create mode 100644 internal/handlers/bpjs/vclaim/sep.go create mode 100644 internal/models/bpjs/vclaim/sep.go create mode 100644 internal/utils/sep diff --git a/go.mod b/go.mod index 51a2d61..32e6655 100644 --- a/go.mod +++ b/go.mod @@ -16,6 +16,7 @@ require ( ) require ( + github.com/daku10/go-lz-string v0.0.6 github.com/go-playground/validator/v10 v10.27.0 github.com/go-sql-driver/mysql v1.8.1 github.com/joho/godotenv v1.5.1 diff --git a/go.sum b/go.sum index 0ee92fd..79eda12 100644 --- a/go.sum +++ b/go.sum @@ -31,6 +31,8 @@ github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFos github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M= github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/daku10/go-lz-string v0.0.6 h1:aO8FFp4QPuNp7+WNyh1DyNjGF3UbZu95tUv9xOZNsYQ= +github.com/daku10/go-lz-string v0.0.6/go.mod h1:Vk++rSG3db8HXJaHEAbxiy/ukjTmPBw/iI+SrVZDzfs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/internal/handlers/bpjs/vclaim/sep.go b/internal/handlers/bpjs/vclaim/sep.go new file mode 100644 index 0000000..c6d1ddd --- /dev/null +++ b/internal/handlers/bpjs/vclaim/sep.go @@ -0,0 +1,164 @@ +package handlers + +import ( + "context" + "fmt" + "net/http" + "time" + + "api-service/internal/config" + models "api-service/internal/models/bpjs/vclaim" + + services "api-service/internal/services/bpjs" + + "github.com/gin-gonic/gin" +) + +type SepHandler struct { + service services.VClaimService +} + +func NewSepHandler(cfg config.BpjsConfig) *SepHandler { + return &SepHandler{ + service: services.NewService(cfg), + } +} + +// CreateSEP godoc +// @Summary Create a new SEP +// @Description Create a new Surat Eligibilitas Peserta +// @Tags bpjs +// @Accept json +// @Produce json +// @Param request body models.SepPostRequest true "SEP creation request" +// @Success 200 {object} models.SepResponse "SEP created successfully" +// @Failure 400 {object} gin.H "Invalid request" +// @Failure 500 {object} gin.H "Internal server error" +// @Router /sep [post] +func (h *SepHandler) CreateSEP(c *gin.Context) { + var req models.SepPostRequest + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid body", "message": err.Error()}) + return + } + + ctx, cancel := context.WithTimeout(c, 30*time.Second) + defer cancel() + + var result map[string]interface{} + if err := h.service.Post(ctx, "/SEP/2.0/insert", req, &result); err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"error": "create failed", "message": err.Error()}) + return + } + + c.JSON(http.StatusOK, models.SepResponse{ + Message: "SEP berhasil dibuat", + Data: result, + }) +} + +// UpdateSEP godoc +// @Summary Update an existing SEP +// @Description Update an existing Surat Eligibilitas Peserta +// @Tags bpjs +// @Accept json +// @Produce json +// @Param request body models.SepPutRequest true "SEP update request" +// @Success 200 {object} models.SepResponse "SEP updated successfully" +// @Failure 400 {object} gin.H "Invalid request" +// @Failure 500 {object} gin.H "Internal server error" +// @Router /sep [put] +func (h *SepHandler) UpdateSEP(c *gin.Context) { + var req models.SepPutRequest + if err := c.ShouldBindJSON(&req); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid body", "message": err.Error()}) + return + } + + ctx, cancel := context.WithTimeout(c, 30*time.Second) + defer cancel() + + var result map[string]interface{} + if err := h.service.Put(ctx, "/SEP/2.0/update", req, &result); err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"error": "update failed", "message": err.Error()}) + return + } + + c.JSON(http.StatusOK, models.SepResponse{ + Message: "SEP berhasil diperbarui", + Data: result, + }) +} + +// DeleteSEP godoc +// @Summary Delete an existing SEP +// @Description Delete a Surat Eligibilitas Peserta by noSep +// @Tags bpjs +// @Accept json +// @Produce json +// @Param noSep path string true "No SEP" +// @Param user query string true "User" +// @Success 200 {object} models.SepResponse "SEP deleted successfully" +// @Failure 400 {object} gin.H "Invalid request" +// @Failure 500 {object} gin.H "Internal server error" +// @Router /sep/{noSep} [delete] +func (h *SepHandler) DeleteSEP(c *gin.Context) { + noSep := c.Param("noSep") + user := c.Query("user") + if noSep == "" || user == "" { + c.JSON(http.StatusBadRequest, gin.H{"error": "noSep & user required"}) + return + } + + body := models.SepDeleteRequest{} + body.TSep.NoSep = noSep + body.TSep.User = user + + ctx, cancel := context.WithTimeout(c, 30*time.Second) + defer cancel() + + if err := h.service.Delete(ctx, "/SEP/2.0/delete", body); err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"error": "delete failed", "message": err.Error()}) + return + } + + var result map[string]interface{} + c.JSON(http.StatusOK, models.SepResponse{ + Message: "SEP berhasil dihapus", + Data: result, + }) +} + +// GetSEP godoc +// @Summary Get an existing SEP +// @Description Retrieve a Surat Eligibilitas Peserta by noSep +// @Tags bpjs +// @Accept json +// @Produce json +// @Param noSep path string true "No SEP" +// @Success 200 {object} models.SepResponse "Data SEP retrieved successfully" +// @Failure 400 {object} gin.H "Invalid request" +// @Failure 500 {object} gin.H "Internal server error" +// @Router /sep/{noSep} [get] +func (h *SepHandler) GetSEP(c *gin.Context) { + noSep := c.Param("noSep") + if noSep == "" { + c.JSON(http.StatusBadRequest, gin.H{"error": "noSep required"}) + return + } + + ctx, cancel := context.WithTimeout(c, 30*time.Second) + defer cancel() + + endpoint := fmt.Sprintf("/SEP/%s", noSep) + var result map[string]interface{} + if err := h.service.Get(ctx, endpoint, &result); err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"error": "fetch failed", "message": err.Error()}) + return + } + + c.JSON(http.StatusOK, models.SepResponse{ + Message: "Data SEP berhasil diambil", + Data: result, + }) +} diff --git a/internal/helpers/bpjs/lz-string.go b/internal/helpers/bpjs/lz-string.go index 35a85ce..4e4a706 100644 --- a/internal/helpers/bpjs/lz-string.go +++ b/internal/helpers/bpjs/lz-string.go @@ -1,111 +1,46 @@ package helper import ( - "errors" - "math" - "unicode/utf8" + "crypto/aes" + "crypto/cipher" + "crypto/sha256" + "encoding/base64" + "log" + + lzstring "github.com/daku10/go-lz-string" ) -// -// Decompress uri encoded lz-string -// http://pieroxy.net/blog/pages/lz-string/index.html -// https://github.com/pieroxy/lz-string/ -// +func StringDecrypt(key string, encryptedString string) (string, error) { + keyHash := sha256.Sum256([]byte(key)) + keyHashBytes := keyHash[:] -// map of "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$" -var keyStrUriSafe map[byte]int = map[byte]int{74: 9, 78: 13, 83: 18, 36: 64, 109: 38, 114: 43, 116: 45, 101: 30, 45: 63, 73: 8, 81: 16, 113: 42, 49: 53, 50: 54, 54: 58, 76: 11, 100: 29, 107: 36, 121: 50, 77: 12, 89: 24, 105: 34, 66: 1, 69: 4, 85: 20, 48: 52, 119: 48, 117: 46, 120: 49, 52: 56, 56: 60, 110: 39, 112: 41, 70: 5, 71: 6, 79: 14, 88: 23, 97: 26, 102: 31, 103: 32, 67: 2, 118: 47, 65: 0, 68: 3, 72: 7, 108: 37, 51: 55, 57: 61, 82: 17, 90: 25, 98: 27, 115: 44, 122: 51, 53: 57, 86: 21, 106: 35, 111: 40, 55: 59, 43: 62, 75: 10, 80: 15, 84: 19, 87: 22, 99: 28, 104: 33} + iv := keyHashBytes[:16] -type dataStruct struct { - input string - val int - position int - index int - dictionary []string - enlargeIn float64 - numBits int + encryptedBytes, err := base64.StdEncoding.DecodeString(encryptedString) + if err != nil { + return "", err + } + + block, err := aes.NewCipher(keyHashBytes) + if err != nil { + return "", err + } + + mode := cipher.NewCBCDecrypter(block, iv) + + decrypted := make([]byte, len(encryptedBytes)) + mode.CryptBlocks(decrypted, encryptedBytes) + + decrypted = RemovePKCS7Padding(decrypted) + + dataResp, err := lzstring.DecompressFromEncodedURIComponent(string(decrypted)) + if err != nil { + log.Fatalf("Error decompress: %v", err) + } + return dataResp, nil } -func getBaseValue(char byte) int { - return keyStrUriSafe[char] +func RemovePKCS7Padding(data []byte) []byte { + paddingLength := int(data[len(data)-1]) + return data[:len(data)-paddingLength] } - -// Input is composed of ASCII characters, so accessing it by array has no UTF-8 pb. -func readBits(nb int, data *dataStruct) int { - result := 0 - power := 1 - for i := 0; i < nb; i++ { - respB := data.val & data.position - data.position = data.position / 2 - if data.position == 0 { - data.position = 32 - data.val = getBaseValue(data.input[data.index]) - data.index += 1 - } - if respB > 0 { - result |= power - } - power *= 2 - } - return result -} - -func appendValue(data *dataStruct, str string) { - data.dictionary = append(data.dictionary, str) - data.enlargeIn -= 1 - if data.enlargeIn == 0 { - data.enlargeIn = math.Pow(2, float64(data.numBits)) - data.numBits += 1 - } -} - -func getString(last string, data *dataStruct) (string, bool, error) { - c := readBits(data.numBits, data) - switch c { - case 0: - str := string(readBits(8, data)) - appendValue(data, str) - return str, false, nil - case 1: - str := string(readBits(16, data)) - appendValue(data, str) - return str, false, nil - case 2: - return "", true, nil - } - if c < len(data.dictionary) { - return data.dictionary[c], false, nil - } - if c == len(data.dictionary) { - return concatWithFirstRune(last, last), false, nil - } - return "", false, errors.New("Bad character encoding.") -} - -// Need to handle UTF-8, so we need to use rune to concatenate -func concatWithFirstRune(str string, getFirstRune string) string { - r, _ := utf8.DecodeRuneInString(getFirstRune) - return str + string(r) -} - -func DecompressFromEncodedUriComponent(input string) (string, error) { - data := dataStruct{input, getBaseValue(input[0]), 32, 1, []string{"0", "1", "2"}, 5, 2} - - result, isEnd, err := getString("", &data) - if err != nil || isEnd { - return result, err - } - last := result - data.numBits += 1 - for { - str, isEnd, err := getString(last, &data) - if err != nil || isEnd { - return result, err - } - - result = result + str - appendValue(&data, concatWithFirstRune(last, str)) - last = str - } - - return "", errors.New("Unexpected end of buffer reached.") -} \ No newline at end of file diff --git a/internal/models/bpjs/vclaim/sep.go b/internal/models/bpjs/vclaim/sep.go new file mode 100644 index 0000000..d381cd0 --- /dev/null +++ b/internal/models/bpjs/vclaim/sep.go @@ -0,0 +1,135 @@ +package models + +// ==== REQUEST ==== + +type SepPostRequest struct { + TSep TSepPost `json:"t_sep" binding:"required"` +} + +type TSepPost struct { + NoKartu string `json:"noKartu" binding:"required"` + TglSep string `json:"tglSep" binding:"required"` // yyyy-MM-dd + PpkPelayanan string `json:"ppkPelayanan" binding:"required"` + JnsPelayanan string `json:"jnsPelayanan" binding:"required"` + KlsRawat KlsRawatPost `json:"klsRawat" binding:"required"` + NoMR string `json:"noMR" binding:"required"` + Rujukan Rujukan `json:"rujukan" binding:"required"` + Catatan string `json:"catatan"` + DiagAwal string `json:"diagAwal" binding:"required"` + Poli Poli `json:"poli" binding:"required"` + Cob Flag `json:"cob" binding:"required"` + Katarak Flag `json:"katarak" binding:"required"` + Jaminan Jaminan `json:"jaminan" binding:"required"` + TujuanKunj string `json:"tujuanKunj"` + FlagProcedure string `json:"flagProcedure"` + KdPenunjang string `json:"kdPenunjang"` + AssesmentPel string `json:"assesmentPel"` + Skdp Skdp `json:"skdp" binding:"required"` + DpjpLayan string `json:"dpjpLayan"` + NoTelp string `json:"noTelp"` + User string `json:"user" binding:"required"` +} + +type KlsRawatPost struct { + KlsRawatHak string `json:"klsRawatHak" binding:"required"` + KlsRawatNaik string `json:"klsRawatNaik"` + Pembiayaan string `json:"pembiayaan"` + PenanggungJawab string `json:"penanggungJawab"` +} + +type Rujukan struct { + AsalRujukan string `json:"asalRujukan" binding:"required"` + TglRujukan string `json:"tglRujukan" binding:"required"` + NoRujukan string `json:"noRujukan" binding:"required"` + PpkRujukan string `json:"ppkRujukan" binding:"required"` +} + +type Poli struct { + Tujuan string `json:"tujuan"` + Eksekutif string `json:"eksekutif" binding:"required"` +} + +type Flag struct { + Flag string `json:"cob,omitempty" json:"katarak,omitempty" binding:"required"` +} + +type Jaminan struct { + LakaLantas string `json:"lakaLantas" binding:"required"` + NoLP string `json:"noLP"` + Penjamin Penjamin `json:"penjamin"` +} + +type Penjamin struct { + TglKejadian string `json:"tglKejadian"` + Keterangan string `json:"keterangan"` + Suplesi Suplesi `json:"suplesi"` +} + +type Suplesi struct { + Suplesi string `json:"suplesi"` + NoSepSuplesi string `json:"noSepSuplesi"` + LokasiLaka LokasiLaka `json:"lokasiLaka"` +} + +type LokasiLaka struct { + KdPropinsi string `json:"kdPropinsi"` + KdKabupaten string `json:"kdKabupaten"` + KdKecamatan string `json:"kdKecamatan"` +} + +type Skdp struct { + NoSurat string `json:"noSurat" binding:"required"` + KodeDPJP string `json:"kodeDPJP" binding:"required"` +} + +// ==== UPDATE ==== + +type SepPutRequest struct { + TSep TSepPut `json:"t_sep" binding:"required"` +} + +type TSepPut struct { + NoSep string `json:"noSep" binding:"required"` + KlsRawat KlsRawatPut `json:"klsRawat"` + NoMR string `json:"noMR"` + Catatan string `json:"catatan"` + DiagAwal string `json:"diagAwal"` + Poli Poli `json:"poli"` + Cob Flag `json:"cob"` + Katarak Flag `json:"katarak"` + Jaminan Jaminan `json:"jaminan"` + DpjpLayan string `json:"dpjpLayan"` + NoTelp string `json:"noTelp"` + User string `json:"user" binding:"required"` +} + +type KlsRawatPut struct { + KlsRawatHak string `json:"klsRawatHak"` + KlsRawatNaik string `json:"klsRawatNaik"` + Pembiayaan string `json:"pembiayaan"` + PenanggungJawab string `json:"penanggungJawab"` +} + +// ==== DELETE ==== + +type SepDeleteRequest struct { + TSep struct { + NoSep string `json:"noSep" binding:"required"` + User string `json:"user" binding:"required"` + } `json:"t_sep" binding:"required"` +} + +// ==== RESPONSE ==== + +type SepResponse struct { + Message string `json:"message"` + Data map[string]interface{} `json:"data,omitempty"` +} + +type SepRawResponse struct { + MetaData struct { + Code string `json:"code"` + Message string `json:"message"` + } `json:"metaData"` + Response interface{} `json:"response"` +} diff --git a/internal/routes/v1/routes.go b/internal/routes/v1/routes.go index c4f3278..1365261 100644 --- a/internal/routes/v1/routes.go +++ b/internal/routes/v1/routes.go @@ -53,8 +53,8 @@ func RegisterRoutes(cfg *config.Config) *gin.Engine { v1.POST("/token/generate-direct", tokenHandler.GenerateTokenDirect) // BPJS endpoints - // bpjsPesertaHandler := bpjsPesertaHandlers.NewPesertaHandler(cfg.Bpjs) - // v1.GET("/bpjs/peserta/nik/:nik/tglSEP/:tglSEP", bpjsPesertaHandler.GetPesertaByNIK) + bpjsPesertaHandler := bpjsPesertaHandlers.NewPesertaHandler(cfg.Bpjs) + v1.GET("/bpjs/peserta/nik/:nik/tglSEP/:tglSEP", bpjsPesertaHandler.GetPesertaByNIK) // ============================================================================= // PROTECTED ROUTES (Authentication Required) @@ -79,11 +79,11 @@ func RegisterRoutes(cfg *config.Config) *gin.Engine { } // BPJS endpoints (sensitive data - should be protected) - bpjsPesertaHandler := bpjsPesertaHandlers.NewPesertaHandler(cfg.Bpjs) - protectedBpjs := protected.Group("/bpjs") - { - protectedBpjs.GET("/peserta/nik/:nik/tglsep/:tglSEP", bpjsPesertaHandler.GetPesertaByNIK) - } + // bpjsPesertaHandler := bpjsPesertaHandlers.NewPesertaHandler(cfg.Bpjs) + // protectedBpjs := protected.Group("/bpjs") + // { + // protectedBpjs.GET("/peserta/nik/:nik/tglSEP/:tglSEP", bpjsPesertaHandler.GetPesertaByNIK) + // } return router } diff --git a/internal/services/bpjs/response.go b/internal/services/bpjs/response.go index 8134949..c169a2c 100644 --- a/internal/services/bpjs/response.go +++ b/internal/services/bpjs/response.go @@ -7,28 +7,22 @@ import ( "crypto/sha256" "encoding/base64" "errors" - "fmt" + + lzstring "github.com/daku10/go-lz-string" ) // ResponseVclaim decrypts the encrypted response from VClaim API func ResponseVclaim(encrypted string, key string) (string, error) { - if encrypted == "" { - return "", errors.New("encrypted response is empty") - } - - if key == "" { - return "", errors.New("decryption key is empty") - } - cipherText, err := base64.StdEncoding.DecodeString(encrypted) if err != nil { - return "", fmt.Errorf("failed to decode base64: %w", err) + return "", err } hash := sha256.Sum256([]byte(key)) + block, err := aes.NewCipher(hash[:]) if err != nil { - return "", fmt.Errorf("failed to create cipher: %w", err) + return "", err } if len(cipherText) < aes.BlockSize { @@ -36,23 +30,20 @@ func ResponseVclaim(encrypted string, key string) (string, error) { } iv := hash[:aes.BlockSize] + if len(cipherText)%aes.BlockSize != 0 { return "", errors.New("cipherText is not a multiple of the block size") } mode := cipher.NewCBCDecrypter(block, iv) mode.CryptBlocks(cipherText, cipherText) - - // Unpad the decrypted data - cipherText, err = helper.Unpad(cipherText, aes.BlockSize) - if err != nil { - return "", fmt.Errorf("failed to unpad: %w", err) - } - // Decompress the data - data, err := helper.DecompressFromEncodedUriComponent(string(cipherText)) + // cipherText, _ = pkcs7.Unpad(cipherText, aes.BlockSize) + cipherText = helper.RemovePKCS7Padding(cipherText) + data, err := lzstring.DecompressFromEncodedURIComponent(string(cipherText)) + // data, err := helper.DecompressFromEncodedUriComponent(string(cipherText)) if err != nil { - return "", fmt.Errorf("failed to decompress: %w", err) + return "", err } return data, nil diff --git a/internal/utils/sep b/internal/utils/sep new file mode 100644 index 0000000..3c721dd --- /dev/null +++ b/internal/utils/sep @@ -0,0 +1,220 @@ + [ + "t_sep" => [ + "noKartu" => $data['noKartu'], + "tglSep" => $data['tglSep'], + "ppkPelayanan" => $data['ppkPelayanan'], + "jnsPelayanan" => $data['jnsPelayanan'], + "klsRawat" => [ + "klsRawatHak" => $data['klsRawatHak'], + "klsRawatNaik" => $data['klsRawatNaik'], + "pembiayaan" => $data['pembiayaan'], + "penanggungJawab" => $data['penanggungJawab'] + ], + "noMR" => $data['noMR'], + "rujukan" => [ + "asalRujukan" => $data['asalRujukan'], + "tglRujukan" => $data['tglRujukan'], + "noRujukan" => $data['noRujukan'], + "ppkRujukan" => $data['ppkRujukan'] + ], + "catatan" => $data['catatan'], + "diagAwal" => $data['diagAwal'], + "poli" => [ + "tujuan" => $data['tujuan'], + "eksekutif" => $data['eksekutif'] + ], + "cob" => [ + "cob" => $data['cob'] + ], + "katarak" => [ + "katarak" => $data['katarak'] + ], + "jaminan" => [ + "lakaLantas" => $data['lakaLantas'], + "noLP" => $data['noLP'], + "penjamin" => [ + "tglKejadian" => $data['tglKejadian'], + "keterangan" => $data['keterangan'], + "suplesi" => [ + "suplesi" => $data['suplesi'], + "noSepSuplesi" => $data['noSepSuplesi'], + "lokasiLaka" => [ + "kdPropinsi" => $data['kdPropinsi'], + "kdKabupaten" => $data['kdKabupaten'], + "kdKecamatan" => $data['kdKecamatan'] + ] + ] + ] + ], + "tujuanKunj" => $data['tujuanKunj'], + "flagProcedure" => $data['flagProcedure'], + "kdPenunjang" => $data['kdPenunjang'], + "assesmentPel" => $data['assesmentPel'], + "skdp" => [ + "noSurat" => $data['noSurat'], + "kodeDPJP" => $data['kodeDPJP'] + ], + "dpjpLayan" => $data['dpjpLayan'], + "noTelp" => $data['noTelp'], + "user" => $data['user'] + ] + ] + ]; + } +} +if (!function_exists('formUpdateData')) { + + + function formUpdateData($data = []) + { + return [ + "request" => [ + "t_sep" => [ + "noSep" => $data['noSep'], + "klsRawat" => [ + "klsRawatHak" => $data['klsRawatHak'], + "klsRawatNaik" => $data['klsRawatNaik'], + "pembiayaan" => $data['pembiayaan'], + "penanggungJawab" => $data['penanggungJawab'] + ], + "noMR" => $data['noMR'], + "catatan" => $data['catatan'], + "diagAwal" => $data['diagAwal'], + "poli" => [ + "tujuan" => $data['tujuan'], + "eksekutif" => $data['eksekutif'] + ], + "cob" => [ + "cob" => $data['cob'] + ], + "katarak" => [ + "katarak" => $data['katarak'] + ], + "jaminan" => [ + "lakaLantas" => $data['lakaLantas'], + "penjamin" => [ + "tglKejadian" => $data['tglKejadian'], + "keterangan" => $data['keterangan'], + "suplesi" => [ + "suplesi" => $data['suplesi'], + "noSepSuplesi" => $data['noSepSuplesi'], + "lokasiLaka" => [ + "kdPropinsi" => $data['kdPropinsi'], + "kdKabupaten" => $data['kdKabupaten'], + "kdKecamatan" => $data['kdKecamatan'] + ] + ] + ] + ], + "dpjpLayan" => $data['dpjpLayan'], + "noTelp" => $data['noTelp'], + "user" => $data['user'] + ] + ] + ]; + } +} +if (!function_exists('formDeleteData')) { + function formDeleteData($data = []) + { + return [ + "request" => [ + "t_sep" => [ + "noSep" => $data['noSep'], + "user" => $data['user'] + ] + ] + ]; + } +} +if (!function_exists('formPengajuanData')) { + function formPengajuanData($data = []) + { + return [ + "request" => [ + "t_sep" => [ + "noKartu" => $data['noKartu'], + "tglSep" => $data['tglSep'], + "jnsPelayanan" => $data['jnsPelayanan'], + "jnsPengajuan" => $data['jnsPengajuan'], + "keterangan" => $data['keterangan'], + "user" => $data['user'] + ] + ] + ]; + } +} +if (!function_exists('formAprovalPengajuanData')) { + function formAprovalPengajuanData($data = []) + { + return [ + "request" => [ + "t_sep" => [ + "noKartu" => $data['noKartu'], + "tglSep" => $data['tglSep'], + "jnsPelayanan" => $data['jnsPelayanan'], + "jnsPengajuan" => $data['jnsPengajuan'], + "keterangan" => $data['keterangan'], + "user" => $data['user'] + ] + ] + ]; + } +} +if (!function_exists('formTanggalPulangData')) { + function formTanggalPulangData($data = []) + { + return [ + "request" => [ + "t_sep" => [ + "noSep" => $data['noSep'], + "statusPulang" => $data['statusPulang'], + "noSuratMeninggal" => $data['noSuratMeninggal'], + "tglMeninggal" => $data['tglMeninggal'], + "tglPulang" => $data['tglPulang'], + "noLPManual" => $data['noLPManual'], + "user" => $data['user'] + ] + ] + ]; + } +} +if (!function_exists('formDeleteSepinternalData')) { + function formDeleteSepinternalData($data = []) + { + return [ + "request" => [ + "t_sep" => [ + "noSep" => $data['noSep'], + "noSurat" => $data['noSurat'], + "tglRujukanInternal" => $data['tglRujukanInternal'], + "kdPoliTuj" => $data['kdPoliTuj'], + "user" => $data['user'] + ] + ] + ]; + } +} +if (!function_exists('formRandomAnswerData')) { + function formRandomAnswerData($data = []) + { + return [ + "request" => [ + "t_sep" => [ + "noKartu" => $data['noKartu'], + "tglSep" => $data['tglSep'], + "jenPel" => $data['jenPel'], + "ppkPelSep" => $data['ppkPelSep'], + "tglLahir" => $data['tglLahir'], + "ppkPst" => $data['ppkPst'], + "user" => $data['user'] + ] + ] + ]; + } +}