primarycare-binder 1.1.13 → 1.1.17

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 +396 -76
  2. package/package.json +1 -1
package/dist/index.cjs.js CHANGED
@@ -8016,7 +8016,7 @@ var query_ids = {
8016
8016
  "db_name": dbName,
8017
8017
  "entity": "Schedule",
8018
8018
  "filter": "Schedule.start >= ".concat(start, " AND Schedule.end <= ").concat(end, " AND Schedule.activestatus == true AND DOCUMENT(Schedule.resourceCode).id == ").concat(id),
8019
- "return_fields": "MERGE(Schedule, {slots : (FOR slt IN Slot FILTER Schedule.id IN slt.ScheduleID AND slt.status!='blocked' AND slt.start >= ".concat(moment().unix(), " AND slt.activestatus==true sort slt._id asc RETURN slt)})")
8019
+ "return_fields": "MERGE(Schedule, {slots : (FOR slt IN Slot FILTER Schedule.id IN slt.ScheduleID AND slt.status!='blocked' AND slt.start >= ".concat(moment().unix(), " AND slt.activestatus==true sort slt._id asc RETURN merge(slt, {DayType: Document(slt.DayType)}))})")
8020
8020
  };
8021
8021
  } // query: ({ start, end, id }) => ({
8022
8022
  // "db_name": dbName,
@@ -8084,7 +8084,7 @@ var queries$a = {
8084
8084
  Encounter: "Encounter.appointmentId == [".concat(appointmentId, "]"),
8085
8085
  Patient: "Patient.id == Encounter.patient_id"
8086
8086
  },
8087
- "return_fields": "merge(Encounter,{patient_id:(for p in Patient.identifier return merge(Patient,{identifier:document(p),name:document(Patient.name),telecom:document(Patient.telecom),photo:document(Patient.photo),martialStatus:document(Patient.maritalstatus)}))})"
8087
+ return_fields: "merge(Encounter,{statusexpand:document(Encounter.status),patient_id:(for p in Patient.identifier return merge(Patient,{identifier:document(p),name:document(Patient.name),telecom:document(Patient.telecom),photo:document(Patient.photo),martialStatus:document(Patient.maritalstatus)}))})"
8088
8088
  };
8089
8089
  },
8090
8090
  visitmodify: {
@@ -9534,6 +9534,141 @@ var getImgUrl = function getImgUrl(fileId) {
9534
9534
  return fileId ? "".concat(__imgdownloadBaseUrl__).concat(fileId) : "";
9535
9535
  };
9536
9536
 
9537
+ var deg2rad = function deg2rad(deg) {
9538
+ return deg * (Math.PI / 180);
9539
+ };
9540
+
9541
+ var getDisctanceFromLatLonInKm = function getDisctanceFromLatLonInKm(lat1, lon1, lat2, lon2) {
9542
+ var R = 6371; // Radius of the earth in km
9543
+
9544
+ var dLat = deg2rad(lat2 - lat1); // deg2rad below
9545
+
9546
+ var dLon = deg2rad(lon2 - lon1);
9547
+ var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
9548
+ var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
9549
+ var d = R * c; // Distance in km
9550
+
9551
+ return parseFloat(d).toFixed(2);
9552
+ };
9553
+
9554
+ var getLocation = function getLocation() {
9555
+ return new es6Promise.Promise(function (resolve, reject) {
9556
+ navigator.geolocation.getCurrentPosition(function (position) {
9557
+ var lat = position.coords.latitude;
9558
+ var _long = position.coords.longitude;
9559
+ resolve([false, {
9560
+ lat: lat,
9561
+ "long": _long
9562
+ }]);
9563
+ }, function (error) {
9564
+ resolve([true, error]);
9565
+ });
9566
+ });
9567
+ };
9568
+
9569
+ var getCurrentPosition = /*#__PURE__*/function () {
9570
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
9571
+ var permission, lat, _long2, _yield$getLocation, _yield$getLocation2, err, currLocation;
9572
+
9573
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
9574
+ while (1) {
9575
+ switch (_context2.prev = _context2.next) {
9576
+ case 0:
9577
+ _context2.next = 2;
9578
+ return navigator.permissions.query({
9579
+ name: 'geolocation'
9580
+ })["catch"](function (err) {
9581
+ return {
9582
+ state: 'denied'
9583
+ };
9584
+ });
9585
+
9586
+ case 2:
9587
+ permission = _context2.sent;
9588
+
9589
+ if (!(permission.state !== 'denied')) {
9590
+ _context2.next = 11;
9591
+ break;
9592
+ }
9593
+
9594
+ _context2.next = 6;
9595
+ return getLocation();
9596
+
9597
+ case 6:
9598
+ _yield$getLocation = _context2.sent;
9599
+ _yield$getLocation2 = _slicedToArray(_yield$getLocation, 2);
9600
+ err = _yield$getLocation2[0];
9601
+ currLocation = _yield$getLocation2[1];
9602
+
9603
+ if (!err) {
9604
+ lat = currLocation.lat;
9605
+ _long2 = currLocation["long"];
9606
+ }
9607
+
9608
+ case 11:
9609
+ return _context2.abrupt("return", {
9610
+ lat: lat,
9611
+ "long": _long2
9612
+ });
9613
+
9614
+ case 12:
9615
+ case "end":
9616
+ return _context2.stop();
9617
+ }
9618
+ }
9619
+ }, _callee2);
9620
+ }));
9621
+
9622
+ return function getCurrentPosition() {
9623
+ return _ref4.apply(this, arguments);
9624
+ };
9625
+ }();
9626
+
9627
+ var getLatLong = /*#__PURE__*/function () {
9628
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(city) {
9629
+ var _resp$results, _resp$results$, _resp$results$$geomet, _resp$results$$geomet2, _resp$results2, _resp$results2$, _resp$results2$$geome, _resp$results2$$geome2;
9630
+
9631
+ var url, data, resp, lat, _long3, _resp$results3, _resp$results3$, _resp$results3$$geome, _resp$results3$$geome2, _resp$results4, _resp$results4$, _resp$results4$$geome, _resp$results4$$geome2;
9632
+
9633
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
9634
+ while (1) {
9635
+ switch (_context3.prev = _context3.next) {
9636
+ case 0:
9637
+ url = "https://maps.googleapis.com/maps/api/geocode/json?address=".concat(city, "&key=AIzaSyBqeACJgp12OLU6EkHeUtFgya2naH1LhrU");
9638
+ _context3.next = 3;
9639
+ return fetch(url);
9640
+
9641
+ case 3:
9642
+ data = _context3.sent;
9643
+ _context3.next = 6;
9644
+ return data.json();
9645
+
9646
+ case 6:
9647
+ resp = _context3.sent;
9648
+
9649
+ if ((resp === null || resp === void 0 ? void 0 : (_resp$results = resp.results) === null || _resp$results === void 0 ? void 0 : (_resp$results$ = _resp$results[0]) === null || _resp$results$ === void 0 ? void 0 : (_resp$results$$geomet = _resp$results$.geometry) === null || _resp$results$$geomet === void 0 ? void 0 : (_resp$results$$geomet2 = _resp$results$$geomet.location) === null || _resp$results$$geomet2 === void 0 ? void 0 : _resp$results$$geomet2.lat) && (resp === null || resp === void 0 ? void 0 : (_resp$results2 = resp.results) === null || _resp$results2 === void 0 ? void 0 : (_resp$results2$ = _resp$results2[0]) === null || _resp$results2$ === void 0 ? void 0 : (_resp$results2$$geome = _resp$results2$.geometry) === null || _resp$results2$$geome === void 0 ? void 0 : (_resp$results2$$geome2 = _resp$results2$$geome.location) === null || _resp$results2$$geome2 === void 0 ? void 0 : _resp$results2$$geome2.lng)) {
9650
+ lat = resp === null || resp === void 0 ? void 0 : (_resp$results3 = resp.results) === null || _resp$results3 === void 0 ? void 0 : (_resp$results3$ = _resp$results3[0]) === null || _resp$results3$ === void 0 ? void 0 : (_resp$results3$$geome = _resp$results3$.geometry) === null || _resp$results3$$geome === void 0 ? void 0 : (_resp$results3$$geome2 = _resp$results3$$geome.location) === null || _resp$results3$$geome2 === void 0 ? void 0 : _resp$results3$$geome2.lat;
9651
+ _long3 = resp === null || resp === void 0 ? void 0 : (_resp$results4 = resp.results) === null || _resp$results4 === void 0 ? void 0 : (_resp$results4$ = _resp$results4[0]) === null || _resp$results4$ === void 0 ? void 0 : (_resp$results4$$geome = _resp$results4$.geometry) === null || _resp$results4$$geome === void 0 ? void 0 : (_resp$results4$$geome2 = _resp$results4$$geome.location) === null || _resp$results4$$geome2 === void 0 ? void 0 : _resp$results4$$geome2.lng;
9652
+ }
9653
+
9654
+ return _context3.abrupt("return", {
9655
+ lat: lat,
9656
+ "long": _long3
9657
+ });
9658
+
9659
+ case 9:
9660
+ case "end":
9661
+ return _context3.stop();
9662
+ }
9663
+ }
9664
+ }, _callee3);
9665
+ }));
9666
+
9667
+ return function getLatLong(_x2) {
9668
+ return _ref5.apply(this, arguments);
9669
+ };
9670
+ }();
9671
+
9537
9672
  var _extraReducers$C;
9538
9673
  var __options$8 = {
9539
9674
  method: "POST",
@@ -10636,7 +10771,7 @@ var APPOINTMENT_UPDATE = createAsyncThunk("appointmentReducer/updateAppointment"
10636
10771
  break;
10637
10772
  }
10638
10773
 
10639
- throw new Error(data.error && (typeof data.error === "string" ? data.error : data.message));
10774
+ throw new Error(data.error && (typeof data.error === "string" ? data.error : data.message || data.errorMessage));
10640
10775
 
10641
10776
  case 9:
10642
10777
  return _context2.abrupt("return", _objectSpread2(_objectSpread2({}, defaultState.List), {}, {
@@ -11162,7 +11297,7 @@ var GET__FOLLOW_UP_APPOINTMENT = createAsyncThunk("appointmentReducer/follow_up_
11162
11297
  db_name: dbName,
11163
11298
  entity: "AppointmentRequest",
11164
11299
  filter: "AppointmentRequest.patientid=='".concat(patientId, "' and DATE_TIMESTAMP(DATE_ADD(AppointmentRequest.encounterdate*1000,AppointmentRequest.followupdurval,DOCUMENT(AppointmentRequest.followupduruom).display=='Days'?'day':DOCUMENT(AppointmentRequest.followupduruom).display=='month'?'month':'week'))>=DATE_TIMESTAMP(DATE_NOW())"),
11165
- return_fields: "merge(AppointmentRequest,{encounterid:(for e in Encounter filter e._id == AppointmentRequest.encounterid return merge(e,{appointmentId:(for app in Appointment filter app.id in e.appointmentId return app.consultationMode)}))},{followupduruom:document(AppointmentRequest.followupduruom)},{followupreason:document(AppointmentRequest.followupreason)},{healthserviceid:to_array(document(AppointmentRequest.healthserviceid))},{orgid:to_array(document(AppointmentRequest.orgid))},{practitionerid:(for doc in Practitioner filter doc._id == AppointmentRequest.practitionerid return merge(doc,{name:(for name in HumanNameMaster filter name._id in doc.name return merge(name,{use:(document(name.use))},{prefix:(document(name.prefix))},{suffix:document(name.suffix)}))},{practitioner_role:(for pr in PractitionerRole filter pr._id in doc.practitioner_role return merge(pr,{role:document(pr.role)}))}))},{patientid:(for pat in Patient filter pat._id == AppointmentRequest.patientid return merge (pat,{name:(for name in HumanNameMaster filter name._id in pat.name return merge(name,{use:(document(name.use))},{prefix:(document(name.prefix))},{suffix:document(name.suffix)}))}))},{specialtyid:document(AppointmentRequest.specialtyid)})"
11300
+ return_fields: "merge(AppointmentRequest,{encounterid:(for e in Encounter filter e._id == AppointmentRequest.encounterid return merge(e,{appointmentId:(for app in Appointment filter app.id in e.appointmentId return app.consultationMode)}))},{followupduruom:document(AppointmentRequest.followupduruom)},{followupreason:document(AppointmentRequest.followupreason)},{healthserviceid:to_array(document(AppointmentRequest.healthserviceid))},{orgid:to_array(document(AppointmentRequest.orgid))}, {practitionerid:(for doc in Practitioner filter doc._id == AppointmentRequest.practitionerid return merge(doc,{name:(for name in HumanNameMaster filter name._id in doc.name return merge(name,{use:document(name.use)},{prefix:merge(document(name.prefix),{coding:document(document(name.prefix).coding)})},{suffix:merge(document(name.suffix),{coding:document(document(name.suffix).coding)})}))}, {practitioner_role:(for pr in PractitionerRole filter pr._id in doc.practitioner_role return merge(pr,{role:document(pr.role)}))},{photo:document(doc.photo)}))}, {patientid:(for pat in Patient filter pat._id == AppointmentRequest.patientid return merge (pat,{name:(for name in HumanNameMaster filter name._id in pat.name return merge(name,{use:(document(name.use))},{prefix:(document(name.prefix))},{suffix:document(name.suffix)}))}))},{specialtyid:document(AppointmentRequest.specialtyid)})"
11166
11301
  }; // const body = {
11167
11302
  // "db_name": dbName,
11168
11303
  // "entity": "AppointmentRequest",
@@ -13521,9 +13656,53 @@ var practitionerReducer$1 = practitionerReducer.reducer;
13521
13656
 
13522
13657
  var _extraReducers$x;
13523
13658
 
13524
- var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
13659
+ var getLocationInfo$1 = /*#__PURE__*/function () {
13660
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(myLocation, city) {
13661
+ var obj,
13662
+ lat,
13663
+ _long,
13664
+ info,
13665
+ _args = arguments;
13666
+
13667
+ return regeneratorRuntime.wrap(function _callee$(_context) {
13668
+ while (1) {
13669
+ switch (_context.prev = _context.next) {
13670
+ case 0:
13671
+ obj = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
13672
+
13673
+ if (obj[city]) {
13674
+ _context.next = 7;
13675
+ break;
13676
+ }
13677
+
13678
+ lat = myLocation.lat, _long = myLocation["long"];
13679
+ _context.next = 5;
13680
+ return getLatLong(city);
13681
+
13682
+ case 5:
13683
+ info = _context.sent;
13684
+
13685
+ if (info.lat && info["long"]) {
13686
+ obj[city] = getDisctanceFromLatLonInKm(info.lat, info["long"], lat, _long);
13687
+ }
13688
+
13689
+ case 7:
13690
+ case "end":
13691
+ return _context.stop();
13692
+ }
13693
+ }
13694
+ }, _callee);
13695
+ }));
13696
+
13697
+ return function getLocationInfo(_x, _x2) {
13698
+ return _ref.apply(this, arguments);
13699
+ };
13700
+ }(); // DOCTER_LISTING
13701
+
13702
+
13703
+ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
13525
13704
  var payload,
13526
- _ref2,
13705
+ _ref3,
13527
13706
  rejectWithValue,
13528
13707
  date,
13529
13708
  startTime,
@@ -13538,15 +13717,21 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13538
13717
  data,
13539
13718
  returnData,
13540
13719
  allLangs,
13541
- _args = arguments;
13720
+ allCities,
13721
+ _yield$getCurrentPosi,
13722
+ myLat,
13723
+ myLong,
13724
+ locationInfo,
13725
+ promArr,
13726
+ _args2 = arguments;
13542
13727
 
13543
- return regeneratorRuntime.wrap(function _callee$(_context) {
13728
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
13544
13729
  while (1) {
13545
- switch (_context.prev = _context.next) {
13730
+ switch (_context2.prev = _context2.next) {
13546
13731
  case 0:
13547
- payload = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
13548
- _ref2 = _args.length > 1 ? _args[1] : undefined, rejectWithValue = _ref2.rejectWithValue;
13549
- _context.prev = 2;
13732
+ payload = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
13733
+ _ref3 = _args2.length > 1 ? _args2[1] : undefined, rejectWithValue = _ref3.rejectWithValue;
13734
+ _context2.prev = 2;
13550
13735
  date = new Date();
13551
13736
 
13552
13737
  if (payload.date) {
@@ -13597,15 +13782,16 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13597
13782
  // }
13598
13783
 
13599
13784
 
13600
- _context.next = 12;
13785
+ _context2.next = 12;
13601
13786
  return fetchData$3({
13602
13787
  body: JSON.stringify(body)
13603
13788
  });
13604
13789
 
13605
13790
  case 12:
13606
- data = _context.sent;
13791
+ data = _context2.sent;
13607
13792
  returnData = [];
13608
13793
  allLangs = new Set();
13794
+ allCities = new Set();
13609
13795
 
13610
13796
  if (Array.isArray(data) && Array.isArray(data[0])) {
13611
13797
  data[0].forEach(function (record) {
@@ -13617,7 +13803,7 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13617
13803
  restData = _objectWithoutProperties(record, ["OrgType", "id", "_id", "displayresource"]);
13618
13804
 
13619
13805
  if (displayresource) {
13620
- var _OrgType$some, _restData$locationID, _restData$hospital2, _OrgType$, _restData$hospital3, _restData$hospital3$O, _restData$hospital4;
13806
+ var _OrgType$some, _restData$address, _restData$address$cit, _restData$hospital2, _restData$hospital2$a, _restData$hospital2$a2, _restData$locationID, _restData$hospital3, _OrgType$, _restData$hospital4, _restData$hospital4$O, _restData$hospital5;
13621
13807
 
13622
13808
  var resourceInfo = {
13623
13809
  resourcetype: "",
@@ -13669,6 +13855,8 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13669
13855
  // isClinic,
13670
13856
  // );
13671
13857
 
13858
+ var city = (restData === null || restData === void 0 ? void 0 : (_restData$address = restData.address) === null || _restData$address === void 0 ? void 0 : (_restData$address$cit = _restData$address.city) === null || _restData$address$cit === void 0 ? void 0 : _restData$address$cit.geogLevelName) || (restData === null || restData === void 0 ? void 0 : (_restData$hospital2 = restData.hospital) === null || _restData$hospital2 === void 0 ? void 0 : (_restData$hospital2$a = _restData$hospital2.address) === null || _restData$hospital2$a === void 0 ? void 0 : (_restData$hospital2$a2 = _restData$hospital2$a.city) === null || _restData$hospital2$a2 === void 0 ? void 0 : _restData$hospital2$a2.geogLevelName) || "";
13859
+ allCities.add(city);
13672
13860
  var info = {
13673
13861
  clinicId: (restData === null || restData === void 0 ? void 0 : (_restData$locationID = restData.locationID) === null || _restData$locationID === void 0 ? void 0 : _restData$locationID.id) || 0,
13674
13862
  id: id,
@@ -13683,6 +13871,7 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13683
13871
  hospitalName: "",
13684
13872
  hospitalLocation: "",
13685
13873
  kms: "0 Kms",
13874
+ city: city,
13686
13875
  weekCalendar: payload.date && payload.date * 1000 || Date.now(),
13687
13876
  isAllSession: isClinic,
13688
13877
  allSession: allSession,
@@ -13696,15 +13885,15 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13696
13885
  resourceInfo: resourceInfo,
13697
13886
  specialities: [],
13698
13887
  healthCareId: healthCareId,
13699
- orgId: isClinic ? id : restData === null || restData === void 0 ? void 0 : (_restData$hospital2 = restData.hospital) === null || _restData$hospital2 === void 0 ? void 0 : _restData$hospital2.id,
13700
- orgType: isClinic ? OrgType === null || OrgType === void 0 ? void 0 : (_OrgType$ = OrgType[0]) === null || _OrgType$ === void 0 ? void 0 : _OrgType$._id : restData === null || restData === void 0 ? void 0 : (_restData$hospital3 = restData.hospital) === null || _restData$hospital3 === void 0 ? void 0 : (_restData$hospital3$O = _restData$hospital3.OrgType) === null || _restData$hospital3$O === void 0 ? void 0 : _restData$hospital3$O[0],
13701
- org_Id: isClinic ? _id : restData === null || restData === void 0 ? void 0 : (_restData$hospital4 = restData.hospital) === null || _restData$hospital4 === void 0 ? void 0 : _restData$hospital4._id,
13888
+ orgId: isClinic ? id : restData === null || restData === void 0 ? void 0 : (_restData$hospital3 = restData.hospital) === null || _restData$hospital3 === void 0 ? void 0 : _restData$hospital3.id,
13889
+ orgType: isClinic ? OrgType === null || OrgType === void 0 ? void 0 : (_OrgType$ = OrgType[0]) === null || _OrgType$ === void 0 ? void 0 : _OrgType$._id : restData === null || restData === void 0 ? void 0 : (_restData$hospital4 = restData.hospital) === null || _restData$hospital4 === void 0 ? void 0 : (_restData$hospital4$O = _restData$hospital4.OrgType) === null || _restData$hospital4$O === void 0 ? void 0 : _restData$hospital4$O[0],
13890
+ org_Id: isClinic ? _id : restData === null || restData === void 0 ? void 0 : (_restData$hospital5 = restData.hospital) === null || _restData$hospital5 === void 0 ? void 0 : _restData$hospital5._id,
13702
13891
  _id: isClinic ? _id : restData === null || restData === void 0 ? void 0 : restData._id,
13703
13892
  _key: restData === null || restData === void 0 ? void 0 : restData._key
13704
13893
  };
13705
13894
 
13706
13895
  if (isClinic) {
13707
- var _restData$clinics5, _restData$clinics5$, _s$Type, _restData$locationID2, _restData$address, _restData$address$, _restData$address2, _restData$address2$, _restData$Practitione, _restData$address3, _restData$address3$, _restData$locationID3, _restData$locationID4, _restData$locationID5;
13896
+ var _restData$clinics5, _restData$clinics5$, _s$Type, _restData$locationID2, _restData$address2, _restData$address2$, _restData$address3, _restData$address3$, _restData$Practitione, _restData$address4, _restData$address4$, _restData$locationID3, _restData$locationID4, _restData$locationID5;
13708
13897
 
13709
13898
  var s = restData === null || restData === void 0 ? void 0 : (_restData$clinics5 = restData.clinics) === null || _restData$clinics5 === void 0 ? void 0 : (_restData$clinics5$ = _restData$clinics5[0]) === null || _restData$clinics5$ === void 0 ? void 0 : _restData$clinics5$.Specialties;
13710
13899
 
@@ -13725,8 +13914,8 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13725
13914
 
13726
13915
  info["name"] = (restData === null || restData === void 0 ? void 0 : (_restData$locationID2 = restData.locationID) === null || _restData$locationID2 === void 0 ? void 0 : _restData$locationID2.shortdesc) || "";
13727
13916
  info["hospitalName"] = (restData === null || restData === void 0 ? void 0 : restData.name) || "";
13728
- info["hospitalLocation"] = (restData === null || restData === void 0 ? void 0 : (_restData$address = restData.address) === null || _restData$address === void 0 ? void 0 : (_restData$address$ = _restData$address[0]) === null || _restData$address$ === void 0 ? void 0 : _restData$address$.line) || "";
13729
- info["title"] = (restData === null || restData === void 0 ? void 0 : (_restData$address2 = restData.address) === null || _restData$address2 === void 0 ? void 0 : (_restData$address2$ = _restData$address2[0]) === null || _restData$address2$ === void 0 ? void 0 : _restData$address2$.line) || "";
13917
+ info["hospitalLocation"] = (restData === null || restData === void 0 ? void 0 : (_restData$address2 = restData.address) === null || _restData$address2 === void 0 ? void 0 : (_restData$address2$ = _restData$address2[0]) === null || _restData$address2$ === void 0 ? void 0 : _restData$address2$.line) || "";
13918
+ info["title"] = (restData === null || restData === void 0 ? void 0 : (_restData$address3 = restData.address) === null || _restData$address3 === void 0 ? void 0 : (_restData$address3$ = _restData$address3[0]) === null || _restData$address3$ === void 0 ? void 0 : _restData$address3$.line) || "";
13730
13919
  info["gender"] = null;
13731
13920
  info["memberIncludes"] = restData === null || restData === void 0 ? void 0 : restData.member_count;
13732
13921
  info["memberIncludesImg"] = restData === null || restData === void 0 ? void 0 : (_restData$Practitione = restData.Practitioner) === null || _restData$Practitione === void 0 ? void 0 : _restData$Practitione.map(function (p) {
@@ -13738,11 +13927,11 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13738
13927
 
13739
13928
  return "";
13740
13929
  });
13741
- info["kms"] = (restData === null || restData === void 0 ? void 0 : (_restData$address3 = restData.address) === null || _restData$address3 === void 0 ? void 0 : (_restData$address3$ = _restData$address3[0]) === null || _restData$address3$ === void 0 ? void 0 : _restData$address3$.distance) ? "".concat(restData.address[0].distance) : "0";
13930
+ info["kms"] = (restData === null || restData === void 0 ? void 0 : (_restData$address4 = restData.address) === null || _restData$address4 === void 0 ? void 0 : (_restData$address4$ = _restData$address4[0]) === null || _restData$address4$ === void 0 ? void 0 : _restData$address4$.distance) ? "".concat(restData.address[0].distance) : "0";
13742
13931
  info["key"] = restData === null || restData === void 0 ? void 0 : restData._key;
13743
13932
  info["img"] = getImgUrl(restData === null || restData === void 0 ? void 0 : (_restData$locationID3 = restData.locationID) === null || _restData$locationID3 === void 0 ? void 0 : (_restData$locationID4 = _restData$locationID3.photo) === null || _restData$locationID4 === void 0 ? void 0 : (_restData$locationID5 = _restData$locationID4[0]) === null || _restData$locationID5 === void 0 ? void 0 : _restData$locationID5.fileid);
13744
13933
  } else {
13745
- var _restData$gender, _restData$gender$codi, _restData$gender$codi2, _restData$Specialties, _restData$communicati, _restData$hospital5, _restData$qualificati, _restData$qualificati2, _restData$qualificati3, _restData$hospital6, _restData$address4, _restData$address4$, _restData$name, _restData$photo, _restData$photo$, _restData$address5, _restData$address5$;
13934
+ var _restData$gender, _restData$gender$codi, _restData$gender$codi2, _restData$Specialties, _restData$communicati, _restData$hospital6, _restData$qualificati, _restData$qualificati2, _restData$qualificati3, _restData$hospital7, _restData$address5, _restData$address5$, _restData$name, _restData$photo, _restData$photo$, _restData$address6, _restData$address6$;
13746
13935
 
13747
13936
  var gender = (restData === null || restData === void 0 ? void 0 : (_restData$gender = restData.gender) === null || _restData$gender === void 0 ? void 0 : (_restData$gender$codi = _restData$gender.coding) === null || _restData$gender$codi === void 0 ? void 0 : (_restData$gender$codi2 = _restData$gender$codi[0]) === null || _restData$gender$codi2 === void 0 ? void 0 : _restData$gender$codi2.display) || "";
13748
13937
  var designation = "";
@@ -13782,17 +13971,17 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13782
13971
  });
13783
13972
  info["title"] = "".concat(gender).concat(gender && " | ").concat(designation);
13784
13973
  info["gender"] = gender;
13785
- info["hospId"] = restData === null || restData === void 0 ? void 0 : (_restData$hospital5 = restData.hospital) === null || _restData$hospital5 === void 0 ? void 0 : _restData$hospital5.id;
13974
+ info["hospId"] = restData === null || restData === void 0 ? void 0 : (_restData$hospital6 = restData.hospital) === null || _restData$hospital6 === void 0 ? void 0 : _restData$hospital6.id;
13786
13975
  info["subtext"] = (restData === null || restData === void 0 ? void 0 : (_restData$qualificati = restData.qualification) === null || _restData$qualificati === void 0 ? void 0 : (_restData$qualificati2 = _restData$qualificati.map) === null || _restData$qualificati2 === void 0 ? void 0 : (_restData$qualificati3 = _restData$qualificati2.call(_restData$qualificati, function (q) {
13787
13976
  return (q === null || q === void 0 ? void 0 : q.name) || "";
13788
13977
  })) === null || _restData$qualificati3 === void 0 ? void 0 : _restData$qualificati3.join(", ")) || "MBBS";
13789
13978
  info["language"] = languages.size > 0 ? _toConsumableArray(languages) : [];
13790
- info["hospitalName"] = (restData === null || restData === void 0 ? void 0 : (_restData$hospital6 = restData.hospital) === null || _restData$hospital6 === void 0 ? void 0 : _restData$hospital6.name) || "";
13791
- info["hospitalLocation"] = (restData === null || restData === void 0 ? void 0 : (_restData$address4 = restData.address) === null || _restData$address4 === void 0 ? void 0 : (_restData$address4$ = _restData$address4[0]) === null || _restData$address4$ === void 0 ? void 0 : _restData$address4$.line) || "";
13979
+ info["hospitalName"] = (restData === null || restData === void 0 ? void 0 : (_restData$hospital7 = restData.hospital) === null || _restData$hospital7 === void 0 ? void 0 : _restData$hospital7.name) || "";
13980
+ info["hospitalLocation"] = (restData === null || restData === void 0 ? void 0 : (_restData$address5 = restData.address) === null || _restData$address5 === void 0 ? void 0 : (_restData$address5$ = _restData$address5[0]) === null || _restData$address5$ === void 0 ? void 0 : _restData$address5$.line) || "";
13792
13981
  var nameObj = (restData === null || restData === void 0 ? void 0 : (_restData$name = restData.name) === null || _restData$name === void 0 ? void 0 : _restData$name[0]) || {};
13793
13982
  info["name"] = makeName(nameObj);
13794
13983
  info["img"] = getImgUrl(restData === null || restData === void 0 ? void 0 : (_restData$photo = restData.photo) === null || _restData$photo === void 0 ? void 0 : (_restData$photo$ = _restData$photo[0]) === null || _restData$photo$ === void 0 ? void 0 : _restData$photo$.fileid);
13795
- info["kms"] = (restData === null || restData === void 0 ? void 0 : (_restData$address5 = restData.address) === null || _restData$address5 === void 0 ? void 0 : (_restData$address5$ = _restData$address5[0]) === null || _restData$address5$ === void 0 ? void 0 : _restData$address5$.distance) ? "".concat(restData.address[0].distance) : "0";
13984
+ info["kms"] = (restData === null || restData === void 0 ? void 0 : (_restData$address6 = restData.address) === null || _restData$address6 === void 0 ? void 0 : (_restData$address6$ = _restData$address6[0]) === null || _restData$address6$ === void 0 ? void 0 : _restData$address6$.distance) ? "".concat(restData.address[0].distance) : "0";
13796
13985
  info["key"] = restData === null || restData === void 0 ? void 0 : restData._key;
13797
13986
  }
13798
13987
 
@@ -13802,25 +13991,56 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13802
13991
  });
13803
13992
  }
13804
13993
 
13805
- return _context.abrupt("return", _objectSpread2(_objectSpread2({}, defaultState.Info), {}, {
13994
+ _context2.next = 19;
13995
+ return getCurrentPosition();
13996
+
13997
+ case 19:
13998
+ _yield$getCurrentPosi = _context2.sent;
13999
+ myLat = _yield$getCurrentPosi.lat;
14000
+ myLong = _yield$getCurrentPosi["long"];
14001
+ locationInfo = {};
14002
+
14003
+ if (!(myLat && myLong)) {
14004
+ _context2.next = 28;
14005
+ break;
14006
+ }
14007
+
14008
+ promArr = _toConsumableArray(allCities).filter(function (c) {
14009
+ return !!c;
14010
+ }).map(function (city) {
14011
+ return getLocationInfo$1({
14012
+ lat: myLat,
14013
+ "long": myLong
14014
+ }, city, locationInfo);
14015
+ });
14016
+ _context2.next = 27;
14017
+ return es6Promise.Promise.all(promArr);
14018
+
14019
+ case 27:
14020
+ returnData.forEach(function (d) {
14021
+ d.kms = locationInfo[d.city] || "0 Kms";
14022
+ });
14023
+
14024
+ case 28:
14025
+ return _context2.abrupt("return", _objectSpread2(_objectSpread2({}, defaultState.Info), {}, {
13806
14026
  data: returnData,
13807
14027
  allLangs: _toConsumableArray(allLangs)
13808
14028
  }));
13809
14029
 
13810
- case 19:
13811
- _context.prev = 19;
13812
- _context.t0 = _context["catch"](2);
13813
- console.log(_context.t0);
13814
- return _context.abrupt("return", rejectWithValue(_objectSpread2(_objectSpread2({}, defaultReject), {}, {
13815
- message: _context.t0.message
14030
+ case 31:
14031
+ _context2.prev = 31;
14032
+ _context2.t0 = _context2["catch"](2);
14033
+ console.log(_context2.t0);
14034
+ return _context2.abrupt("return", rejectWithValue(_objectSpread2(_objectSpread2({}, defaultReject), {}, {
14035
+ message: _context2.t0.message
13816
14036
  })));
13817
14037
 
13818
- case 23:
14038
+ case 35:
13819
14039
  case "end":
13820
- return _context.stop();
14040
+ return _context2.stop();
13821
14041
  }
13822
14042
  }
13823
- }, _callee, null, [[2, 19]]);
14043
+ }, _callee2, null, [[2, 31]]);
13824
14044
  }))); // end
13825
14045
  // FUZZY SEARCH CREATE INITIALSTATE
13826
14046
 
@@ -14105,6 +14325,9 @@ var GET_HOSPITALS_LOCALITY = createAsyncThunk("searhcApiSlice/getHospitals", /*#
14105
14325
  location,
14106
14326
  body,
14107
14327
  data,
14328
+ _yield$getCurrentPosi,
14329
+ lat,
14330
+ _long,
14108
14331
  returnData,
14109
14332
  _args4 = arguments;
14110
14333
 
@@ -14115,7 +14338,7 @@ var GET_HOSPITALS_LOCALITY = createAsyncThunk("searhcApiSlice/getHospitals", /*#
14115
14338
  payload = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
14116
14339
  _ref8 = _args4.length > 1 ? _args4[1] : undefined, rejectWithValue = _ref8.rejectWithValue;
14117
14340
  _context4.prev = 2;
14118
- _payload$city2 = payload.city, city = _payload$city2 === void 0 ? "" : _payload$city2, _payload$location = payload.location, location = _payload$location === void 0 ? "" : _payload$location;
14341
+ _payload$city2 = payload.city, city = _payload$city2 === void 0 ? "" : _payload$city2, _payload$location = payload.location, location = _payload$location === void 0 ? {} : _payload$location;
14119
14342
  body = {
14120
14343
  db_name: dbName,
14121
14344
  queryid: query_ids["searhcApiSlice/getHospitals"],
@@ -14133,6 +14356,13 @@ var GET_HOSPITALS_LOCALITY = createAsyncThunk("searhcApiSlice/getHospitals", /*#
14133
14356
 
14134
14357
  case 7:
14135
14358
  data = _context4.sent;
14359
+ _context4.next = 10;
14360
+ return getCurrentPosition();
14361
+
14362
+ case 10:
14363
+ _yield$getCurrentPosi = _context4.sent;
14364
+ lat = _yield$getCurrentPosi.lat;
14365
+ _long = _yield$getCurrentPosi["long"];
14136
14366
  returnData = [];
14137
14367
 
14138
14368
  if (Array.isArray(data)) {
@@ -14140,11 +14370,18 @@ var GET_HOSPITALS_LOCALITY = createAsyncThunk("searhcApiSlice/getHospitals", /*#
14140
14370
  if (hospInfo.id && hospInfo.name) {
14141
14371
  var _hospInfo$address, _hospInfo$address2;
14142
14372
 
14373
+ var distance = "";
14374
+
14375
+ if (lat && _long) {
14376
+ distance = getDisctanceFromLatLonInKm(lat, _long, location.latitude, location.longitude) + " KM";
14377
+ }
14378
+
14143
14379
  returnData.push({
14144
14380
  value: hospInfo.id,
14145
14381
  label: hospInfo.name,
14146
14382
  lat: hospInfo === null || hospInfo === void 0 ? void 0 : (_hospInfo$address = hospInfo.address) === null || _hospInfo$address === void 0 ? void 0 : _hospInfo$address.latitude,
14147
- "long": hospInfo === null || hospInfo === void 0 ? void 0 : (_hospInfo$address2 = hospInfo.address) === null || _hospInfo$address2 === void 0 ? void 0 : _hospInfo$address2.longitude
14383
+ "long": hospInfo === null || hospInfo === void 0 ? void 0 : (_hospInfo$address2 = hospInfo.address) === null || _hospInfo$address2 === void 0 ? void 0 : _hospInfo$address2.longitude,
14384
+ distance: distance
14148
14385
  });
14149
14386
  }
14150
14387
  });
@@ -14154,19 +14391,19 @@ var GET_HOSPITALS_LOCALITY = createAsyncThunk("searhcApiSlice/getHospitals", /*#
14154
14391
  data: returnData
14155
14392
  }));
14156
14393
 
14157
- case 13:
14158
- _context4.prev = 13;
14394
+ case 18:
14395
+ _context4.prev = 18;
14159
14396
  _context4.t0 = _context4["catch"](2);
14160
14397
  return _context4.abrupt("return", rejectWithValue(_objectSpread2(_objectSpread2({}, defaultReject), {}, {
14161
14398
  message: _context4.t0.message
14162
14399
  })));
14163
14400
 
14164
- case 16:
14401
+ case 21:
14165
14402
  case "end":
14166
14403
  return _context4.stop();
14167
14404
  }
14168
14405
  }
14169
- }, _callee4, null, [[2, 13]]);
14406
+ }, _callee4, null, [[2, 18]]);
14170
14407
  })));
14171
14408
  var GET_SYMPTOMS = createAsyncThunk("searhcApiSlice/getSymptoms", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
14172
14409
  var payload,
@@ -14552,26 +14789,82 @@ var SPECIALITY_AGAINST_PRACTITIONER = createAsyncThunk("searhcApiSlice/specialit
14552
14789
  }
14553
14790
  }, _callee10, null, [[2, 12]]);
14554
14791
  })));
14555
- var PRACTITIONER_AGAINST_ORGANIZATION = createAsyncThunk("searhcApiSlice/practitionerAgainstOrganization", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11() {
14792
+
14793
+ var getLocationInfo = /*#__PURE__*/function () {
14794
+ var _ref21 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11() {
14795
+ var _hospInfo$address3, _hospInfo$address3$, _hospInfo$address3$$c;
14796
+
14797
+ var hospInfo,
14798
+ obj,
14799
+ city,
14800
+ info,
14801
+ _args11 = arguments;
14802
+ return regeneratorRuntime.wrap(function _callee11$(_context11) {
14803
+ while (1) {
14804
+ switch (_context11.prev = _context11.next) {
14805
+ case 0:
14806
+ hospInfo = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
14807
+ obj = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {};
14808
+ city = hospInfo === null || hospInfo === void 0 ? void 0 : (_hospInfo$address3 = hospInfo.address) === null || _hospInfo$address3 === void 0 ? void 0 : (_hospInfo$address3$ = _hospInfo$address3[0]) === null || _hospInfo$address3$ === void 0 ? void 0 : (_hospInfo$address3$$c = _hospInfo$address3$.city) === null || _hospInfo$address3$$c === void 0 ? void 0 : _hospInfo$address3$$c.geogLevelName;
14809
+
14810
+ if (obj[city]) {
14811
+ _context11.next = 8;
14812
+ break;
14813
+ }
14814
+
14815
+ _context11.next = 6;
14816
+ return getLatLong(city);
14817
+
14818
+ case 6:
14819
+ info = _context11.sent;
14820
+ obj[city] = info;
14821
+
14822
+ case 8:
14823
+ case "end":
14824
+ return _context11.stop();
14825
+ }
14826
+ }
14827
+ }, _callee11);
14828
+ }));
14829
+
14830
+ return function getLocationInfo() {
14831
+ return _ref21.apply(this, arguments);
14832
+ };
14833
+ }();
14834
+
14835
+ var PRACTITIONER_AGAINST_ORGANIZATION = createAsyncThunk("searhcApiSlice/practitionerAgainstOrganization", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12() {
14556
14836
  var payload,
14557
- _ref22,
14837
+ _ref23,
14558
14838
  rejectWithValue,
14559
14839
  _payload$practitioner,
14560
14840
  practitionerId,
14841
+ _yield$getCurrentPosi2,
14842
+ myLat,
14843
+ myLong,
14561
14844
  body,
14562
14845
  data,
14563
14846
  returnData,
14564
14847
  _data$result,
14565
- _args11 = arguments;
14848
+ _data$result2,
14849
+ cityMap,
14850
+ promArr,
14851
+ _args12 = arguments;
14566
14852
 
14567
- return regeneratorRuntime.wrap(function _callee11$(_context11) {
14853
+ return regeneratorRuntime.wrap(function _callee12$(_context12) {
14568
14854
  while (1) {
14569
- switch (_context11.prev = _context11.next) {
14855
+ switch (_context12.prev = _context12.next) {
14570
14856
  case 0:
14571
- payload = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
14572
- _ref22 = _args11.length > 1 ? _args11[1] : undefined, rejectWithValue = _ref22.rejectWithValue;
14573
- _context11.prev = 2;
14857
+ payload = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
14858
+ _ref23 = _args12.length > 1 ? _args12[1] : undefined, rejectWithValue = _ref23.rejectWithValue;
14859
+ _context12.prev = 2;
14574
14860
  _payload$practitioner = payload.practitionerId, practitionerId = _payload$practitioner === void 0 ? "" : _payload$practitioner;
14861
+ _context12.next = 6;
14862
+ return getCurrentPosition();
14863
+
14864
+ case 6:
14865
+ _yield$getCurrentPosi2 = _context12.sent;
14866
+ myLat = _yield$getCurrentPosi2.lat;
14867
+ myLong = _yield$getCurrentPosi2["long"];
14575
14868
  body = {
14576
14869
  db_name: dbName,
14577
14870
  entity: "Practitioner,Organization",
@@ -14579,45 +14872,72 @@ var PRACTITIONER_AGAINST_ORGANIZATION = createAsyncThunk("searhcApiSlice/practit
14579
14872
  Practitioner: "Practitioner.id==".concat(practitionerId),
14580
14873
  Organization: "document(Practitioner.practitioner_role)[*].OrgID any == Organization._id"
14581
14874
  },
14582
- return_fields: "{OrganizationName:Organization.name, OrgID:Organization.id}"
14875
+ return_fields: "{address: (let add = Document(Organization.address[0]) return merge(add, { city: Document(add.city) })), OrganizationName:Organization.name, OrgID:Organization.id}"
14583
14876
  };
14584
- _context11.next = 7;
14877
+ _context12.next = 12;
14585
14878
  return fetchData$3({
14586
14879
  body: JSON.stringify(body)
14587
14880
  }, __readDocumentUrl__);
14588
14881
 
14589
- case 7:
14590
- data = _context11.sent;
14882
+ case 12:
14883
+ data = _context12.sent;
14591
14884
  returnData = [];
14592
14885
 
14593
- if (Array.isArray(data === null || data === void 0 ? void 0 : data.result)) {
14594
- data === null || data === void 0 ? void 0 : (_data$result = data.result) === null || _data$result === void 0 ? void 0 : _data$result.forEach(function (hospInfo) {
14595
- returnData.push({
14596
- value: hospInfo.OrgID,
14597
- label: hospInfo.OrganizationName,
14598
- lat: 0,
14599
- "long": 0
14600
- });
14601
- });
14886
+ if (!Array.isArray(data === null || data === void 0 ? void 0 : data.result)) {
14887
+ _context12.next = 20;
14888
+ break;
14602
14889
  }
14603
14890
 
14604
- return _context11.abrupt("return", _objectSpread2(_objectSpread2({}, defaultState.Info), {}, {
14891
+ cityMap = {};
14892
+ promArr = data === null || data === void 0 ? void 0 : (_data$result = data.result) === null || _data$result === void 0 ? void 0 : _data$result.map(function (hospInfo) {
14893
+ return getLocationInfo(hospInfo, cityMap);
14894
+ });
14895
+ _context12.next = 19;
14896
+ return es6Promise.Promise.all(promArr);
14897
+
14898
+ case 19:
14899
+ data === null || data === void 0 ? void 0 : (_data$result2 = data.result) === null || _data$result2 === void 0 ? void 0 : _data$result2.forEach(function (hospInfo) {
14900
+ var _hospInfo$address4, _hospInfo$address4$, _hospInfo$address4$$c;
14901
+
14902
+ var city = hospInfo === null || hospInfo === void 0 ? void 0 : (_hospInfo$address4 = hospInfo.address) === null || _hospInfo$address4 === void 0 ? void 0 : (_hospInfo$address4$ = _hospInfo$address4[0]) === null || _hospInfo$address4$ === void 0 ? void 0 : (_hospInfo$address4$$c = _hospInfo$address4$.city) === null || _hospInfo$address4$$c === void 0 ? void 0 : _hospInfo$address4$$c.geogLevelName;
14903
+
14904
+ var _ref24 = cityMap[city] || {},
14905
+ lat = _ref24.lat,
14906
+ _long2 = _ref24["long"];
14907
+
14908
+ var distance = "";
14909
+
14910
+ if (myLat && myLong && lat && _long2) {
14911
+ distance = getDisctanceFromLatLonInKm(lat, _long2, myLat, myLong) + " KM";
14912
+ }
14913
+
14914
+ returnData.push({
14915
+ value: hospInfo.OrgID,
14916
+ label: hospInfo.OrganizationName,
14917
+ lat: 0,
14918
+ "long": 0,
14919
+ distance: distance
14920
+ });
14921
+ });
14922
+
14923
+ case 20:
14924
+ return _context12.abrupt("return", _objectSpread2(_objectSpread2({}, defaultState.Info), {}, {
14605
14925
  data: returnData
14606
14926
  }));
14607
14927
 
14608
- case 13:
14609
- _context11.prev = 13;
14610
- _context11.t0 = _context11["catch"](2);
14611
- return _context11.abrupt("return", rejectWithValue(_objectSpread2(_objectSpread2({}, defaultReject), {}, {
14612
- message: _context11.t0.message
14928
+ case 23:
14929
+ _context12.prev = 23;
14930
+ _context12.t0 = _context12["catch"](2);
14931
+ return _context12.abrupt("return", rejectWithValue(_objectSpread2(_objectSpread2({}, defaultReject), {}, {
14932
+ message: _context12.t0.message
14613
14933
  })));
14614
14934
 
14615
- case 16:
14935
+ case 26:
14616
14936
  case "end":
14617
- return _context11.stop();
14937
+ return _context12.stop();
14618
14938
  }
14619
14939
  }
14620
- }, _callee11, null, [[2, 13]]);
14940
+ }, _callee12, null, [[2, 23]]);
14621
14941
  })));
14622
14942
  var searhcApiSlice = createSlice({
14623
14943
  name: "searhcApiSlice",
@@ -18302,7 +18622,7 @@ var dashboardQuery = {
18302
18622
  entity: "Appointment,Encounter",
18303
18623
  filter: {
18304
18624
  Appointment: "Appointment.activestatus==true && Appointment.start>=".concat(start, " && Appointment.end<=").concat(end),
18305
- Encounter: "Encounter._key=='".concat(encounterKey, "' && Encounter.activestatus==true && Encounter.appointmentId[*] any == Appointment.id && DOCUMENT(Encounter.statushistory[*].status)[*].display ANY =='Checked-in'")
18625
+ Encounter: "Encounter._key=='".concat(encounterKey, "' && Encounter.activestatus==true && Encounter.appointmentId[*] any == Appointment.id AND (lower(DOCUMENT(Encounter.status).display)==lower('Checked-in') or lower(DOCUMENT(Encounter.status).display)==lower('Triage In-Progress'))")
18306
18626
  },
18307
18627
  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)}))})}"
18308
18628
  },
@@ -18311,7 +18631,7 @@ var dashboardQuery = {
18311
18631
  entity: "Appointment,Encounter",
18312
18632
  filter: {
18313
18633
  Appointment: "Appointment.activestatus==true && Appointment.start>=".concat(start, " && Appointment.end<=").concat(end),
18314
- Encounter: "Encounter._key=='".concat(encounterKey, "' && Encounter.activestatus==true && Encounter.appointmentId[*] any == Appointment.id && DOCUMENT(Encounter.statushistory[*].status)[*].display ANY =='Checked-in'")
18634
+ Encounter: "Encounter._key=='".concat(encounterKey, "' && Encounter.activestatus==true && Encounter.appointmentId[*] any == Appointment.id AND (lower(DOCUMENT(Encounter.status).display)==lower('Checked-in') or lower(DOCUMENT(Encounter.status).display)==lower('Triage In-Progress'))")
18315
18635
  },
18316
18636
  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)}))})}"
18317
18637
  }
@@ -18561,7 +18881,7 @@ var highPriorityPatientQuery = {
18561
18881
  1: {
18562
18882
  db_name: "primarycare",
18563
18883
  entity: "Encounter",
18564
- filter: "Encounter.participant[*].Practitioner_id ANY ==".concat(practionerId, " AND Encounter.encounterdate>=").concat(startDate, " && Encounter.encounterdate<=").concat(endDate, " AND lower(DOCUMENT(Encounter.priority).display)=='high'"),
18884
+ 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'))"),
18565
18885
  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)})"
18566
18886
  },
18567
18887
  2: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primarycare-binder",
3
- "version": "1.1.13",
3
+ "version": "1.1.17",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",