Skip to content

Commit

Permalink
UI Navigation -> UWL: Add new workitems #2768
Browse files Browse the repository at this point in the history
  • Loading branch information
shral committed Sep 29, 2020
1 parent 7d4af52 commit 9cba0f3
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="form_input" *ngIf="object[o].vr != 'SQ'">
<div *ngFor="let v of object[o].Value; let i=index; trackBy:trackByFn">
<div *ngIf="object[o].vr != 'PN'" class="ariod">
<input class="{{o}}" [placeholderchanger]="{code:o,name:DCM4CHE.elementName.forTag(o,privateCreator(o)),mode:mode,delete:false,iod:iod,externalInternalAetMode:externalInternalAetMode}" *ngIf="object[o].vr != 'DA' && o != '00100040' && o != '00080005' && o != '00102203'" [(ngModel)]="object[o].Value[i]">
<input *ngIf="!(object[o].enum && object[o].enum.length > 0) && object[o].vr != 'DA' && o != '00100040' && o != '00080005' && o != '00102203'" class="{{o}}" [placeholderchanger]="{code:o,name:DCM4CHE.elementName.forTag(o,privateCreator(o)),mode:mode,delete:false,iod:iod,externalInternalAetMode:externalInternalAetMode}" [(ngModel)]="object[o].Value[i]">
<!-- <p-calendar
class="{{o}}"
*ngIf="object[o].vr === 'DA' && o != '00100040' && o != '00080005' && o != '00102203'"
Expand All @@ -19,7 +19,7 @@

<range-picker
class="{{o}}"
*ngIf="object[o].vr === 'DA' && o != '00100040' && o != '00080005' && o != '00102203'"
*ngIf="(object[o].vr === 'DA' || object[o].vr === 'DA') && o != '00100040' && o != '00080005' && o != '00102203'"
[model]="object[o].Value[i]"
(modelChange)="object[o].Value[i] = $event"
[datePickerMode]="true"
Expand All @@ -36,6 +36,11 @@
<option value="ALTERED">Altered</option>
<option value="UNALTERED">Unaltered</option>
</select>
<select *ngIf="object[o].enum && object[o].enum.length > 0" [(ngModel)]="object[o].Value[0]">
<option *ngIf="!(object[o].required && object[o].required === 1)" value="">*</option>
<option *ngFor="let n of object[o].enum" value="{{n}}">{{n}}</option>
</select>

<specific-char-picker [(model)]="object[o].Value[i]" (modelChange)="charChange($event)" *ngIf="o === '00080005'"></specific-char-picker>
<div [placeholderchanger]="{code:o,name:DCM4CHE.elementName.forTag(o,privateCreator(o)),mode:mode,delete:true,iod:iod}" (click)="removeAttr(o)" *ngIf="o != '00104000' && !prefix" class="iod_remove glyphicon glyphicon-remove {{o}}"></div>
</div>
Expand Down
64 changes: 63 additions & 1 deletion dcm4chee-arc-ui2/src/app/helpers/j4care.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {j4care} from "./j4care.service";
import {DicomNetworkConnection} from "../interfaces";
import {DcmWebApp} from "../models/dcm-web-app";
import * as _ from "lodash-es";

const AETS1 = [{
"dicomAETitle": "DCM4CHEE",
Expand Down Expand Up @@ -523,7 +524,68 @@ describe('j4care', () => {
console.log("t",t);
console.log("s",s);
},""))
})
});

it("",()=>{
let obj = {
"00741204": {
"vr": "LO",
"required": 1,
"Value": [
"bsdf"
]
},
"00741202": {
"vr": "LO",
"required": 2,
"Value": [
"test"
]
},
"00404025": {
"vr": "SQ",
"Value": [
{
"00080100": {
"vr": "SH",
"required": 1,
"Value": [
"test2"
]
}
}
]
}
};
const result = {
"00741204": {
"vr": "LO",
"Value": [
"bsdf"
]
},
"00741202": {
"vr": "LO",
"Value": [
"test"
]
},
"00404025": {
"vr": "SQ",
"Value": [
{
"00080100": {
"vr": "SH",
"Value": [
"test2"
]
}
}
]
}
};
expect(j4care.removeKeyFromObject(obj,"required")).toEqual(result);
});

