primarycare-binder 1.1.14 → 1.1.18

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 +399 -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,
@@ -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",
@@ -11405,6 +11540,8 @@ var GENERAL_INSTRUCTION = createAsyncThunk("appointmentReducer/generalInstructio
11405
11540
  var payload,
11406
11541
  _ref23,
11407
11542
  rejectWithValue,
11543
+ _data$result2,
11544
+ _data$result2$,
11408
11545
  _payload$org_id,
11409
11546
  org_id,
11410
11547
  body,
@@ -11424,7 +11561,7 @@ var GENERAL_INSTRUCTION = createAsyncThunk("appointmentReducer/generalInstructio
11424
11561
  db_name: dbName,
11425
11562
  entity: "ResourcebyApptType",
11426
11563
  filter: "ResourcebyApptType.organization_id=='".concat(org_id, "' AND lower(document(ResourcebyApptType.ApptTypeCode).display)=='consultation' AND ResourcebyApptType.status==true AND ResourcebyApptType.activestatus==true"),
11427
- return_fields: "{generalInstruction:(FOR gn IN TO_ARRAY(ResourcebyApptType.generalInstruction) RETURN MERGE(gn,{fcode:DOCUMENT(gn.fcode)})),appointmentInstruction:(FOR ai IN TO_ARRAY(ResourcebyApptType.ApptInstructions) RETURN MERGE(ai,{AppInstructionCriteria:DOCUMENT(ai.AppInstructionCriteria)}))}"
11564
+ return_fields: "{orgContact: (let orgInfo = Document(ResourcebyApptType.organization_id) let contact = orgInfo.contact[0] return Document(contact.telecom)[0].value)[0], generalInstruction:(FOR gn IN TO_ARRAY(ResourcebyApptType.generalInstruction) RETURN MERGE(gn,{fcode:DOCUMENT(gn.fcode)})),appointmentInstruction:(FOR ai IN TO_ARRAY(ResourcebyApptType.ApptInstructions) RETURN MERGE(ai,{AppInstructionCriteria:DOCUMENT(ai.AppInstructionCriteria)}))}"
11428
11565
  };
11429
11566
  _context11.next = 7;
11430
11567
  return fetchData$3({
@@ -11457,7 +11594,8 @@ var GENERAL_INSTRUCTION = createAsyncThunk("appointmentReducer/generalInstructio
11457
11594
  return _context11.abrupt("return", _objectSpread2(_objectSpread2({}, defaultState.List), {}, {
11458
11595
  data: {
11459
11596
  appointmentInstruction: _toConsumableArray(returnData.appointmentInstruction),
11460
- generalInstruction: _toConsumableArray(returnData.generalInstruction)
11597
+ generalInstruction: _toConsumableArray(returnData.generalInstruction),
11598
+ orgContact: 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$.orgContact
11461
11599
  }
11462
11600
  }));
11463
11601
 
@@ -11917,7 +12055,7 @@ var REASON_FOR_APPT_CANCEL_MODIFY = createAsyncThunk("appointmentReducer/reasonF
11917
12055
  body,
11918
12056
  data,
11919
12057
  returnData,
11920
- _data$result2,
12058
+ _data$result3,
11921
12059
  _args16 = arguments;
11922
12060
 
11923
12061
  return regeneratorRuntime.wrap(function _callee16$(_context16) {
@@ -11943,7 +12081,7 @@ var REASON_FOR_APPT_CANCEL_MODIFY = createAsyncThunk("appointmentReducer/reasonF
11943
12081
  returnData = [];
11944
12082
 
11945
12083
  if (Array.isArray(data === null || data === void 0 ? void 0 : data.result)) {
11946
- data === null || data === void 0 ? void 0 : (_data$result2 = data.result) === null || _data$result2 === void 0 ? void 0 : _data$result2.map(function (_) {
12084
+ data === null || data === void 0 ? void 0 : (_data$result3 = data.result) === null || _data$result3 === void 0 ? void 0 : _data$result3.map(function (_) {
11947
12085
  returnData.push({
11948
12086
  title: _ === null || _ === void 0 ? void 0 : _.display,
11949
12087
  value: _ === null || _ === void 0 ? void 0 : _.id,
@@ -13521,9 +13659,53 @@ var practitionerReducer$1 = practitionerReducer.reducer;
13521
13659
 
13522
13660
  var _extraReducers$x;
13523
13661
 
13524
- var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
13662
+ var getLocationInfo$1 = /*#__PURE__*/function () {
13663
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(myLocation, city) {
13664
+ var obj,
13665
+ lat,
13666
+ _long,
13667
+ info,
13668
+ _args = arguments;
13669
+
13670
+ return regeneratorRuntime.wrap(function _callee$(_context) {
13671
+ while (1) {
13672
+ switch (_context.prev = _context.next) {
13673
+ case 0:
13674
+ obj = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
13675
+
13676
+ if (obj[city]) {
13677
+ _context.next = 7;
13678
+ break;
13679
+ }
13680
+
13681
+ lat = myLocation.lat, _long = myLocation["long"];
13682
+ _context.next = 5;
13683
+ return getLatLong(city);
13684
+
13685
+ case 5:
13686
+ info = _context.sent;
13687
+
13688
+ if (info.lat && info["long"]) {
13689
+ obj[city] = getDisctanceFromLatLonInKm(info.lat, info["long"], lat, _long);
13690
+ }
13691
+
13692
+ case 7:
13693
+ case "end":
13694
+ return _context.stop();
13695
+ }
13696
+ }
13697
+ }, _callee);
13698
+ }));
13699
+
13700
+ return function getLocationInfo(_x, _x2) {
13701
+ return _ref.apply(this, arguments);
13702
+ };
13703
+ }(); // DOCTER_LISTING
13704
+
13705
+
13706
+ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
13525
13707
  var payload,
13526
- _ref2,
13708
+ _ref3,
13527
13709
  rejectWithValue,
13528
13710
  date,
13529
13711
  startTime,
@@ -13538,15 +13720,21 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13538
13720
  data,
13539
13721
  returnData,
13540
13722
  allLangs,
13541
- _args = arguments;
13723
+ allCities,
13724
+ _yield$getCurrentPosi,
13725
+ myLat,
13726
+ myLong,
13727
+ locationInfo,
13728
+ promArr,
13729
+ _args2 = arguments;
13542
13730
 
13543
- return regeneratorRuntime.wrap(function _callee$(_context) {
13731
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
13544
13732
  while (1) {
13545
- switch (_context.prev = _context.next) {
13733
+ switch (_context2.prev = _context2.next) {
13546
13734
  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;
13735
+ payload = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
13736
+ _ref3 = _args2.length > 1 ? _args2[1] : undefined, rejectWithValue = _ref3.rejectWithValue;
13737
+ _context2.prev = 2;
13550
13738
  date = new Date();
13551
13739
 
13552
13740
  if (payload.date) {
@@ -13597,15 +13785,16 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13597
13785
  // }
13598
13786
 
13599
13787
 
13600
- _context.next = 12;
13788
+ _context2.next = 12;
13601
13789
  return fetchData$3({
13602
13790
  body: JSON.stringify(body)
13603
13791
  });
13604
13792
 
13605
13793
  case 12:
13606
- data = _context.sent;
13794
+ data = _context2.sent;
13607
13795
  returnData = [];
13608
13796
  allLangs = new Set();
13797
+ allCities = new Set();
13609
13798
 
13610
13799
  if (Array.isArray(data) && Array.isArray(data[0])) {
13611
13800
  data[0].forEach(function (record) {
@@ -13617,7 +13806,7 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13617
13806
  restData = _objectWithoutProperties(record, ["OrgType", "id", "_id", "displayresource"]);
13618
13807
 
13619
13808
  if (displayresource) {
13620
- var _OrgType$some, _restData$locationID, _restData$hospital2, _OrgType$, _restData$hospital3, _restData$hospital3$O, _restData$hospital4;
13809
+ 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
13810
 
13622
13811
  var resourceInfo = {
13623
13812
  resourcetype: "",
@@ -13669,6 +13858,8 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13669
13858
  // isClinic,
13670
13859
  // );
13671
13860
 
13861
+ 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) || "";
13862
+ allCities.add(city);
13672
13863
  var info = {
13673
13864
  clinicId: (restData === null || restData === void 0 ? void 0 : (_restData$locationID = restData.locationID) === null || _restData$locationID === void 0 ? void 0 : _restData$locationID.id) || 0,
13674
13865
  id: id,
@@ -13683,6 +13874,7 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13683
13874
  hospitalName: "",
13684
13875
  hospitalLocation: "",
13685
13876
  kms: "0 Kms",
13877
+ city: city,
13686
13878
  weekCalendar: payload.date && payload.date * 1000 || Date.now(),
13687
13879
  isAllSession: isClinic,
13688
13880
  allSession: allSession,
@@ -13696,15 +13888,15 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13696
13888
  resourceInfo: resourceInfo,
13697
13889
  specialities: [],
13698
13890
  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,
13891
+ orgId: isClinic ? id : restData === null || restData === void 0 ? void 0 : (_restData$hospital3 = restData.hospital) === null || _restData$hospital3 === void 0 ? void 0 : _restData$hospital3.id,
13892
+ 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],
13893
+ 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
13894
  _id: isClinic ? _id : restData === null || restData === void 0 ? void 0 : restData._id,
13703
13895
  _key: restData === null || restData === void 0 ? void 0 : restData._key
13704
13896
  };
13705
13897
 
13706
13898
  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;
13899
+ 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
13900
 
13709
13901
  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
13902
 
@@ -13725,8 +13917,8 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13725
13917
 
13726
13918
  info["name"] = (restData === null || restData === void 0 ? void 0 : (_restData$locationID2 = restData.locationID) === null || _restData$locationID2 === void 0 ? void 0 : _restData$locationID2.shortdesc) || "";
13727
13919
  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) || "";
13920
+ 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) || "";
13921
+ 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
13922
  info["gender"] = null;
13731
13923
  info["memberIncludes"] = restData === null || restData === void 0 ? void 0 : restData.member_count;
13732
13924
  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 +13930,11 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13738
13930
 
13739
13931
  return "";
13740
13932
  });
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";
13933
+ 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
13934
  info["key"] = restData === null || restData === void 0 ? void 0 : restData._key;
13743
13935
  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
13936
  } 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$;
13937
+ 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
13938
 
13747
13939
  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
13940
  var designation = "";
@@ -13782,17 +13974,17 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13782
13974
  });
13783
13975
  info["title"] = "".concat(gender).concat(gender && " | ").concat(designation);
13784
13976
  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;
13977
+ info["hospId"] = restData === null || restData === void 0 ? void 0 : (_restData$hospital6 = restData.hospital) === null || _restData$hospital6 === void 0 ? void 0 : _restData$hospital6.id;
13786
13978
  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
13979
  return (q === null || q === void 0 ? void 0 : q.name) || "";
13788
13980
  })) === null || _restData$qualificati3 === void 0 ? void 0 : _restData$qualificati3.join(", ")) || "MBBS";
13789
13981
  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) || "";
13982
+ info["hospitalName"] = (restData === null || restData === void 0 ? void 0 : (_restData$hospital7 = restData.hospital) === null || _restData$hospital7 === void 0 ? void 0 : _restData$hospital7.name) || "";
13983
+ 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
13984
  var nameObj = (restData === null || restData === void 0 ? void 0 : (_restData$name = restData.name) === null || _restData$name === void 0 ? void 0 : _restData$name[0]) || {};
13793
13985
  info["name"] = makeName(nameObj);
13794
13986
  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";
13987
+ 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
13988
  info["key"] = restData === null || restData === void 0 ? void 0 : restData._key;
13797
13989
  }
13798
13990
 
@@ -13802,25 +13994,56 @@ var DOCTER_LISTING = createAsyncThunk("docterListingReducer/docterListing", /*#_
13802
13994
  });
13803
13995
  }
13804
13996
 
13805
- return _context.abrupt("return", _objectSpread2(_objectSpread2({}, defaultState.Info), {}, {
13997
+ _context2.next = 19;
13998
+ return getCurrentPosition();
13999
+
14000
+ case 19:
14001
+ _yield$getCurrentPosi = _context2.sent;
14002
+ myLat = _yield$getCurrentPosi.lat;
14003
+ myLong = _yield$getCurrentPosi["long"];
14004
+ locationInfo = {};
14005
+
14006
+ if (!(myLat && myLong)) {
14007
+ _context2.next = 28;
14008
+ break;
14009
+ }
14010
+
14011
+ promArr = _toConsumableArray(allCities).filter(function (c) {
14012
+ return !!c;
14013
+ }).map(function (city) {
14014
+ return getLocationInfo$1({
14015
+ lat: myLat,
14016
+ "long": myLong
14017
+ }, city, locationInfo);
14018
+ });
14019
+ _context2.next = 27;
14020
+ return es6Promise.Promise.all(promArr);
14021
+
14022
+ case 27:
14023
+ returnData.forEach(function (d) {
14024
+ d.kms = locationInfo[d.city] || "0 Kms";
14025
+ });
14026
+
14027
+ case 28:
14028
+ return _context2.abrupt("return", _objectSpread2(_objectSpread2({}, defaultState.Info), {}, {
13806
14029
  data: returnData,
13807
14030
  allLangs: _toConsumableArray(allLangs)
13808
14031
  }));
13809
14032
 
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
14033
+ case 31:
14034
+ _context2.prev = 31;
14035
+ _context2.t0 = _context2["catch"](2);
14036
+ console.log(_context2.t0);
14037
+ return _context2.abrupt("return", rejectWithValue(_objectSpread2(_objectSpread2({}, defaultReject), {}, {
14038
+ message: _context2.t0.message
13816
14039
  })));
13817
14040
 
13818
- case 23:
14041
+ case 35:
13819
14042
  case "end":
13820
- return _context.stop();
14043
+ return _context2.stop();
13821
14044
  }
13822
14045
  }
13823
- }, _callee, null, [[2, 19]]);
14046
+ }, _callee2, null, [[2, 31]]);
13824
14047
  }))); // end
13825
14048
  // FUZZY SEARCH CREATE INITIALSTATE
13826
14049
 
@@ -14105,6 +14328,9 @@ var GET_HOSPITALS_LOCALITY = createAsyncThunk("searhcApiSlice/getHospitals", /*#
14105
14328
  location,
14106
14329
  body,
14107
14330
  data,
14331
+ _yield$getCurrentPosi,
14332
+ lat,
14333
+ _long,
14108
14334
  returnData,
14109
14335
  _args4 = arguments;
14110
14336
 
@@ -14115,7 +14341,7 @@ var GET_HOSPITALS_LOCALITY = createAsyncThunk("searhcApiSlice/getHospitals", /*#
14115
14341
  payload = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
14116
14342
  _ref8 = _args4.length > 1 ? _args4[1] : undefined, rejectWithValue = _ref8.rejectWithValue;
14117
14343
  _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;
14344
+ _payload$city2 = payload.city, city = _payload$city2 === void 0 ? "" : _payload$city2, _payload$location = payload.location, location = _payload$location === void 0 ? {} : _payload$location;
14119
14345
  body = {
14120
14346
  db_name: dbName,
14121
14347
  queryid: query_ids["searhcApiSlice/getHospitals"],
@@ -14133,6 +14359,13 @@ var GET_HOSPITALS_LOCALITY = createAsyncThunk("searhcApiSlice/getHospitals", /*#
14133
14359
 
14134
14360
  case 7:
14135
14361
  data = _context4.sent;
14362
+ _context4.next = 10;
14363
+ return getCurrentPosition();
14364
+
14365
+ case 10:
14366
+ _yield$getCurrentPosi = _context4.sent;
14367
+ lat = _yield$getCurrentPosi.lat;
14368
+ _long = _yield$getCurrentPosi["long"];
14136
14369
  returnData = [];
14137
14370
 
14138
14371
  if (Array.isArray(data)) {
@@ -14140,11 +14373,18 @@ var GET_HOSPITALS_LOCALITY = createAsyncThunk("searhcApiSlice/getHospitals", /*#
14140
14373
  if (hospInfo.id && hospInfo.name) {
14141
14374
  var _hospInfo$address, _hospInfo$address2;
14142
14375
 
14376
+ var distance = "";
14377
+
14378
+ if (lat && _long) {
14379
+ distance = getDisctanceFromLatLonInKm(lat, _long, location.latitude, location.longitude) + " KM";
14380
+ }
14381
+
14143
14382
  returnData.push({
14144
14383
  value: hospInfo.id,
14145
14384
  label: hospInfo.name,
14146
14385
  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
14386
+ "long": hospInfo === null || hospInfo === void 0 ? void 0 : (_hospInfo$address2 = hospInfo.address) === null || _hospInfo$address2 === void 0 ? void 0 : _hospInfo$address2.longitude,
14387
+ distance: distance
14148
14388
  });
14149
14389
  }
14150
14390
  });
@@ -14154,19 +14394,19 @@ var GET_HOSPITALS_LOCALITY = createAsyncThunk("searhcApiSlice/getHospitals", /*#
14154
14394
  data: returnData
14155
14395
  }));
14156
14396
 
14157
- case 13:
14158
- _context4.prev = 13;
14397
+ case 18:
14398
+ _context4.prev = 18;
14159
14399
  _context4.t0 = _context4["catch"](2);
14160
14400
  return _context4.abrupt("return", rejectWithValue(_objectSpread2(_objectSpread2({}, defaultReject), {}, {
14161
14401
  message: _context4.t0.message
14162
14402
  })));
14163
14403
 
14164
- case 16:
14404
+ case 21:
14165
14405
  case "end":
14166
14406
  return _context4.stop();
14167
14407
  }
14168
14408
  }
14169
- }, _callee4, null, [[2, 13]]);
14409
+ }, _callee4, null, [[2, 18]]);
14170
14410
  })));
14171
14411
  var GET_SYMPTOMS = createAsyncThunk("searhcApiSlice/getSymptoms", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
14172
14412
  var payload,
@@ -14552,26 +14792,82 @@ var SPECIALITY_AGAINST_PRACTITIONER = createAsyncThunk("searhcApiSlice/specialit
14552
14792
  }
14553
14793
  }, _callee10, null, [[2, 12]]);
14554
14794
  })));
14555
- var PRACTITIONER_AGAINST_ORGANIZATION = createAsyncThunk("searhcApiSlice/practitionerAgainstOrganization", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11() {
14795
+
14796
+ var getLocationInfo = /*#__PURE__*/function () {
14797
+ var _ref21 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11() {
14798
+ var _hospInfo$address3, _hospInfo$address3$, _hospInfo$address3$$c;
14799
+
14800
+ var hospInfo,
14801
+ obj,
14802
+ city,
14803
+ info,
14804
+ _args11 = arguments;
14805
+ return regeneratorRuntime.wrap(function _callee11$(_context11) {
14806
+ while (1) {
14807
+ switch (_context11.prev = _context11.next) {
14808
+ case 0:
14809
+ hospInfo = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
14810
+ obj = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {};
14811
+ 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;
14812
+
14813
+ if (obj[city]) {
14814
+ _context11.next = 8;
14815
+ break;
14816
+ }
14817
+
14818
+ _context11.next = 6;
14819
+ return getLatLong(city);
14820
+
14821
+ case 6:
14822
+ info = _context11.sent;
14823
+ obj[city] = info;
14824
+
14825
+ case 8:
14826
+ case "end":
14827
+ return _context11.stop();
14828
+ }
14829
+ }
14830
+ }, _callee11);
14831
+ }));
14832
+
14833
+ return function getLocationInfo() {
14834
+ return _ref21.apply(this, arguments);
14835
+ };
14836
+ }();
14837
+
14838
+ var PRACTITIONER_AGAINST_ORGANIZATION = createAsyncThunk("searhcApiSlice/practitionerAgainstOrganization", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12() {
14556
14839
  var payload,
14557
- _ref22,
14840
+ _ref23,
14558
14841
  rejectWithValue,
14559
14842
  _payload$practitioner,
14560
14843
  practitionerId,
14844
+ _yield$getCurrentPosi2,
14845
+ myLat,
14846
+ myLong,
14561
14847
  body,
14562
14848
  data,
14563
14849
  returnData,
14564
14850
  _data$result,
14565
- _args11 = arguments;
14851
+ _data$result2,
14852
+ cityMap,
14853
+ promArr,
14854
+ _args12 = arguments;
14566
14855
 
14567
- return regeneratorRuntime.wrap(function _callee11$(_context11) {
14856
+ return regeneratorRuntime.wrap(function _callee12$(_context12) {
14568
14857
  while (1) {
14569
- switch (_context11.prev = _context11.next) {
14858
+ switch (_context12.prev = _context12.next) {
14570
14859
  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;
14860
+ payload = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
14861
+ _ref23 = _args12.length > 1 ? _args12[1] : undefined, rejectWithValue = _ref23.rejectWithValue;
14862
+ _context12.prev = 2;
14574
14863
  _payload$practitioner = payload.practitionerId, practitionerId = _payload$practitioner === void 0 ? "" : _payload$practitioner;
14864
+ _context12.next = 6;
14865
+ return getCurrentPosition();
14866
+
14867
+ case 6:
14868
+ _yield$getCurrentPosi2 = _context12.sent;
14869
+ myLat = _yield$getCurrentPosi2.lat;
14870
+ myLong = _yield$getCurrentPosi2["long"];
14575
14871
  body = {
14576
14872
  db_name: dbName,
14577
14873
  entity: "Practitioner,Organization",
@@ -14579,45 +14875,72 @@ var PRACTITIONER_AGAINST_ORGANIZATION = createAsyncThunk("searhcApiSlice/practit
14579
14875
  Practitioner: "Practitioner.id==".concat(practitionerId),
14580
14876
  Organization: "document(Practitioner.practitioner_role)[*].OrgID any == Organization._id"
14581
14877
  },
14582
- return_fields: "{OrganizationName:Organization.name, OrgID:Organization.id}"
14878
+ return_fields: "{address: (let add = Document(Organization.address[0]) return merge(add, { city: Document(add.city) })), OrganizationName:Organization.name, OrgID:Organization.id}"
14583
14879
  };
14584
- _context11.next = 7;
14880
+ _context12.next = 12;
14585
14881
  return fetchData$3({
14586
14882
  body: JSON.stringify(body)
14587
14883
  }, __readDocumentUrl__);
14588
14884
 
14589
- case 7:
14590
- data = _context11.sent;
14885
+ case 12:
14886
+ data = _context12.sent;
14591
14887
  returnData = [];
14592
14888
 
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
- });
14889
+ if (!Array.isArray(data === null || data === void 0 ? void 0 : data.result)) {
14890
+ _context12.next = 20;
14891
+ break;
14602
14892
  }
14603
14893
 
14604
- return _context11.abrupt("return", _objectSpread2(_objectSpread2({}, defaultState.Info), {}, {
14894
+ cityMap = {};
14895
+ promArr = data === null || data === void 0 ? void 0 : (_data$result = data.result) === null || _data$result === void 0 ? void 0 : _data$result.map(function (hospInfo) {
14896
+ return getLocationInfo(hospInfo, cityMap);
14897
+ });
14898
+ _context12.next = 19;
14899
+ return es6Promise.Promise.all(promArr);
14900
+
14901
+ case 19:
14902
+ data === null || data === void 0 ? void 0 : (_data$result2 = data.result) === null || _data$result2 === void 0 ? void 0 : _data$result2.forEach(function (hospInfo) {
14903
+ var _hospInfo$address4, _hospInfo$address4$, _hospInfo$address4$$c;
14904
+
14905
+ 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;
14906
+
14907
+ var _ref24 = cityMap[city] || {},
14908
+ lat = _ref24.lat,
14909
+ _long2 = _ref24["long"];
14910
+
14911
+ var distance = "";
14912
+
14913
+ if (myLat && myLong && lat && _long2) {
14914
+ distance = getDisctanceFromLatLonInKm(lat, _long2, myLat, myLong) + " KM";
14915
+ }
14916
+
14917
+ returnData.push({
14918
+ value: hospInfo.OrgID,
14919
+ label: hospInfo.OrganizationName,
14920
+ lat: 0,
14921
+ "long": 0,
14922
+ distance: distance
14923
+ });
14924
+ });
14925
+
14926
+ case 20:
14927
+ return _context12.abrupt("return", _objectSpread2(_objectSpread2({}, defaultState.Info), {}, {
14605
14928
  data: returnData
14606
14929
  }));
14607
14930
 
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
14931
+ case 23:
14932
+ _context12.prev = 23;
14933
+ _context12.t0 = _context12["catch"](2);
14934
+ return _context12.abrupt("return", rejectWithValue(_objectSpread2(_objectSpread2({}, defaultReject), {}, {
14935
+ message: _context12.t0.message
14613
14936
  })));
14614
14937
 
14615
- case 16:
14938
+ case 26:
14616
14939
  case "end":
14617
- return _context11.stop();
14940
+ return _context12.stop();
14618
14941
  }
14619
14942
  }
14620
- }, _callee11, null, [[2, 13]]);
14943
+ }, _callee12, null, [[2, 23]]);
14621
14944
  })));
14622
14945
  var searhcApiSlice = createSlice({
14623
14946
  name: "searhcApiSlice",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primarycare-binder",
3
- "version": "1.1.14",
3
+ "version": "1.1.18",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",