瀏覽代碼

fix: 我的-添加就诊卡修改成添加就诊人

carver 2 年之前
父節點
當前提交
a590a742e4

+ 1 - 1
antbuilder/industry/hospitalV2/components/edit-patient/index.axml

@@ -54,7 +54,7 @@
           onInput="onPhoneInput"
           placeholder-class="placeholder"
           value="{{ editForm.phoneNumber }}"
-          placeholder="请输入在医院预留的手机号"
+          placeholder="请输入在医院预留的手机号"
           disabled="{{ isAuthSuccess && !editForm.id }}"
         />
       </view>

+ 412 - 412
antbuilder/industry/hospitalV2/components/edit-patient/index.js

@@ -1,12 +1,12 @@
 import { connect } from "herculex";
 import { checkPhone, checkIdCard } from "./check";
 import {
-  editCard,
-  createCard,
-  createPatient,
-  patientUpdate,
-  getPatientList,
-  getLoginUserCardList,
+	editCard,
+	createCard,
+	createPatient,
+	patientUpdate,
+	getPatientList,
+	getLoginUserCardList,
 } from "./service";
 import doLogin from "../../utils/doLogin";
 import history from "../../utils/history";
@@ -14,418 +14,418 @@ import loadOcr from "../../utils/loadOcr";
 import getEncryptStr from "../../utils/getEncryptStr";
 import { reportCmPV_YL } from "../../utils/cloudMonitorHelper";
 const caIcon =
-  "https://gw.alipayobjects.com/mdn/rms_373ab8/afts/img/A*w6MrS5tmnFAAAAAAAAAAAAAAARQnAQ";
+	"https://gw.alipayobjects.com/mdn/rms_373ab8/afts/img/A*w6MrS5tmnFAAAAAAAAAAAAAAARQnAQ";
 const bookIcon =
