private void createPatientSession(ViewPatientActivity activity) { newPatientSessionManager = new NewPatientSessionManager(activity); // newPatientSessionManager.createNewPatientSession(patient.getFirstName(), // patient.getMiddleName(), patient.getLastName(), patient.getBirthdate(), // patient.getGender(), patient.getCivilStatus(), // patient.getProfileImageBytes()); newPatientSessionManager.setPatientInfo( Long.toString(patient.getId()), patient.getFirstName(), patient.getLastName(), patient.getAge(), patient.getGender(), patient.getProfileImageBytes()); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_patient); SystemSessionManager systemSessionManager = new SystemSessionManager(this); if (systemSessionManager.checkLogin()) finish(); Bundle extras = getIntent().getExtras(); if (extras != null) patientId = extras.getLong("patientId"); CircleImageView profileImage = (CircleImageView) findViewById(R.id.view_patient_profile_image); TextView patientName = (TextView) findViewById(R.id.view_patient_name); TextView ageGender = (TextView) findViewById(R.id.view_patient_age_gender); TextView civilStatus = (TextView) findViewById(R.id.view_patient_civil_status); TextView bloodType = (TextView) findViewById(R.id.view_patient_blood); // TextView contactInfo = (TextView)findViewById(R.id.view_patient_contact); // TextView addressInfo = (TextView)findViewById(R.id.view_patient_address); // TextView caseRecordCount = // (TextView)findViewById(R.id.view_patient_case_record_count); RecyclerView caseRecordList = (RecyclerView) findViewById(R.id.view_patient_case_recycler); Button backBtn = (Button) findViewById(R.id.view_patient_back_btn); Button updatePatientBtn = (Button) findViewById(R.id.view_patient_update_btn); Button newCaseRecordBtn = (Button) findViewById(R.id.view_patient_create_case_btn); Button uploadCaseRecordBtn = (Button) findViewById(R.id.view_patient_upload_btn); initializeDatabase(); caseRecords = new ArrayList<>(); patient = getPatientInfo(); getCaseRecords(); createPatientSession(this); setPic(profileImage, patient.getProfileImageBytes()); patientName.setText( patientFullName(patient.getFirstName(), patient.getMiddleName(), patient.getLastName())); String patientAgeGender = patient.getAge() + ", " + patient.getGender(); ageGender.setText(patientAgeGender); civilStatus.setText(patient.getCivilStatus()); RecyclerView.LayoutManager caseRecordsLayoutManager = new LinearLayoutManager(this); RecyclerView.ItemDecoration dividerItemDecoration = new DividerItemDecoration(this); CaseRecordAdapter caseRecordAdapter = new CaseRecordAdapter(caseRecords); caseRecordList.setHasFixedSize(true); caseRecordList.setLayoutManager(caseRecordsLayoutManager); caseRecordList.setAdapter(caseRecordAdapter); caseRecordList.addItemDecoration(dividerItemDecoration); caseRecordAdapter.SetOnItemClickListener( new CaseRecordAdapter.OnItemClickListener() { @Override public void onItemClick(View view, int position) { int selectedCaseRecordId = caseRecords.get(position).getCaseRecordId(); Intent intent = new Intent(ViewPatientActivity.this, ViewCaseRecordActivity.class); intent.putExtra("caseRecordId", selectedCaseRecordId); intent.putExtra("patientId", patientId); startActivity(intent); } }); backBtn.setOnClickListener(this); updatePatientBtn.setOnClickListener(this); newCaseRecordBtn.setOnClickListener(this); }