· 9 years ago · Nov 07, 2016, 06:34 AM
1package app.thinkon.com.models.dbtool.dao;
2
3import android.content.Context;
4import android.database.sqlite.SQLiteDatabase;
5
6import app.thinkon.com.models.dbtool.BaseDAO;
7import app.thinkon.com.models.dbtool.DAO;
8
9/**
10 * Created by Administrator on 2016/10/26.
11 */
12
13public class HE_QuestionExamItem extends BaseDAO implements DAO {
14
15 // è¡¨æ ¼å稱
16 public static final String TABLE_NAME = "he_questionexamitem";
17 // è¡¨æ ¼æ¬„ä½å稱
18 public static final String KEY_ID = "_id";
19 public static final String QUESLIST = "queslist";
20 public static final String QUESINDEX = "quesindex";
21 public static final String ANSWER = "answer";
22 public static final String HEALTHWARNINGS = "healthwarnings";
23 public static final String RISKFACTORS = "riskfactors";
24 public static final String SCORE = "score";
25 public static final String ANSWERJUMP = "answerjump";
26 public static final String DISABLESTATE = "disablestate";
27 public static final String CREATOR = "creator";
28 public static final String CREATIONTIME = "creationtime";
29 public static final String MODIFIER = "modifier";
30 public static final String MODIFIEDTIME = "modifiedtime";
31 public static final String SITEID = "siteid";
32 public static final String SITENAME = "sitename";
33 public static final String DEF1 = "def1";
34 public static final String DEF2 = "def2";
35
36 public static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS " + getTableName() + " (" +
37 getKeyId() + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
38 QUESLIST + " TEXT NOT NULL, " +
39 QUESINDEX + " TEXT NOT NULL, " +
40 ANSWER + " TEXT NOT NULL, " +
41 HEALTHWARNINGS + " TEXT NOT NULL, " +
42 RISKFACTORS + " TEXT NOT NULL, " +
43 SCORE + " INTEGER, " +
44 ANSWERJUMP + " TEXT, " +
45 DISABLESTATE + " TEXT, " +
46 CREATOR + " TEXT, " +
47 CREATIONTIME + " DATETIME , " +
48 MODIFIER + " TEXT, " +
49 MODIFIEDTIME + " DATETIME, " +
50 SITEID + " TEXT, " +
51 SITENAME + " TEXT, " +
52 DEF1 + " TEXT, " +
53 DEF2 + " TEXT)";
54
55 public static final String DROP_TABLE = "DROP TABLE IF EXISTS " + TABLE_NAME;
56
57 public HE_QuestionExamItem(Context context) {
58 super(context);
59 ini();
60 }
61
62 public HE_QuestionExamItem(SQLiteDatabase sqLiteDatabase) {
63 super(sqLiteDatabase);
64 ini();
65 }
66
67 private void ini() {
68 setTableName(TABLE_NAME);
69 setKeyId(KEY_ID);
70 setCreateTable(CREATE_TABLE);
71 setDropTable(DROP_TABLE);
72 }
73
74 @Override
75 public void buildSchema() {
76 db.execSQL(getCreateTable());
77 if (getCount() == 0) {
78 String sql="INSERT INTO "+ getTableName() +" VALUES ( null, ?, ?, ?, ?,?,?,?,'F','SYS',datetime('NOW'),null,null,null,null,null,null)";
79 /*db.execSQL(sql,new String[]{"HealthQ1","7","有","","","10","8"});
80 db.execSQL(sql,new String[]{"HealthQ1","7","沒有","","","6","9"});
81 db.execSQL(sql,new String[]{"HealthQ1","8","*","","","0","10"});*/
82
83 db.execSQL(sql,new String[]{"HealthQ2","1","亞裔美國人","RI-R001(1)@@@Y1BG001","","1","-1"});
84 db.execSQL(sql,new String[]{"HealthQ2","1","拉ä¸ç¾Žæ´²","RI-R001(1)@@@Y1BG001","","1","-1"});
85 db.execSQL(sql,new String[]{"HealthQ2","1","美國土著","RI-R001(1)@@@Y1BG001","","1","-1"});
86 db.execSQL(sql,new String[]{"HealthQ2","1","太平洋島居民","RI-R001(1)@@@Y1BG001","","1","-1"});
87 db.execSQL(sql,new String[]{"HealthQ2","1","ä¸åœ‹è¯äºº","RI-R001(1)@@@Y1BG001","","0","-1"});
88 db.execSQL(sql,new String[]{"HealthQ2","1","其它","RI-R001(1)@@@Y1BG001","","0","-1"});
89
90 for(int i = 2;i<17;i++) {
91 db.execSQL(sql, new String[]{"HealthQ2", "" + i, "是", "", "", "1", "-1"});
92 db.execSQL(sql, new String[]{"HealthQ2", "" + i, "å¦", "", "", "0", "-1"});
93 }
94
95
96 db.execSQL(sql,new String[]{"HealthQ1","1","是","","","10","-1"});
97 db.execSQL(sql,new String[]{"HealthQ1","1","å¦","","","6","-1"});
98 db.execSQL(sql,new String[]{"HealthQ1","2","是","","","10","-1"});
99 db.execSQL(sql,new String[]{"HealthQ1","2","å¦","","","6","-1"});
100
101 db.execSQL(sql,new String[]{"HealthQ1","3","經常æ”å–éŽé‡","","","10","-1"});
102 db.execSQL(sql,new String[]{"HealthQ1","3","å¶çˆ¾æ”å–éŽé‡","","","8","-1"});
103 db.execSQL(sql,new String[]{"HealthQ1","3","é©ä¸","","","6","-1"});
104 db.execSQL(sql,new String[]{"HealthQ1","3","å¶çˆ¾æ”å–ä¸è¶³","","","4","-1"});
105 db.execSQL(sql,new String[]{"HealthQ1","3","經常æ”å–ä¸è¶³","","","2","-1"});
106
107 db.execSQL(sql,new String[]{"HealthQ1","5","æ¯å¤©é£Ÿç”¨ï¼“種以上補充å“","","","10","-1"});
108 db.execSQL(sql,new String[]{"HealthQ1","5","æ¯å¤©é£Ÿç”¨ï¼‘~2種","","","8","-1"});
109 db.execSQL(sql,new String[]{"HealthQ1","5","å¶çˆ¾é£Ÿç”¨","","","6","-1"});
110 db.execSQL(sql,new String[]{"HealthQ1","5","從ä¸é£Ÿç”¨","","","4","-1"});
111 db.execSQL(sql,new String[]{"HealthQ1","5","其它","","","2","-1"});
112
113 db.execSQL(sql,new String[]{"HealthQ1","7","有","","","10","8"});
114 db.execSQL(sql,new String[]{"HealthQ1","7","沒有","","","6","9"});
115
116 db.execSQL(sql,new String[]{"HealthQ1","8","是","","","10","10"});
117 db.execSQL(sql,new String[]{"HealthQ1","8","å¦","","","6","10"});
118
119 db.execSQL(sql,new String[]{"HealthQ1","10","是","","","10","-1"});
120 db.execSQL(sql,new String[]{"HealthQ1","10","å¦","","","6","-1"});
121
122 db.execSQL(sql,new String[]{"HealthQ1","11","幾乎æ¯å¤©æœ‰æ˜Žé¡¯å¾µå…†","","","10","-1"});
123 db.execSQL(sql,new String[]{"HealthQ1","11","å¶çˆ¾æœ‰å¾µå…†","","","8","-1"});
124 db.execSQL(sql,new String[]{"HealthQ1","11","無明顥徵兆","","","6","-1"});
125 db.execSQL(sql,new String[]{"HealthQ1","11","完全無徵兆","","","4","-1"});
126 db.execSQL(sql,new String[]{"HealthQ1","11","ä¸é©ç”¨","","","2","-1"});
127 }
128 }
129}