Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#5215] Health record export #5264

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

singharpita
Copy link
Contributor

No description provided.

Copy link
Member

@paulbert paulbert left a comment

Choose a reason for hiding this comment

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

This is a good start, but the profile information & other notes from each examination should also be exported.

Also if there are two examinations on the same day, only the latest one will be exported.

@@ -75,4 +79,16 @@ export class HealthComponent implements OnInit, AfterViewChecked {
this.displayedColumns = Object.keys(this.eventTable.data[0]);
}

exportCSV() {
const data = this.eventTable.data.map(h =>
Object.entries(h).reduce((object, [ key, value ]: [ any, any ]) => {
Copy link
Member

Choose a reason for hiding this comment

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

Please fix the indentation in this block

@@ -7,6 +7,8 @@
<mat-toolbar class="primary-color font-size-1">
<a mat-raised-button color="accent" class="margin-lr-3" i18n [routerLink]="['update']">Update Details</a>
<a mat-raised-button color="accent" class="margin-lr-3" i18n [routerLink]="['event', { id: userDetail._id }]">Add Examination</a>
<span class="toolbar-fill"></span>
<a mat-raised-button color="primary" class="margin-lr-3" i18n (click)="exportCSV()" >Export Examination</a>
Copy link
Member

Choose a reason for hiding this comment

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

This should be the accent color or a mat-stroked-button so it does not blend into the toolbar

exportCSV() {
const data = this.eventTable.data.map(h =>
Object.entries(h).reduce((object, [ key, value ]: [ any, any ]) => {
key = isNaN(key) ? key : this.datePipe.transform(key, 'shortDate');
Copy link
Member

Choose a reason for hiding this comment

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

A better solution (and a solution to the only recent date shown) would be to convert the date from a UNIX timestamp to the Excel number. You could put that in CsvService.

= event.date / 86400 + 25569

From:
https://excelribbon.tips.net/T010849_Converting_UNIX_Date_Time_Stamps.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants