- contract/jkda.go 补创建请求结构体(healthRecord + manageInfo + 既往史节点) - osi/jkda.go 新增 CreateHealthRecord/UpdateHealthRecord - osi/codes.go 登记 JKDA00001 create / JKDA00003 update serviceId 与路径 - mapping 映射创建路径(真实字典快照反查主数据) - 代码与单测完成;真实 create 待安全测试档案与写入授权(见 tasks.md T-206 BLOCKED) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
49 lines
1.2 KiB
Go
49 lines
1.2 KiB
Go
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
|
|
}
|