Commit e937af24 by nlp97

no message

parent 0a2f4a0f
<!-- <!--
* @Author: ninglupeng * @Author: ninglupeng
* @Date: 2020-11-24 16:18:58 * @Date: 2020-11-24 16:18:58
* @LastEditors: wsq * @LastEditors: ninglupeng
* @LastEditTime: 2022-11-04 16:26:05 * @LastEditTime: 2022-11-04 17:04:04
* @Description: * @Description:
--> -->
<template> <template>
...@@ -409,282 +409,198 @@ export default { ...@@ -409,282 +409,198 @@ export default {
} }
}); });
}, },
mounted() {
if (this.$i18n.locale == "zh") {
this.getResource();
} else {
//症状列表
this.symptomList = [
{ id: 1, element: "يۇتقۇنچاق ئاغرىش", sort: 1 },
{ id: 2, element: "بۇرنى پۈتۈپ قىلىش", sort: 2 },
{ id: 3, element: "قىزىتماق", sort: 3 },
{ id: 5, element: "يۆتەل", sort: 5 },
{ id: 6, element: "بەلغەم يۆتەل", sort: 6 },
{ id: 7, element: "بېشى قايماق", sort: 7 },
{ id: 8, element: "باش ئاغرىقى", sort: 8 },
{ id: 9, element: "مۇسكۇل ئاغرىش", sort: 9 },
{ id: 10, element: "ماغدۇرسىزلىق", sort: 10 },
{ id: 11, element: "نەپەس قىيىنلىشىش", sort: 11 },
{ id: 12, element: "بۇرنىدىن سۇ ئېقىش", sort: 12 },
];
//国籍列表
this.nationalityList = [
"جۇڭگو",
"جۇڭگو شياڭگاڭ",
"جۇڭگو ئاۋمېن",
"جۇڭگو تەيۋەن",
"چەتئەل",
];
//医保类型列表
this.typeOfMedicalInsuranceList = [
"شاڭخەي داۋالىنىش سۇغۇرتىسى",
"سىرتتىكى داۋالىنىش سۇغۇرتىسى",
"ئۆزى چىقىم قىلىش",
];
//职业列表
this.occupationList = [
"خىزمەتچى",
"ئىشچى",
"مەمۇرى خادىم",
"دېھقان",
"دېھقان",
"ھەربىي سەپتىن چېكىنگەن",
"باشقا خىزمەت",
];
}
this.setLastValue(); getLocalStorge(key) {
return window.localStorage.getItem(key);
}, },
methods: {
setLastValue() {
if (this.getLocalStorge("symptom")) {
this.symptom = this.getLocalStorge("symptom").split(",");
}
let arr = [
"patientName", //患者姓名
"nationality", //国籍
"passportId", //护照号
"HasSymptom", //是否有症状
"otherSymptom", //其他症状
"otherOccupation", //其他职业
"age", //年龄
"gender", //性别
"height", //身高
"weight", //体重
"maritalStatus", //婚姻状况
"birthday", //出生日期
"isConceive", //怀孕状况
"gestationalWeeks", //怀孕周期
"occupation", //职业
"contactInformation", //联系方式
"FamilyMembersPhone", //家属联系方式
"Registeredresidence", //籍贯 (包括省市)
"province", //籍贯 (省)
"city", //籍贯 (市)
"address", //地址
"idCard", //身份证号
"typeOfMedicalInsurance", //医保类型
"insurance", //商业保险
];
arr.map((item) => {
if (this.getLocalStorge(item)) {
this[`${item}`] = this.getLocalStorge(item);
}
});
},
getLocalStorge(key) { setLocalStorge(key) {
return window.localStorage.getItem(key); window.localStorage.setItem(key, this[`${key}`]);
}, },
setValue(key, value) {
window.localStorage.setItem(key, value);
},
onConfirm(values) {
console.log(values);
this.Registeredresidence = values
.filter((item) => !!item)
.map((item) => item.name)
.join("/");
setLocalStorge(key) { this.province = values[0].name;
window.localStorage.setItem(key, this[`${key}`]); this.city = values[1].name;
},
setValue(key, value) {
window.localStorage.setItem(key, value);
},
onConfirm(values) {
console.log(values);
this.Registeredresidence = values
.filter((item) => !!item)
.map((item) => item.name)
.join("/");
this.province = values[0].name; this.setLocalStorge("Registeredresidence");
this.city = values[1].name; this.setLocalStorge("province");
this.setLocalStorge("city");
this.setLocalStorge("Registeredresidence"); this.showArea = false;
this.setLocalStorge("province"); },
this.setLocalStorge("city");
this.showArea = false; validator(val) {
}, const card15 = /^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}[0-9Xx]$/;
const card18 = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
return card15.test(val) || card18.test(val);
},
validator(val) { getResource() {
const card15 = /^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}[0-9Xx]$/; this.setLoading(true);
const card18 = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/; this.$http.get(`/Research/Resource`, {}).then((data) => {
return card15.test(val) || card18.test(val); let arr = data.filter((item) => {
}, return item.category == "国籍";
});
getResource() { let arr1 = data.filter((item) => {
this.setLoading(true); return item.category == "医保类型";
this.$http.get(`/Research/Resource`, {}).then((data) => { });
let arr = data.filter((item) => {
return item.category == "国籍"; let arr2 = data.filter((item) => {
}); return item.category == "职业";
});
let arr1 = data.filter((item) => { this.symptomList = data.filter((item) => {
return item.category == "医保类型"; return item.category == "症状";
}); });
//国籍列表
let arr2 = data.filter((item) => { this.nationalityList = arr.map((item) => {
return item.category == "职业"; return item.element;
}); });
this.symptomList = data.filter((item) => { //医保类型列表
return item.category == "症状"; this.typeOfMedicalInsuranceList = arr1.map((item) => {
}); return item.element;
//国籍列表 });
this.nationalityList = arr.map((item) => { //职业列表
return item.element; this.occupationList = arr2.map((item) => {
}); return item.element;
//医保类型列表
this.typeOfMedicalInsuranceList = arr1.map((item) => {
return item.element;
});
//职业列表
this.occupationList = arr2.map((item) => {
return item.element;
});
this.setLoading(false);
}); });
},
getdate() { this.setLoading(false);
let obj = this.getInfo(this.idCard); });
},
if (this.validator(this.idCard)) { getdate() {
this.age = obj.age; let obj = this.getInfo(this.idCard);
this.birthday = obj.birth;
this.gender = obj.sex == 1 ? "男" : "女";
this.setLocalStorge("idCard"); if (this.validator(this.idCard)) {
this.setLocalStorge("birthday"); this.age = obj.age;
this.setLocalStorge("age"); this.birthday = obj.birth;
this.setLocalStorge("gender"); this.gender = obj.sex == 1 ? "男" : "女";
}
},
//根据身份证号码获取出生年月 年龄 性别 this.setLocalStorge("idCard");
getInfo(idCard) { this.setLocalStorge("birthday");
let sex = null; this.setLocalStorge("age");
let birth = null; this.setLocalStorge("gender");
let myDate = new Date(); }
let month = myDate.getMonth() + 1; },
let day = myDate.getDate();
let age = 0;
if (idCard.length === 18) {
age = myDate.getFullYear() - idCard.substring(6, 10) - 1;
sex = idCard.substring(16, 17);
birth =
idCard.substring(6, 10) +
"-" +
idCard.substring(10, 12) +
"-" +
idCard.substring(12, 14);
if (
idCard.substring(10, 12) < month ||
(idCard.substring(10, 12) === month &&
idCard.substring(12, 14) <= day)
)
age++;
}
if (idCard.length === 15) {
age = myDate.getFullYear() - idCard.substring(6, 8) - 1901;
sex = idCard.substring(13, 14);
birth =
"19" +
idCard.substring(6, 8) +
"-" +
idCard.substring(8, 10) +
"-" +
idCard.substring(10, 12);
if (
idCard.substring(8, 10) < month ||
(idCard.substring(8, 10) === month && idCard.substring(10, 12) <= day)
)
age++;
}
if (sex % 2 === 0) sex = 0; //根据身份证号码获取出生年月 年龄 性别
// 性别代码 1代表男,0代表女,暂时不涉及其他类型性别 getInfo(idCard) {
else sex = 1; let sex = null;
return { let birth = null;
age, let myDate = new Date();
sex, let month = myDate.getMonth() + 1;
birth, let day = myDate.getDate();
}; let age = 0;
},
if (idCard.length === 18) {
age = myDate.getFullYear() - idCard.substring(6, 10) - 1;
sex = idCard.substring(16, 17);
birth =
idCard.substring(6, 10) +
"-" +
idCard.substring(10, 12) +
"-" +
idCard.substring(12, 14);
if (
idCard.substring(10, 12) < month ||
(idCard.substring(10, 12) === month &&
idCard.substring(12, 14) <= day)
)
age++;
}
if (idCard.length === 15) {
age = myDate.getFullYear() - idCard.substring(6, 8) - 1901;
sex = idCard.substring(13, 14);
birth =
"19" +
idCard.substring(6, 8) +
"-" +
idCard.substring(8, 10) +
"-" +
idCard.substring(10, 12);
if (
idCard.substring(8, 10) < month ||
(idCard.substring(8, 10) === month && idCard.substring(10, 12) <= day)
)
age++;
}
onbirthday(date) { if (sex % 2 === 0) sex = 0;
this.birthday = formatDate(date, "yyyy-MM-dd "); // 性别代码 1代表男,0代表女,暂时不涉及其他类型性别
console.log( else sex = 1;
"🚀 ~ file: page4.vue ~ line 630 ~ onbirthday ~ this.birthday", return {
this.birthday age,
); sex,
birth,
};
},
this.setLocalStorge("birthday"); onbirthday(date) {
// this.getdate(); this.birthday = formatDate(date, "yyyy-MM-dd ");
this.age = this.ages(formatDate(date, "yyyy-MM-dd ")); console.log(
this.showbirthday = false; "🚀 ~ file: page4.vue ~ line 630 ~ onbirthday ~ this.birthday",
}, this.birthday
);
this.setLocalStorge("birthday");
// this.getdate();
this.age = this.ages(formatDate(date, "yyyy-MM-dd "));
this.showbirthday = false;
},
ages(birth) { ages(birth) {
birth = birth.replace(/-/g, "/"); //把格式中的"-"替换为"/" birth = birth.replace(/-/g, "/"); //把格式中的"-"替换为"/"
birth = new Date(birth); //替换后转为Date类型 birth = new Date(birth); //替换后转为Date类型
var now = new Date(); //获取当前日期 var now = new Date(); //获取当前日期
var nowYear = now.getFullYear(); //当前日期的年份 var nowYear = now.getFullYear(); //当前日期的年份
var nowMonth = now.getMonth(); var nowMonth = now.getMonth();
var nowDay = now.getDay(); var nowDay = now.getDay();
var birthYear = birth.getFullYear(); var birthYear = birth.getFullYear();
var birthMonth = birth.getMonth(); var birthMonth = birth.getMonth();
var birthDay = birth.getDay(); //出生日期的日数 var birthDay = birth.getDay(); //出生日期的日数
var age; var age;
if (birth > now) { if (birth > now) {
return false; return false;
} else if ( } else if (
nowYear == birthYear || nowYear == birthYear ||
(nowYear > birthYear && nowMonth >= birthMonth && nowDay >= birthDay) (nowYear > birthYear && nowMonth >= birthMonth && nowDay >= birthDay)
) { ) {
age = nowYear - birthYear; age = nowYear - birthYear;
} else { } else {
age = nowYear - birthYear - 1; //简而言之,没过生日岁数不能+1 age = nowYear - birthYear - 1; //简而言之,没过生日岁数不能+1
} }
return age; return age;
}, },
formatter(type, val) { formatter(type, val) {
if (type === "year") { if (type === "year") {
return `${val}年`; return `${val}年`;
} }
if (type === "month") { if (type === "month") {
return `${val}月`; return `${val}月`;
} else if (type === "day") { } else if (type === "day") {
return `${val}日`; return `${val}日`;
} else if (type === "hour") { } else if (type === "hour") {
return `${val}时`; return `${val}时`;
} else if (type === "minute") { } else if (type === "minute") {
return `${val}分`; return `${val}分`;
} }
return val; return val;
},
}, },
computed: {}, },
}; computed: {},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: ninglupeng * @Author: ninglupeng
* @Date: 2022-10-31 14:22:35 * @Date: 2022-10-31 14:22:35
* @LastEditors: ninglupeng * @LastEditors: ninglupeng
* @LastEditTime: 2022-11-04 16:41:00 * @LastEditTime: 2022-11-04 16:59:35
* @Description: * @Description:
*/ */
module.exports = { module.exports = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment