Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

数组合并处理方法 #68

Open
gaowei1012 opened this issue Jan 15, 2021 · 0 comments
Open

数组合并处理方法 #68

gaowei1012 opened this issue Jan 15, 2021 · 0 comments

Comments

@gaowei1012
Copy link
Owner

数组合并处理方法

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)
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant