primarycare-binder 1.1.2 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.cjs.js +108 -137
  2. package/package.json +1 -1
package/dist/index.cjs.js CHANGED
@@ -11654,8 +11654,6 @@ var UPDATE_APPOINTMENT_STATUS = createAsyncThunk("appointmentReducer/updateAppoi
11654
11654
  //NURSE - completed_nurse
11655
11655
  //DOCTOR - completed
11656
11656
 
11657
- debugger;
11658
-
11659
11657
  if (status === "completed_assemble") {
11660
11658
  encounterStatus = "checked-in";
11661
11659
  } else if (status === "inprogress_nurse") {
@@ -11664,18 +11662,18 @@ var UPDATE_APPOINTMENT_STATUS = createAsyncThunk("appointmentReducer/updateAppoi
11664
11662
  } else if (status === "completed_nurse") {
11665
11663
  encounterStatus = "Triaged";
11666
11664
  } else if (status === "doctor_inprogress") {
11667
- encounterStatus = "in-progress";
11665
+ encounterStatus = "In-Progress";
11668
11666
  status = "completed_nurse";
11669
11667
  } else if (status === "completed") {
11670
11668
  encounterStatus = "consultation over";
11671
11669
  }
11672
11670
 
11673
11671
  if (!encounterStatus) {
11674
- _context14.next = 21;
11672
+ _context14.next = 20;
11675
11673
  break;
11676
11674
  }
11677
11675
 
11678
- _context14.next = 9;
11676
+ _context14.next = 8;
11679
11677
  return fetchData$3({
11680
11678
  body: JSON.stringify({
11681
11679
  db_name: dbName,
@@ -11685,10 +11683,10 @@ var UPDATE_APPOINTMENT_STATUS = createAsyncThunk("appointmentReducer/updateAppoi
11685
11683
  })
11686
11684
  }, __readDocumentUrl__);
11687
11685
 
11688
- case 9:
11686
+ case 8:
11689
11687
  encounterCode = _context14.sent;
11690
11688
  encounterStatus = (_encounterCode$result = encounterCode === null || encounterCode === void 0 ? void 0 : (_encounterCode$result2 = encounterCode.result) === null || _encounterCode$result2 === void 0 ? void 0 : (_encounterCode$result3 = _encounterCode$result2[0]) === null || _encounterCode$result3 === void 0 ? void 0 : _encounterCode$result3._id) !== null && _encounterCode$result !== void 0 ? _encounterCode$result : "";
11691
- _context14.next = 13;
11689
+ _context14.next = 12;
11692
11690
  return fetchData$3({
11693
11691
  body: JSON.stringify({
11694
11692
  db_name: dbName,
@@ -11698,12 +11696,12 @@ var UPDATE_APPOINTMENT_STATUS = createAsyncThunk("appointmentReducer/updateAppoi
11698
11696
  })
11699
11697
  }, __readDocumentUrl__);
11700
11698
 
11701
- case 13:
11699
+ case 12:
11702
11700
  encounterInfo = _context14.sent;
11703
11701
  _ref30 = (encounterInfo === null || encounterInfo === void 0 ? void 0 : (_encounterInfo$result = encounterInfo.result) === null || _encounterInfo$result === void 0 ? void 0 : _encounterInfo$result[0]) || {}, _id = _ref30._id, _key = _ref30._key, statushistory = _ref30.statushistory;
11704
11702
 
11705
11703
  if (!(_id && _key && statushistory && Array.isArray(statushistory))) {
11706
- _context14.next = 21;
11704
+ _context14.next = 20;
11707
11705
  break;
11708
11706
  }
11709
11707
 
@@ -11740,12 +11738,12 @@ var UPDATE_APPOINTMENT_STATUS = createAsyncThunk("appointmentReducer/updateAppoi
11740
11738
  status: encounterStatus
11741
11739
  }
11742
11740
  }];
11743
- _context14.next = 21;
11741
+ _context14.next = 20;
11744
11742
  return fetchData$3({
11745
11743
  body: JSON.stringify(updateData)
11746
11744
  }, __uspsertUrl__);
11747
11745
 
11748
- case 21:
11746
+ case 20:
11749
11747
  // const appData = await fetchData({
11750
11748
  // body: JSON.stringify(appBody),
11751
11749
  // });
@@ -11756,7 +11754,6 @@ var UPDATE_APPOINTMENT_STATUS = createAsyncThunk("appointmentReducer/updateAppoi
11756
11754
  }
11757
11755
 
11758
11756
  appInfo["comment"] = status;
11759
- debugger;
11760
11757
  body = [{
11761
11758
  db_name: dbName,
11762
11759
  entity: "Appointment",
@@ -11767,30 +11764,30 @@ var UPDATE_APPOINTMENT_STATUS = createAsyncThunk("appointmentReducer/updateAppoi
11767
11764
  id: appointmentId
11768
11765
  }
11769
11766
  }];
11770
- _context14.next = 28;
11767
+ _context14.next = 26;
11771
11768
  return fetchData$3({
11772
11769
  body: JSON.stringify(body)
11773
11770
  }, __uspsertUrl__);
11774
11771
 
11775
- case 28:
11772
+ case 26:
11776
11773
  data = _context14.sent;
11777
11774
  return _context14.abrupt("return", _objectSpread2(_objectSpread2({}, defaultState.List), {}, {
11778
11775
  data: data
11779
11776
  }));
11780
11777
 
11781
- case 32:
11782
- _context14.prev = 32;
11778
+ case 30:
11779
+ _context14.prev = 30;
11783
11780
  _context14.t0 = _context14["catch"](2);
11784
11781
  return _context14.abrupt("return", rejectWithValue(_objectSpread2(_objectSpread2({}, defaultReject), {}, {
11785
11782
  message: _context14.t0.message
11786
11783
  })));
11787
11784
 
11788
- case 35:
11785
+ case 33:
11789
11786
  case "end":
11790
11787
  return _context14.stop();
11791
11788
  }
11792
11789
  }
11793
- }, _callee14, null, [[2, 32]]);
11790
+ }, _callee14, null, [[2, 30]]);
11794
11791
  })));
