Open gaowei1012 opened 3 years ago
const info = { "username": "主治医师-王医生", "id_number": "01-221", "age": 37, "gender": "男", "hospital": "上海协和医院", "medicine": "999感冒灵颗粒", "quantity": 14, "price": 12.8, "doctor": "王医生", "insurance_number": "0900099-11323", "insurance_coverage": "医院个人身保险", } /// data 这里是 一个 数组对象 for (const i in data) { const arr = {} const structure = data[i].data_structure for (const i in structure) { arr[structure[i].attr_key] = info[structure[i].attr_key] } const temp = { uchain_data_id:data[i].uchain_data_id, data: sm2Utils.encryptData(arr, data[i].userinfo.public_key), user_id: data[i].userinfo.user_id } newArr.push(temp) }
数组合并处理方法