-  "https://gw.alipayobjects.com/mdn/rms_373ab8/afts/img/A*nta9QpHSTvkAAAAAAAAAAAAAARQnAQ";
+	"https://gw.alipayobjects.com/mdn/rms_373ab8/afts/img/A*nta9QpHSTvkAAAAAAAAAAAAAARQnAQ";
 
 const getDefaultForm = () => ({
-  id: "",
-  name: "",
-  sex: "男",
-  idCardNo: "",
-  relationShip: "",
-  phoneNumber: "",
-  idCardType: "身份证",
-
-  /* 新增卡字段 */
-  type: "",
-  cardNum: "",
-  defaultCard: "",
-  phoneRsa: "",
-  fullNameRsa: "",
-  idcardNoRsa: "",
+	id: "",
+	name: "",
+	sex: "男",
+	idCardNo: "",
+	relationShip: "",
+	phoneNumber: "",
+	idCardType: "身份证",
+
+	/* 新增卡字段 */
+	type: "",
+	cardNum: "",
+	defaultCard: "",
+	phoneRsa: "",
+	fullNameRsa: "",
+	idcardNoRsa: "",
 });
 
 const copy = (data) => JSON.parse(JSON.stringify(data));
 
 Component(
-  connect({
-    mapStateToProps: {
-      userInfo: ({ $global }) => $global.userInfo || {},
-    },
-  })({
-    props: {
-      componentData: {},
-    },
-    data: {
-      caIcon,
-      bookIcon,
-      show: false,
-      routeState: null,
-      medicCardsList: [],
-      isAuthSuccess: false,
-      editForm: getDefaultForm(),
-      genders: [
-        {
-          label: "男",
-          value: "男",
-        },
-        {
-          label: "女",
-          value: "女",
-        },
-      ],
-      certTypes: [
-        {
-          id: 1,
-          name: "身份证",
-        },
-      ],
-    },
-
-    didMount() {
-      const { componentData } = this.props;
-      const { editForm, routeState } = componentData || {};
-      const state = {};
-
-      if (routeState) {
-        state.routeState = routeState;
-      }
-      /* 编辑 */
-
-      if (editForm) {
-        state.editForm = this.initData(editForm);
-      }
-
-      this.setData(state);
-      /* 埋点服务预警 */
-
-      reportCmPV_YL({
-        title: "在线建档",
-      });
-    },
-
-    methods: {
-      isEditCard() {
-        const { $routeConfig } = this.$page;
-        const { query } = $routeConfig;
-        return query.editType === "card";
-      },
-
-      initData(data) {
-        const _data = {};
-        const defaultData = getDefaultForm();
-        Object.keys(defaultData).forEach((key) => {
-          const value = data[key] || defaultData[key];
-          if (value) _data[key] = value;
-        });
-        return _data;
-      },
-
-      onClosePopup() {
-        this.setData({
-          show: false,
-        });
-      },
-
-      onTap() {
-        this.onClosePopup();
-      },
-
-      async onRelationChange({ id, name }) {
-        let isAuthSuccess = false;
-        const { editForm: _editForm } = this.data;
-        let editForm = copy(_editForm);
-        /* 如果是从本人切换到其他关系上的需要清空数据 */
-
-        if (_editForm.relationShip === "本人" && id !== 1) {
-          editForm = getDefaultForm();
-        }
-
-        editForm.relationShip = name;
-        /* 如果为本人,唤起授权 */
-
-        if (id === 1) {
-          const { userInfo } = this.data; // 判断用户是否已经登陆
-
-          if (userInfo.isLogin) {
-            isAuthSuccess = true;
-          } else {
-            isAuthSuccess = await doLogin.call(this, {
-              scopes: "auth_user",
-            });
-          }
-
-          if (isAuthSuccess) {
-            const {
-              phone,
-              gender = "m",
-              idCardNo,
-              fullName,
-              phoneRsa,
-              fullNameRsa,
-              idcardNoRsa,
-            } = this.data.userInfo;
-            editForm.name = fullName;
-            editForm.idCardNo = idCardNo;
-            editForm.phoneNumber = phone;
-            editForm.phoneRsa = phoneRsa;
-            editForm.fullNameRsa = fullNameRsa;
-            editForm.idcardNoRsa = idcardNoRsa;
-            editForm.sex = gender === "m" ? "男" : "女";
-          }
-        }
-
-        this.setData({
-          isAuthSuccess,
-          editForm: { ...editForm },
-        });
-      },
-
-      /* 一键清除 */
-      clearInput(value, key) {
-        // eslint-disable-next-line no-param-reassign
-        value = value || "";
-        const { editForm } = this.data;
-        const oldValue = editForm[key] || "";
-        return oldValue.indexOf("*") < 0 ? value : "";
-      },
-
-      /* 输入姓名 */
-      onNameInput({ detail }) {
-        this.setData({
-          "editForm.name": this.clearInput(detail.value, "name"),
-        });
-      },
-
-      /* 选择性别 */
-      onSexChange(item) {
-        this.setData({
-          "editForm.sex": item,
-        });
-      },
-
-      /* 选择证件类别 */
-      onCertTypeChange({ detail }) {
-        const { value } = detail;
-        const { certTypes = [] } = this.data;
-        const { name = "" } = certTypes[value];
-        this.setData({
-          "editForm.certTypes": name,
-        });
-      },
-
-      /* 输入身份证 */
-      onCardNoInput({ detail }) {
-        this.setData({
-          "editForm.idCardNo": this.clearInput(detail.value, "idCardNo"),
-        });
-      },
-
-      /* 输入电话号码 */
-      onPhoneInput({ detail }) {
-        this.setData({
-          "editForm.phoneNumber": this.clearInput(detail.value, "phoneNumber"),
-        });
-      },
-
-      async onCardChange({ cardNum }) {
-        this.resolveFn && this.resolveFn(cardNum);
-      },
-
-      showTip(msg) {
-        my.showToast({
-          content: msg,
-          duration: 3000,
-        });
-        return false;
-      },
-
-      showSuccess(msg) {
-        my.showToast({
-          type: "success",
-          content: msg,
-          duration: 1500,
-        });
-      },
-
-      showError(msg) {
-        my.showToast({
-          type: "fail",
-          content: msg,
-          duration: 1500,
-        });
-      },
-
-      vailForm(form) {
-        const { idCardNo = "", phoneNumber = "" } = form;
-        const { sex, name, idCardType, relationShip } = form;
-        const rest = {
-          sex,
-          name,
-          idCardType,
-          relationShip,
-        };
-        const values = Object.values(rest);
-
-        if (values.filter((v) => !!v).length !== values.length) {
-          return this.showTip("将页面上的信息填写完整!");
-        }
-
-        if (!checkIdCard(idCardNo)) {
-          return this.showTip("身份证格式不正确!");
-        }
-
-        if (!checkPhone(phoneNumber)) {
-          return this.showTip("手机号格式不正确!");
-        }
-
-        return true;
-      },
-
-      /*
-       * 获取非脱敏的字段
-       * */
-      restForm(form) {
-        const _form = {};
-        Object.keys(form).forEach((key) => {
-          const value = form[key] || "";
-          if (value.indexOf("*") < 0) _form[key] = value;
-        });
-        return _form;
-      },
-
-      //  保存就诊人
-      async patientSave() {
-        const { editForm, isAuthSuccess } = this.data;
-        /* 如果不是本人,校验字段 */
-
-        if (!isAuthSuccess) {
-          if (!this.vailForm(editForm)) return;
-        }
-        /* 获取非脱敏的字段 */
-
-        const form = this.restForm(editForm);
-        /* 不是编辑的情况,才需要选择就诊卡 */
-        if (!editForm.id && !this.isEditCard()) {
-          form.bindCardNum = await this.onCheckCard(form);
-        }
-        await this.onSubmit(this.initData(form));
-      },
-
-      /* 提交 */
-      async onSubmit(_form) {
-        const { routeState } = this.data;
-        /* 加密数据 */
-
-        const form = {
-          ..._form,
-          idCardNo: await getEncryptStr(_form.idCardNo),
-          phoneNumber: await getEncryptStr(_form.phoneNumber),
-        };
-        let msg = "";
-
-        try {
-          my.showLoading();
-          const isEditCard = this.isEditCard();
-          /* 如果有id 或者绑定的卡id为编辑 */
-          if (form.id || form.cardNum) {
-            if (isEditCard) {
-              msg = "就诊卡编辑成功";
-              await editCard(form);
-            } else {
-              msg = "就诊人编辑成功";
-              await patientUpdate(form);
-            }
-          } else if (isEditCard) {
-            msg = "就诊卡添加成功";
-            await createCard(form);
-          } else {
-            msg = "就诊人添加成功";
-            await createPatient(form);
-          }
-          this.goNav(routeState);
-          this.showSuccess(msg);
-        } catch (e) {
-          this.showError(e.msg);
-        }
-        my.hideLoading();
-      },
-
-      goNav(state) {
-        if (state) {
-          const { routeType = "push", ...rest } = state;
-          /* routeType push/replace */
-
-          if (history[routeType]) {
-            history[routeType](rest);
-          }
-        } else {
-          my.navigateBack();
-        }
-      },
-
-      /* 获取就诊卡 */
-      async onCheckCard() {
-        const { editForm, isAuthSuccess } = this.data;
-        my.showLoading();
-        const { idCardNo } = editForm;
-        return new Promise(async (resolve) => {
-          const medicCardsList = isAuthSuccess
-            ? await getLoginUserCardList()
-            : await this.getCardByIdCardNo(idCardNo);
-          /* 如果卡大于一张 */
-
-          if (medicCardsList.length <= 1) {
-            return resolve("");
-          }
-
-          my.hideLoading();
-          this.resolveFn = resolve;
-          this.setData({
-            show: true,
-            medicCardsList,
-          });
-        });
-      },
-
-      /* 根据idCardNo查询某个就诊人的就诊卡 */
-      async getCardByIdCardNo(idCardNo) {
-        const value = await getEncryptStr(idCardNo);
-        const list = await getPatientList({
-          idCardNo: value,
-        });
-        if (!list.length) return [];
-        const { medicCards = [] } = list[0];
-        return medicCards;
-      },
-
-      choosePhoneContact() {
-        my.choosePhoneContact({
-          success: ({ mobile }) => {
-            this.setData({
-              "editForm.phoneNumber": mobile.replace(/(\s|-|\+)/g, ""),
-            });
-          },
-        });
-      },
-
-      async onLaunchOcr() {
-        const { readIDCard, IDCardTypes } = await loadOcr();
-        readIDCard({
-          bizId: "ocr_01",
-          type: IDCardTypes.FRONT,
-        })
-          .then((res) => {
-            if (res.error) {
-              return Promise.reject(res.error);
-            }
-
-            const {
-              num: { data: idCardNo },
-              name: { data: realName },
-              sex: { data: userSex },
-            } = res.data;
-            this.setData({
-              "editForm.sex": userSex,
-              "editForm.name": realName,
-              "editForm.idCardNo": idCardNo,
-            });
-          })
-          .catch((e) => {
-            this.showTip(e.message || "识别身份证失败");
-          });
-      },
-    },
-  })
+	connect({
+		mapStateToProps: {
+			userInfo: ({ $global }) => $global.userInfo || {},
+		},
+	})({
+		props: {
+			componentData: {},
+		},
+		data: {
+			caIcon,
+			bookIcon,
+			show: false,
+			routeState: null,
+			medicCardsList: [],
+			isAuthSuccess: false,
+			editForm: getDefaultForm(),
+			genders: [
+				{
+					label: "男",
+					value: "男",
+				},
+				{
+					label: "女",
+					value: "女",
+				},
+			],
+			certTypes: [
+				{
+					id: 1,
+					name: "身份证",
+				},
+			],
+		},
+
+		didMount() {
+			const { componentData } = this.props;
+			const { editForm, routeState } = componentData || {};
+			const state = {};
+
+			if (routeState) {
+				state.routeState = routeState;
+			}
+			/* 编辑 */
+
+			if (editForm) {
+				state.editForm = this.initData(editForm);
+			}
+
+			this.setData(state);
+			/* 埋点服务预警 */
+
+			reportCmPV_YL({
+				title: "在线建档",
+			});
+		},
+
+		methods: {
+			isEditCard() {
+				const { $routeConfig } = this.$page;
+				const { query } = $routeConfig;
+				return query.editType === "card";
+			},
+
+			initData(data) {
+				const _data = {};
+				const defaultData = getDefaultForm();
+				Object.keys(defaultData).forEach((key) => {
+					const value = data[key] || defaultData[key];
+					if (value) _data[key] = value;
+				});
+				return _data;
+			},
+
+			onClosePopup() {
+				this.setData({
+					show: false,
+				});
+			},
+
+			onTap() {
+				this.onClosePopup();
+			},
+
+			async onRelationChange({ id, name }) {
+				let isAuthSuccess = false;
+				const { editForm: _editForm } = this.data;
+				let editForm = copy(_editForm);
+				/* 如果是从本人切换到其他关系上的需要清空数据 */
+
+				if (_editForm.relationShip === "本人" && id !== 1) {
+					editForm = getDefaultForm();
+				}
+
+				editForm.relationShip = name;
+				/* 如果为本人,唤起授权 */
+
+				if (id === 1) {
+					const { userInfo } = this.data; // 判断用户是否已经登陆
+
+					if (userInfo.isLogin) {
+						isAuthSuccess = true;
+					} else {
+						isAuthSuccess = await doLogin.call(this, {
+							scopes: "auth_user",
+						});
+					}
+
+					if (isAuthSuccess) {
+						const {
+							phone,
+							gender = "m",
+							idCardNo,
+							fullName,
+							phoneRsa,
+							fullNameRsa,
+							idcardNoRsa,
+						} = this.data.userInfo;
+						editForm.name = fullName;
+						editForm.idCardNo = idCardNo;
+						editForm.phoneNumber = phone;
+						editForm.phoneRsa = phoneRsa;
+						editForm.fullNameRsa = fullNameRsa;
+						editForm.idcardNoRsa = idcardNoRsa;
+						editForm.sex = gender === "m" ? "男" : "女";
+					}
+				}
+
+				this.setData({
+					isAuthSuccess,
+					editForm: { ...editForm },
+				});
+			},
+
+			/* 一键清除 */
+			clearInput(value, key) {
+				// eslint-disable-next-line no-param-reassign
+				value = value || "";
+				const { editForm } = this.data;
+				const oldValue = editForm[key] || "";
+				return oldValue.indexOf("*") < 0 ? value : "";
+			},
+
+			/* 输入姓名 */
+			onNameInput({ detail }) {
+				this.setData({
+					"editForm.name": this.clearInput(detail.value, "name"),
+				});
+			},
+
+			/* 选择性别 */
+			onSexChange(item) {
+				this.setData({
+					"editForm.sex": item,
+				});
+			},
+
+			/* 选择证件类别 */
+			onCertTypeChange({ detail }) {
+				const { value } = detail;
+				const { certTypes = [] } = this.data;
+				const { name = "" } = certTypes[value];
+				this.setData({
+					"editForm.certTypes": name,
+				});
+			},
+
+			/* 输入身份证 */
+			onCardNoInput({ detail }) {
+				this.setData({
+					"editForm.idCardNo": this.clearInput(detail.value, "idCardNo"),
+				});
+			},
+
+			/* 输入电话号码 */
+			onPhoneInput({ detail }) {
+				this.setData({
+					"editForm.phoneNumber": this.clearInput(detail.value, "phoneNumber"),
+				});
+			},
+
+			async onCardChange({ cardNum }) {
+				this.resolveFn && this.resolveFn(cardNum);
+			},
+
+			showTip(msg) {
+				my.showToast({
+					content: msg,
+					duration: 3000,
+				});
+				return false;
+			},
+
+			showSuccess(msg) {
+				my.showToast({
+					type: "success",
+					content: msg,
+					duration: 1500,
+				});
+			},
+
+			showError(msg) {
+				my.showToast({
+					type: "fail",
+					content: msg,
+					duration: 1500,
+				});
+			},
+
+			vailForm(form) {
+				const { idCardNo = "", phoneNumber = "" } = form;
+				const { sex, name, idCardType, relationShip } = form;
+				const rest = {
+					sex,
+					name,
+					idCardType,
+					relationShip,
+				};
+				const values = Object.values(rest);
+
+				if (values.filter((v) => !!v).length !== values.length) {
+					return this.showTip("将页面上的信息填写完整!");
+				}
+
+				if (!checkIdCard(idCardNo)) {
+					return this.showTip("身份证格式不正确!");
+				}
+
+				if (!checkPhone(phoneNumber)) {
+					return this.showTip("手机号格式不正确!");
+				}
+
+				return true;
+			},
+
+			/*
+			 * 获取非脱敏的字段
+			 * */
+			restForm(form) {
+				const _form = {};
+				Object.keys(form).forEach((key) => {
+					const value = form[key] || "";
+					if (value.indexOf("*") < 0) _form[key] = value;
+				});
+				return _form;
+			},
+
+			//  保存就诊人
+			async patientSave() {
+				const { editForm, isAuthSuccess } = this.data;
+				/* 如果不是本人,校验字段 */
+
+				if (!isAuthSuccess) {
+					if (!this.vailForm(editForm)) return;
+				}
+				/* 获取非脱敏的字段 */
+
+				const form = this.restForm(editForm);
+				/* 不是编辑的情况,才需要选择就诊卡 */
+				if (!editForm.id && !this.isEditCard()) {
+					form.bindCardNum = await this.onCheckCard(form);
+				}
+				await this.onSubmit(this.initData(form));
+			},
+
+			/* 提交 */
+			async onSubmit(_form) {
+				const { routeState } = this.data;
+				/* 加密数据 */
+
+				const form = {
+					..._form,
+					idCardNo: await getEncryptStr(_form.idCardNo),
+					phoneNumber: await getEncryptStr(_form.phoneNumber),
+				};
+				let msg = "";
+				try {
+					my.showLoading();
+					const isEditCard = this.isEditCard();
+					/* 如果有id 或者绑定的卡id为编辑 */
+					if (form.id || form.cardNum) {
+						if (isEditCard) {
+							msg = "就诊卡编辑成功";
+							await editCard(form);
+						} else {
+							msg = "就诊人编辑成功";
+							await patientUpdate(form);
+						}
+					} else if (isEditCard) {
+						msg = "就诊卡添加成功";
+						await createCard(form);
+					} else {
+						msg = "就诊人添加成功";
+						await createPatient(form);
+					}
+					this.goNav(routeState);
+					this.showSuccess(msg);
+				} catch (e) {
+					this.showError(e.msg);
+				}
+				my.hideLoading();
+			},
+
+			goNav(state) {
+				if (state) {
+					const { routeType = "push", ...rest } = state;
+					/* routeType push/replace */
+
+					if (history[routeType]) {
+						history[routeType](rest);
+					}
+				} else {
+					my.navigateBack();
+				}
+			},
+
+			/* 获取就诊卡 */
+			async onCheckCard() {
+				console.log("onCheckCard");
+				const { editForm, isAuthSuccess } = this.data;
+				my.showLoading();
+				const { idCardNo } = editForm;
+				return new Promise(async (resolve) => {
+					const medicCardsList = isAuthSuccess
+						? await getLoginUserCardList()
+						: await this.getCardByIdCardNo(idCardNo);
+					/* 如果卡大于一张 */
+
+					if (medicCardsList.length <= 1) {
+						return resolve("");
+					}
+
+					my.hideLoading();
+					this.resolveFn = resolve;
+					this.setData({
+						show: true,
+						medicCardsList,
+					});
+				});
+			},
+
+			/* 根据idCardNo查询某个就诊人的就诊卡 */
+			async getCardByIdCardNo(idCardNo) {
+				const value = await getEncryptStr(idCardNo);
+				const list = await getPatientList({
+					idCardNo: value,
+				});
+				if (!list.length) return [];
+				const { medicCards = [] } = list[0];
+				return medicCards;
+			},
+
+			choosePhoneContact() {
+				my.choosePhoneContact({
+					success: ({ mobile }) => {
+						this.setData({
+							"editForm.phoneNumber": mobile.replace(/(\s|-|\+)/g, ""),
+						});
+					},
+				});
+			},
+
+			async onLaunchOcr() {
+				const { readIDCard, IDCardTypes } = await loadOcr();
+				readIDCard({
+					bizId: "ocr_01",
+					type: IDCardTypes.FRONT,
+				})
+					.then((res) => {
+						if (res.error) {
+							return Promise.reject(res.error);
+						}
+
+						const {
+							num: { data: idCardNo },
+							name: { data: realName },
+							sex: { data: userSex },
+						} = res.data;
+						this.setData({
+							"editForm.sex": userSex,
+							"editForm.name": realName,
+							"editForm.idCardNo": idCardNo,
+						});
+					})
+					.catch((e) => {
+						this.showTip(e.message || "识别身份证失败");
+					});
+			},
+		},
+	})
 );

