package idc_test import ( "encoding/json" "fmt" "testing" "gogs.uu.mdfitnesscao.com/Algor/sdk" "gogs.uu.mdfitnesscao.com/Algor/sdk/idc" "gogs.uu.mdfitnesscao.com/Algor/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") }