Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyasstrh committed Jun 4, 2020
2 parents 360db95 + 683ff32 commit 85435e0
Show file tree
Hide file tree
Showing 13 changed files with 331 additions and 34 deletions.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<activity android:name=".TestActivity" />
<activity android:name=".AppointementActivity" />
<activity android:name=".FicheInfo" />
<activity android:name=".PatientInfoActivity" />
<activity android:name=".DossierMedical" />
<activity android:name=".ChatActivity" />
<activity android:name=".PatientRequestPage" />
Expand Down
22 changes: 22 additions & 0 deletions app/src/main/java/com/ensias/healthcareapp/Common/Common.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,28 @@ public class Common {
public static String CurrentPhone = "062912361255";
public static SimpleDateFormat simpleFormat = new SimpleDateFormat("dd_MM_yyyy");

public static int convertBloodToInt(String s){
switch (s){
case "A+":
return 0;
case "A-":
return 1;
case "B+":
return 2;
case "B-":
return 3;
case "AB+":
return 4;
case "AB-":
return 5;
case "O+":
return 6;
case "O-":
return 7;
default:
return 0;
}
}
public static String convertTimeSlotToString(int slot) {
switch(slot) {
case 0:
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/java/com/ensias/healthcareapp/DossierMedical.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.ensias.healthcareapp.Common.Common;
Expand All @@ -20,6 +21,7 @@ public class DossierMedical extends AppCompatActivity {
private final static String TAG = "DossierMedical";
private FloatingActionButton createNewFicheButton;
private String patient_email;
private Button infobtn;


@Override
Expand All @@ -42,6 +44,13 @@ public void onClick(View view) {
if(Common.CurrentUserType.equals("patient")){
createNewFicheButton.setVisibility(View.GONE);
}
infobtn= findViewById(R.id.infobtn);
infobtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openPatientInfo();
}
});


}
Expand Down Expand Up @@ -105,4 +114,13 @@ private void openPatientFiche(){
startActivity(intent);
}

private void openPatientInfo(){
Intent intent = new Intent(this, PatientInfoActivity.class);
String patient_name = getIntent().getStringExtra("patient_name");
String patient_email = getIntent().getStringExtra("patient_email");
intent.putExtra("patient_email", patient_email);
intent.putExtra("patient_name", patient_name);
startActivity(intent);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package com.ensias.healthcareapp;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.ensias.healthcareapp.Common.Common;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;

import java.util.HashMap;

import static com.ensias.healthcareapp.Common.Common.convertBloodToInt;

public class PatientInfoActivity extends AppCompatActivity {

EditText heightBtn;
EditText weightBtn;
Spinner bloodtypeSpinner;
Button updateBtn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_patient_info);
updateBtn = findViewById(R.id.updateInfoBtn);
heightBtn = findViewById(R.id.heightBtn);
weightBtn = findViewById(R.id.weightBtn);
final Spinner specialiteList = (Spinner) findViewById(R.id.bloodType);
ArrayAdapter<CharSequence> adapterSpecialiteList = ArrayAdapter.createFromResource(this,
R.array.blood_spinner, android.R.layout.simple_spinner_item);
adapterSpecialiteList.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
specialiteList.setAdapter(adapterSpecialiteList);

String patient_name = getIntent().getStringExtra("patient_name");
String patient_email = getIntent().getStringExtra("patient_email");

FirebaseFirestore.getInstance().collection("Patient").document(patient_email).collection("moreInfo")
.document(patient_email).get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
@Override
public void onSuccess(DocumentSnapshot documentSnapshot) {
weightBtn.setText( ""+documentSnapshot.getString("weight"));
heightBtn.setText( ""+documentSnapshot.getString("height"));
specialiteList.setSelection(convertBloodToInt(documentSnapshot.getString("bloodType")));
}
});

updateBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
HashMap<String,Object> map = new HashMap<>();
map.put("height",""+heightBtn.getText());
map.put("weight",""+weightBtn.getText());
map.put("bloodType",""+specialiteList.getSelectedItem().toString());
Log.e("tag", "onClick: "+specialiteList.getTag() );
FirebaseFirestore.getInstance().collection("Patient").document(patient_email).collection("moreInfo")
.document(patient_email).set(map);
Toast.makeText(PatientInfoActivity.this,"Update Success!",Toast.LENGTH_SHORT).show();

}
});
if(Common.CurrentUserType.equals("patient")){
updateBtn.setVisibility(View.GONE);
heightBtn.setEnabled(false);
weightBtn.setEnabled(false);
specialiteList.setEnabled(false);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
import com.ensias.healthcareapp.model.Fiche;
import com.firebase.ui.firestore.FirestoreRecyclerAdapter;
import com.firebase.ui.firestore.FirestoreRecyclerOptions;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;

import java.io.Serializable;

Expand All @@ -30,14 +33,26 @@ public ConsultationAdapter(@NonNull FirestoreRecyclerOptions<Fiche> options) {

@Override
protected void onBindViewHolder(@NonNull FicheHolder holder, int position, @NonNull final Fiche model) {
holder.doctor_name.setText(model.getDoctor());
FirebaseFirestore.getInstance().document("Doctor/"+model.getDoctor()).get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
@Override
public void onSuccess(DocumentSnapshot documentSnapshot) {
holder.doctor_name.setText(documentSnapshot.getString("name"));
}
});
holder.type.setText(model.getType());
holder.btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openPage(v.getContext(),model);
}
});
String[] date ;
date = model.getDateCreated().toString().split(" ");
// Thu Jun 04 14:46:12 GMT+01:00 2020
holder.appointement_day_name.setText(date[0]);
holder.appointement_day.setText(date[2]);
holder.appointement_month.setText(date[1]);
holder.doctor_view_title.setText(date[3]);
}

private void openPage(Context wf,Fiche m){
Expand All @@ -59,11 +74,20 @@ class FicheHolder extends RecyclerView.ViewHolder {
TextView doctor_name;
TextView type;
Button btn;
TextView appointement_month;
TextView appointement_day;
TextView appointement_day_name;
TextView doctor_view_title;

public FicheHolder(View itemView) {
super(itemView);
doctor_name = itemView.findViewById(R.id.doctor_name);
type = itemView.findViewById(R.id.text_view_description);
btn = itemView.findViewById(R.id.voir_fiche_btn);
appointement_month = itemView.findViewById(R.id.appointement_month);
appointement_day = itemView.findViewById(R.id.appointement_day);
appointement_day_name = itemView.findViewById(R.id.appointement_day_name);
doctor_view_title = itemView.findViewById(R.id.doctor_view_title);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -17,6 +18,12 @@

import com.firebase.ui.firestore.FirestoreRecyclerAdapter;
import com.firebase.ui.firestore.FirestoreRecyclerOptions;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;

import java.util.ArrayList;
import java.util.List;

public class HospitalisationAdapter extends FirestoreRecyclerAdapter<Fiche,HospitalisationAdapter.FicheHolder2> {

Expand All @@ -26,14 +33,26 @@ public HospitalisationAdapter(@NonNull FirestoreRecyclerOptions<Fiche> options)

@Override
protected void onBindViewHolder(@NonNull FicheHolder2 holder, int position, @NonNull final Fiche model) {
holder.doctor_name.setText(model.getDoctor());
holder.type.setText(model.getType());
FirebaseFirestore.getInstance().document("Doctor/"+model.getDoctor()).get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
@Override
public void onSuccess(DocumentSnapshot documentSnapshot) {
holder.doctor_name.setText(documentSnapshot.getString("name"));
}
}); holder.type.setText(model.getType());
holder.btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openPage(v.getContext(),model);
}
});
String[] date ;
date = model.getDateCreated().toString().split(" ");
// Thu Jun 04 14:46:12 GMT+01:00 2020
holder.appointement_day_name.setText(date[0]);
holder.appointement_day.setText(date[2]);
holder.appointement_month.setText(date[1]);
holder.doctor_view_title.setText(date[3]);

}

private void openPage(Context wf, Fiche m){
Expand All @@ -56,11 +75,20 @@ class FicheHolder2 extends RecyclerView.ViewHolder {
TextView doctor_name;
TextView type;
Button btn;
TextView appointement_month;
TextView appointement_day;
TextView appointement_day_name;
TextView doctor_view_title;

public FicheHolder2(View itemView) {
super(itemView);
doctor_name = itemView.findViewById(R.id.doctor_name2);
type = itemView.findViewById(R.id.text_view_description2);
btn = itemView.findViewById(R.id.voir_fiche_btn2);
appointement_month = itemView.findViewById(R.id.appointement_month);
appointement_day = itemView.findViewById(R.id.appointement_day);
appointement_day_name = itemView.findViewById(R.id.appointement_day_name);
doctor_view_title = itemView.findViewById(R.id.doctor_view_title);
}
}
}
Binary file added app/src/main/res/drawable-v24/note_background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xxxhdpi/healthy.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 17 additions & 30 deletions app/src/main/res/layout/activity_dossier_medical.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,36 +58,6 @@
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="#000000" />

<EditText
android:id="@+id/editText4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/patient_name"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginStart="228dp"
android:layout_marginLeft="228dp"
android:layout_marginTop="0dp"
android:inputType="number"
android:hint="Height"
android:textColorHint="#b8b8b8"
android:textColor="#000000"
android:textSize="14sp" />

<EditText
android:id="@+id/editText5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginStart="228dp"
android:layout_marginLeft="228dp"
android:inputType="number"
android:hint="Weight"
android:textColorHint="#b8b8b8"
android:textColor="#000000"
android:textSize="14sp" />

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/floatingActionButton"
android:layout_width="wrap_content"
Expand All @@ -103,6 +73,23 @@
app:backgroundTint="@color/colorPrimaryDark"
app:srcCompat="@android:drawable/ic_menu_edit" />

<Button
android:id="@+id/infobtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_gravity="bottom|end"
android:layout_marginStart="14dp"
android:layout_marginLeft="14dp"
android:layout_marginTop="13dp"
android:layout_marginEnd="91dp"
android:layout_marginRight="91dp"
android:clickable="true"
android:scaleType="center"
android:text="physical info"
app:backgroundTint="@color/colorAccent" />


</RelativeLayout>
<RelativeLayout
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/activity_fiche_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
xmlns:tools="https://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FicheInfo">
tools:context=".FicheInfo"
android:background="@drawable/note_background">

<TextView
android:id="@+id/textView2"
Expand Down
Loading

0 comments on commit 85435e0

Please sign in to comment.