123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617 |
- package idc_test
- import (
- "encoding/json"
- "fmt"
- "testing"
- "gogs.uu.mdfitnesscao.com/cuiguohai/sdk"
- "gogs.uu.mdfitnesscao.com/cuiguohai/sdk/idc"
- "gogs.uu.mdfitnesscao.com/cuiguohai/sdk/utils"
- )
- func TestList(t *testing.T) {
- t.Run("test", func(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.mdfitnesscao.com",
- AppDebug: true,
- })
- var jsonStr = `
- {
- "result":{
- "assessmentDate":"2023-09-18",
- "calErr":null,
- "debugInfo":null,
- "examDate":1693152000,
- "majorDisease":[
- {
-
- "name":"乳腺癌",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["乳腺彩超"],
- "riskDegree":1,
- "riskDesc":"低风险",
- "classification":1,
- "department":["乳腺外科"],
- "followUpTime":"每年",
- "abnormalDatas":null,
- "knownFactors":[
- {
- "diseaseRelationName":[
- "双侧乳腺囊性占位性病变",
- "C-BI-RADS分类:2类"
- ],
- "itemName":"乳房",
- "mark":1,
- "value":[
- "双侧乳腺囊性占位性病变",
- "C-BI-RADS分类:2类"
- ]
- }
- ],
- "medDatas":null
- },
- {
-
- "name":"肺癌",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["胸部CT"],
- "riskDegree":0,
- "riskDesc":"无法评估",
- "classification":1,
- "department":["呼吸内科"],
- "followUpTime":"近期",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- },
- {
-
- "name":"结直肠癌",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["肠镜","粪便隐血试验"],
- "riskDegree":0,
- "riskDesc":"无法评估",
- "classification":1,
- "department":["消化内科"],
- "followUpTime":"近期",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- },
- {
-
- "name":"甲状腺癌",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["甲状腺功能"],
- "riskDegree":0,
- "riskDesc":"无法评估",
- "classification":1,
- "department":["内分泌科"],
- "followUpTime":"近期",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- },
- {
-
- "name":"胃癌",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["胃镜"],
- "riskDegree":0,
- "riskDesc":"无法评估",
- "classification":1,
- "department":["消化内科"],
- "followUpTime":"近期",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- },
- {
-
- "name":"宫颈癌",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["TCT检查","HPV检查"],
- "riskDegree":1,
- "riskDesc":"低风险",
- "classification":1,
- "department":["妇科"],
- "followUpTime":"每年",
- "abnormalDatas":null,
- "knownFactors":[
- {
- "diseaseRelationName":[
- "宫颈潴留囊肿"
-
- ],
- "itemName":"宫颈",
- "mark":1,
- "value":[
- "宫颈潴留囊肿"
-
- ]
- }
- ],
- "medDatas":null
- },
- {
-
- "name":"肝癌",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["肝脏彩超/腹部彩超"],
- "riskDegree":1,
- "riskDesc":"低风险",
- "classification":1,
- "department":["消化内科"],
- "followUpTime":"每年",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- },
- {
-
- "name":"子宫内膜癌",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["子宫附件彩超"],
- "riskDegree":1,
- "riskDesc":"低风险",
- "classification":1,
- "department":["妇科"],
- "followUpTime":"每年",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- },
- {
-
- "name":"食管癌",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["食管内镜/胃镜"],
- "riskDegree":0,
- "riskDesc":"无法评估",
- "classification":1,
- "department":["消化内科"],
- "followUpTime":"近期",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- },
- {
-
- "name":"卵巢癌",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["子宫附件彩超"],
- "riskDegree":1,
- "riskDesc":"低风险",
- "classification":1,
- "department":["妇科"],
- "followUpTime":"每年",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- },
- {
-
- "name":"肾癌",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["肾脏彩超","尿常规"],
- "riskDegree":1,
- "riskDesc":"低风险",
- "classification":1,
- "department":["肾内科"],
- "followUpTime":"每年",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- },
- {
-
- "name":"胰腺癌",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["胰腺彩超"],
- "riskDegree":1,
- "riskDesc":"低风险",
- "classification":1,
- "department":["消化内科"],
- "followUpTime":"每年",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- },
- {
-
- "name":"高血压",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["血压检查","一般检查","同型半胱氨酸检查","心脏彩超"],
- "riskDegree":1,
- "riskDesc":"低风险",
- "classification":3,
- "department":["心血管内科"],
- "followUpTime":"每年",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- },
- {
-
- "name":"血脂异常",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["血脂检查","一般检查"],
- "riskDegree":1,
- "riskDesc":"低风险",
- "classification":3,
- "department":["心血管内科"],
- "followUpTime":"每年",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- },
- {
-
- "name":"心律失常",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["心电图"],
- "riskDegree":1,
- "riskDesc":"低风险",
- "classification":3,
- "department":["心血管内科"],
- "followUpTime":"每年",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- },
- {
-
- "name":"慢性阻塞性肺疾病",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["肺功能"],
- "riskDegree":0,
- "riskDesc":"无法评估",
- "classification":3,
- "department":["呼吸内科"],
- "followUpTime":"近期",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- },
- {
-
- "name":"慢性胃炎",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["胃镜","幽门螺杆菌检查","胃蛋白酶原I","胃蛋白酶原II","胃蛋白酶原比值","胃泌素17"],
- "riskDegree":0,
- "riskDesc":"无法评估",
- "classification":3,
- "department":["消化内科"],
- "followUpTime":"近期",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- },
- {
-
- "name":"慢性乙型病毒性肝炎",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["乙肝两对半"],
- "riskDegree":0,
- "riskDesc":"无法评估",
- "classification":3,
- "department":["消化内科"],
- "followUpTime":"近期",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- },
- {
-
- "name":"肝硬化",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["乙肝两对半","乙肝DNA定量检测","甲胎蛋白","肝脏彩超","肝功能"],
- "riskDegree":1,
- "riskDesc":"低风险",
- "classification":3,
- "department":["消化内科"],
- "followUpTime":"每年",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- },
- {
-
- "name":"糖尿病",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["糖化血红蛋白","糖化血清蛋白","餐后血糖","尿常规"],
- "riskDegree":0,
- "riskDesc":"无法评估",
- "classification":3,
- "department":["内分泌科"],
- "followUpTime":"近期",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- },
- {
-
- "name":"肾功能损伤",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["肾功能检查","尿微量白蛋白","肾脏彩超","尿常规"],
- "riskDegree":1,
- "riskDesc":"低风险",
- "classification":3,
- "department":["肾内科"],
- "followUpTime":"每年",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- },
- {
-
- "name":"骨质疏松",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["骨密度检查"],
- "riskDegree":0,
- "riskDesc":"无法评估",
- "classification":3,
- "department":["内分泌科"],
- "followUpTime":"近期",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- },
- {
-
- "name":"冠心病",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["血压检查","血脂检查","空腹血糖检查","糖化血清蛋白","糖化血红蛋白","颈动脉彩超"],
- "riskDegree":1,
- "riskDesc":"低风险",
- "classification":2,
- "department":["心血管内科"],
- "followUpTime":"每年",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- },
- {
-
- "name":"脑卒中",
- "nodeId":"4:b8fbfa26-3437-4bbb-8349-96abd14851ea:633",
- "notificationTime":"365",
- "recommendItems":["血压检查","血脂检查","空腹血糖检查","颈动脉彩超","颅脑CT","颅脑MRI"],
- "riskDegree":1,
- "riskDesc":"低风险",
- "classification":2,
- "department":["心血管内科"],
- "followUpTime":"每年",
- "abnormalDatas":null,
- "knownFactors":null,
- "medDatas":null
- }
-
-
- ],
- "reportConfig":{
- "reportCancerCfg":{
- "sectionContent":[
- {
- "note":"",
- "rank":1,
- "title":"您的疾病与主要风险因素"
- },
- {
- "note":"",
- "rank":2,
- "title":"疾病风险评估及建议"
- },
- {
- "note":"",
- "rank":3,
- "title":"该板块疾病主要风险因素及建议"
- },
- {
- "note":"",
- "rank":4,
- "title":"相关数据结果汇总"
- }
- ],
- "sectionName":"肿瘤风险评估"
- },
- "reportCardiovascularCfg":{
- "sectionContent":[
- {
- "note":"",
- "rank":1,
- "title":"您的疾病与主要风险因素"
- },
- {
- "note":"",
- "rank":2,
- "title":"疾病风险评估及建议"
- },
- {
- "note":"",
- "rank":3,
- "title":"该板块疾病主要风险因素及建议"
- },
- {
- "note":"",
- "rank":4,
- "title":"相关数据结果汇总"
- }
- ],
- "sectionName":"急性心脑血管事件风险评估"
- },
- "reportPersonaliseCfg":{
- "sectionContent":[
- {
- "note":"",
- "rank":2,
- "title":"疾病风险评估及建议"
- },
- {
- "note":"",
- "rank":3,
- "title":"该板块疾病主要风险因素及建议"
- },
- {
- "note":"",
- "rank":4,
- "title":"相关数据结果汇总"
- }
- ],
- "sectionName":"个性化疾病风险评估"
- },
- "reportPreviewCfg":{
- "sectionContent":[
- {
- "note":"本版块的疾病需要您高度重视,因为他们已经开始或者很快就会开始对您的身体造成严重的伤害,需要您尽快至医院治疗,减少伤害,降低经济损失。注意,进一步的检查项目有助于更详细的知晓您的身体状况,更准确的评估疾病的风险。",
- "rank":1,
- "title":"建议立即或尽快就医"
- },
- {
- "note":"本版块的疾病需要您密切关注,某些风险因素需要您按照医生建议定期复查,监测他们的变化趋势,同时也要对不良的生化习惯进行调整,降低疾病的发生概率。注意,进一步的检查项目有助于更详细的知晓您的身体状况,更准确的评估疾病的风险。",
- "rank":2,
- "title":"建议近期就医"
- },
- {
- "note":"以下内容是基于您上传的数据整理出的复查建议,请您定期复查,监测您的风险因素变化或者对低风险疾病进行定期复查",
- "rank":3,
- "title":"您的复查建议"
- }
- ],
- "sectionName":"重大疾病风险概览"
- }
- },
- "userInfo":{
- "currentAge":"",
- "examAge":"38",
- "gender":"女",
- "name":"匿名用户"
- }
- },
- "type":2
- }`
- var requestJson map[string]any
- json.Unmarshal([]byte(jsonStr), &requestJson)
- fmt.Println(requestJson)
- response, err := idc.CallbackResult("20230828000004", requestJson)
- if err != nil {
- t.Errorf("err: %v", err)
- }
- t.Logf("推送结果: %v", response)
- })
- }
- func TestGetAllValues(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.mdfitnesscao.com",
- AppDebug: true,
- })
- m, err := idc.GetMedicalData("Ydm62mB8")
- fmt.Println(utils.JsonEncode(m), err)
- // r := m.GetArchivesDataByIndicatorId("4:b8fbfa26-3437-4bbb-8349-96abd14851ea:830")
- // fmt.Println(utils.JsonEncode(r))
- // s := m.GetArchivesDataByQuestionNo("QUshijianxuanze")
- // fmt.Println(utils.JsonEncode(s))
- }
- func TestTotalConfirmByArchivesIds(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.mdfitnesscao.com",
- AppDebug: true,
- })
- m, err := idc.TotalMedicalReportChartsByArchivesIds([]string{"Ydm62mB8", "WNm0dm07", "111"})
- fmt.Println(utils.JsonEncode(m), err)
- // r := m.GetArchivesDataByIndicatorId("4:b8fbfa26-3437-4bbb-8349-96abd14851ea:830")
- // fmt.Println(utils.JsonEncode(r))
- // s := m.GetArchivesDataByQuestionNo("QUshijianxuanze")
- // fmt.Println(utils.JsonEncode(s))
- }
- func TestGetLatestMedicalReportByArchivesId(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.mdfitnesscao.com",
- AppDebug: true,
- })
- m, err := idc.GetLatestMedicalReportByArchivesId("GdJGwYJK")
- fmt.Println(utils.JsonEncode(m), err)
- }
- func TestGetCompareReportByArchivesId(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.mdfitnesscao.com",
- AppDebug: true,
- })
- m, _ := idc.GetCompareReportByArchivesId("GdJGwYJK")
- fmt.Println(utils.JsonEncode(m))
- }
- func TestUpdateArchives(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.mdfitnesscao.com",
- AppDebug: true,
- })
- m, _ := idc.UpdateArchives(&sdk.MedicalDataBindArchivesFormByOpenAPI{
- ArchivesId: "DRzxXazy",
- MedicalDataId: "2024031400040010",
- MechanismId: "Xwlg97rP",
- })
- fmt.Println(utils.JsonEncode(m), "23")
- }
- func TestQueryIndicatorDataByParams(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.mdfitnesscao.com",
- AppDebug: true,
- })
- m, _ := idc.QueryIndicatorDataByParams(&sdk.QueryIDCIndicatorDataQuery{
- ArchivesId: "DRzxXazy",
- QueryData: []*sdk.QueryIDCIndicatorDataQueryData{
- {
- BodyDataId: "4:b8fbfa26-3437-4bbb-8349-96abd14851ea:1142",
- },
- },
- })
- fmt.Println(utils.JsonEncode(m), "23")
- }
- func TestGetArchivesCreatedMapByMemberCardId(t *testing.T) {
- sdk.InitConfig(&sdk.ClientConfig{
- ApiDomain: "https://mcapi.mdfitnesscao.com",
- AppDebug: true,
- })
- m, _ := idc.GetArchivesCreatedMapByMemberCardId(1)
- fmt.Println(utils.JsonEncode(m), "23")
- }
|