primary_care_admin_binder 0.1.69 → 0.1.70

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 +49 -16
  2. package/package.json +1 -1
package/dist/index.cjs.js CHANGED
@@ -30092,10 +30092,10 @@ var queries$6 = {
30092
30092
  user_upsert: function user_upsert(data) {
30093
30093
  var filter = {};
30094
30094
 
30095
- if (data._key) {
30095
+ if (data.check_key) {
30096
30096
  filter = {
30097
30097
  filter: {
30098
- _key: data._key
30098
+ _key: data.prect_key
30099
30099
  }
30100
30100
  };
30101
30101
  }
@@ -30106,18 +30106,23 @@ var queries$6 = {
30106
30106
  "is_metadata": true,
30107
30107
  "metadataId": "04ecb73d-f048-44ce-8563-c9be015812dd"
30108
30108
  }, filter), {}, {
30109
- "doc": _objectSpread2({}, data)
30109
+ "doc": _objectSpread2({}, data.payload)
30110
30110
  })];
30111
30111
  },
30112
30112
  practitioner_by_id: function practitioner_by_id(data) {
30113
30113
  return {
30114
30114
  "db_name": dbName$1,
30115
- // "entity": "Practitioner",
30116
30115
  "entity": "Person",
30117
- // "filter": `Practitioner.PersonID==${data.id} && Practitioner.activestatus==true`,
30118
30116
  "filter": "Person._id =='".concat(data.id, "' && Person.activestatus == true "),
30119
- // "return_fields": "merge(Practitioner,{identifier:(for doc in IdentifierMaster filter doc._id in Practitioner.identifier return merge(doc,{period:(for cod in doc.period return document(cod))})),address:(for a in Practitioner.address return document(a)),communication:( FOR cod IN CodeableConceptMaster filter cod._id in Practitioner.communication RETURN MERGE(cod,{coding:(FOR d IN cod.coding RETURN DOCUMENT(d))})),marital_status:(FOR cod IN CodeableConceptMaster filter cod._id==Practitioner.marital_status RETURN MERGE(cod,{coding:(FOR d IN cod.coding RETURN DOCUMENT(d))})),name:(for a in Practitioner.name return MERGE(document(a),{period:DOCUMENT(document(a).period)})),nationality:(FOR cod IN SMGeographicMaster filter cod._id==Practitioner.nationality RETURN cod),photo:(for a in Practitioner.photo return document(a)),position:(for pt in CodeableConceptMaster filter pt._id==Practitioner.position return merge(pt,{coding:(FOR d IN pt.coding RETURN DOCUMENT(d))})),practitioner_type:(for pt in CodeableConceptMaster filter pt._id==Practitioner.practitioner_type return merge(pt,{coding:(FOR d IN pt.coding RETURN DOCUMENT(d))})),telecom:(for a in Practitioner.telecom return document(a)),job_experience:(for c in Practitioner.job_experience RETURN merge(c,{jobexperience_contact_details:(for con in c.jobexperience_contact_details return document(con)), jobexperience_address:(for add in c.jobexperience_address return document(add))})),training_details:(for c in Practitioner.training_details RETURN merge(c,{training_contact_details:(for con in c.training_contact_details return document(con)), training_address:(for add in c.training_address return document(add))})),practitioner_role:(for doc in PractitionerRole filter doc._id IN Practitioner.practitioner_role return MERGE(doc,{telecom:(for rol in ContactPointMaster filter rol._id in doc.telecom return rol),role:(for cod in CodeableConceptMaster filter cod._id==doc.role return merge(cod,{coding:(for code in CodingMaster filter code._id in cod.coding return code)})),period:(for per in periodMaster filter per._id in doc.period return per)})),gender:(FOR cod IN CodeableConceptMaster filter cod._id==Practitioner.gender RETURN MERGE(cod,{coding:(FOR d IN cod.coding RETURN DOCUMENT(d))})),employee_status:(for pt in CodeableConceptMaster filter pt._id==Practitioner.employee_status return merge(pt,{coding:(FOR d IN pt.coding RETURN DOCUMENT(d))}))})"
30120
- "return_fields": "merge(Person,{OrgID: document(Person.OrgID)},{address: document(Person.address)},{gender: document(Person.gender)},{orgType: document(Person.orgType)},{name: (for doc in document(Person.name) return merge(doc,{period: document(doc.period)},{ use: document(doc.use)},{prefix: document(doc.prefix)},{ suffix: document(doc.suffix)}))},{identifier: (for ide in document(Person.identifier)return merge(ide,{ period: document(ide.period)}))},{ telecom: (for doc in document(Person.telecom) return merge(doc, { system: document(doc.system)},{use: document(document(doc.use).coding)},{ period: document(Person.Person)},{ valueprefix: document(doc.valueprefix) }, {rank: document(document(doc.rank).coding)}))})"
30117
+ "return_fields": "merge(Person, {Practitioner: (for x in Practitioner filter x.PersonID == ".concat(data.PersonID, " return { PersonID: x.PersonID, userId: x.practitioner_id, practitioner_role: (for z in x.practitioner_role return document(document(document(z).role).coding)[0] ), SpecialtyID: document(x.practitioner_role)[0].SpecialtyID , role: (for z in x.practitioner_role return {coding: document(document(document(z).role).coding), \"_key\": document(document(z).role)._key,\"_id\": document(document(z).role)._id,\"_rev\": document(document(z).role)._rev,\"Type\": document(document(z).role).Type,\"activestatus\": document(document(z).role).activestatus,\"createdby\": \"\",\"createddate\": document(document(z).role).createddate,\"id\": document(document(z).role).id,\"status\": document(document(z).role).status,\"text\": document(document(z).role).text,\"updatedate\": document(document(z).role).updatedate, \"updatedby\": \"\"} ) })} ,{reporting_entity_type: document(Person.orgType)}, {reporting_entity_name: document(Person.OrgID[0])},{OrgID: document(Person.OrgID)},{address: document(Person.address)},{gender: document(Person.gender)},{orgType: document(Person.orgType)},{name: (for doc in document(Person.name) return merge(doc,{period: document(doc.period)},{ use: document(doc.use)},{prefix: document(doc.prefix)},{ suffix: document(doc.suffix)}))},{identifier: (for ide in document(Person.identifier)return merge(ide,{ period: document(ide.period)}))},{ telecom: (for doc in document(Person.telecom) return merge(doc, { system: document(doc.system)},{use: document(document(doc.use).coding)},{ period: document(Person.Person)},{ valueprefix: document(doc.valueprefix) }, {rank: document(document(doc.rank).coding)}))})")
30118
+ };
30119
+ },
30120
+ check_practioner: function check_practioner(data) {
30121
+ return {
30122
+ "db_name": dbName$1,
30123
+ "entity": "Practitioner",
30124
+ "filter": "Practitioner.PersonID == ".concat(data),
30125
+ "return_fields": "Practitioner "
30121
30126
  };
30122
30127
  }
