primarycare-binder 1.1.86 → 1.1.89

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 +127 -6
  2. package/package.json +1 -1
package/dist/index.cjs.js CHANGED
@@ -8063,11 +8063,17 @@ var queries$b = {
8063
8063
  };
8064
8064
  },
8065
8065
  visit_read: function visit_read(encounter_id) {
8066
+ // return {
8067
+ // db_name: `${dbName}`,
8068
+ // entity: "Encounter",
8069
+ // filter: `Encounter.activestatus==true && Encounter._id=='${encounter_id}'`,
8070
+ // return_fields: "MERGE(Encounter,{reasonReference: Document(Encounter.reasonReference),practitioner_details:(FOR practdet IN TO_ARRAY(Encounter.practitioner_details) RETURN MERGE(practdet,{speciality:MERGE(DOCUMENT(practdet.speciality),{coding:(FOR cod IN TO_ARRAY(DOCUMENT(practdet.speciality).coding) RETURN DOCUMENT(cod))})}))})",
8071
+ // };
8066
8072
  return {
8067
8073
  db_name: "".concat(dbName),
8068
8074
  entity: "Encounter",
8069
8075
  filter: "Encounter.activestatus==true && Encounter._id=='".concat(encounter_id, "'"),
8070
- return_fields: "MERGE(Encounter,{reasonReference: Document(Encounter.reasonReference),practitioner_details:(FOR practdet IN TO_ARRAY(Encounter.practitioner_details) RETURN MERGE(practdet,{speciality:MERGE(DOCUMENT(practdet.speciality),{coding:(FOR cod IN TO_ARRAY(DOCUMENT(practdet.speciality).coding) RETURN DOCUMENT(cod))})}))})"
8076
+ return_fields: "MERGE(Encounter,{reasonReference: Document(Encounter.reasonReference),practitioner_details:(FOR practdet IN TO_ARRAY(Encounter.practitioner_details) RETURN MERGE(practdet,{speciality:DOCUMENT(practdet.speciality)}))},{identifier: ( FOR IdentifierMaster IN IdentifierMaster FILTER IdentifierMaster._id in Encounter.identifier return merge(IdentifierMaster,{period:document(IdentifierMaster.period)}))},{statushistory:(for sat in TO_ARRAY(Encounter.statushistory) return merge(sat,{period:document(sat.period)}))})"
8071
8077
  };
8072
8078
  },