11795
11792
  var CANCEL_APPOINTMENT_STATUS = createAsyncThunk("appointmentReducer/cancelApoointmentStatus", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee15() {
11796
11793
  var payload,
@@ -14506,9 +14503,8 @@ var SPECIALITY_AGAINST_PRACTITIONER = createAsyncThunk("searhcApiSlice/specialit
14506
14503
  _context10.prev = 2;
14507
14504
  body = {
14508
14505
  db_name: dbName,
14509
- entity: "Practitioner,PractitionerRole",
14510
- filter: queries$a["specialityAgainstPractitioner"].query(),
14511
- return_fields: queries$a["specialityAgainstPractitioner"].returnFields
14506
+ entity: "Practitioner",
14507
+ return_fields: "MERGE(Practitioner,{name:(FOR cod IN TO_ARRAY(Practitioner.name) RETURN DOCUMENT(cod)),SPECIALTY:(FOR spec IN TO_ARRAY(Practitioner.practitioner_role) FOR speccod IN TO_ARRAY( DOCUMENT(spec).SpecialtyID) RETURN MERGE(DOCUMENT(speccod),{coding:(FOR cod IN DOCUMENT(speccod).coding RETURN DOCUMENT(cod))})) })"
14512
14508
  };
14513
14509
  _context10.next = 6;
14514
14510
  return fetchData$3({
@@ -14521,13 +14517,13 @@ var SPECIALITY_AGAINST_PRACTITIONER = createAsyncThunk("searhcApiSlice/specialit
14521
14517
 
14522
14518
  if (Array.isArray(data === null || data === void 0 ? void 0 : data.result)) {
14523
14519
  data === null || data === void 0 ? void 0 : data.result.forEach(function (spec) {
14524
- var _spec$name, _spec$name$, _spec$SPECIALTY;
14520
+ var _spec$name, _spec$name$, _spec$SPECIALTY, _spec$SPECIALTY$, _spec$SPECIALTY$$codi, _spec$SPECIALTY$$codi2;
14525
14521
 
14526
14522
  returnData.push({
14527
14523
  label: (_spec$name = spec.name) === null || _spec$name === void 0 ? void 0 : (_spec$name$ = _spec$name[0]) === null || _spec$name$ === void 0 ? void 0 : _spec$name$.text,
14528
14524
  value: spec.id,
14529
14525
  type: 'Doctor',
14530
- speciality: spec === null || spec === void 0 ? void 0 : (_spec$SPECIALTY = spec.SPECIALTY) === null || _spec$SPECIALTY === void 0 ? void 0 : _spec$SPECIALTY.text
14526
+ speciality: spec === null || spec === void 0 ? void 0 : (_spec$SPECIALTY = spec.SPECIALTY) === null || _spec$SPECIALTY === void 0 ? void 0 : (_spec$SPECIALTY$ = _spec$SPECIALTY[0]) === null || _spec$SPECIALTY$ === void 0 ? void 0 : (_spec$SPECIALTY$$codi = _spec$SPECIALTY$.coding) === null || _spec$SPECIALTY$$codi === void 0 ? void 0 : (_spec$SPECIALTY$$codi2 = _spec$SPECIALTY$$codi[0]) === null || _spec$SPECIALTY$$codi2 === void 0 ? void 0 : _spec$SPECIALTY$$codi2.display
14531
14527
  });
14532
14528
  });
14533
14529
  }
@@ -14572,9 +14568,12 @@ var PRACTITIONER_AGAINST_ORGANIZATION = createAsyncThunk("searhcApiSlice/practit
14572
14568
  _payload$practitioner = payload.practitionerId, practitionerId = _payload$practitioner === void 0 ? "" : _payload$practitioner;
14573
14569
  body = {
14574
14570
  db_name: dbName,
14575
- entity: "Practitioner,PractitionerRole,Organization",
14576
- filter: queries$a["practitionerAgainstOrganization"].query(practitionerId),
14577
- return_fields: queries$a["practitionerAgainstOrganization"].returnFields
14571
+ entity: "Practitioner,Organization",
14572
+ filter: {
14573
+ Practitioner: "Practitioner.id==".concat(practitionerId),
14574
+ Organization: "document(Practitioner.practitioner_role)[*].OrgID any == Organization._id"
14575
+ },
14576
+ return_fields: "{OrganizationName:Organization.name, OrgID:Organization.id}"
14578
14577
  };
14579
14578
  _context11.next = 7;
14580
14579
  return fetchData$3({
@@ -14589,7 +14588,7 @@ var PRACTITIONER_AGAINST_ORGANIZATION = createAsyncThunk("searhcApiSlice/practit
14589
14588
  data === null || data === void 0 ? void 0 : (_data$result = data.result) === null || _data$result === void 0 ? void 0 : _data$result.forEach(function (hospInfo) {
14590
14589
  returnData.push({
14591
14590
  value: hospInfo.OrgID,
14592
- label: hospInfo.Organization,
14591
+ label: hospInfo.OrganizationName,
14593
14592
  lat: 0,
14594
14593
  "long": 0
14595
14594
  });
@@ -18015,15 +18014,15 @@ var dashboardQuery = {
18015
18014
  1: {
18016
18015
  db_name: "primarycare",
18017
18016
  entity: "Appointment",
18018
- filter: "Appointment.activestatus==true && Appointment.orgid=='".concat(orgID, "' && Appointment.start>=").concat(startDate, " && Appointment.end<=").concat(endDate, " && lower(Appointment.appointmentType)!='cancelled' && Appointment.practitionerID any ==").concat(loginId, " && Appointment.orgid=='").concat(orgID, "' collect with count into length"),
18017
+ filter: "Appointment.activestatus==true && Appointment.orgid=='".concat(orgID, "' && Appointment.start>=").concat(startDate, " && Appointment.end<=").concat(endDate, " && lower(Appointment.appointmentType)!='cancelled' && document(Appointment.resourcecode).id ==").concat(loginId, " collect with count into length"),
18019
18018
  return_fields: "{Count:length}"
18020
18019
  },
18021
18020
  2: {
18022
18021
  db_name: "primarycare",
18023
18022
  entity: "Practitioner,Appointment",
18024
18023
  filter: {
18025
- Practitioner: "Practitioner.activestatus==true && lower(document(Practitioner.practitioner_type).display)=='nurse' && Practitioner.id==".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orgID, "'"),
18026
- Appointment: "Appointment.activestatus==true && Appointment.orgid=='".concat(orgID, "' && Appointment.start>=").concat(startDate, " && Appointment.end<=").concat(endDate, " && lower(Appointment.appointmentType)!='cancelled' && DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Appointment.SpecialtyID collect with count into length")
18024
+ Practitioner: "Practitioner.activestatus==true && DOCUMENT(DOCUMENT(DOCUMENT(Practitioner.practitioner_role[*])[*].role)[0].coding)[*].code ANY =='PR023' && Practitioner.id==".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orgID, "'"),
18025
+ Appointment: "Appointment.activestatus==true && Appointment.orgid=='".concat(orgID, "' && Appointment.start>=").concat(startDate, " && Appointment.end<=").concat(endDate, " && lower(Appointment.appointmentType)!='cancelled' && document(DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID)[*].id ANY IN Appointment.SpecialtyID collect with count into length")
18027
18026
  },
18028
18027
  return_fields: "{Count:length}"
18029
18028
  },
@@ -18054,7 +18053,6 @@ var dashboardQuery = {
18054
18053
  };
18055
18054
  },
18056
18055
  todayVisit: function todayVisit(orgID, startDate, endDate, loginId) {
18057
- debugger;
18058
18056
  return {
18059
18057
  1: {
18060
18058
  db_name: dbName,
@@ -18069,8 +18067,8 @@ var dashboardQuery = {
18069
18067
  db_name: dbName,
18070
18068
  entity: "Practitioner,Encounter",
18071
18069
  filter: {
18072
- Practitioner: "Practitioner.activestatus==true && lower(document(Practitioner.practitioner_type).display)=='nurse' && Practitioner.id== ".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orgID, "'"),
18073
- Encounter: "Encounter.activestatus == true && Encounter.Organization_id == '".concat(orgID, "' && DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Encounter.practitioner_details[*].speciality AND Encounter.encounterdate>=").concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " && lower(first(document(Encounter.statushistory[*].status)[*].display))=='checked-in' collect with count into length")
18070
+ Practitioner: "Practitioner.activestatus==true && DOCUMENT(DOCUMENT(DOCUMENT(Practitioner.practitioner_role[*])[*].role)[0].coding)[*].code ANY =='PR023' && Practitioner.id== ".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orgID, "'"),
18071
+ Encounter: "Encounter.activestatus == true && Encounter.Organization_id == '".concat(orgID, "' && document(DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID)[*].id ANY IN Encounter.practitioner_details[*].speciality AND Encounter.encounterdate>=").concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " && lower(first(document(Encounter.statushistory[*].status)[*].display))=='checked-in' collect with count into length")
18074
18072
  },
18075
18073
  return_fields: "{CheckedIn:length}"
18076
18074
  },
@@ -18089,8 +18087,8 @@ var dashboardQuery = {
18089
18087
  db_name: dbName,
18090
18088
  entity: "Practitioner,Encounter",
18091
18089
  filter: {
18092
- Practitioner: "Practitioner.practitioner_type=='CodingMaster/10628' and Practitioner.id==".concat(loginId, " AND DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY ==").concat(orgID),
18093
- Encounter: "DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Encounter.practitioner_details[*].speciality AND Encounter.encounterdate>=".concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " && Encounter.status=='CodingMaster/12401' collect with count into length")
18090
+ Practitioner: "DOCUMENT(DOCUMENT(DOCUMENT(Practitioner.practitioner_role[*])[*].role)[0].coding)[*].code ANY =='PR023' and Practitioner.id==".concat(loginId, " AND DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orgID, "'"),
18091
+ Encounter: "DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Encounter.practitioner_details[*].speciality AND Encounter.encounterdate>=".concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " && document(Encounter.status).code=='ENCSTATUS008' collect with count into length")
18094
18092
  },
18095
18093
  return_fields: "{CheckedIn:length}"
18096
18094
  } // 3: {},
@@ -18104,8 +18102,8 @@ var dashboardQuery = {
18104
18102
  db_name: dbName,
18105
18103
  entity: "Practitioner,Encounter",
18106
18104
  filter: {
18107
- Practitioner: "lower(document(Practitioner.practitioner_type).display)=='nurse' and Practitioner.id==".concat(loginId, " AND DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY ==").concat(orgID),
18108
- Encounter: "DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Encounter.practitioner_details[*].speciality AND Encounter.encounterdate>=".concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " && lower(first(document(Encounter.statushistory[*].status)[*].display)) =='triaged' collect with count into length")
18105
+ Practitioner: "DOCUMENT(DOCUMENT(DOCUMENT(Practitioner.practitioner_role[*])[*].role)[0].coding)[*].code ANY =='PR023' and Practitioner.id==".concat(loginId, " AND DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orgID, "'"),
18106
+ Encounter: "DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Encounter.practitioner_details[*].speciality AND Encounter.encounterdate>=".concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " && document(Encounter.statushistory[*].status)[*].display ANY =='Triaged' collect with count into length")
18109
18107
  },
18110
18108
  return_fields: "{Triage:length}"
18111
18109
  } // 3: {},
@@ -18119,8 +18117,8 @@ var dashboardQuery = {
18119
18117
  db_name: dbName,
18120
18118
  entity: "Practitioner,Encounter",
18121
18119
  filter: {
18122
- Practitioner: "Practitioner.practitioner_type=='CodingMaster/10628' and Practitioner.id==".concat(loginId, " AND DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY ==").concat(orgID),
18123
- Encounter: "DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Encounter.practitioner_details[*].speciality AND Encounter.encounterdate>=".concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " && Encounter.status=='CodingMaster/11596' collect with count into length")
18120
+ Practitioner: "DOCUMENT(DOCUMENT(DOCUMENT(Practitioner.practitioner_role[*])[*].role)[0].coding)[*].code ANY =='PR023' and Practitioner.id==".concat(loginId, " AND DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orgID, "'"),
18121
+ Encounter: "DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Encounter.practitioner_details[*].speciality AND Encounter.encounterdate>=".concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " && document(Encounter.status).code=='ENCSTATUS005' collect with count into length")
18124
18122
  },
18125
18123
  return_fields: "{InProgress:length}"
18126
18124
  } // 3: {},
@@ -18134,47 +18132,19 @@ var dashboardQuery = {
18134
18132
  db_name: dbName,
18135
18133
  entity: "Practitioner,Encounter",
18136
18134
  filter: {
18137
- Practitioner: "lower(document(Practitioner.practitioner_type).display)=='doctor' and Practitioner.id==".concat(loginId, " AND DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY ==").concat(orgID),
18138
- Encounter: "DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Encounter.practitioner_details[*].speciality AND Encounter.encounterdate>=".concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " && lower(first(document(Encounter.statushistory[*].status)[*].display)) =='finished' collect with count into length")
18135
+ Practitioner: "DOCUMENT(DOCUMENT(DOCUMENT(Practitioner.practitioner_role[*])[*].role)[0].coding)[*].code ANY =='PR023' and Practitioner.id==".concat(loginId, " AND DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orgID, "'"),
18136
+ Encounter: "DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Encounter.practitioner_details[*].speciality AND Encounter.encounterdate>=".concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " && document(Encounter.statushistory[*].status)[*].code ANY =='ENCSTATUS0010' collect with count into length")
18139
18137
  },
18140
18138
  return_fields: "{Finished:length}"
18141
18139
  } // 3: {},
18142
18140
 
18143
18141
  };
18144
18142
  },
18145
- // checkingAppointment: (orgID, startDate, endDate, loginId) => {
18146
- // return {
18147
- // 1: {
18148
- // db_name: dbName,
18149
- // entity: "Practitioner,PractitionerRole,Appointment,Encounter",
18150
- // filter: {
18151
- // Practitioner: `Practitioner.id == ${loginId}`,
18152
- // PractitionerRole: `PractitionerRole.id == Practitioner.PractitionerRoleID && PractitionerRole.OrgID[*] ANY == ${orgID}`,
18153
- // Appointment: `Appointment.start >= ${startDate} && Appointment.end <= ${endDate} && Appointment.SpecialtyID[*] ANY == PractitionerRole.SpecialtyID[0]`,
18154
- // Encounter:
18155
- // "Encounter.appointmentId[*] ANY == Appointment.id COLLECT WITH COUNT INTO length",
18156
- // },
18157
- // return_fields: "{'checkedInCount' : length}",
18158
- // },
18159
- // 2: {
18160
- // db_name: dbName,
18161
- // entity: "Practitioner,PractitionerRole,Appointment,Encounter",
18162
- // filter: `Practitioner.id == ${loginId} && PractitionerRole.id == Practitioner.PractitionerRoleID && PractitionerRole.OrgID[*] ANY == ${orgID} && Appointment.start >= ${startDate} && Appointment.end <= ${endDate} && Appointment.SpecialtyID[*] ANY == PractitionerRole.SpecialtyID[0] && Encounter.appointmentId[*] ANY == Appointment.id COLLECT WITH COUNT INTO length`,
18163
- // return_fields: "{'checkedInCount' : length}",
18164
- // },
18165
- // 3: {
18166
- // db_name: dbName,
18167
- // entity: "Practitioner,PractitionerRole,Appointment,Encounter",
18168
- // filter: `Practitioner.id == ${loginId} && PractitionerRole._id == Practitioner.PractitionerRole && PractitionerRole.OrgID[*] ANY == ${orgID} && Appointment.start >= ${startDate} && Appointment.end <= ${endDate} && Appointment.SpecialtyID[*] ANY == PractitionerRole.SpecialtyID[0] && Encounter.appointmentId[*] ANY == Appointment.id COLLECT WITH COUNT INTO length`,
18169
- // return_fields: "{'checkedInCount' : length}",
18170
- // },
18171
- // };
18172
- // },
18173
18143
  patientWaitingTimeQuery: function patientWaitingTimeQuery(orgID, loginId) {
18174
18144
  return {
18175
18145
  1: {
18176
18146
  db_name: dbName,
18177
- queryid: "4a129656-d8e2-4a3c-9626-7488903118f9",
18147
+ queryid: "21fd3638-914e-41a8-b6e5-36459565595a",
18178
18148
  filter: {
18179
18149
  practid: loginId,
18180
18150
  orgid: "".concat(orgID)
@@ -18197,7 +18167,7 @@ var dashboardQuery = {
18197
18167
  db_name: "primarycare",
18198
18168
  entity: "Appointment,Encounter",
18199
18169
  filter: {
18200
- Appointment: "Appointment.activestatus==true && Appointment.start>= ".concat(startDate, " && Appointment.end<=").concat(endDate, " && Appointment.practitionerID any ==").concat(loginId, " && Appointment.orgid=='").concat(orgID, "' "),
18170
+ Appointment: "Appointment.activestatus==true && Appointment.start>= ".concat(startDate, " && Appointment.end<=").concat(endDate, " && document(Appointment.resourcecode).id ==").concat(loginId, " && Appointment.orgid=='").concat(orgID, "' "),
18201
18171
  Encounter: "Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('First Visit') collect with count into length"
18202
18172
  },
18203
18173
  return_fields: "{FirstVisitCount:length}"
@@ -18206,8 +18176,8 @@ var dashboardQuery = {
18206
18176
  db_name: "primarycare",
18207
18177
  entity: "Practitioner,Appointment,Encounter",
18208
18178
  filter: {
18209
- Practitioner: "Practitioner.activestatus==true && lower(document(Practitioner.practitioner_type).display)=='nurse' && Practitioner.id==".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orgID, "'"),
18210
- Appointment: "Appointment.activestatus==true && Appointment.orgid=='".concat(orgID, "' && Appointment.start>=").concat(startDate, " && Appointment.end<=").concat(endDate, " && DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Appointment.SpecialtyID"),
18179
+ Practitioner: "DOCUMENT(DOCUMENT(DOCUMENT(Practitioner.practitioner_role[*])[*].role)[0].coding)[*].code ANY =='PR023' && Practitioner.id==".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orgID, "'"),
18180
+ Appointment: "Appointment.activestatus==true && Appointment.orgid=='".concat(orgID, "' && Appointment.start>=").concat(startDate, " && Appointment.end<=").concat(endDate, " && document(DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID)[*].id ANY IN Appointment.SpecialtyID"),
18211
18181
  Encounter: "Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('First Visit') collect with count into length"
18212
18182
  },
18213
18183
  return_fields: "{FirstVisitCount:length}"
@@ -18229,7 +18199,7 @@ var dashboardQuery = {
18229
18199
  db_name: "primarycare",
18230
18200
  entity: "Appointment,Encounter",
18231
18201
  filter: {
18232
- Appointment: "Appointment.activestatus==true && Appointment.start>= ".concat(startDate, " && Appointment.end<=").concat(endDate, " && Appointment.practitionerID any ==").concat(loginId, " && Appointment.orgid=='").concat(orgID, "' "),
18202
+ Appointment: "Appointment.activestatus==true && Appointment.start>= ".concat(startDate, " && Appointment.end<=").concat(endDate, " && document(Appointment.resourcecode).id ==").concat(loginId, " && Appointment.orgid=='").concat(orgID, "' "),
18233
18203
  Encounter: "Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('Other Visits') collect with count into length"
18234
18204
  },
18235
18205
  return_fields: "{OtherVisitsCount:length}"
@@ -18238,8 +18208,8 @@ var dashboardQuery = {
18238
18208
  db_name: "primarycare",
18239
18209
  entity: "Practitioner,Appointment,Encounter",
18240
18210
  filter: {
18241
- Practitioner: "Practitioner.activestatus==true && lower(document(Practitioner.practitioner_type).display)=='nurse' && Practitioner.id==".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orgID, "'"),
18242
- Appointment: "Appointment.activestatus==true && Appointment.orgid=='".concat(orgID, "' && Appointment.start>=").concat(startDate, " && Appointment.end<=").concat(endDate, " && DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Appointment.SpecialtyID"),
18211
+ Practitioner: "DOCUMENT(DOCUMENT(DOCUMENT(Practitioner.practitioner_role[*])[*].role)[0].coding)[*].code ANY =='PR023' && Practitioner.id==".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orgID, "'"),
18212
+ Appointment: "Appointment.activestatus==true && Appointment.orgid=='".concat(orgID, "' && Appointment.start>=").concat(startDate, " && Appointment.end<=").concat(endDate, " && document(DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID)[*].id ANY IN Appointment.SpecialtyID"),
18243
18213
  Encounter: "Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('Other Visits') collect with count into length"
18244
18214
  },
18245
18215
  return_fields: "{OtherVisitsCount:length}"
@@ -18261,7 +18231,7 @@ var dashboardQuery = {
18261
18231
  db_name: "primarycare",
18262
18232
  entity: "Appointment,Encounter",
18263
18233
  filter: {
18264
- Appointment: "Appointment.activestatus==true && Appointment.start>= ".concat(startDate, " && Appointment.end<=").concat(endDate, " && Appointment.practitionerID any ==").concat(loginId, " && Appointment.orgid=='").concat(orgID, "' "),
18234
+ Appointment: "Appointment.activestatus==true && Appointment.start>= ".concat(startDate, " && Appointment.end<=").concat(endDate, " && document(Appointment.resourcecode).id ==").concat(loginId, " && Appointment.orgid=='").concat(orgID, "' "),
18265
18235
  Encounter: "Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('Walkin') collect with count into length"
18266
18236
  },
18267
18237
  return_fields: "{WalkinCount:length}"
@@ -18270,8 +18240,8 @@ var dashboardQuery = {
18270
18240
  db_name: "primarycare",
18271
18241
  entity: "Practitioner,Appointment,Encounter",
18272
18242
  filter: {
18273
- Practitioner: "Practitioner.activestatus==true && lower(document(Practitioner.practitioner_type).display)=='nurse' && Practitioner.id==".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orgID, "'"),
18274
- Appointment: "Appointment.activestatus==true && Appointment.orgid=='".concat(orgID, "' && Appointment.start>=").concat(startDate, " && Appointment.end<=").concat(endDate, " && DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Appointment.SpecialtyID"),
18243
+ Practitioner: "DOCUMENT(DOCUMENT(DOCUMENT(Practitioner.practitioner_role[*])[*].role)[0].coding)[*].code ANY =='PR023' && Practitioner.id==".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orgID, "'"),
18244
+ Appointment: "Appointment.activestatus==true && Appointment.orgid=='".concat(orgID, "' && Appointment.start>=").concat(startDate, " && Appointment.end<=").concat(endDate, " && document(DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID)[*].id ANY IN Appointment.SpecialtyID"),
18275
18245
  Encounter: "Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('Walkin') collect with count into length"
18276
18246
  },
18277
18247
  return_fields: "{WalkinCount:length}"
@@ -18293,7 +18263,7 @@ var dashboardQuery = {
18293
18263
  db_name: "primarycare",
18294
18264
  entity: "Appointment,Encounter",
18295
18265
  filter: {
18296
- Appointment: "Appointment.activestatus==true && Appointment.start>=".concat(startDate, " && Appointment.end<=").concat(endDate, " && Appointment.practitionerID any ==").concat(loginId, " && Appointment.orgid=='").concat(orgID, "' "),
18266
+ Appointment: "Appointment.activestatus==true && Appointment.start>=".concat(startDate, " && Appointment.end<=").concat(endDate, " && document(Appointment.resourcecode).id ==").concat(loginId, " && Appointment.orgid=='").concat(orgID, "' "),
18297
18267
  Encounter: "Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('New Patient') collect with count into length"
18298
18268
  },
18299
18269
  return_fields: "{NewPatientCount:length}"
@@ -18302,8 +18272,8 @@ var dashboardQuery = {
18302
18272
  db_name: "primarycare",
18303
18273
  entity: "Practitioner,Appointment,Encounter",
18304
18274
  filter: {
18305
- Practitioner: "Practitioner.activestatus==true && lower(document(Practitioner.practitioner_type).display)=='nurse' && Practitioner.id==".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orgID, "'"),
18306
- Appointment: "Appointment.activestatus==true && Appointment.orgid=='".concat(orgID, "' && Appointment.start>=").concat(startDate, " && Appointment.end<=").concat(endDate, " && DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Appointment.SpecialtyID"),
18275
+ Practitioner: "DOCUMENT(DOCUMENT(DOCUMENT(Practitioner.practitioner_role[*])[*].role)[0].coding)[*].code ANY =='PR023' && Practitioner.id==".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orgID, "'"),
18276
+ Appointment: "Appointment.activestatus==true && Appointment.orgid=='".concat(orgID, "' && Appointment.start>=").concat(startDate, " && Appointment.end<=").concat(endDate, " && document(DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID)[*].id ANY IN Appointment.SpecialtyID"),
18307
18277
  Encounter: "Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('New Patient') collect with count into length"
18308
18278
  },
18309
18279
  return_fields: "{NewPatientCount:length}"
@@ -18326,7 +18296,7 @@ var dashboardQuery = {
18326
18296
  entity: "Appointment,Encounter",
18327
18297
  filter: {
18328
18298
  Appointment: "Appointment.activestatus==true && Appointment.start>=".concat(start, " && Appointment.end<=").concat(end),
18329
- Encounter: "Encounter._key=='".concat(encounterKey, "' && Encounter.activestatus==true && Encounter.appointmentId[*] any == Appointment.id && lower(document(Encounter.status).display) like 'checked-in'")
18299
+ Encounter: "Encounter._key=='".concat(encounterKey, "' && Encounter.activestatus==true && Encounter.appointmentId[*] any == Appointment.id && lower(first(document(Encounter.statushistory[*].status)[*].display)) =='checked-in'")
18330
18300
  },
18331
18301
  return_fields: "{Appointment:merge(keep(Appointment,'_id','_key','id','alias','start','appno','appointmentReason','consultationMode','SpecialtyID'),{SpecialtyID:(for c in CodeableConceptMaster filter c.id in Appointment.SpecialtyID return merge(c,{coding:document(c.coding)}))}),Encounter:merge(keep(Encounter,'_id','_key','id','encounter_no','visit_type','status','patient_id','participant','encounterdate','participantHistory','practitioner_details','reasonCode','reasonReference'),{patient_id:(for pat in Patient filter pat.id==Encounter.patient_id return merge(pat,{name:(for hn in HumanNameMaster filter hn._id in pat.name return merge(hn,{use:document(hn.use),prefix:document(hn.prefix),suffix:document(hn.suffix)})),telecom:document(pat.telecom),gender:document(pat.gender),MRN:pat.alias,age:pat.age,photo:document(pat.photo)})),status:document(Encounter.status)},{practitioner_details:(for pd in Encounter.practitioner_details return merge(pd,{speciality:(for cdd in CodeableConceptMaster filter cdd._id == pd.speciality return merge(cdd,{coding: document(cdd.coding)}))}))},{participant:(for par in Encounter.participant return merge(par,{Practitioner_id:(for prac in Practitioner filter prac.id == par.Practitioner_id return merge(keep(prac,'_id','_key','id','name','practitioner_role','practitioner_type'),{name:(for hnm in HumanNameMaster filter hnm._id in prac.name return merge(hnm,{use:(for cod in CodeableConceptMaster filter cod._id==hnm.use return document(cod.coding)),prefix:(for cod in CodeableConceptMaster filter cod._id==hnm.prefix return document(cod.coding)),suffix:(for cod in CodeableConceptMaster filter cod._id==hnm.suffix return document(cod.coding))}))},{practitioner_type:(for cod in CodeableConceptMaster filter cod._id ==par.practitioner_type return document(cod.coding) )},{practitioner_role:(for prcrole in PractitionerRole filter prcrole._id in prac.practitioner_role return merge(prcrole,{role:(for cd in CodeableConceptMaster filter cd._id==prcrole.role return merge(cd,{coding: document(cd.coding)}))},{SpecialtyID:(for cdd in CodeableConceptMaster filter cdd._id == prcrole.SpecialtyID return merge(cdd, {coding:document(cdd.coding)}))}))}))},{type:document(par.type)},{PractitionerRole_id:(for prid in PractitionerRole filter prid.id==par.PractitionerRole_id return merge(prid,{role:document(prid.role)}))}))},{reasonReference:document(Encounter.reasonReference)},{participantHistory:(for phy in to_array (Encounter.participantHistory) return merge(phy,{specialty:(for spe in Specialty filter spe._id == phy.specialty return merge(spe,{facilities:document(spe.facilities)}))},{practitionerId:keep(document(phy.practitionerId),'_id','_key','id','name')},{practroleId:document(phy.practroleId)},{participantType:document(phy.participantType)}))})}"
18332
18302
  },
@@ -18335,7 +18305,7 @@ var dashboardQuery = {
18335
18305
  entity: "Appointment,Encounter",
18336
18306
  filter: {
18337
18307
  Appointment: "Appointment.activestatus==true && Appointment.start>=".concat(start, " && Appointment.end<=").concat(end),
18338
- Encounter: "Encounter._key=='".concat(encounterKey, "' && Encounter.activestatus==true && Encounter.appointmentId[*] any == Appointment.id && lower(document(Encounter.status).display) like 'checked-in'")
18308
+ Encounter: "Encounter._key=='".concat(encounterKey, "' && Encounter.activestatus==true && Encounter.appointmentId[*] any == Appointment.id && lower(first(document(Encounter.statushistory[*].status)[*].display)) =='checked-in'")
18339
18309
  },
18340
18310
  return_fields: "{Appointment:merge(keep(Appointment,'_id','_key','id','alias','start','appno','appointmentReason','consultationMode','SpecialtyID'),{SpecialtyID:(for c in CodeableConceptMaster filter c.id in Appointment.SpecialtyID return merge(c,{coding:document(c.coding)}))}),Encounter:merge(keep(Encounter,'_id','_key','id','encounter_no','visit_type','status','patient_id','participant','encounterdate','participantHistory','practitioner_details','reasonCode','reasonReference'),{patient_id:(for pat in Patient filter pat.id==Encounter.patient_id return merge(pat,{name:(for hn in HumanNameMaster filter hn._id in pat.name return merge(hn,{use:document(hn.use),prefix:document(hn.prefix),suffix:document(hn.suffix)})),telecom:document(pat.telecom),gender:document(pat.gender),MRN:pat.alias,age:pat.age,photo:document(pat.photo)})),status:document(Encounter.status)},{practitioner_details:(for pd in Encounter.practitioner_details return merge(pd,{speciality:(for cdd in CodeableConceptMaster filter cdd._id == pd.speciality return merge(cdd,{coding: document(cdd.coding)}))}))},{participant:(for par in Encounter.participant return merge(par,{Practitioner_id:(for prac in Practitioner filter prac.id == par.Practitioner_id return merge(keep(prac,'_id','_key','id','name','practitioner_role','practitioner_type'),{name:(for hnm in HumanNameMaster filter hnm._id in prac.name return merge(hnm,{use:(for cod in CodeableConceptMaster filter cod._id==hnm.use return document(cod.coding)),prefix:(for cod in CodeableConceptMaster filter cod._id==hnm.prefix return document(cod.coding)),suffix:(for cod in CodeableConceptMaster filter cod._id==hnm.suffix return document(cod.coding))}))},{practitioner_type:(for cod in CodeableConceptMaster filter cod._id ==par.practitioner_type return document(cod.coding) )},{practitioner_role:(for prcrole in PractitionerRole filter prcrole._id in prac.practitioner_role return merge(prcrole,{role:(for cd in CodeableConceptMaster filter cd._id==prcrole.role return merge(cd,{coding: document(cd.coding)}))},{SpecialtyID:(for cdd in CodeableConceptMaster filter cdd._id == prcrole.SpecialtyID return merge(cdd, {coding:document(cdd.coding)}))}))}))},{type:document(par.type)},{PractitionerRole_id:(for prid in PractitionerRole filter prid.id==par.PractitionerRole_id return merge(prid,{role:document(prid.role)}))}))},{reasonReference:document(Encounter.reasonReference)},{participantHistory:(for phy in to_array (Encounter.participantHistory) return merge(phy,{specialty:(for spe in Specialty filter spe._id == phy.specialty return merge(spe,{facilities:document(spe.facilities)}))},{practitionerId:keep(document(phy.practitionerId),'_id','_key','id','name')},{practroleId:document(phy.practroleId)},{participantType:document(phy.participantType)}))})}"
18341
18311
  }
@@ -18451,14 +18421,13 @@ var dashboardQuery = {
18451
18421
  }
18452
18422
  };
18453
18423
  var visitQuery = {
18454
- checkedIn: function checkedIn(startDate, endDate, orgId, loginId) {
18455
- debugger;
18424
+ checkedIn: function checkedIn(startDate, endDate, orgId, loginId, orGId) {
18456
18425
  return {
18457
18426
  1: {
18458
18427
  db_name: dbName,
18459
18428
  entity: "Practitioner,Encounter",
18460
18429
  filter: {
18461
- Practitioner: "Practitioner.activestatus==true && Practitioner.id== ".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY ==").concat(orgId),
18430
+ Practitioner: "Practitioner.activestatus==true && Practitioner.id== ".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orGId, "'"),
18462
18431
  Encounter: "Encounter.activestatus == true && Encounter.Organization_id == ".concat(orgId, " && Encounter.participant[*].Practitioner_id any == Practitioner.id && Encounter.encounterdate>=").concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " && lower(first(document(Encounter.statushistory[*].status)[*].display))=='checked-in' collect with count into length")
18463
18432
  },
18464
18433
  return_fields: "{CheckedIn:length}"
@@ -18467,8 +18436,8 @@ var visitQuery = {
18467
18436
  db_name: dbName,
18468
18437
  entity: "Practitioner,Encounter",
18469
18438
  filter: {
18470
- Practitioner: "Practitioner.activestatus==true && lower(document(Practitioner.practitioner_type).display)=='nurse' && Practitioner.id== ".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY ==").concat(orgId),
18471
- Encounter: "Encounter.activestatus == true && Encounter.Organization_id == ".concat(orgId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Encounter.practitioner_details[*].speciality AND Encounter.encounterdate>=").concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " && lower(first(document(Encounter.statushistory[*].status)[*].display))=='checked-in' collect with count into length")
18439
+ Practitioner: "DOCUMENT(DOCUMENT(DOCUMENT(Practitioner.practitioner_role[*])[*].role)[0].coding)[*].code ANY =='PR023' && Practitioner.id== ".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orGId, "'"),
18440
+ Encounter: "Encounter.activestatus == true && Encounter.Organization_id == ".concat(orgId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Encounter.practitioner_details[*].speciality AND Encounter.encounterdate>=").concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " && lower(first(document(Encounter.statushistory[*].status)[*].display))=='checked-in' collect with count into length")
18472
18441
  },
18473
18442
  return_fields: "{CheckedIn:length}"
18474
18443
  },
@@ -18480,13 +18449,13 @@ var visitQuery = {
18480
18449
  }
18481
18450
  };
18482
18451
  },
18483
- traigeDone: function traigeDone(startDate, endDate, orgId, loginId) {
18452
+ traigeDone: function traigeDone(startDate, endDate, orgId, loginId, orGId) {
18484
18453
  return {
18485
18454
  1: {
18486
18455
  db_name: dbName,
18487
18456
  entity: "Practitioner,Encounter",
18488
18457
  filter: {
18489
- Practitioner: "Practitioner.activestatus==true && Practitioner.id== ".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY ==").concat(orgId),
18458
+ Practitioner: "Practitioner.activestatus==true && Practitioner.id== ".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orGId, "'"),
18490
18459
  Encounter: "Encounter.activestatus == true && Encounter.Organization_id == ".concat(orgId, " && Encounter.participant[*].Practitioner_id any == Practitioner.id && Encounter.encounterdate>=").concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " && DOCUMENT(Encounter.statushistory[*].status)[*].display ANY =='Triaged' collect with count into length")
18491
18460
  },
18492
18461
  return_fields: "{TriagedCount:length}"
@@ -18495,7 +18464,7 @@ var visitQuery = {
18495
18464
  db_name: dbName,
18496
18465
  entity: "Practitioner,Encounter",
18497
18466
  filter: {
18498
- Practitioner: "Practitioner.activestatus==true && lower(document(Practitioner.practitioner_type).display)=='nurse' && Practitioner.id==".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY ==").concat(orgId),
18467
+ Practitioner: "DOCUMENT(DOCUMENT(DOCUMENT(Practitioner.practitioner_role[*])[*].role)[0].coding)[*].code ANY =='PR023' && Practitioner.id==".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orGId, "'"),
18499
18468
  Encounter: "Encounter.activestatus == true && Encounter.Organization_id == ".concat(orgId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Encounter.practitioner_details[*].speciality AND Encounter.encounterdate>=").concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " && DOCUMENT(Encounter.statushistory[*].status)[*].display ANY=='Triaged' collect with count into length")
18500
18469
  },
18501
18470
  return_fields: "{TriagedCount:length}"
@@ -18508,14 +18477,14 @@ var visitQuery = {
18508
18477
  }
18509
18478
  };
18510
18479
  },
18511
- visitCompleted: function visitCompleted(startDate, endDate, orgId, loginId) {
18480
+ visitCompleted: function visitCompleted(startDate, endDate, orgId, loginId, orGId) {
18512
18481
  return {
18513
18482
  1: {
18514
18483
  db_name: "primarycare",
18515
18484
  entity: "Practitioner,Encounter",
18516
18485
  filter: {
18517
- Practitioner: "Practitioner.activestatus==true && Practitioner.id== ".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY ==").concat(orgId),
18518
- Encounter: "Encounter.activestatus == true && Encounter.Organization_id ==".concat(orgId, " && Encounter.participant[*].Practitioner_id any == Practitioner.id && Encounter.encounterdate>= ").concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " && DOCUMENT(Encounter.statushistory[*].status)[*].display ANY =='Consultation over' collect with count into length")
18486
+ Practitioner: "Practitioner.activestatus==true && Practitioner.id== ".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orGId, "'"),
18487
+ Encounter: "Encounter.activestatus == true && Encounter.Organization_id ==".concat(orgId, " && Encounter.participant[*].Practitioner_id any == Practitioner.id && Encounter.encounterdate>= ").concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " && document(Encounter.statushistory[*].status)[*].code ANY =='ENCSTATUS0010' collect with count into length")
18519
18488
  },
18520
18489
  return_fields: "{CompletedCount:length}"
18521
18490
  },
@@ -18523,15 +18492,15 @@ var visitQuery = {
18523
18492
  db_name: dbName,
18524
18493
  entity: "Practitioner,Encounter",
18525
18494
  filter: {
18526
- Practitioner: "Practitioner.activestatus==true && lower(document(Practitioner.practitioner_type).display)=='nurse' && Practitioner.id== ".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orgId, "'"),
18527
- Encounter: "Encounter.activestatus == true && Encounter.Organization_id == ".concat(orgId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Encounter.practitioner_details[*].speciality AND Encounter.encounterdate>= ").concat(startDate, " && Encounter.encounterdate<= ").concat(endDate, " && Encounter.encounterdate<=").concat(endDate, " && DOCUMENT(Encounter.statushistory[*].status)[*].display ANY=='Consultation over' collect with count into length")
18495
+ Practitioner: "DOCUMENT(DOCUMENT(DOCUMENT(Practitioner.practitioner_role[*])[*].role)[0].coding)[*].code ANY =='PR023' && Practitioner.id== ".concat(loginId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(orGId, "'"),
18496
+ Encounter: "Encounter.activestatus == true && Encounter.Organization_id == ".concat(orgId, " && DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Encounter.practitioner_details[*].speciality AND Encounter.encounterdate>= ").concat(startDate, " && Encounter.encounterdate<= ").concat(endDate, " && Encounter.encounterdate<=").concat(endDate, " && document(Encounter.statushistory[*].status)[*].code ANY =='ENCSTATUS0010' collect with count into length")
18528
18497
  },
18529
18498
  return_fields: "{CompletedCount:length}"
18530
18499
  },
18531
18500
  3: {
18532
18501
  db_name: dbName,
18533
18502
  entity: "Encounter",
18534
- filter: "Encounter.activestatus == true && Encounter.Organization_id == ".concat(orgId, " && Encounter.encounterdate>=").concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " && DOCUMENT(Encounter.statushistory[*].status)[*].display ANY=='Consultation over' collect with count into length"),
18503
+ filter: "Encounter.activestatus == true && Encounter.Organization_id == ".concat(orgId, " && Encounter.encounterdate>=").concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " && document(Encounter.statushistory[*].status)[*].code ANY =='ENCSTATUS0010' collect with count into length"),
18535
18504
  return_fields: "{CompletedCount:length}"
18536
18505
  }
18537
18506
  };
@@ -18586,14 +18555,14 @@ var highPriorityPatientQuery = {
18586
18555
  1: {
18587
18556
  db_name: "primarycare",
18588
18557
  entity: "Encounter",
18589
- filter: "Encounter.participant[*].Practitioner_id ANY ==".concat(practionerId, " AND Encounter.encounterdate>=").concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " AND lower(DOCUMENT(Encounter.priority).display)=='high' AND (lower(DOCUMENT(Encounter.status).display)==lower('Triaged') or lower(DOCUMENT(Encounter.status).display)==lower('in-progress')) "),
18590
- return_fields: " MERGE(Encounter,{patient_id:(FOR pat IN Patient FILTER pat.id==Encounter.patient_id RETURN MERGE(pat,{name:(FOR hn IN TO_ARRAY(pat.name) RETURN DOCUMENT(hn))})),participant:(FOR pract IN TO_ARRAY(Encounter.participant) RETURN MERGE(pract,{Practitioner_id:(FOR prac IN Practitioner FILTER prac.id==pract.Practitioner_id RETURN MERGE(prac,{name:(FOR hn IN TO_ARRAY(prac.name) RETURN DOCUMENT(hn))}))})) ,priority:DOCUMENT(Encounter.priority),priorityreason:DOCUMENT(Encounter.priorityreason)})"
18558
+ filter: "Encounter.participant[*].Practitioner_id ANY ==".concat(practionerId, " AND Encounter.encounterdate>=").concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " AND lower(DOCUMENT(Encounter.priority).display)=='high'"),
18559
+ return_fields: "MERGE(Encounter,{patient_id:(FOR pat IN Patient FILTER pat.id==Encounter.patient_id RETURN MERGE(pat,{name:(FOR hn IN TO_ARRAY(pat.name) RETURN DOCUMENT(hn)),photo:(FOR ph IN TO_ARRAY(pat.photo) RETURN DOCUMENT(ph))})),priority:DOCUMENT(Encounter.priority),priorityreason:DOCUMENT(Encounter.priorityreason)},{appointmentId:(for app in Appointment filter app.id in Encounter.appointmentId return app)},{reasonReference:document(Encounter.reasonReference)})"
18591
18560
  },
18592
18561
  2: {
18593
18562
  db_name: "primarycare",
18594
18563
  entity: "Practitioner,Encounter",
18595
18564
  filter: {
18596
- Practitioner: "lower(document(Practitioner.practitioner_type).display)=='nurse' and Practitioner.id==".concat(practionerId, " AND DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(org_id, "'"),
18565
+ Practitioner: "DOCUMENT(DOCUMENT(DOCUMENT(Practitioner.practitioner_role[*])[*].role)[0].coding)[*].code ANY =='PR023' and Practitioner.id==".concat(practionerId, " AND DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(org_id, "'"),
18597
18566
  Encounter: "Encounter.encounterdate>=".concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " AND DOCUMENT(Encounter.priority).display=='High' AND (lower(DOCUMENT(Encounter.status).display)==lower('Checked-in') or lower(DOCUMENT(Encounter.status).display)==lower('Triage In-Progress')) ")
18598
18567
  },
18599
18568
  return_fields: "MERGE(Encounter,{patient_id:(FOR pat IN Patient FILTER pat.id==Encounter.patient_id RETURN MERGE(pat,{name:(FOR hn IN TO_ARRAY(pat.name) RETURN DOCUMENT(hn)),photo:(FOR ph IN TO_ARRAY(pat.photo) RETURN DOCUMENT(ph))})),priority:DOCUMENT(Encounter.priority),priorityreason:DOCUMENT(Encounter.priorityreason)},{appointmentId:(for app in Appointment filter app.id in Encounter.appointmentId return app)},{reasonReference:document(Encounter.reasonReference)})"
@@ -18643,7 +18612,7 @@ var APPOINTMENTS = createAsyncThunk("dashboardApiSlice/runquery", /*#__PURE__*/_
18643
18612
  data = _context.sent;
18644
18613
  _context.next = 9;
18645
18614
  return fetchData$3({
18646
- body: JSON.stringify(visitQuery.checkedIn(startDate, endDate, orGId, loginId)[roleId])
18615
+ body: JSON.stringify(visitQuery.checkedIn(startDate, endDate, orGId, loginId, orgId)[roleId])
18647
18616
  }, __readDocumentUrl__);
18648
18617
 
18649
18618
  case 9:
@@ -18718,11 +18687,11 @@ var TODAY_SCHEDULE = createAsyncThunk("dashboardApiSlice/today_schedul", /*#__PU
18718
18687
  var _val$slot;
18719
18688
 
18720
18689
  (_val$slot = val.slot) === null || _val$slot === void 0 ? void 0 : _val$slot.map(function (task) {
18721
- var _task$Appointment$0$D, _task$Appointment, _task$Appointment$, _task$status, _task$start, _task$end, _task$Type;
18690
+ var _task$Appointment$0$c, _task$Appointment, _task$Appointment$, _task$start, _task$end, _task$Type;
18722
18691
 
18723
18692
  return arr.push({
18724
- title: (_task$Appointment$0$D = task === null || task === void 0 ? void 0 : (_task$Appointment = task.Appointment) === null || _task$Appointment === void 0 ? void 0 : (_task$Appointment$ = _task$Appointment[0]) === null || _task$Appointment$ === void 0 ? void 0 : _task$Appointment$.Description) !== null && _task$Appointment$0$D !== void 0 ? _task$Appointment$0$D : "",
18725
- status: ((_task$status = task === null || task === void 0 ? void 0 : task.status) !== null && _task$status !== void 0 ? _task$status : (task === null || task === void 0 ? void 0 : task.status) === "available" && (task === null || task === void 0 ? void 0 : task.Appointment.length) > 0) ? true : false,
18693
+ title: (_task$Appointment$0$c = task === null || task === void 0 ? void 0 : (_task$Appointment = task.Appointment) === null || _task$Appointment === void 0 ? void 0 : (_task$Appointment$ = _task$Appointment[0]) === null || _task$Appointment$ === void 0 ? void 0 : _task$Appointment$.consultationMode) !== null && _task$Appointment$0$c !== void 0 ? _task$Appointment$0$c : "",
18694
+ status: (task === null || task === void 0 ? void 0 : task.Appointment.length) > 0 ? false : true,
18726
18695
  timefrom: (_task$start = task === null || task === void 0 ? void 0 : task.start) !== null && _task$start !== void 0 ? _task$start : "",
18727
18696
  timeto: (_task$end = task === null || task === void 0 ? void 0 : task.end) !== null && _task$end !== void 0 ? _task$end : "",
18728
18697
  type: (_task$Type = task === null || task === void 0 ? void 0 : task.Type) !== null && _task$Type !== void 0 ? _task$Type : ""
@@ -19076,34 +19045,32 @@ var TODAY_VISIT = createAsyncThunk("dashboardApiSlice/today_visit", /*#__PURE__*
19076
19045
  _ref18 = _args9.length > 1 ? _args9[1] : undefined, rejectWithValue = _ref18.rejectWithValue;
19077
19046
  _context9.prev = 2;
19078
19047
  orgId = payload.orgId, startDate = payload.startDate, endDate = payload.endDate, roleId = payload.roleId, loginId = payload.loginId, orgIdInt = payload.orgIdInt;
19079
- debugger;
19080
- _context9.next = 7;
19048
+ _context9.next = 6;
19081
19049
  return fetchData$3({
19082
19050
  body: JSON.stringify(visitQuery.checkedIn(startDate, endDate, orgIdInt, loginId)[roleId])
19083
19051
  }, __readDocumentUrl__);
19084
19052
 
19085
- case 7:
19053
+ case 6:
19086
19054
  data = _context9.sent;
19087
- debugger;
19088
19055
  return _context9.abrupt("return", _objectSpread2(_objectSpread2({}, defaultState.List), {}, {
19089
19056
  data: {
19090
19057
  count: (_data$result$0$Checke2 = data === null || data === void 0 ? void 0 : (_data$result2 = data.result) === null || _data$result2 === void 0 ? void 0 : (_data$result2$ = _data$result2[0]) === null || _data$result2$ === void 0 ? void 0 : _data$result2$.CheckedIn) !== null && _data$result$0$Checke2 !== void 0 ? _data$result$0$Checke2 : 0
19091
19058
  }
19092
19059
  }));
19093
19060
 
19094
- case 12:
19095
- _context9.prev = 12;
19061
+ case 10:
19062
+ _context9.prev = 10;
19096
19063
  _context9.t0 = _context9["catch"](2);
19097
19064
  return _context9.abrupt("return", rejectWithValue(_objectSpread2(_objectSpread2({}, defaultReject), {}, {
19098
19065
  message: _context9.t0.message
19099
19066
  })));
19100
19067
 
19101
- case 15:
19068
+ case 13:
19102
19069
  case "end":
19103
19070
  return _context9.stop();
19104
19071
  }
19105
19072
  }
19106
- }, _callee9, null, [[2, 12]]);
19073
+ }, _callee9, null, [[2, 10]]);
19107
19074
  })));
19108
19075
  var OTHER_VISIT_COUNT = createAsyncThunk("dashboardApiSlice/runquery", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10() {
19109
19076
  var payload,
@@ -20634,6 +20601,7 @@ var VISIT_CHECKEDIN = createAsyncThunk("visitStatsApiSlice/visitCheckedin", /*#_
20634
20601
  endDate,
20635
20602
  roleId,
20636
20603
  loginId,
20604
+ org_id,
20637
20605
  data,
20638
20606
  _args = arguments;
20639
20607
 
@@ -20644,10 +20612,10 @@ var VISIT_CHECKEDIN = createAsyncThunk("visitStatsApiSlice/visitCheckedin", /*#_
20644
20612
  payload = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
20645
20613
  _ref2 = _args.length > 1 ? _args[1] : undefined, rejectWithValue = _ref2.rejectWithValue;
20646
20614
  _context.prev = 2;
20647
- orgId = payload.orgId, startDate = payload.startDate, endDate = payload.endDate, roleId = payload.roleId, loginId = payload.loginId;
20615
+ orgId = payload.orgId, startDate = payload.startDate, endDate = payload.endDate, roleId = payload.roleId, loginId = payload.loginId, org_id = payload.org_id;
20648
20616
  _context.next = 6;
20649
20617
  return fetchData$3({
20650
- body: JSON.stringify(visitQuery.checkedIn(startDate, endDate, orgId, loginId)[roleId])
20618
+ body: JSON.stringify(visitQuery.checkedIn(startDate, endDate, orgId, loginId, org_id)[roleId])
20651
20619
  }, __readDocumentUrl__);
20652
20620
 
20653
20621
  case 6:
@@ -20842,6 +20810,7 @@ var GET_VISIT_STATS = createAsyncThunk("visitStatsApiSlice/visitStatsCount", /*#
20842
20810
  endDate,
20843
20811
  loginId,
20844
20812
  roleId,
20813
+ org_id,
20845
20814
  data,
20846
20815
  data1,
20847
20816
  data2,
@@ -20855,31 +20824,31 @@ var GET_VISIT_STATS = createAsyncThunk("visitStatsApiSlice/visitStatsCount", /*#
20855
20824
  payload = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
20856
20825
  _ref10 = _args5.length > 1 ? _args5[1] : undefined, rejectWithValue = _ref10.rejectWithValue;
20857
20826
  _context5.prev = 2;
20858
- orgId = payload.orgId, startDate = payload.startDate, endDate = payload.endDate, loginId = payload.loginId, roleId = payload.roleId;
20827
+ orgId = payload.orgId, startDate = payload.startDate, endDate = payload.endDate, loginId = payload.loginId, roleId = payload.roleId, org_id = payload.org_id;
20859
20828
  _context5.next = 6;
20860
20829
  return fetchData$3({
20861
- body: JSON.stringify(visitQuery.checkedIn(startDate, endDate, orgId, loginId)[roleId])
20830
+ body: JSON.stringify(visitQuery.checkedIn(startDate, endDate, orgId, loginId, org_id)[roleId])
20862
20831
  }, __readDocumentUrl__);
20863
20832
 
20864
20833
  case 6:
20865
20834
  data = _context5.sent;
20866
20835
  _context5.next = 9;
20867
20836
  return fetchData$3({
20868
- body: JSON.stringify(visitQuery.traigeDone(startDate, endDate, orgId, loginId)[roleId])
20837
+ body: JSON.stringify(visitQuery.traigeDone(startDate, endDate, orgId, loginId, org_id)[roleId])
20869
20838
  }, __readDocumentUrl__);
20870
20839
 
20871
20840
  case 9:
20872
20841
  data1 = _context5.sent;
20873
20842
  _context5.next = 12;
20874
20843
  return fetchData$3({
20875
- body: JSON.stringify(visitQuery.visitCompleted(startDate, endDate, orgId, loginId)[roleId])
20844
+ body: JSON.stringify(visitQuery.visitCompleted(startDate, endDate, orgId, loginId, org_id)[roleId])
20876
20845
  }, __readDocumentUrl__);
20877
20846
 
20878
20847
  case 12:
20879
20848
  data2 = _context5.sent;
20880
20849
  _context5.next = 15;
20881
20850
  return fetchData$3({
20882
- body: JSON.stringify(visitQuery.noShows(startDate, endDate, orgId, loginId)[roleId])
20851
+ body: JSON.stringify(visitQuery.noShows(startDate, endDate, orgId, loginId, org_id)[roleId])
20883
20852
  }, __readDocumentUrl__);
20884
20853
 
20885
20854
  case 15:
@@ -26010,7 +25979,7 @@ var queries$6 = {
26010
25979
  db_name: "primarycare",
26011
25980
  entity: "CA_OrderLine",
26012
25981
  filter: "CA_OrderLine.encounter_Id==\"".concat(encounter_id, "\" && CA_OrderLine.Oltype=='LAB' && CA_OrderLine.parentOrderId=='' && CA_OrderLine.activestatus==true"),
26013
- return_fields: "MERGE(CA_OrderLine,{childRecurrent:(for doc in CA_OrderLine_CA_OrderLine_E filter doc._to == CA_OrderLine._id RETURN DOCUMENT(doc._from)),org_Id:DOCUMENT(CA_OrderLine.org_Id),Requestor:(for req in TO_ARRAY(CA_OrderLine.Requestor) return merge(req,{organization:(document(req.organization)),practId:(for prac in Practitioner filter prac._id==req.practId return {id:prac._id,name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:(for cod in CodeableConceptMaster filter cod._id == nam.use return document(cod.coding)[*].display),prefix:(for cod in CodeableConceptMaster filter cod._id == nam.prefix return document(cod.coding)[*].display),suffix:(for cod in CodeableConceptMaster filter cod._id == nam.suffix return document(cod.coding)[*].display)}))}),practRole:document(req.practRole)}))})" // db_name: `${dbName}`,
25982
+ return_fields: "MERGE(CA_OrderLine,{childRecurrent:(for doc in CA_OrderLine_CA_OrderLine_E filter doc._to == CA_OrderLine._id RETURN MERGE(DOCUMENT(doc._from),{Requestor:(for req in TO_ARRAY(DOCUMENT(doc._from).Requestor) return merge(req,{organization:(document(req.organization)),practId:(for prac in Practitioner filter prac._id==req.practId return {id:prac._id,name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:(for cod in CodeableConceptMaster filter cod._id == nam.use return document(cod.coding)[*].display),prefix:(for cod in CodeableConceptMaster filter cod._id == nam.prefix return document(cod.coding)[*].display),suffix:(for cod in CodeableConceptMaster filter cod._id == nam.suffix return document(cod.coding)[*].display)}))}),practRole:document(req.practRole)}))})),org_Id:DOCUMENT(CA_OrderLine.org_Id),Requestor:(for req in TO_ARRAY(CA_OrderLine.Requestor) return merge(req,{organization:(document(req.organization)),practId:(for prac in Practitioner filter prac._id==req.practId return {id:prac._id,name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:(for cod in CodeableConceptMaster filter cod._id == nam.use return document(cod.coding)[*].display),prefix:(for cod in CodeableConceptMaster filter cod._id == nam.prefix return document(cod.coding)[*].display),suffix:(for cod in CodeableConceptMaster filter cod._id == nam.suffix return document(cod.coding)[*].display)}))}),practRole:document(req.practRole)}))})" // db_name: `${dbName}`,
26014
25983
  // entity: "CA_OrderLine",
26015
25984
  // filter: `CA_OrderLine.encounter_Id=="${encounter_id}" && CA_OrderLine.Oltype=='LAB' && CA_OrderLine.parentOrderId=="${order_id}" && CA_OrderLine.activestatus==true`,
26016
25985
  // filter: `CA_OrderLine.encounter_Id=="${encounter_id}" && CA_OrderLine.Oltype=='LAB' && CA_OrderLine.parentOrderId=='' && CA_OrderLine.activestatus==true`,
@@ -28746,7 +28715,7 @@ var DRUGMASTER_MASTER = createAsyncThunk("MedicationMastersSlice/drugMaster_mast
28746
28715
  data = _context2.sent;
28747
28716
  arr = [];
28748
28717
  data.result.map(function (val) {
28749
- var _val$FormCode, _val$FormCode2, _val$StrengthValuesPo, _val$StrengthValuesPo2, _val$StrengthValuesPo3, _val$StrengthValuesPo4, _val$DrugType, _val$DrugType2;
28718
+ var _val$FormCode, _val$FormCode2, _val$StrengthValuesPo, _val$StrengthValuesPo2, _val$StrengthValuesPo3, _val$StrengthValuesPo4, _val$DrugType, _val$DrugType2, _val$DrugType3, _val$DrugType4;
28750
28719
 
28751
28720
  var json = {
28752
28721
  value: val === null || val === void 0 ? void 0 : val._id,
@@ -28756,7 +28725,9 @@ var DRUGMASTER_MASTER = createAsyncThunk("MedicationMastersSlice/drugMaster_mast
28756
28725
  StrengthValues: val === null || val === void 0 ? void 0 : (_val$StrengthValuesPo = val.StrengthValuesPossible) === null || _val$StrengthValuesPo === void 0 ? void 0 : (_val$StrengthValuesPo2 = _val$StrengthValuesPo[0]) === null || _val$StrengthValuesPo2 === void 0 ? void 0 : _val$StrengthValuesPo2.StrengthValue,
28757
28726
  StrengthUOM: val === null || val === void 0 ? void 0 : (_val$StrengthValuesPo3 = val.StrengthValuesPossible) === null || _val$StrengthValuesPo3 === void 0 ? void 0 : (_val$StrengthValuesPo4 = _val$StrengthValuesPo3[0]) === null || _val$StrengthValuesPo4 === void 0 ? void 0 : _val$StrengthValuesPo4.StrengthUOM,
28758
28727
  drugType: val === null || val === void 0 ? void 0 : (_val$DrugType = val.DrugType) === null || _val$DrugType === void 0 ? void 0 : _val$DrugType.drugtype,
28759
- drugTypeId: val === null || val === void 0 ? void 0 : (_val$DrugType2 = val.DrugType) === null || _val$DrugType2 === void 0 ? void 0 : _val$DrugType2._id // formValue
28728
+ drugTypeLong: val === null || val === void 0 ? void 0 : (_val$DrugType2 = val.DrugType) === null || _val$DrugType2 === void 0 ? void 0 : _val$DrugType2.longdesc,
28729
+ drugTypeShort: val === null || val === void 0 ? void 0 : (_val$DrugType3 = val.DrugType) === null || _val$DrugType3 === void 0 ? void 0 : _val$DrugType3.shortdesc,
28730
+ drugTypeId: val === null || val === void 0 ? void 0 : (_val$DrugType4 = val.DrugType) === null || _val$DrugType4 === void 0 ? void 0 : _val$DrugType4._id // formValue
28760
28731
 
28761
28732
  };
28762
28733
  arr.push(_objectSpread2(_objectSpread2({}, json), {}, {
@@ -30962,7 +30933,7 @@ var queries$4 = {
30962
30933
  db_name: "primarycare",
30963
30934
  entity: "CA_OrderLine",
30964
30935
  filter: "CA_OrderLine.encounter_Id==\"".concat(encounter_id, "\" && CA_OrderLine.Oltype=='TREAT' && CA_OrderLine.parentOrderId=='' && CA_OrderLine.activestatus==true"),
30965
- return_fields: "MERGE(CA_OrderLine,{childRecurrent:(for doc in CA_OrderLine_CA_OrderLine_E filter doc._to == CA_OrderLine._id RETURN DOCUMENT(doc._from)),org_Id:DOCUMENT(CA_OrderLine.org_Id),Requestor:(for req in TO_ARRAY(CA_OrderLine.Requestor) return merge(req,{organization:document(req.organization),practId:(for prac in Practitioner filter prac._id==req.practId return merge({id: prac._id, name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:(for cod in CodeableConceptMaster filter cod._id == nam.use return document(cod.coding)[*].display),prefix:(for cod in CodeableConceptMaster filter cod._id == nam.prefix return document(cod.coding)[*].display),suffix:(for cod in CodeableConceptMaster filter cod._id == nam.suffix return document(cod.coding)[*].display)}))})),practRole:document(req.practRole)}))})"
30936
+ return_fields: "MERGE(CA_OrderLine,{childRecurrent:(for doc in CA_OrderLine_CA_OrderLine_E filter doc._to == CA_OrderLine._id RETURN MERGE(DOCUMENT(doc._from),{Requestor:(for req in TO_ARRAY(DOCUMENT(doc._from).Requestor) return merge(req,{organization:(document(req.organization)),practId:(for prac in Practitioner filter prac._id==req.practId return {id:prac._id,name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:(for cod in CodeableConceptMaster filter cod._id == nam.use return document(cod.coding)[*].display),prefix:(for cod in CodeableConceptMaster filter cod._id == nam.prefix return document(cod.coding)[*].display),suffix:(for cod in CodeableConceptMaster filter cod._id == nam.suffix return document(cod.coding)[*].display)}))}),practRole:document(req.practRole)}))})),org_Id:DOCUMENT(CA_OrderLine.org_Id),Requestor:(for req in TO_ARRAY(CA_OrderLine.Requestor) return merge(req,{organization:(document(req.organization)),practId:(for prac in Practitioner filter prac._id==req.practId return {id:prac._id,name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:(for cod in CodeableConceptMaster filter cod._id == nam.use return document(cod.coding)[*].display),prefix:(for cod in CodeableConceptMaster filter cod._id == nam.prefix return document(cod.coding)[*].display),suffix:(for cod in CodeableConceptMaster filter cod._id == nam.suffix return document(cod.coding)[*].display)}))}),practRole:document(req.practRole)}))})"
30966
30937
  };
30967
30938
  },
30968
30939
  treatment_delete: function treatment_delete(id) {
@@ -32874,7 +32845,7 @@ var queries$3 = (_queries = {
32874
32845
  db_name: "primarycare",
32875
32846
  entity: "CA_OrderLine",
32876
32847
  filter: "CA_OrderLine.encounter_Id==\"".concat(encounter_id, "\" && CA_OrderLine.Oltype=='RAD' && CA_OrderLine.parentOrderId=='' && CA_OrderLine.activestatus==true"),
32877
- return_fields: "MERGE(CA_OrderLine,{childRecurrent:(for doc in CA_OrderLine_CA_OrderLine_E filter doc._to == CA_OrderLine._id RETURN DOCUMENT(doc._from)),org_Id:DOCUMENT(CA_OrderLine.org_Id),Requestor:(for req in TO_ARRAY(CA_OrderLine.Requestor) return merge(req,{organization:document(req.organization),practId:(for prac in Practitioner filter prac._id==req.practId return merge({id: prac._id, name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:(for cod in CodeableConceptMaster filter cod._id == nam.use return document(cod.coding)[*].display),prefix:(for cod in CodeableConceptMaster filter cod._id == nam.prefix return document(cod.coding)[*].display),suffix:(for cod in CodeableConceptMaster filter cod._id == nam.suffix return document(cod.coding)[*].display)}))})),practRole:document(req.practRole)}))})"
32848
+ return_fields: "MERGE(CA_OrderLine,{childRecurrent:(for doc in CA_OrderLine_CA_OrderLine_E filter doc._to == CA_OrderLine._id RETURN MERGE(DOCUMENT(doc._from),{Requestor:(for req in TO_ARRAY(DOCUMENT(doc._from).Requestor) return merge(req,{organization:(document(req.organization)),practId:(for prac in Practitioner filter prac._id==req.practId return {id:prac._id,name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:(for cod in CodeableConceptMaster filter cod._id == nam.use return document(cod.coding)[*].display),prefix:(for cod in CodeableConceptMaster filter cod._id == nam.prefix return document(cod.coding)[*].display),suffix:(for cod in CodeableConceptMaster filter cod._id == nam.suffix return document(cod.coding)[*].display)}))}),practRole:document(req.practRole)}))})),org_Id:DOCUMENT(CA_OrderLine.org_Id),Requestor:(for req in TO_ARRAY(CA_OrderLine.Requestor) return merge(req,{organization:(document(req.organization)),practId:(for prac in Practitioner filter prac._id==req.practId return {id:prac._id,name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:(for cod in CodeableConceptMaster filter cod._id == nam.use return document(cod.coding)[*].display),prefix:(for cod in CodeableConceptMaster filter cod._id == nam.prefix return document(cod.coding)[*].display),suffix:(for cod in CodeableConceptMaster filter cod._id == nam.suffix return document(cod.coding)[*].display)}))}),practRole:document(req.practRole)}))})"
32878
32849
  };
32879
32850
  },
32880
32851
  treatment_delete: function treatment_delete(id) {
@@ -37276,41 +37247,41 @@ var query$4 = {
37276
37247
  },
37277
37248
  // NURSE
37278
37249
  getAppointmentsNurse: function getAppointmentsNurse(data) {
37279
- return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Practitioner,Appointment\",\n \"filter\": {\n \"Practitioner\": \"Practitioner.activestatus==true && lower(document(Practitioner.practitioner_type).display)=='nurse' && Practitioner.id==").concat(data === null || data === void 0 ? void 0 : data.practionerID, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(data === null || data === void 0 ? void 0 : data.orgID, "'\",\n \"Appointment\": \"Appointment.activestatus==true && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "' && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && lower(Appointment.appointmentType)!='cancelled' && DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Appointment.SpecialtyID\"\n },\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in document(Appointment.practitionerID) return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37250
+ return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Practitioner,Appointment\",\n \"filter\": {\n \"Practitioner\": \"Practitioner.activestatus==true && DOCUMENT(DOCUMENT(DOCUMENT(Practitioner.practitioner_role[*])[*].role)[0].coding)[*].code ANY =='PR023' && Practitioner.id==").concat(data === null || data === void 0 ? void 0 : data.practionerID, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(data === null || data === void 0 ? void 0 : data.orgID, "'\",\n \"Appointment\": \"Appointment.activestatus==true && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "' && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && lower(Appointment.appointmentType)!='cancelled' && document(DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID)[*].id ANY IN Appointment.SpecialtyID\"\n },\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in document(Appointment.practitionerID) return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37280
37251
  },
37281
37252
  getFirstVisitsNurse: function getFirstVisitsNurse(data) {
37282
- return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Practitioner,Appointment,Encounter\",\n \"filter\": {\n \"Practitioner\": \"Practitioner.activestatus==true && lower(document(Practitioner.practitioner_type).display)=='nurse' && Practitioner.id==").concat(data === null || data === void 0 ? void 0 : data.practionerID, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(data === null || data === void 0 ? void 0 : data.orgID, "'\",\n \"Appointment\": \"Appointment.activestatus==true && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "' && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Appointment.SpecialtyID\",\n \"Encounter\": \"Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('First Visit')\",\n },\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in document(Appointment.practitionerID) return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37253
+ return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Practitioner,Appointment,Encounter\",\n \"filter\": {\n \"Practitioner\": \"Practitioner.activestatus==true && DOCUMENT(DOCUMENT(DOCUMENT(Practitioner.practitioner_role[*])[*].role)[0].coding)[*].code ANY =='PR023' && Practitioner.id==").concat(data === null || data === void 0 ? void 0 : data.practionerID, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(data === null || data === void 0 ? void 0 : data.orgID, "'\",\n \"Appointment\": \"Appointment.activestatus==true && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "' && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && document(DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID)[*].id ANY IN Appointment.SpecialtyID\",\n \"Encounter\": \"Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('First Visit')\",\n },\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in document(Appointment.practitionerID) return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37283
37254
  },
37284
37255
  getNewPatientsNurse: function getNewPatientsNurse(data) {
37285
- return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Appointment,Encounter\",\n \"filter\": {\n \n \"Appointment\": \"Appointment.activestatus==true && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "' && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Appointment.SpecialtyID\",\n \"Encounter\": \"Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('New Patient')\",\n },\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in document(Appointment.practitionerID) return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37256
+ return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Practitioner,Appointment,Encounter\",\n \"filter\": {\n \"Practitioner\": \"Practitioner.activestatus==true && DOCUMENT(DOCUMENT(DOCUMENT(Practitioner.practitioner_role[*])[*].role)[0].coding)[*].code ANY =='PR023' && Practitioner.id==").concat(data === null || data === void 0 ? void 0 : data.practionerID, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(data === null || data === void 0 ? void 0 : data.orgID, "'\",\n \"Appointment\": \"Appointment.activestatus==true && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "' && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && document(DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID)[*].id ANY IN Appointment.SpecialtyID\",\n \"Encounter\": \"Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('New Patient')\",\n },\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in document(Appointment.practitionerID) return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37286
37257
  },
37287
37258
  getOtherVisitsNurse: function getOtherVisitsNurse(data) {
37288
- return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Practitioner,Appointment,Encounter\",\n \"filter\": {\n \"Practitioner\": \"Practitioner.activestatus==true && lower(document(Practitioner.practitioner_type).display)=='nurse' && Practitioner.id==").concat(data === null || data === void 0 ? void 0 : data.practionerID, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(data === null || data === void 0 ? void 0 : data.orgID, "'\",\n \"Appointment\": \"Appointment.activestatus==true && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "' && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Appointment.SpecialtyID\",\n \"Encounter\": \"Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('Other Visits')\",\n },\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in document(Appointment.practitionerID) return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37259
+ return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Practitioner,Appointment,Encounter\",\n \"filter\": {\n \"Practitioner\": \"Practitioner.activestatus==true && DOCUMENT(DOCUMENT(DOCUMENT(Practitioner.practitioner_role[*])[*].role)[0].coding)[*].code ANY =='PR023' && Practitioner.id==").concat(data === null || data === void 0 ? void 0 : data.practionerID, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(data === null || data === void 0 ? void 0 : data.orgID, "'\",\n \"Appointment\": \"Appointment.activestatus==true && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "' && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && document(DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID)[*].id ANY IN Appointment.SpecialtyID\",\n \"Encounter\": \"Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('Other Visits')\",\n },\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in document(Appointment.practitionerID) return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37289
37260
  },
37290
37261
  getTodayVisitsNurse: function getTodayVisitsNurse(data) {
37291
- return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Practitioner,Encounter\",\n \"filter\": {\n \"Practitioner\": \"Practitioner.activestatus==true && lower(document(Practitioner.practitioner_type).display)=='nurse' && Practitioner.id==").concat(data === null || data === void 0 ? void 0 : data.practionerID, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(data === null || data === void 0 ? void 0 : data.orgID, "'\",\n \"Appointment\": \"Appointment.activestatus==true && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "' && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Appointment.SpecialtyID\",\n \"Encounter\": \"Appointment.id in Encounter.appointmentId && lower(first(document(Encounter.statushistory[*].status)[*].display))=='checked-in'\",\n },\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in document(Appointment.practitionerID) return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37262
+ return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Practitioner,Encounter\",\n \"filter\": {\n \"Practitioner\": \"Practitioner.activestatus==true && DOCUMENT(DOCUMENT(DOCUMENT(Practitioner.practitioner_role[*])[*].role)[0].coding)[*].code ANY =='PR023' && Practitioner.id==").concat(data === null || data === void 0 ? void 0 : data.practionerID, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(data === null || data === void 0 ? void 0 : data.orgID, "'\",\n \"Appointment\": \"Appointment.activestatus==true && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "' && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && document(DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID)[*].id ANY IN Appointment.SpecialtyID\",\n \"Encounter\": \"Appointment.id in Encounter.appointmentId && lower(first(document(Encounter.statushistory[*].status)[*].display))=='checked-in'\",\n },\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in document(Appointment.practitionerID) return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37292
37263
  },
37293
37264
  getWalkInsNurse: function getWalkInsNurse(data) {
37294
- return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Practitioner,Appointment,Encounter\",\n \"filter\": {\n \"Practitioner\": \"Practitioner.activestatus==true && lower(document(Practitioner.practitioner_type).display)=='nurse' && Practitioner.id==").concat(data === null || data === void 0 ? void 0 : data.practionerID, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(data === null || data === void 0 ? void 0 : data.orgID, "'\",\n \"Appointment\": \"Appointment.activestatus==true && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "' && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID ANY IN Appointment.SpecialtyID\",\n \"Encounter\": \"Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('Walkin')\",\n },\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in document(Appointment.practitionerID) return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37265
+ return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Practitioner,Appointment,Encounter\",\n \"filter\": {\n \"Practitioner\": \"Practitioner.activestatus==true && DOCUMENT(DOCUMENT(DOCUMENT(Practitioner.practitioner_role[*])[*].role)[0].coding)[*].code ANY =='PR023' && Practitioner.id==").concat(data === null || data === void 0 ? void 0 : data.practionerID, " && DOCUMENT(Practitioner.practitioner_role[*])[*].OrgID ANY =='").concat(data === null || data === void 0 ? void 0 : data.orgID, "'\",\n \"Appointment\": \"Appointment.activestatus==true && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "' && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && document(DOCUMENT(Practitioner.practitioner_role[*])[*].SpecialtyID)[*].id ANY IN Appointment.SpecialtyID\",\n \"Encounter\": \"Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('Walkin')\",\n },\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in document(Appointment.practitionerID) return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37295
37266
  },
37296
37267
  //Doctor
37297
37268
  getAppointmentsDoctor: function getAppointmentsDoctor(data) {
37298
- return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Appointment\",\n \"filter\": \"Appointment.activestatus==true && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && lower(Appointment.appointmentType)!='cancelled' && Appointment.practitionerID any ==").concat(data === null || data === void 0 ? void 0 : data.practionerID, " && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "'\",\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in Practitioner filter prac.id in Appointment.practitionerID return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37269
+ return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Appointment\",\n \"filter\": \"Appointment.activestatus==true && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && lower(Appointment.appointmentType)!='cancelled' && document(Appointment.resourcecode).id ==").concat(data === null || data === void 0 ? void 0 : data.practionerID, " && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "'\",\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in Practitioner filter prac.id in Appointment.practitionerID return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37299
37270
  },
37300
37271
  getFirstVisitsDoctor: function getFirstVisitsDoctor(data) {
37301
- return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Appointment,Encounter\",\n \"filter\":{\n \"Appointment\":\"Appointment.activestatus==true && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && Appointment.practitionerID any ==").concat(data === null || data === void 0 ? void 0 : data.practionerID, " && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "'\",\n \"Encounter\":\"Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('First Visit')\"\n }\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in Practitioner filter prac.id in Appointment.practitionerID return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37272
+ return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Appointment,Encounter\",\n \"filter\":{\n \"Appointment\":\"Appointment.activestatus==true && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && document(Appointment.resourcecode).id ==").concat(data === null || data === void 0 ? void 0 : data.practionerID, " && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "'\",\n \"Encounter\":\"Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('First Visit')\"\n }\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in Practitioner filter prac.id in Appointment.practitionerID return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37302
37273
  },
37303
37274
  getNewPatientsDoctor: function getNewPatientsDoctor(data) {
37304
- return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Appointment,Encounter\",\n \"filter\":{\n \"Appointment\":\"Appointment.activestatus==true && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && Appointment.practitionerID any ==").concat(data === null || data === void 0 ? void 0 : data.practionerID, " && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "'\",\n \"Encounter\":\"Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('New Patient')\"\n }\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in Practitioner filter prac.id in Appointment.practitionerID return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37275
+ return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Appointment,Encounter\",\n \"filter\":{\n \"Appointment\":\"Appointment.activestatus==true && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && document(Appointment.resourcecode).id ==").concat(data === null || data === void 0 ? void 0 : data.practionerID, " && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "'\",\n \"Encounter\":\"Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('New Patient')\"\n }\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in Practitioner filter prac.id in Appointment.practitionerID return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37305
37276
  },
37306
37277
  getOtherVisitsDoctor: function getOtherVisitsDoctor(data) {
37307
- return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Appointment,Encounter\",\n \"filter\":{\n \"Appointment\":\"Appointment.activestatus==true && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && Appointment.practitionerID any ==").concat(data === null || data === void 0 ? void 0 : data.practionerID, " && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "'\",\n \"Encounter\":\"Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('Other Visits')\"\n }\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in Practitioner filter prac.id in Appointment.practitionerID return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37278
+ return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Appointment,Encounter\",\n \"filter\":{\n \"Appointment\":\"Appointment.activestatus==true && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && document(Appointment.resourcecode).id ==").concat(data === null || data === void 0 ? void 0 : data.practionerID, " && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "'\",\n \"Encounter\":\"Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('Other Visits')\"\n }\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in Practitioner filter prac.id in Appointment.practitionerID return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37308
37279
  },
37309
37280
  getTodayVisitsDoctor: function getTodayVisitsDoctor(data) {
37310
- return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Appointment,Encounter\",\n \"filter\": {\n \"Appointment\": \"Appointment.activestatus==true && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "' && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && Appointment.practitionerID any ==").concat(data === null || data === void 0 ? void 0 : data.practionerID, "\",\n \"Encounter\": \"Appointment.id in Encounter.appointmentId && lower(first(document(Encounter.statushistory[*].status)[*].display))=='checked-in'\",\n },\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in document(Appointment.practitionerID) return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37281
+ return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Appointment,Encounter\",\n \"filter\": {\n \"Appointment\": \"Appointment.activestatus==true && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "' && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && document(Appointment.resourcecode).id ==").concat(data === null || data === void 0 ? void 0 : data.practionerID, "\",\n \"Encounter\": \"Appointment.id in Encounter.appointmentId && lower(first(document(Encounter.statushistory[*].status)[*].display))=='checked-in'\",\n },\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in document(Appointment.practitionerID) return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37311
37282
  },
37312
37283
  getWalkInsDoctor: function getWalkInsDoctor(data) {
37313
- return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Appointment,Encounter\",\n \"filter\":{\n \"Appointment\":\"Appointment.activestatus==true && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && Appointment.practitionerID any ==").concat(data === null || data === void 0 ? void 0 : data.practionerID, " && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "'\",\n \"Encounter\":\"Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('Walkin')\"\n }\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in Practitioner filter prac.id in Appointment.practitionerID return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37284
+ return "\n {\n \"db_name\": \"".concat(dbName, "\",\n \"entity\": \"Appointment,Encounter\",\n \"filter\":{\n \"Appointment\":\"Appointment.activestatus==true && Appointment.start>=").concat(data === null || data === void 0 ? void 0 : data.startDate, " && Appointment.end<=").concat(data === null || data === void 0 ? void 0 : data.endDate, " && document(Appointment.resourcecode).id ==").concat(data === null || data === void 0 ? void 0 : data.practionerID, " && Appointment.orgid=='").concat(data === null || data === void 0 ? void 0 : data.orgID, "'\",\n \"Encounter\":\"Appointment.id in Encounter.appointmentId && lower(Encounter.visit_type)==lower('Walkin')\"\n }\n \"return_fields\": \"merge(Appointment,{PersonID:(for per in Person filter per.Id in Appointment.PersonID return merge(per,{name:(for nam in HumanNameMaster filter nam._id in per.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(per.gender)})),practitionerID:(for prac in Practitioner filter prac.id in Appointment.practitionerID return merge(prac,{name:(for nam in HumanNameMaster filter nam._id in prac.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{gender:document(prac.gender)}))})\"\n }\n ");
37314
37285
  }
37315
37286
  };
37316
37287
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primarycare-binder",
3
- "version": "1.1.2",
3
+ "version": "1.1.6",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",