30123
30128
  };
@@ -30127,6 +30132,8 @@ var USER_UPSERT = createAsyncThunk("userSlice/user_upsert", /*#__PURE__*/_asyncT
30127
30132
  var payload,
30128
30133
  _ref2,
30129
30134
  rejectWithValue,
30135
+ temp_data,
30136
+ qry,
30130
30137
  params,
30131
30138
  queriesjson,
30132
30139
  data,
@@ -30139,35 +30146,61 @@ var USER_UPSERT = createAsyncThunk("userSlice/user_upsert", /*#__PURE__*/_asyncT
30139
30146
  payload = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
30140
30147
  _ref2 = _args.length > 1 ? _args[1] : undefined, rejectWithValue = _ref2.rejectWithValue;
30141
30148
  _context.prev = 2;
30142
- params = _objectSpread2({
30143
- _key: payload._key
30144
- }, payload);
30149
+ console.clear();
30150
+ console.log(payload);
30151
+
30152
+ if (!payload.PersonID) {
30153
+ _context.next = 11;
30154
+ break;
30155
+ }
30156
+
30157
+ qry = queries$6.check_practioner(payload.PersonID);
30158
+ _context.next = 9;
30159
+ return fetchData({
30160
+ body: JSON.stringify(qry)
30161
+ }, __readDocumentUrl__);
30162
+
30163
+ case 9:
30164
+ temp_data = _context.sent;
30165
+ console.log(temp_data.result);
30166
+
30167
+ case 11:
30168
+ params = {
30169
+ payload: payload
30170
+ };
30171
+
30172
+ if (temp_data.result.length > 0) {
30173
+ params.check_key = payload._key;
30174
+ params.prect_key = temp_data.result[0]._key;
30175
+ }
30176
+
30145
30177
  queriesjson = queries$6.user_upsert(params);
30146
- _context.next = 7;
30178
+ _context.next = 16;
30147
30179
  return fetchData({
30148
30180
  body: JSON.stringify(queriesjson)
30149
30181
  }, __uspsertUrl__);
30150
30182
 
30151
- case 7:
30183
+ case 16:
30152
30184
  data = _context.sent;
30153
30185
  return _context.abrupt("return", _objectSpread2(_objectSpread2({}, defaultState.List), {}, {
30154
30186
  _key: data._key,
30155
30187
  data: data
30156
30188
  }));
30157
30189
 
30158
- case 11:
30159
- _context.prev = 11;
30190
+ case 20:
30191
+ _context.prev = 20;
30160
30192
  _context.t0 = _context["catch"](2);
30193
+ console.log(_context.t0);
30161
30194
  return _context.abrupt("return", rejectWithValue(_objectSpread2(_objectSpread2({}, defaultReject), {}, {
30162
30195
  message: _context.t0.message
30163
30196
  })));
30164
30197
 
30165
- case 14:
30198
+ case 24:
30166
30199
  case "end":
30167
30200
  return _context.stop();
30168
30201
  }
30169
30202
  }
30170
- }, _callee, null, [[2, 11]]);
30203
+ }, _callee, null, [[2, 20]]);
30171
30204
  })));
30172
30205
  var USER_DELETE = createAsyncThunk("userSlice/user_delete", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
30173
30206
  var payload,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primary_care_admin_binder",
3
- "version": "0.1.69",
3
+ "version": "0.1.70",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",