INFO4077 Diabetes_Surveillance_Project/Suep_Native App/Suep/MyApplication/app/src/main/java/com/example/myapplication/DbHandler.java
public ArrayList<HashMap<String, String>> GetUserByUserId(int patientid) {
        SQLiteDatabase db = this.getWritableDatabase();
        ArrayList<HashMap<String, String>> patientList = new ArrayList<>();
        String query = "SELECT * FROM " + TABLE_Patients;
        Cursor cursor = db.query(TABLE_Patients, new String[]{KEY_NAME, KEY_PRENAME, KEY_TELEPHONE, KEY_EMAIL,
                KEY_DOB, KEY_CITY, KEY_QUATER}, KEY_ID + "=?", new String[]{String.valueOf(patientid)}, null, null, null, null);
        if (cursor.moveToNext()) {
            HashMap<String, String> user = new HashMap<>();
            user.put("name", cursor.getString(cursor.getColumnIndex(KEY_NAME)));
            user.put("prename", cursor.getString(cursor.getColumnIndex(KEY_PRENAME)));
            user.put("telephone", cursor.getString(cursor.getColumnIndex(KEY_TELEPHONE)));
            user.put("date of birth", cursor.getString(cursor.getColumnIndex(KEY_DOB)));
            user.put("city", cursor.getString(cursor.getColumnIndex(KEY_CITY)));
            user.put("Quater", cursor.getString(cursor.getColumnIndex(KEY_QUATER)));
            patientList.add(user);
        }
        return patientList;
    }
// Get User Details based on userid

Get User Details based on userid
Get User Details based on userid
public ArrayList<HashMap<String, String>> GetUserByUserId(int patientid) {
        SQLiteDatabase db = this.getWritableDatabase();
        ArrayList<HashMap<String, String>> patientList = new ArrayList<>();
        String query = "SELECT * FROM " + TABLE_Patients;
        Cursor cursor = db.query(TABLE_Patients, new String[]{KEY_NAME, KEY_PRENAME, KEY_TELEPHONE, KEY_EMAIL,
                KEY_DOB, KEY_CITY, KEY_QUATER}, KEY_ID + "=?", new String[]{String.valueOf(patientid)}, null, null, null, null);
        if (cursor.moveToNext()) {
            HashMap<String, String> user = new HashMap<>();
            user.put("name", cursor.getString(cursor.getColumnIndex(KEY_NAME)));
            user.put("prename", cursor.getString(cursor.getColumnIndex(KEY_PRENAME)));
            user.put("telephone", cursor.getString(cursor.getColumnIndex(KEY_TELEPHONE)));
            user.put("date of birth", cursor.getString(cursor.getColumnIndex(KEY_DOB)));
            user.put("city", cursor.getString(cursor.getColumnIndex(KEY_CITY)));
            user.put("Quater", cursor.getString(cursor.getColumnIndex(KEY_QUATER)));
            patientList.add(user);
        }
        return patientList;
    }
public ArrayList < HashMap < String , String > > GetUserByUserId ( int patientid ) { SQLiteDatabase db = this . getWritableDatabase ( ) ; ArrayList < HashMap < String , String > > patientList = new ArrayList < > ( ) ; String query = "SELECT * FROM " + TABLE_Patients ; Cursor cursor = db . query ( TABLE_Patients , new String [ ] { KEY_NAME , KEY_PRENAME , KEY_TELEPHONE , KEY_EMAIL , KEY_DOB , KEY_CITY , KEY_QUATER } , KEY_ID + "=?" , new String [ ] { String . valueOf ( patientid ) } , null , null , null , null ) ; if ( cursor . moveToNext ( ) ) { HashMap < String , String > user = new HashMap < > ( ) ; user . put ( "name" , cursor . getString ( cursor . getColumnIndex ( KEY_NAME ) ) ) ; user . put ( "prename" , cursor . getString ( cursor . getColumnIndex ( KEY_PRENAME ) ) ) ; user . put ( "telephone" , cursor . getString ( cursor . getColumnIndex ( KEY_TELEPHONE ) ) ) ; user . put ( "date of birth" , cursor . getString ( cursor . getColumnIndex ( KEY_DOB ) ) ) ; user . put ( "city" , cursor . getString ( cursor . getColumnIndex ( KEY_CITY ) ) ) ; user . put ( "Quater" , cursor . getString ( cursor . getColumnIndex ( KEY_QUATER ) ) ) ; patientList . add ( user ) ; } return patientList ; }
Get User Details based on userid
Get User Details based on userid