8073
8079
  get_apo_read: function get_apo_read(appointmentId) {
@@ -8169,7 +8175,7 @@ var queries$b = {
8169
8175
  },
8170
8176
  codablemasterGetPatientname: {
8171
8177
  query: function query(patientName) {
8172
- return "UPPER(DOCUMENT(Person.name)[*].text) LIKE '%".concat(patientName, "%'");
8178
+ return "(LIKE(DOCUMENT(Person.name)[0].text,'%".concat(patientName, "%',true) || LIKE(DOCUMENT(Person.name)[0].given,'%").concat(patientName, "%',true) || LIKE(DOCUMENT(Person.name)[0].family,'%").concat(patientName, "%',true)) && Person.activestatus == true");
8173
8179
  },
8174
8180
  returnFields: "{prefix: DOCUMENT(Person.name)[*].prefix,gender: Person.gender,birthDate: Person.birthDay,suffix: DOCUMENT(Person.name)[*].suffix, nameObj: DOCUMENT(Person.name)[*], name: DOCUMENT(Person.name)[*].text, personId: Person.Id,patientDetail: (for pat in Patient FILTER pat.personID == Person.Id RETURN merge(pat,{name:(for nam in HumanNameMaster filter nam._id in pat.name return merge(nam,{use:document(nam.use),prefix:document(nam.prefix),suffix:document(nam.suffix)}))},{photo:document(pat.photo)})),telecom: Document(Person.telecom),photo:document(Person.photo)}"
8175
8181
  },
@@ -8482,6 +8488,87 @@ var utcTOLocal$1 = function utcTOLocal(date, format) {
8482
8488
 
8483
8489
  var fmt = format ? format : "DD-MM-YYYY";
8484
8490
  return moment$1.utc(Ndate).local().format(fmt);
8491
+ };
8492
+
8493
+ var utcTOLocal_ = function utcTOLocal_(date, format) {
8494
+ var Ndate = new Date();
8495
+
8496
+ if (typeof date === "number") {
8497
+ Ndate = moment$1.unix(date);
8498
+ } else {
8499
+ Ndate = moment$1(date);
8500
+ }
8501
+
8502
+ var fmt = format ? format : "DD-MM-YYYY";
8503
+
8504
+ if (format) {
8505
+ return moment$1.utc(Ndate).local().format(fmt);
8506
+ } else {
8507
+ return moment$1.utc(Ndate).local();
8508
+ }
8509
+ };
8510
+ var getNumberOfDays = function getNumberOfDays(start, end) {
8511
+ var date1 = new Date(start);
8512
+ var date2 = new Date(end); // One day in milliseconds
8513
+
8514
+ var oneDay = 1000 * 60 * 60 * 24; // Calculating the time difference between two dates
8515
+
8516
+ var diffInTime = date2.getTime() - date1.getTime(); // Calculating the no. of days between two dates
8517
+
8518
+ var diffInDays = Math.round(diffInTime / oneDay);
8519
+ return diffInDays;
8520
+ };
8521
+ var weekCalculation = function weekCalculation(date_) {
8522
+ var d = new Date(date_);
8523
+ var date = d.getDate();
8524
+ var day = d.getDay();
8525
+ var weekOfMonth = Math.ceil((date - 1 - day) / 7);
8526
+ return weekOfMonth;
8527
+ };
8528
+ var timeLine_ = function timeLine_(appointmentDate) {
8529
+ //DAY CALCULATION
8530
+ var appDate = utcTOLocal_(appointmentDate, "MM/DD/YYY");
8531
+ var currentDate = utcTOLocal_(new Date(), "MM/DD/YYY"); //DAYS DIFFERENCE CALCULATION
8532
+
8533
+ var diffDays = getNumberOfDays(currentDate, appDate); //MONTH CALCULATION
8534
+
8535
+ var appointmentMonth = utcTOLocal_(appointmentDate, "MM");
8536
+ var currentMonth = utcTOLocal_(new Date(), "MM"); //WEEK CALCULATION
8537
+
8538
+ var appointmentWeek = weekCalculation(utcTOLocal_(appointmentDate));
8539
+ var currentWeek = weekCalculation(new Date());
8540
+ var type = ""; //TODAY
8541
+
8542
+ if (diffDays === 0) {
8543
+ type = "TODAY";
8544
+ } //THIS MONTH
8545
+ else if (currentMonth === appointmentMonth) {
8546
+ //debugger
8547
+ //THIS WEEK
8548
+ if (appointmentWeek === currentWeek) {
8549
+ type = "THIS_WEEK";
8550
+ } //LAST WEEK
8551
+ else if (appointmentWeek + 1 === currentWeek) {
8552
+ type = "LAST_WEEK";
8553
+ } //NEXT WEEK
8554
+ else if (appointmentWeek - 1 === currentWeek) {
8555
+ type = "NEXT_WEEK";
8556
+ } //THIS MONTH
8557
+ else {
8558
+ type = "THIS_MONTH";
8559
+ }
8560
+ } //LAST MONTH
8561
+ else if (appointmentMonth < currentMonth) {
8562
+ type = "LAST_MONTH";
8563
+ } //NEXT MONTH
8564
+ else if (appointmentMonth > currentMonth) {
8565
+ type = "NEXT_MONTH";
8566
+ } else {
8567
+ type = "TODAY";
8568
+ } // debugger
8569
+
8570
+
8571
+ return type;
8485
8572
  }; // const getUtcTime = (date) => {
8486
8573
  // let a = null
8487
8574
  // if (date) {
@@ -8502,7 +8589,6 @@ var utcTOLocal$1 = function utcTOLocal(date, format) {
8502
8589
  // }
8503
8590
  // };
8504
8591
 
8505
-
8506
8592
  var deg2rad = function deg2rad(deg) {
8507
8593
  return deg * (Math.PI / 180);
8508
8594
  };
@@ -11609,7 +11695,16 @@ var ALL_APPOINTMENTS = createAsyncThunk("appointmentReducer/allAppointments", /*
11609
11695
  data = _context6.sent;
11610
11696
  returnData = {
11611
11697
  pastAppointment: [],
11698
+ pastAppointmentThisWeek: [],
11699
+ pastAppointmentLastWeek: [],
11700
+ pastAppointmentThisMonth: [],
11701
+ pastAppointmentLastMonth: [],
11612
11702
  upcomingAppointment: [],
11703
+ upcomingAppointmentToday: [],
11704
+ upcomingAppointmentThisWeek: [],
11705
+ upcomingAppointmentNextWeek: [],
11706
+ upcomingAppointmentThisMonth: [],
11707
+ upcomingAppointmentNextMonth: [],
11613
11708
  followUpAppointment: [],
11614
11709
  currentVisist: []
11615
11710
  };
@@ -11617,14 +11712,40 @@ var ALL_APPOINTMENTS = createAsyncThunk("appointmentReducer/allAppointments", /*
11617
11712
  if (assemble && moment$1(utcTOLocal$1(v === null || v === void 0 ? void 0 : v.start) * 1000).startOf("day").diff(moment$1().startOf("day"), "days") === 0 && (v.comment === "completed_assemble" || v.comment === "onhold_nurse" || v.comment === "completed_nurse" || v.comment === "onhold_doctor")) {
11618
11713
  returnData.currentVisist.push(v);
11619
11714
  } else {
11620
- returnData.pastAppointment.push(v);
11715
+ var type_ = timeLine_(v.start); //debugger
11716
+
11717
+ if (type_ === "THIS_WEEK") {
11718
+ returnData.pastAppointmentThisWeek.push(v);
11719
+ } else if (type_ === "LAST_WEEK") {
11720
+ returnData.pastAppointmentLastWeek.push(v);
11721
+ } else if (type_ === "THIS_MONTH") {
11722
+ returnData.pastAppointmentThisMonth.push(v);
11723
+ } else if (type_ === "LAST_MONTH") {
11724
+ returnData.pastAppointmentLastMonth.push(v);
11725
+ } else {
11726
+ returnData.pastAppointment.push(v);
11727
+ }
11621
11728
  }
11622
11729
  });
11623
11730
  (_data$3 = data[0]) === null || _data$3 === void 0 ? void 0 : (_data$3$upcoming_appo = _data$3.upcoming_appointment) === null || _data$3$upcoming_appo === void 0 ? void 0 : (_data$3$upcoming_appo2 = _data$3$upcoming_appo.forEach) === null || _data$3$upcoming_appo2 === void 0 ? void 0 : _data$3$upcoming_appo2.call(_data$3$upcoming_appo, function (v) {
11624
11731
  if (assemble && moment$1(utcTOLocal$1(v === null || v === void 0 ? void 0 : v.start), "DD-MM-YYYY").startOf("day").diff(moment$1().startOf("day"), "days") === 0 && (v.comment === "completed_assemble" || v.comment === "onhold_nurse" || v.comment === "completed_nurse" || v.comment === "onhold_doctor")) {
11625
11732
  returnData.currentVisist.push(v);
11626
11733
  } else {
11627
- returnData.upcomingAppointment.push(v);
11734
+ var type_ = timeLine_(v.start); //debugger
11735
+
11736
+ if (type_ === "TODAY") {
11737
+ returnData.upcomingAppointmentToday.push(v);
11738
+ } else if (type_ === "THIS_WEEK") {
11739
+ returnData.upcomingAppointmentThisWeek.push(v);
11740
+ } else if (type_ === "NEXT_WEEK") {
11741
+ returnData.upcomingAppointmentNextWeek.push(v);
11742
+ } else if (type_ === "THIS_MONTH") {
11743
+ returnData.upcomingAppointmentThisMonth.push(v);
11744
+ } else if (type_ === "NEXT_MONTH") {
11745
+ returnData.upcomingAppointmentNextMonth.push(v);
11746
+ } else {
11747
+ returnData.upcomingAppointment.push(v);
11748
+ }
11628
11749
  }
11629
11750
  });
11630
11751
  return _context6.abrupt("return", _objectSpread2(_objectSpread2({}, defaultState.List), {}, {
@@ -18745,7 +18866,7 @@ var GET_ENCOUNTER_HEADER = createAsyncThunk("OrganizationRegisterPatientApiSlice
18745
18866
  db_name: dbName,
18746
18867
  entity: "Encounter",
18747
18868
  filter: "Encounter.patient_id == ".concat(patientId, " && Encounter.id==").concat(encounterId, " && Encounter.activestatus == true"),
18748
- return_fields: "merge({id:Encounter.id},{_id:Encounter._id},{_key:Encounter._key},{encounterdate:Encounter.encounterdate},{encounter_no:Encounter.encounter_no},{type:document(Encounter.type)[*].display},{visit_type:Encounter.visit_type},{location:(for doc in Encounter.location for loc in LocationMaster filter loc._id == doc.location_id return document(document(loc.locationType).coding))},{Practitioner_id:(for part in Encounter.participant for practId in Practitioner filter practId.id == part.Practitioner_id return {name:(for doc in HumanNameMaster filter doc._id in practId.name return merge(doc,{use:(document(document(doc.use).coding)),prefix:(document(document(doc.prefix).coding)),suffix:(document(document(doc.suffix).coding))}))} )},{PractitionerRole_id:(for part in Encounter.participant for practRole in PractitionerRole filter practRole.id == part.PractitionerRole_id return document(document(practRole.role).coding) )})",
18869
+ return_fields: "merge({id:adqolcEncounter.id},{_id:adqolcEncounter._id},{_key:adqolcEncounter._key},{encounterdate:adqolcEncounter.encounterdate},{encounter_no:adqolcEncounter.encounter_no},{type:document(adqolcEncounter.type)[*].display},{visit_type:adqolcEncounter.visit_type},{location:(for doc in adqolcEncounter.location for loc in LocationMaster filter loc._id == doc.location_id return document(document(loc.locationType).coding))},{Practitioner_id:(for part in adqolcEncounter.participant for practId in Practitioner filter practId.id == part.Practitioner_id return {name:(for doc in HumanNameMaster filter doc._id in practId.name return merge(doc,{use:(document(document(doc.use).coding)),prefix:(document(document(doc.prefix).coding)),suffix:(document(document(doc.suffix).coding))})),communication:document(practId.communication)[*]} )},{PractitionerRole_id:(for part in adqolcEncounter.participant for practRole in PractitionerRole filter practRole.id == part.PractitionerRole_id return document(document(practRole.role).coding) )})",
18749
18870
  sort: "Encounter.encounterdate desc"
18750
18871
  };
18751
18872
  _context13.next = 7;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primarycare-binder",
3
- "version": "1.1.86",
3
+ "version": "1.1.89",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",