Files
chis_osi/osi/codes.go
T

49 lines
1.2 KiB
Go
Raw Normal View History

package osi
import (
"fmt"
"strings"
)
const (
ServiceIDJKDACreate = "JKDA00001"
ServiceIDJKDAFind = "JKDA00002"
ServiceIDJKDAUpdate = "JKDA00003"
ServiceIDJKDAFindRqbj = "JKDA00005"
ServiceIDGridAddress = "WGDZ00001"
ServiceIDDoctors = "ZRYS00001"
ServiceIDDrugs = "YPML00001"
ServiceIDOrgs = "CXJG00002"
)
const codeRetryableTimeout = "405"
var servicePaths = map[string]string{
ServiceIDJKDACreate: "/jkda/create",
ServiceIDJKDAFind: "/auto/jkda/find",
ServiceIDJKDAUpdate: "/jkda/update",
ServiceIDJKDAFindRqbj: "/jkda/findrqbj",
ServiceIDGridAddress: "/auto/wgdzcx/query",
ServiceIDDoctors: "/auto/zryscx/query",
ServiceIDDrugs: "/auto/ypmlcx/query",
ServiceIDOrgs: "/auto/cxjg/query",
}
func PathOf(serviceID string) (string, error) {
path, ok := servicePaths[serviceID]
if !ok {
return "", fmt.Errorf("unknown serviceId %q", serviceID)
}
return path, nil
}
func IsSuccessCode(code string) bool {
code = strings.TrimSpace(code)
code = strings.TrimLeft(code, "0")
return code == "1"
}
func IsRetryableCode(code string) bool {
return strings.TrimSpace(code) == codeRetryableTimeout
}