+ 1 - 1
antbuilder/industry/hospitalV2/components/personal-center-head/personalCenterHead.axml

@@ -76,7 +76,7 @@
                   class="btn-icon"
                   src="{{ addIcon }}"
                 />
-                <text>添加就诊</text>
+                <text>添加就诊</text>
               </view>
             </view>
           </block>

+ 122 - 149
antbuilder/industry/hospitalV2/components/personal-center-head/personalCenterHead.js

@@ -1,161 +1,134 @@
-import { connect } from 'herculex';
+import { connect } from "herculex";
 import { setPagesQuery } from "../../../../core/utils";
-import { createSubscribe } from 'applet-page-component';
-import { getMyCardInfo } from './service';
-import history from '../../utils/history';
-import doLogin from '../../utils/doLogin';
+import { createSubscribe } from "applet-page-component";
+import { getMyCardInfo } from "./service";
+import history from "../../utils/history";
+import doLogin from "../../utils/doLogin";
 const app = getApp();
-const qrImage = 'https://gw.alipayobjects.com/mdn/rms_373ab8/afts/img/A*z8duR6vAPp0AAAAAAAAAAAAAARQnAQ';
-const addIcon = 'https://gw.alipayobjects.com/mdn/rms_373ab8/afts/img/A*dqcsTZEuGTgAAAAAAAAAAAAAARQnAQ';
-Component(createSubscribe({
-  onShow() {
-    const {
-      isLogin
-    } = this.data;
-    if (isLogin) this.fetchCardInfo();
-  }
+const qrImage =
+	"https://gw.alipayobjects.com/mdn/rms_373ab8/afts/img/A*z8duR6vAPp0AAAAAAAAAAAAAARQnAQ";
+const addIcon =
+	"https://gw.alipayobjects.com/mdn/rms_373ab8/afts/img/A*dqcsTZEuGTgAAAAAAAAAAAAAARQnAQ";
+Component(
+	createSubscribe({
+		onShow() {
+			const { isLogin } = this.data;
+			if (isLogin) this.fetchCardInfo();
+		},
+	})(
+		connect({
+			mapStateToProps: {
+				scopes: ({ $global }) => $global.scopes,
+				userInfo: ({ $global }) => $global.userInfo || {},
+				isLogin: ({ $global }) => $global.userInfo.isLogin,
+			},
+		})({
+			props: {
+				componentData: {},
+			},
+			data: {
+				addIcon,
+				qrImage,
+				cardInfo: null,
+				showPatient: false,
+				imgSrcPrefix: app.globalData.imgSrcPrefix,
+			},
 
-})(connect({
-  mapStateToProps: {
-    scopes: ({
-      $global
-    }) => $global.scopes,
-    userInfo: ({
-      $global
-    }) => $global.userInfo || {},
-    isLogin: ({
-      $global
-    }) => $global.userInfo.isLogin
-  }
-})({
-  props: {
-    componentData: {}
-  },
-  data: {
-    addIcon,
-    qrImage,
-    cardInfo: null,
-    showPatient: false,
-    imgSrcPrefix: app.globalData.imgSrcPrefix
-  },
+			async didUpdate(_, preState) {
+				const { isLogin = false } = preState;
+				const { isLogin: curLogin } = this.data;
 
-  async didUpdate(_, preState) {
-    const {
-      isLogin = false
-    } = preState;
-    const {
-      isLogin: curLogin
-    } = this.data;
+				if (isLogin !== curLogin && curLogin) {
+					await this.fetchCardInfo();
+				}
+			},
 
-    if (isLogin !== curLogin && curLogin) {
-      await this.fetchCardInfo();
-    }
-  },
+			methods: {
+				async fetchCardInfo() {
+					const info = await getMyCardInfo();
+					this.setData({
+						cardInfo: info,
+					});
+				},
 
-  methods: {
-    async fetchCardInfo() {
-      const info = await getMyCardInfo();
-      this.setData({
-        cardInfo: info
-      });
-    },
+				setQuery(patientId) {
+					setPagesQuery({
+						currentUserId: patientId,
+					});
+				},
 
-    setQuery(patientId) {
-      setPagesQuery({
-        currentUserId: patientId
-      });
-    },
+				/**
+				 * 去登陆
+				 */
+				async onLogin() {
+					await doLogin.call(this, {
+						scopes: "auth_user",
+					});
+				},
 
-    /**
-     * 去登陆
-     */
-    async onLogin() {
-      await doLogin.call(this, {
-        scopes: 'auth_user'
-      });
-    },
+				/**
+				 * 切换就诊人
+				 */
+				changeBtn() {
+					console.log("1111111");
+					this.setData({
+						showPatient: true,
+					});
+				},
 
-    /**
-     * 切换就诊人
-     */
-    changeBtn() {
-      console.log('1111111');
-      this.setData({
-        showPatient: true
-      });
-    },
+				onClose() {
+					this.setData({
+						showPatient: false,
+					});
+				},
 
-    onClose() {
-      this.setData({
-        showPatient: false
-      });
-    },
+				onChange(item) {
+					const { cardInfo } = this.data;
+					const { id: patientId, bindCardNum: cardNum, hisPatientId } = item;
+					this.setData({
+						showPatient: false,
+						cardInfo: { ...cardInfo, cardNum, patientId, hisPatientId },
+					});
+					my.showToast({
+						duration: 1500,
+						content: "就诊人切换成功",
+					});
+				},
 
-    onChange(item) {
-      const {
-        cardInfo
-      } = this.data;
-      const {
-        id: patientId,
-        bindCardNum: cardNum,
-        hisPatientId
-      } = item;
-      this.setData({
-        showPatient: false,
-        cardInfo: { ...cardInfo,
-          cardNum,
-          patientId,
-          hisPatientId
-        }
-      });
-      my.showToast({
-        duration: 1500,
-        content: '就诊人切换成功'
-      });
-    },
+				toPatientDetail() {
+					const { patientId } = this.data.cardInfo;
+					history.push({
+						title: "就诊人详情",
+						query: {
+							id: patientId,
+						},
+						pageType: "patient-detail",
+					});
+				},
 
-    toPatientDetail() {
-      const {
-        patientId
-      } = this.data.cardInfo;
-      history.push({
-        title: '就诊人详情',
-        query: {
-          id: patientId
-        },
-        pageType: 'patient-detail'
-      });
-    },
-
-    toAddCard() {
-      const {
-        userInfo
-      } = this.data;
-      const {
-        phone,
-        gender,
-        idCardNo,
-        fullName
-      } = userInfo || {};
-      const editForm = {
-        idCardNo,
-        name: fullName,
-        defaultCard: '是',
-        phoneNumber: phone,
-        relationShip: '本人',
-        sex: gender === 'm' ? '男' : '女'
-      };
-      history.push({
-        title: '添加就诊卡',
-        pageType: 'edit-patient',
-        query: {
-          editType: 'card'
-        },
-        componentData: {
-          editForm
-        }
-      });
-    }
-
-  }
-})));
+				toAddCard() {
+					const { userInfo } = this.data;
+					const { gender } = userInfo || {};
+					const editForm = {
+						// idCardNo,
+						// name: fullName,
+						defaultCard: "是",
+						// phoneNumber: phone,
+						relationShip: "本人",
+						sex: gender === "m" ? "男" : "女",
+					};
+					history.push({
+						title: "添加就诊人",
+						pageType: "edit-patient",
+						query: {
+							// editType: "card",
+						},
+						componentData: {
+							editForm,
+						},
+					});
+				},
+			},
+		})
+	)
+);