it("Should extract language object from the language ldap string",()=>{
expect(
Expand Down
22 changes: 21 additions & 1 deletion dcm4chee-arc-ui2/src/app/helpers/j4care.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class j4care {
savedKeys += `[${savedKeys}]`;
}
for(let key in object){
if(object.hasOwnProperty(key)) {
if(object.hasOwnProperty(key) && key) {
if(typeof object[key] === "object"){
this.traverse(object[key],func, key);
}else{
Expand All @@ -48,6 +48,26 @@ export class j4care {
}
return object;
}

static removeKeyFromObject(object, toRemoveKey){
if(_.isArray(toRemoveKey)){
toRemoveKey.forEach(k=>{
if(_.hasIn(object, k)){
delete object[k];
}
})
}else{
if(_.hasIn(object, toRemoveKey)){
delete object[toRemoveKey];
}
}
for(let key in object){
if(typeof object[key] === "object"){
this.removeKeyFromObject(object[key], toRemoveKey);
}
}
return object;
}
static getPath(obj, searchKey:string, value:string) {
for(let key in obj) {
if(obj[key] && typeof obj[key] === "object") {
Expand Down
14 changes: 8 additions & 6 deletions dcm4chee-arc-ui2/src/app/study/study/study.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export class StudyComponent implements OnInit, OnDestroy, AfterContentChecked{
placeholder: $localize `:@@more_functions:More functions`,
options:[
new SelectDropdown("create_patient",$localize `:@@study.create_patient:Create patient`),
// new SelectDropdown("create_ups",$localize `:@@study.create_ups:Add new Workitem`),
new SelectDropdown("create_ups",$localize `:@@study.create_ups:Add new Workitem`),
new SelectDropdown("upload_dicom",$localize`:@@study.upload_dicom_object:Upload DICOM Object`),
new SelectDropdown("permanent_delete",$localize `:@@study.short_permanent_delete:Permanent delete`, $localize `:@@study.permanent_delete:Delete rejected Instances permanently`),
new SelectDropdown("export_multiple",$localize `:@@study.export_multiple:Export matching studies`),
Expand Down Expand Up @@ -2586,26 +2586,28 @@ export class StudyComponent implements OnInit, OnDestroy, AfterContentChecked{
});

this.dialogRef.componentInstance.mode = "create";
this.dialogRef.componentInstance.object = workitem;
this.dialogRef.componentInstance.patient = workitem;
this.dialogRef.componentInstance.dropdown = this.service.getArrayFromIod(ups);
this.dialogRef.componentInstance.iod = this.service.replaceKeyInJson(ups, 'items', 'Value');
this.dialogRef.componentInstance.saveLabel = config.saveLabel;
this.dialogRef.componentInstance.titleLabel = config.titleLabel;
this.dialogRef.afterClosed().subscribe(ok => {
if (ok){
j4care.removeKeyFromObject(workitem.attrs, ["required","enum", "multi"]);
if(mode === "create"){
/* this.service.createUPS(undefined,workitem.attrs,this.studyWebService).subscribe(res=>{
this.service.modifyUPS(undefined,workitem.attrs,this.studyWebService).subscribe(res=>{
this.appService.showMsg($localize `:@@study.patient_created_successfully:Workitem created successfully`);
},err=>{
workitem = undefined;
this.httpErrorHandler.handleError(err);
});*/
});
}else{
/* this.service.modifyUPS(this.service.getPatientId(originalWorkitemObject.attrs),workitem.attrs,this.studyWebService).subscribe(res=>{
this.service.modifyUPS(this.service.getPatientId(originalWorkitemObject.attrs),workitem.attrs,this.studyWebService).subscribe(res=>{
this.appService.showMsg($localize `:@@study.workitem_updated_successfully:Workitem updated successfully`);
},err=>{
_.assign(workitem, originalWorkitemObject);
this.httpErrorHandler.handleError(err);
});*/
});
}
}else{
_.assign(workitem, originalWorkitemObject);
Expand Down
4 changes: 2 additions & 2 deletions dcm4chee-arc-ui2/src/app/study/study/study.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3207,15 +3207,15 @@ export class StudyService {

modifyUPS(workitemUID: string, object, deviceWebservice: StudyWebService) {
// const url = this.getModifyPatientUrl(deviceWebservice);
return this.getModifyPatientUrl(deviceWebservice)
return this.getModifyUPSUrl(deviceWebservice)
.pipe(switchMap((url:string)=>{
if (url) {
if (workitemUID) {
//Change ups;
return this.$http.put(`${url}/${workitemUID}`, object);
} else {
//Create new patient
return this.$http.post(url, object);
return this.$http.post(url, object, new HttpHeaders({'Content-Type': 'application/dicom+json','Accept': 'application/dicom+json'}));
}
}
return throwError({error: $localize `:@@error_on_getting_needed_webapp:Error on getting the needed WebApp (with one of the web service classes "DCM4CHEE_ARC_AET" or "PAM")`});
Expand Down
12 changes: 10 additions & 2 deletions dcm4chee-arc-ui2/src/assets/iod/upsCreate.iod.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
"00080005": { "vr": "CS", "multi": true },
"00081195": { "vr": "UI", "required": 2 },
"0020000D": { "vr": "UI", "required": 2 },
"00741200": { "vr": "CS", "required": 1 },
"00741200": { "vr": "CS", "required": 1, "enum": [
"LOW",
"MEDIUM",
"HIGH"
]},
"00741204": { "vr": "LO", "required": 1 },
"00404041": { "vr": "LT", "required": 1 },
"00404041": { "vr": "LT", "required": 1,"enum": [
"INCOMPLETE",
"UNAVAILABLE",
"READY"
]},
"00404005": { "vr": "DT", "required": 2 },
"00741000": { "vr": "CS", "required": 1 },
"00741202": { "vr": "LO", "required": 2 },
Expand Down

0 comments on commit 9cba0f3

Please sign in to comment.