123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472 |
- "use strict";
- var common_vendor = require("../common/vendor.js");
- var api_patient = require("../api/patient.js");
- require("../common/request.js");
- const _sfc_main = {
- data() {
- return {
- relationShow: false,
- relations: [
- {
- name: "\u672C\u4EBA"
- },
- {
- name: "\u914D\u5076"
- },
- {
- name: "\u7236\u6BCD"
- },
- {
- name: "\u5B50\u5973"
- },
- {
- name: "\u670B\u53CB"
- },
- {
- name: "\u4EB2\u621A"
- },
- {
- name: "\u5176\u4ED6"
- }
- ],
- historyAllergics: [
- {
- name: "\u963F\u53F8\u5339\u6797",
- checked: 0
- },
- {
- name: "\u78FA\u80FA\u7C7B",
- checked: 0
- },
- {
- name: "\u5934\u5B62\u7C7B",
- checked: 0
- },
- {
- name: "\u9752\u6BD2\u7D20\u7C7B",
- checked: 0
- },
- {
- name: "\u5976\u5236\u54C1",
- checked: 0
- },
- {
- name: "\u5176\u4ED6",
- checked: 0
- }
- ],
- selfMedHistorys: [
- {
- name: "\u7CD6\u5C3F\u75C5",
- checked: 0
- },
- {
- name: "\u54EE\u5598",
- checked: 0
- },
- {
- name: "\u6076\u6027\u80BF\u7624",
- checked: 0
- },
- {
- name: "\u9AD8\u8840\u538B",
- checked: 0
- },
- {
- name: "\u5176\u4ED6",
- checked: 0
- }
- ],
- familyMedHistorys: [
- {
- name: "\u7CD6\u5C3F\u75C5",
- checked: 0
- },
- {
- name: "\u54EE\u5598",
- checked: 0
- },
- {
- name: "\u6076\u6027\u80BF\u7624",
- checked: 0
- },
- {
- name: "\u9AD8\u8840\u538B",
- checked: 0
- },
- {
- name: "\u5176\u4ED6",
- checked: 0
- }
- ],
- type: null,
- patientId: null,
- form: {
- sex: 1,
- birthday: "",
- idCard: "",
- relation: "",
- liverUnusual: "\u6B63\u5E38",
- renalUnusual: "\u6B63\u5E38",
- historyAllergic: "\u65E0",
- familyMedHistory: "\u65E0",
- selfMedHistory: "\u65E0"
- }
- };
- },
- onLoad(option) {
- this.type = option.type;
- if (this.type == "edit") {
- this.patientId = option.patientId;
- this.getPatientById();
- common_vendor.index.setNavigationBarTitle({
- title: "\u7F16\u8F91\u5C31\u8BCA\u4EBA"
- });
- } else {
- common_vendor.index.setNavigationBarTitle({
- title: "\u65B0\u589E\u5C31\u8BCA\u4EBA"
- });
- }
- },
- methods: {
- liverUnusualChange(item) {
- console.log(item);
- this.form.liverUnusual = item.detail.value;
- },
- renalUnusualChange(item) {
- console.log(item);
- this.form.renalUnusual = item.detail.value;
- },
- historyAllergicOptionChange(item) {
- item.checked = item.checked == 1 ? 0 : 1;
- },
- selfMedHistoryOptionChange(item) {
- item.checked = item.checked == 1 ? 0 : 1;
- },
- familyMedHistoryOptionChange(item) {
- item.checked = item.checked == 1 ? 0 : 1;
- },
- historyAllergicChange(item) {
- console.log(item);
- this.form.historyAllergic = item.detail.value;
- },
- selfMedHistoryChange(item) {
- console.log(item);
- this.form.selfMedHistory = item.detail.value;
- },
- familyMedHistoryChange(item) {
- console.log(item);
- this.form.familyMedHistory = item.detail.value;
- },
- relationSelect(e) {
- this.form.relation = e.name;
- },
- idcardChange() {
- if (this.form.idCard.length == 18) {
- var json = this.$parseIDCardInfo(this.form.idCard);
- this.form.birthday = json.birthday;
- console.log(json);
- }
- },
- genderChange(type) {
- this.form.sex = type;
- },
- getPatientById() {
- var data = { patientId: this.patientId };
- api_patient.getPatientById(data).then((res) => {
- if (res.code == 200) {
- this.form = res.data;
- this.date = this.form.birthday;
- if (this.form.historyAllergic != null && this.form.historyAllergic != "\u65E0") {
- var options = this.form.historyAllergic.split(",");
- this.historyAllergics.forEach((item) => {
- for (var i = 0; i < options.length; i++) {
- if (item.name == options[i]) {
- item.checked = 1;
- }
- }
- });
- this.form.historyAllergic = "\u6709";
- }
- if (this.form.selfMedHistory != null && this.form.selfMedHistory != "\u65E0") {
- var options = this.form.selfMedHistory.split(",");
- this.selfMedHistorys.forEach((item) => {
- for (var i = 0; i < options.length; i++) {
- if (item.name == options[i]) {
- item.checked = 1;
- }
- }
- });
- this.form.selfMedHistory = "\u6709";
- }
- if (this.form.familyMedHistory != null && this.form.familyMedHistory != "\u65E0") {
- var options = this.form.familyMedHistory.split(",");
- this.familyMedHistorys.forEach((item) => {
- for (var i = 0; i < options.length; i++) {
- if (item.name == options[i]) {
- item.checked = 1;
- }
- }
- });
- this.form.familyMedHistory = "\u6709";
- }
- } else {
- common_vendor.index.showToast({
- title: res.msg
- });
- }
- }, (rej) => {
- });
- },
- submit() {
- if (this.type == "add") {
- this.addPatient();
- } else if (this.type == "edit") {
- this.editPatient();
- }
- },
- editPatient() {
- var data = {
- patientId: this.patientId,
- patientName: this.form.patientName,
- mobile: this.form.mobile,
- sex: this.form.sex,
- birthday: this.form.birthday,
- idCard: this.form.idCard,
- relation: this.form.relation,
- liverUnusual: this.form.liverUnusual,
- renalUnusual: this.form.renalUnusual
- };
- if (this.form.historyAllergic == "\u6709") {
- var options = [];
- this.historyAllergics.forEach((item) => {
- if (item.checked == 1) {
- options.push(item.name);
- }
- });
- data.historyAllergic = options.toString();
- } else {
- data.historyAllergic = this.form.historyAllergic;
- }
- if (this.form.selfMedHistory == "\u6709") {
- var options = [];
- this.selfMedHistorys.forEach((item) => {
- if (item.checked == 1) {
- options.push(item.name);
- }
- });
- data.selfMedHistory = options.toString();
- } else {
- data.selfMedHistory = this.form.selfMedHistory;
- }
- if (this.form.familyMedHistory == "\u6709") {
- var options = [];
- this.familyMedHistorys.forEach((item) => {
- if (item.checked == 1) {
- options.push(item.name);
- }
- });
- data.familyMedHistory = options.toString();
- } else {
- data.familyMedHistory = this.form.familyMedHistory;
- }
- api_patient.editPatient(data).then((res) => {
- if (res.code == 200) {
- common_vendor.index.showToast({
- icon: "success",
- title: "\u64CD\u4F5C\u6210\u529F"
- });
- setTimeout(function() {
- common_vendor.index.$emit("refreshPatient");
- common_vendor.index.navigateBack({
- delta: 1
- });
- }, 500);
- } else {
- common_vendor.index.showToast({
- icon: "none",
- title: res.msg
- });
- }
- }, (rej) => {
- });
- },
- addPatient() {
- var data = {
- patientName: this.form.patientName,
- mobile: this.form.mobile,
- sex: this.form.sex,
- birthday: this.form.birthday,
- idCard: this.form.idCard,
- relation: this.form.relation,
- liverUnusual: this.form.liverUnusual,
- renalUnusual: this.form.renalUnusual
- };
- if (this.form.historyAllergic == "\u6709") {
- var options = [];
- this.historyAllergics.forEach((item) => {
- if (item.checked == 1) {
- options.push(item.name);
- }
- });
- data.historyAllergic = options.toString();
- } else {
- data.historyAllergic = this.form.historyAllergic;
- }
- if (this.form.selfMedHistory == "\u6709") {
- var options = [];
- this.selfMedHistorys.forEach((item) => {
- if (item.checked == 1) {
- options.push(item.name);
- }
- });
- data.selfMedHistory = options.toString();
- } else {
- data.selfMedHistory = this.form.selfMedHistory;
- }
- if (this.form.familyMedHistory == "\u6709") {
- var options = [];
- this.familyMedHistorys.forEach((item) => {
- if (item.checked == 1) {
- options.push(item.name);
- }
- });
- data.familyMedHistory = options.toString();
- } else {
- data.familyMedHistory = this.form.familyMedHistory;
- }
- api_patient.addPatient(data).then((res) => {
- if (res.code == 200) {
- common_vendor.index.showToast({
- icon: "success",
- title: "\u64CD\u4F5C\u6210\u529F"
- });
- setTimeout(function() {
- common_vendor.index.$emit("refreshPatient");
- common_vendor.index.navigateBack({
- delta: 1
- });
- }, 500);
- } else {
- common_vendor.index.showToast({
- icon: "none",
- title: res.msg
- });
- }
- }, (rej) => {
- });
- },
- birthdayChange: function(e) {
- this.form.birthday = e.target.value;
- }
- }
- };
- if (!Array) {
- const _easycom_u_alert2 = common_vendor.resolveComponent("u-alert");
- const _easycom_u_tag2 = common_vendor.resolveComponent("u-tag");
- const _easycom_u_action_sheet2 = common_vendor.resolveComponent("u-action-sheet");
- (_easycom_u_alert2 + _easycom_u_tag2 + _easycom_u_action_sheet2)();
- }
- const _easycom_u_alert = () => "../uni_modules/uview-plus/components/u-alert/u-alert.js";
- const _easycom_u_tag = () => "../uni_modules/uview-plus/components/u-tag/u-tag.js";
- const _easycom_u_action_sheet = () => "../uni_modules/uview-plus/components/u-action-sheet/u-action-sheet.js";
- if (!Math) {
- (_easycom_u_alert + _easycom_u_tag + _easycom_u_action_sheet)();
- }
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return common_vendor.e({
- a: common_vendor.p({
- title: "\u56FD\u5BB6\u536B\u5065\u59D4\u8981\u6C42\uFF0C\u5C31\u533B\u884C\u4E3A\u5FC5\u987B\u5B9E\u540D\u767B\u8BB0",
- type: "info"
- }),
- b: $data.form.patientName,
- c: common_vendor.o(($event) => $data.form.patientName = $event.detail.value),
- d: common_vendor.o(($event) => $options.genderChange(1)),
- e: $data.form.sex === 1,
- f: common_vendor.o(($event) => $options.genderChange(2)),
- g: $data.form.sex === 2,
- h: $data.form.mobile,
- i: common_vendor.o(($event) => $data.form.mobile = $event.detail.value),
- j: common_vendor.o(($event) => $options.idcardChange()),
- k: $data.form.idCard,
- l: common_vendor.o(($event) => $data.form.idCard = $event.detail.value),
- m: $data.form.birthday,
- n: $data.form.birthday,
- o: common_vendor.o((...args) => $options.birthdayChange && $options.birthdayChange(...args)),
- p: $data.form.relation,
- q: common_vendor.o(($event) => $data.relationShow = true),
- r: $data.form.liverUnusual === "\u6B63\u5E38",
- s: $data.form.liverUnusual === "\u5F02\u5E38",
- t: common_vendor.o((...args) => $options.liverUnusualChange && $options.liverUnusualChange(...args)),
- v: $data.form.renalUnusual === "\u6B63\u5E38",
- w: $data.form.renalUnusual === "\u5F02\u5E38",
- x: common_vendor.o((...args) => $options.renalUnusualChange && $options.renalUnusualChange(...args)),
- y: $data.form.historyAllergic === "\u65E0",
- z: $data.form.historyAllergic === "\u6709",
- A: common_vendor.o((...args) => $options.historyAllergicChange && $options.historyAllergicChange(...args)),
- B: $data.form.historyAllergic == "\u6709"
- }, $data.form.historyAllergic == "\u6709" ? {
- C: common_vendor.f($data.historyAllergics, (item, index, i0) => {
- return {
- a: common_vendor.o(($event) => $options.historyAllergicOptionChange(item)),
- b: "0a9339af-1-" + i0,
- c: common_vendor.p({
- borderColor: item.checked == 1 ? "#ffffff" : "#C39A58",
- bgColor: item.checked == 1 ? "#C39A58" : "#ffffff",
- color: item.checked == 1 ? "#ffffff" : "#C39A58",
- shape: "circle",
- text: item.name
- })
- };
- })
- } : {}, {
- D: $data.form.selfMedHistory === "\u65E0",
- E: $data.form.selfMedHistory === "\u6709",
- F: common_vendor.o((...args) => $options.selfMedHistoryChange && $options.selfMedHistoryChange(...args)),
- G: $data.form.selfMedHistory == "\u6709"
- }, $data.form.selfMedHistory == "\u6709" ? {
- H: common_vendor.f($data.selfMedHistorys, (item, index, i0) => {
- return {
- a: common_vendor.o(($event) => $options.selfMedHistoryOptionChange(item)),
- b: "0a9339af-2-" + i0,
- c: common_vendor.p({
- borderColor: item.checked == 1 ? "#ffffff" : "#C39A58",
- bgColor: item.checked == 1 ? "#C39A58" : "#ffffff",
- color: item.checked == 1 ? "#ffffff" : "#C39A58",
- shape: "circle",
- text: item.name
- })
- };
- })
- } : {}, {
- I: $data.form.familyMedHistory === "\u65E0",
- J: $data.form.familyMedHistory === "\u6709",
- K: common_vendor.o((...args) => $options.familyMedHistoryChange && $options.familyMedHistoryChange(...args)),
- L: $data.form.familyMedHistory == "\u6709"
- }, $data.form.familyMedHistory == "\u6709" ? {
- M: common_vendor.f($data.familyMedHistorys, (item, index, i0) => {
- return {
- a: common_vendor.o(($event) => $options.familyMedHistoryOptionChange(item)),
- b: "0a9339af-3-" + i0,
- c: common_vendor.p({
- borderColor: item.checked == 1 ? "#ffffff" : "#C39A58",
- bgColor: item.checked == 1 ? "#C39A58" : "#ffffff",
- color: item.checked == 1 ? "#ffffff" : "#C39A58",
- shape: "circle",
- text: item.name
- })
- };
- })
- } : {}, {
- N: common_vendor.o(($event) => $options.submit()),
- O: common_vendor.o(($event) => $data.relationShow = false),
- P: common_vendor.o($options.relationSelect),
- Q: common_vendor.p({
- show: $data.relationShow,
- actions: $data.relations,
- title: "\u8BF7\u9009\u62E9"
- })
- });
- }
- var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages_user/addEditPatient.vue"]]);
- wx.createPage(MiniProgramPage);
|