Grouped Patients
is the number of people who have only trialled it once 90"> 90"> 90"> 90"> 90"> 90">
makeUnique(arr) {
var flags = [],
output = [],
l = arr.length,
i;
for (i = 0; i < l; i++) {
if (flags[arr[i].patientId]) continue;
flags[arr[i].patientId] = true;
output.push(arr[i].age);
}
this.trialledCount = output.length;
//set the value of set method to this
// return output.length;
}
findDays(firstDate: any, secondDate: any) {
var oneDay = 24 * 60 * 60 * 1000; // hours*minutes*seconds*milliseconds
var dateFirst = new Date(firstDate);
var dateSecond = new Date(secondDate);
var diffDays = Math.round(Math.abs((dateFirst.getTime() - dateSecond.getTime()) / (oneDay)));
return diffDays;
}
countInvalidPurchase(): any {
this.countInvalid++;
}
getCountInvalidPurchase(): any {
return this.countInvalid;
}
countValidPurchase(): any {
this.countValid++;
}
getCountValidPurchase(): any {
return this.countValid;
}
countSwitched(): any {
this.countSwitchedVal++;
}
getCountSwitched(): any {
return this.countSwitchedVal;
}
makeUnique(arr) {
var flags = [],
output = [],
l = arr.length,
i;
for (i = 0; i < l; i++) {
if (flags[arr[i].patientId]) continue;
flags[arr[i].patientId] = true;
output.push(arr[i].age);
}
this.trialledCount = output.length;
//set the value of set method to this
// return output.length;
}
findDays(firstDate: any, secondDate: any) {
var oneDay = 24 * 60 * 60 * 1000; // hours*minutes*seconds*milliseconds
var dateFirst = new Date(firstDate);
var dateSecond = new Date(secondDate);
var diffDays = Math.round(Math.abs((dateFirst.getTime() - dateSecond.getTime()) / (oneDay)));
return diffDays;
}
countInvalidPurchase(): any {
this.countInvalid++;
}
getCountInvalidPurchase(): any {
return this.countInvalid;
}
countValidPurchase(): any {
this.countValid++;
}
getCountValidPurchase(): any {
return this.countValid;
}
countSwitched(): any {
this.countSwitchedVal++;
}
getCountSwitched(): any {
return this.countSwitchedVal;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.10/angular.min.js"></script>
<h1>Grouped Patients </h1>
<div class="tools-category" *ngFor="let patientPurchase of patientPurchases | groupBy:'patientId' | pairs; let i = index">
<h3></h3>
<div class="tools-by-cat">
is the number of people who have only trialled it once
<div *ngFor="let val of patientPurchase[1]" class="tool-item">
<div *ngIf="(patientPurchases[i+1].patientId == val.patientId)">
<div *ngIf="val.medication == 'B'">
<div *ngIf="patientPurchases[i+1].medication == 'I'">
<div *ngIf="findDays(val.purchaseDate,patientPurchases[i+1].purchaseDate) > 90">
</div>
<div *ngIf="findDays(val.purchaseDate,patientPurchases[i+1].purchaseDate) < 90">
</div>
</div>
<div *ngIf="patientPurchases[i+1].medication == 'I'">
<div *ngIf="findDays(val.purchaseDate,patientPurchases[i+1].purchaseDate) > 90">
</div>
</div>
<div *ngIf="patientPurchases[i+1].medication == 'B'">
<div *ngIf="findDays(val.purchaseDate,patientPurchases[i+1].purchaseDate) > 90">
</div>
</div>
</div>
<div *ngIf="val.medication == 'I'">
<div *ngIf="patientPurchases[i+1].medication == 'B'">
<div *ngIf="findDays(val.purchaseDate,patientPurchases[i+1].purchaseDate) > 90">
</div>
<div *ngIf="findDays(val.purchaseDate,patientPurchases[i+1].purchaseDate) < 90">
</div>
<div *ngIf="patientPurchases[i+1].medication == 'I'">
<div *ngIf="findDays(val.purchaseDate,patientPurchases[i+1].purchaseDate) > 90">
</div>
</div>
<div *ngIf="patientPurchases[i+1].medication == 'B'">
<div *ngIf="findDays(val.purchaseDate,patientPurchases[i+1].purchaseDate) > 90">
</div>
</div>
</div>
</div>
</div>
<h2></h2>
<p></p>
</div>
</div>
</div>
<!-- begin snippet: js hide: false console: true babel: false -->
Aucun commentaire:
Enregistrer un commentaire