Skip to content

Commit

Permalink
#737 Design & Implementation of SAMS logo & download mindmap zip
Browse files Browse the repository at this point in the history
#744 Implementation of Notifications when doctor has provided the prescription & add prescription icon on Activities
#726 Remove repeated questions from Associated Symptoms
#557 Improve the formatting for associated complaints
  • Loading branch information
nehav39 committed Nov 11, 2019
1 parent c88dcff commit a82fa7f
Show file tree
Hide file tree
Showing 31 changed files with 749 additions and 252 deletions.
4 changes: 0 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ dependencies {
implementation('com.github.SandroMachado:restaurant:0.2.0@aar') {
transitive = true
}

implementation 'com.rengwuxian.materialedittext:library:2.1.4'


}
apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin

4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:roundIcon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
Expand Down Expand Up @@ -233,7 +233,7 @@
</intent-filter>
</service>

<!-- <meta-data android:name="firebase_crashlytics_collection_enabled" android:value="false" />-->
<meta-data android:name="firebase_crashlytics_collection_enabled" android:value="false" />

</application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,18 @@

import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;

import io.intelehealth.client.R;
import io.intelehealth.client.activities.homeActivity.HomeActivity;
import io.intelehealth.client.app.AppConstants;
import io.intelehealth.client.database.dao.EncounterDAO;
import io.intelehealth.client.database.dao.ProviderDAO;
import io.intelehealth.client.database.dao.VisitsDAO;
import io.intelehealth.client.models.ActivePatientModel;
import io.intelehealth.client.models.dto.EncounterDTO;
import io.intelehealth.client.models.dto.VisitDTO;
import io.intelehealth.client.utilities.Logger;
import io.intelehealth.client.utilities.SessionManager;
import io.intelehealth.client.utilities.StringUtils;
Expand All @@ -46,6 +51,8 @@ public class ActivePatientActivity extends AppCompatActivity {
RecyclerView recyclerView;
AlertDialog.Builder dialogBuilder;

private ArrayList<String> listPatientUUID = new ArrayList<String>();

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down Expand Up @@ -73,6 +80,50 @@ protected void onCreate(Bundle savedInstanceState) {
recyclerView.setVisibility(View.VISIBLE);
doQuery();
}

getVisits();
}

private void getVisits() {

ArrayList<String> encounterVisitUUID = new ArrayList<String>();
HashSet<String> hsPatientUUID = new HashSet<String>();

//Get all Visits
VisitsDAO visitsDAO = new VisitsDAO();
List<VisitDTO> visitsDTOList = visitsDAO.getAllVisits();

//Get all Encounters
EncounterDAO encounterDAO = new EncounterDAO();
List<EncounterDTO> encounterDTOList = encounterDAO.getAllEncounters();

//Get Visit Note Encounters only, visit note encounter id - d7151f82-c1f3-4152-a605-2f9ea7414a79
if (encounterDTOList.size() > 0) {
for (int i = 0; i < encounterDTOList.size(); i++) {
if (encounterDTOList.get(i).getEncounterTypeUuid().equalsIgnoreCase("d7151f82-c1f3-4152-a605-2f9ea7414a79")) {
encounterVisitUUID.add(encounterDTOList.get(i).getVisituuid());
}
}
}

//Get patientUUID from visitList
for (int i = 0; i < encounterVisitUUID.size(); i++) {

for (int j = 0; j < visitsDTOList.size(); j++) {

if (encounterVisitUUID.get(i).equalsIgnoreCase(visitsDTOList.get(j).getUuid())) {
listPatientUUID.add(visitsDTOList.get(j).getPatientuuid());
}
}
}

if (listPatientUUID.size() > 0) {

hsPatientUUID.addAll(listPatientUUID);
listPatientUUID.clear();
listPatientUUID.addAll(hsPatientUUID);

}
}

