Files
chis_osi/osi/codes.go
T
ilaandClaude Opus 4.8 0e1915fc2b feat(osi): 体检最近一次查询打通(T-301)
- osi.LastHealthCheck(JKTJLSJL00002 /auto/jktjlscx/query)
- contract.HealthCheckSummary 只强类型化定位字段,完整内容走 Result.Raw
- codes.go 登记 JKTJLSJL00002 + JKTJLIST00002 路由
- 单测:路径/解码/Raw 保留/idcard 小写映射/单键校验(脱敏假数据)
- 实测:单查 JKTJ00002 平台未部署;data 为单对象;身份证字段小写 idcard

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 00:45:47 +08:00

56 lines
1.6 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package osi
import (
"fmt"
"strings"
)
const (
ServiceIDJKDACreate = "JKDA00001"
ServiceIDJKDAFind = "JKDA00002"
ServiceIDJKDAUpdate = "JKDA00003"
ServiceIDJKDAFindRqbj = "JKDA00005"
ServiceIDGridAddress = "WGDZ00001"
ServiceIDDoctors = "ZRYS00001"
ServiceIDDrugs = "YPML00001"
ServiceIDOrgs = "CXJG00002"
ServiceIDJKTJLast = "JKTJLSJL00002" // 最近一次体检(实测可用)
ServiceIDJKTJList = "JKTJLIST00002" // 已检/待检人员列表(入参待厂家确认)
// 单条查询 JKTJ00002:docx 标 auto/jktj/query,平台实测"没有url的接口配置"(未部署),
// auto/jktj/find 待确认;确认前不登记路由。见 docs/04 §11、docs/06 B5。
)
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",
ServiceIDJKTJLast: "/auto/jktjlscx/query",
ServiceIDJKTJList: "/auto/jktjlist/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
}