地质所 沉降监测网建设项目
chenhuan
2024-05-16 0fdd42e318f51f9e3c6581473416af1cca69877f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
package com.javaweb.third.baidu.bean.ocr;
 
 
import com.alibaba.fastjson.JSONObject;
import com.javaweb.third.baidu.bean.BaseResult;
 
 
/**
 * 身份证识别结果
 * @author
 */
public class IdCardOcrResult extends BaseResult {
 
    private String image_status;
 
    private String words_result_num;
    private Integer direction;
 
 
    private String name;
    private String ID;
    private String gender;
    private String minZhu;
    private String address;
    private String birthday;
    public IdCardOcrResult(String json){
        this.setJson(json);
        try{
            JSONObject jsonObject= JSONObject.parseObject(json);
            String e_code=jsonObject.getString("error_code");
            if(notNull(e_code)){
                this.setError_code(e_code);
                String e_msg=jsonObject.getString("error_msg");
                this.setError_msg(e_msg);
                this.setRequestOk(false);
            }else {
                this.setRequestOk(true);
                this.setLog_id(jsonObject.getString("log_id"));
                this.image_status=jsonObject.getString("image_status");
                this.words_result_num=jsonObject.getString("words_result_num");
                this.direction=jsonObject.getInteger("direction");
                JSONObject words_result_json=jsonObject.getJSONObject("words_result");
                this.name=words_result_json.getJSONObject("姓名").getString("words");
                this.address=words_result_json.getJSONObject("住址").getString("words");
                this.birthday=words_result_json.getJSONObject("出生").getString("words");
                this.ID=words_result_json.getJSONObject("公民身份号码").getString("words");
                this.gender=words_result_json.getJSONObject("性别").getString("words");
                this.minZhu=words_result_json.getJSONObject("民族").getString("words");
            }
        }catch (Exception ex){
            ex.printStackTrace();
            this.setRequestOk(false);
            this.setError_msg("解析json字符串出现异常!");
        }
    }
    public static IdCardOcrResult create(String jsonStr) {
        return new IdCardOcrResult(jsonStr);
    }
 
    @Override
    public String toString() {
        return "IdCardOcrResult{" +
                "image_status='" + image_status + '\'' +
                ", words_result_num='" + words_result_num + '\'' +
                ", direction=" + direction +
                ", name='" + name + '\'' +
                ", ID='" + ID + '\'' +
                ", gender='" + gender + '\'' +
                ", minZhu='" + minZhu + '\'' +
                ", address='" + address + '\'' +
                ", birthday='" + birthday + '\'' +
                '}';
    }
 
    public String getImage_status() {
        return image_status;
    }
 
    public void setImage_status(String image_status) {
        this.image_status = image_status;
    }
 
    public String getWords_result_num() {
        return words_result_num;
    }
 
    public void setWords_result_num(String words_result_num) {
        this.words_result_num = words_result_num;
    }
 
    public Integer getDirection() {
        return direction;
    }
 
    public void setDirection(Integer direction) {
        this.direction = direction;
    }
 
    public String getName() {
        return name;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
    public String getID() {
        return ID;
    }
 
    public void setID(String ID) {
        this.ID = ID;
    }
 
    public String getGender() {
        return gender;
    }
 
    public void setGender(String gender) {
        this.gender = gender;
    }
 
    public String getMinZhu() {
        return minZhu;
    }
 
    public void setMinZhu(String minZhu) {
        this.minZhu = minZhu;
    }
 
    public String getAddress() {
        return address;
    }
 
    public void setAddress(String address) {
        this.address = address;
    }
 
    public String getBirthday() {
        return birthday;
    }
 
    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }
}