/**
Expand All @@ -84,9 +135,9 @@ private void doQuery() {
List<ActivePatientModel> activePatientList = new ArrayList<>();
Date cDate = new Date();
String query = "SELECT a.uuid, a.patientuuid, a.startdate, a.enddate, b.first_name, b.middle_name, b.last_name, b.date_of_birth,b.openmrs_id " +
"FROM tbl_visit a, tbl_patient b " +
"WHERE a.patientuuid = b.uuid " +
"AND a.enddate is NULL OR a.enddate='' GROUP BY a.uuid ORDER BY a.startdate ASC";
"FROM tbl_visit a, tbl_patient b " +
"WHERE a.patientuuid = b.uuid " +
"AND a.enddate is NULL OR a.enddate='' GROUP BY a.uuid ORDER BY a.startdate ASC";
final Cursor cursor = db.rawQuery(query, null);

if (cursor != null) {
Expand Down Expand Up @@ -119,7 +170,7 @@ private void doQuery() {
for (ActivePatientModel activePatientModel : activePatientList)
Logger.logD(TAG, activePatientModel.getFirst_name() + " " + activePatientModel.getLast_name());

ActivePatientAdapter mActivePatientAdapter = new ActivePatientAdapter(activePatientList, ActivePatientActivity.this);
ActivePatientAdapter mActivePatientAdapter = new ActivePatientAdapter(activePatientList, ActivePatientActivity.this, listPatientUUID);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(ActivePatientActivity.this);
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.addItemDecoration(new
Expand Down Expand Up @@ -259,9 +310,9 @@ private boolean endVisit(String patientUuid, String patientName, String visitUUI
private void doQueryWithProviders(List<String> providersuuids) {
List<ActivePatientModel> activePatientList = new ArrayList<>();
String query = "select distinct a.uuid,c.uuid AS patientuuid,a.startdate AS startdate,a.enddate AS enddate, c.first_name,c.middle_name,c.last_name,c.openmrs_id,c.date_of_birth " +
"from tbl_visit a,tbl_encounter b ,tbl_patient c " +
"where b.visituuid=a.uuid and b.provider_uuid in ('" + StringUtils.convertUsingStringBuilder(providersuuids) + "') " +
"and a.patientuuid=c.uuid and (a.enddate is null OR a.enddate='') order by a.startdate ASC";
"from tbl_visit a,tbl_encounter b ,tbl_patient c " +
"where b.visituuid=a.uuid and b.provider_uuid in ('" + StringUtils.convertUsingStringBuilder(providersuuids) + "') " +
"and a.patientuuid=c.uuid and (a.enddate is null OR a.enddate='') order by a.startdate ASC";
Logger.logD(TAG, query);
final Cursor cursor = db.rawQuery(query, null);

Expand Down Expand Up @@ -295,7 +346,7 @@ private void doQueryWithProviders(List<String> providersuuids) {
for (ActivePatientModel activePatientModel : activePatientList)
Logger.logD(TAG, activePatientModel.getFirst_name() + " " + activePatientModel.getLast_name());

ActivePatientAdapter mActivePatientAdapter = new ActivePatientAdapter(activePatientList, ActivePatientActivity.this);
ActivePatientAdapter mActivePatientAdapter = new ActivePatientAdapter(activePatientList, ActivePatientActivity.this, listPatientUUID);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(ActivePatientActivity.this);
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.addItemDecoration(new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

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

import io.intelehealth.client.R;
Expand All @@ -26,10 +28,12 @@ public class ActivePatientAdapter extends RecyclerView.Adapter<ActivePatientAdap
List<ActivePatientModel> activePatientModels;
Context context;
LayoutInflater layoutInflater;
ArrayList<String> listPatientUUID;

public ActivePatientAdapter(List<ActivePatientModel> activePatientModels, Context context) {
public ActivePatientAdapter(List<ActivePatientModel> activePatientModels, Context context, ArrayList<String> _listPatientUUID) {
this.activePatientModels = activePatientModels;
this.context = context;
this.listPatientUUID = _listPatientUUID;
}

@Override
Expand All @@ -48,19 +52,16 @@ public void onBindViewHolder(ActivePatientViewHolder holder, int position) {
final ActivePatientModel activePatientModel = activePatientModels.get(position);
String header;
if (activePatientModel.getOpenmrs_id() != null) {
header = String.format("%s %s - " + context.getString(R.string.visit_summary_heading_id) + ": %s", activePatientModel.getFirst_name(),
header = String.format("%s %s, %s", activePatientModel.getFirst_name(),
activePatientModel.getLast_name(), activePatientModel.getOpenmrs_id());
} else {
header = String.format("%s %s", activePatientModel.getFirst_name(),
activePatientModel.getLast_name());
}
int age = DateAndTimeUtils.getAge(activePatientModel.getDate_of_birth());
String dob = DateAndTimeUtils.SimpleDatetoLongDate(activePatientModel.getDate_of_birth());
String body = String.format(context.getString(R.string.id_number) + ": %s \n " +
context.getString(R.string.identification_screen_prompt_phone_number) + ": %s\n" +
context.getString(R.string.identification_screen_prompt_birthday) +
": %s (" + context.getString(R.string.identification_screen_prompt_age) + " %d)", activePatientModel.getOpenmrs_id(), activePatientModel.getPhone_number(),
dob, age);
String body = String.format(context.getString(R.string.identification_screen_prompt_age) + " %d yrs", age);


holder.getHeadTextView().setText(header);
holder.getBodyTextView().setText(body);
Expand All @@ -79,11 +80,28 @@ public void onClick(View v) {
intent.putExtra("patientUuid", activePatientModel.getPatientuuid());
intent.putExtra("status", patientStatus);
intent.putExtra("tag", "");

if (holder.ivPriscription.getTag().equals("1")) {
intent.putExtra("hasPrescription", "true");
} else {
intent.putExtra("hasPrescription", "false");
}
context.startActivity(intent);
}
});

for (int i = 0; i < listPatientUUID.size(); i++) {
if (activePatientModels.get(position).getPatientuuid().equalsIgnoreCase(listPatientUUID.get(i))) {
holder.ivPriscription.setImageDrawable(context.getResources().getDrawable(R.drawable.ic_prescription_green));
holder.ivPriscription.setTag("1");
}
}
}

@Override
public int getItemViewType(int position) {
return position;
}

@Override
public int getItemCount() {
Expand All @@ -95,12 +113,14 @@ public class ActivePatientViewHolder extends RecyclerView.ViewHolder {
private TextView bodyTextView;
private TextView indicatorTextView;
private View rootView;
private ImageView ivPriscription;

public ActivePatientViewHolder(View itemView) {
super(itemView);
headTextView = itemView.findViewById(R.id.list_item_head_text_view);
bodyTextView = itemView.findViewById(R.id.list_item_body_text_view);
indicatorTextView = itemView.findViewById(R.id.list_item_indicator_text_view);
ivPriscription = itemView.findViewById(R.id.iv_prescription);
rootView = itemView;
}
public TextView getHeadTextView() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AlertDialog;
Expand All @@ -16,6 +17,7 @@
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;

import com.crashlytics.android.Crashlytics;
Expand Down Expand Up @@ -47,12 +49,8 @@ public class ComplaintNodeActivity extends AppCompatActivity {
String state;
String patientName;
String intentTag;

SearchView searchView;


List<Node> complaints;

CustomArrayAdapter listAdapter;
String encounterVitals;
String encounterAdultIntials;
Expand Down Expand Up @@ -119,7 +117,8 @@ public void onClick(View view) {


boolean hasLicense = false;
if (sessionManager.getLicenseKey() != null && !sessionManager.getLicenseKey().isEmpty())
// if (sessionManager.getLicenseKey() != null && !sessionManager.getLicenseKey().isEmpty())
if (!sessionManager.getLicenseKey().isEmpty())
hasLicense = true;
JSONObject currentFile = null;
if (hasLicense) {
Expand Down Expand Up @@ -200,13 +199,17 @@ public void onClick(DialogInterface dialog, int which) {
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
Button pb = alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL);
pb.setTextColor(getResources().getColor((R.color.colorPrimary)));
pb.setTypeface(Typeface.DEFAULT,Typeface.BOLD);
} else {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setTitle(R.string.complaint_dialog_title);
final LayoutInflater inflater = getLayoutInflater();
View convertView = inflater.inflate(R.layout.list_dialog_complaint, null);
alertDialogBuilder.setView(convertView);
ListView listView = convertView.findViewById(R.id.complaint_dialog_list_view);
listView.setDivider(null);
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, displaySelection);
listView.setAdapter(arrayAdapter);
alertDialogBuilder.setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
Expand Down Expand Up @@ -236,6 +239,12 @@ public void onClick(DialogInterface dialog, int which) {
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
Button pb = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
Button nb = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE);
pb.setTextColor(getResources().getColor((R.color.colorPrimary)));
pb.setTypeface(Typeface.DEFAULT,Typeface.BOLD);
nb.setTextColor(getResources().getColor((R.color.colorPrimary)));
nb.setTypeface(Typeface.DEFAULT,Typeface.BOLD);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,8 @@ public class FamilyHistoryActivity extends AppCompatActivity {
String patientName;
String intentTag;


ArrayList<String> physicalExams;

String mFileName = "famHist.json";

int lastExpandedPosition = -1;

Node familyHistoryMap;
Expand Down Expand Up @@ -157,7 +154,8 @@ public void onClick(View view) {
}
});

if (sessionManager.getLicenseKey() != null && !sessionManager.getLicenseKey().isEmpty())
// if (sessionManager.getLicenseKey() != null && !sessionManager.getLicenseKey().isEmpty())
if (!sessionManager.getLicenseKey().isEmpty())
hasLicense = true;

if (hasLicense) {
Expand Down Expand Up @@ -257,6 +255,7 @@ private void onFabClick() {
intent.putExtra("state", state);
intent.putExtra("name", patientName);
intent.putExtra("tag", intentTag);
intent.putExtra("hasPrescription", "false");
startActivity(intent);
} else {

Expand Down
Loading

0 comments on commit a82fa7f

Please sign in to comment.