Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions nh_eobs/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,23 @@ def get_patient_info(self, cr, uid, hospital_number, context=None):
patient[0]['activities'] = activities
return patient

def get_all_patients(self, cr, uid, ids, context=None):

if ids:
domain = [
('patient_id', 'in', ids),
('state', '=', 'started'),
('data_model', '=', 'nh.clinical.spell'),
'|',
('patient_id.follower_ids', 'in', [uid])
]
else:
domain = [
('state', '=', 'started'),
('data_model', '=', 'nh.clinical.spell'),
]
return self.collect_patients(cr, uid, domain, context=context)

def get_patients(self, cr, uid, ids, context=None):
"""
Return containing every field from
Expand Down
41 changes: 41 additions & 0 deletions nh_eobs_mobile/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
methods=['GET'],
url_prefix='/mobile'
)
all_patients = EobsRoute(
'all_patients',
'/all_patients/',
methods=['GET'],
url_prefix='/mobile'
)
patient_list = EobsRoute(
'patient_list',
'/patients/',
Expand Down Expand Up @@ -568,6 +574,41 @@ def get_patients(self, *args, **kw):
'urls': URLS}
)

@http.route(URLS['all_patients'], type='http', auth="user")
def get_all_patients(self, *args, **kw):
"""
Returns the patient task list for all patients.
:returns: patient task list response object
:rtype: :class:`http.Response<openerp.http.Response>`
"""

cr, uid, context = request.cr, request.session.uid, request.context
patient_api = request.registry['nh.eobs.api']
patient_api.unassign_my_activities(cr, uid)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems unusual, why are activities unassigned, simply by listing 'All Patients' view?

I'm guessing it's what the other lists do

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea, it's just a copy of the get_patients function with the uid removed from the domain.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, np. I think sticking to what it does now is the safest bet. Just seems a little unusual

follow_activities = patient_api.get_assigned_activities(
cr, uid,
activity_type='nh.clinical.patient.follow',
context=context
)
patients = self.process_patient_list(
cr, uid, patient_api.get_all_patients(
cr, uid, [], context=context), context=context)
patient_api.get_patient_followers(cr, uid, patients, context=context)
following_patients = self.process_patient_list(
cr, uid, patient_api.get_followed_patients(
cr, uid, []), context=context)
return request.render(
'nh_eobs_mobile.patient_task_list',
qcontext={
'notifications': follow_activities,
'items': patients,
'notification_count': len(follow_activities),
'followed_items': following_patients,
'section': 'patient',
'username': request.session['login'],
'urls': URLS}
)

@http.route(URLS['share_patient_list'], type='http', auth='user')
def get_share_patients(self, *args, **kw):
"""
Expand Down
6 changes: 6 additions & 0 deletions nh_eobs_mobile/controllers/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
'method': 'GET',
'args': False
},
{
'name': 'all_patients',
'endpoint': 'all_patients/',
'method': 'GET',
'args': False
},
{
'name': 'single_patient',
'endpoint': 'patient/',
Expand Down
24 changes: 21 additions & 3 deletions nh_eobs_mobile/views/template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,32 @@
<li class="logout"><a t-att-href="urls['logout']" class="button back">Logout</a></li>
</ul>
</div>
<ul class="header-menu two-col">
<ul class="header-menu three-col">
<t t-if="section=='task'">
<li><a t-att-href="urls['task_list']" id="taskNavItem" class="selected">Tasks</a></li>
<li><a t-att-href="urls['patient_list']" id="patientNavItem">My Patients <t t-if="notification_count and notification_count &gt; 0"><span class="urgent-badge"><t t-esc="notification_count"/></span></t></a></li>
<li>
<a t-att-href="urls['all_patients']" id="allPatientNavItem">
All Patients
</a>
</li>
</t>
<t t-if="section=='patient'">
<li><a t-att-href="urls['task_list']" id="taskNavItem">Tasks</a></li>
<li><a t-att-href="urls['patient_list']" id="patientNavItem" class="selected">My Patients <t t-if="notification_count and notification_count &gt; 0"><span class="urgent-badge"><t t-esc="notification_count"/></span></t></a></li>
<li>
<a t-att-href="urls['task_list']" id="taskNavItem">
Tasks
</a>
</li>
<li>
<a t-att-href="urls['patient_list']" id="patientNavItem" class="selected">
My Patients <t t-if="notification_count and notification_count &gt; 0"><span class="urgent-badge"><t t-esc="notification_count"/></span></t>
</a>
</li>
<li>
<a t-att-href="urls['all_patients']" id="allPatientNavItem" class="selected">
All Patients<t t-if="notification_count and notification_count &gt; 0"><span class="urgent-badge"><t t-esc="notification_count"/></span></t>
</a>
</li>
</t>
</ul>
</div>
Expand Down