Commit 0a2f4a0f by nlp97

Merge branch 'feature/语言国际化--dev公卫' of…

Merge branch 'feature/语言国际化--dev公卫' of https://gitlab.suvalue.com/ninglupeng/ShanghaiGongwei into feature/语言国际化--dev公卫

# Conflicts:
#	src/components/page4.vue
#	src/components/page6.vue
parents eef26273 5c75918f
<!-- <!--
* @Author: ninglupeng * @Author: ninglupeng
* @Date: 2020-11-24 16:18:58 * @Date: 2020-11-24 16:18:58
* @LastEditors: ninglupeng * @LastEditors: wsq
* @LastEditTime: 2022-11-04 16:39:07 * @LastEditTime: 2022-11-04 16:26:05
* @Description: * @Description:
--> -->
<template> <template>
...@@ -302,7 +302,7 @@ export default { ...@@ -302,7 +302,7 @@ export default {
city: "", //籍贯 (市) city: "", //籍贯 (市)
address: "", //地址 address: "", //地址
idCard: "", //身份证号 idCard: "", //身份证号
typeOfMedicalInsurance: "", //医保类型---默认值 typeOfMedicalInsurance: "", //医保类型---默认值 上海医保
insurance: this.$i18n.locale == "zh" ? "无" : "يوق", //商业保险---默认值 无 insurance: this.$i18n.locale == "zh" ? "无" : "يوق", //商业保险---默认值 无
HasSymptom: this.$i18n.locale == "zh" ? "否" : "ياق", //有无症状---默认值 否 HasSymptom: this.$i18n.locale == "zh" ? "否" : "ياق", //有无症状---默认值 否
...@@ -409,198 +409,282 @@ export default { ...@@ -409,198 +409,282 @@ 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 = [
"خىزمەتچى",
"ئىشچى",
"مەمۇرى خادىم",
"دېھقان",
"دېھقان",
"ھەربىي سەپتىن چېكىنگەن",
"باشقا خىزمەت",
];
}
getLocalStorge(key) { this.setLastValue();
return window.localStorage.getItem(key);
},
setLocalStorge(key) {
window.localStorage.setItem(key, this[`${key}`]);
}, },
setValue(key, value) { methods: {
window.localStorage.setItem(key, value); setLastValue() {
}, if (this.getLocalStorge("symptom")) {
onConfirm(values) { this.symptom = this.getLocalStorge("symptom").split(",");
console.log(values); }
this.Registeredresidence = values let arr = [
.filter((item) => !!item) "patientName", //患者姓名
.map((item) => item.name) "nationality", //国籍
.join("/"); "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);
}
});
},
this.province = values[0].name; getLocalStorge(key) {
this.city = values[1].name; return window.localStorage.getItem(key);
},
this.setLocalStorge("Registeredresidence"); setLocalStorge(key) {
this.setLocalStorge("province"); window.localStorage.setItem(key, this[`${key}`]);
this.setLocalStorge("city"); },
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.showArea = false; this.province = values[0].name;
}, this.city = values[1].name;
validator(val) { this.setLocalStorge("Registeredresidence");
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.setLocalStorge("province");
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.setLocalStorge("city");
return card15.test(val) || card18.test(val);
},
getResource() { this.showArea = false;
this.setLoading(true); },
this.$http.get(`/Research/Resource`, {}).then((data) => {
let arr = data.filter((item) => {
return item.category == "国籍";
});
let arr1 = data.filter((item) => { validator(val) {
return item.category == "医保类型"; 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);
},
let arr2 = data.filter((item) => { getResource() {
return item.category == "职业"; this.setLoading(true);
}); this.$http.get(`/Research/Resource`, {}).then((data) => {
this.symptomList = data.filter((item) => { let arr = data.filter((item) => {
return item.category == "症状"; return item.category == "国籍";
}); });
//国籍列表
this.nationalityList = arr.map((item) => { let arr1 = data.filter((item) => {
return item.element; return item.category == "医保类型";
}); });
//医保类型列表
this.typeOfMedicalInsuranceList = arr1.map((item) => { let arr2 = data.filter((item) => {
return item.element; return item.category == "职业";
}); });
//职业列表 this.symptomList = data.filter((item) => {
this.occupationList = arr2.map((item) => { return item.category == "症状";
return item.element; });
//国籍列表
this.nationalityList = arr.map((item) => {
return item.element;
});
//医保类型列表
this.typeOfMedicalInsuranceList = arr1.map((item) => {
return item.element;
});
//职业列表
this.occupationList = arr2.map((item) => {
return item.element;
});
this.setLoading(false);
}); });
},
this.setLoading(false); getdate() {
}); let obj = this.getInfo(this.idCard);
},
getdate() { if (this.validator(this.idCard)) {
let obj = this.getInfo(this.idCard); this.age = obj.age;
this.birthday = obj.birth;
this.gender = obj.sex == 1 ? "男" : "女";
if (this.validator(this.idCard)) { this.setLocalStorge("idCard");
this.age = obj.age; this.setLocalStorge("birthday");
this.birthday = obj.birth; this.setLocalStorge("age");
this.gender = obj.sex == 1 ? "男" : "女"; this.setLocalStorge("gender");
}
},
this.setLocalStorge("idCard"); //根据身份证号码获取出生年月 年龄 性别
this.setLocalStorge("birthday"); getInfo(idCard) {
this.setLocalStorge("age"); let sex = null;
this.setLocalStorge("gender"); let birth = null;
} 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;
getInfo(idCard) { // 性别代码 1代表男,0代表女,暂时不涉及其他类型性别
let sex = null; else sex = 1;
let birth = null; return {
let myDate = new Date(); age,
let month = myDate.getMonth() + 1; sex,
let day = myDate.getDate(); birth,
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; onbirthday(date) {
// 性别代码 1代表男,0代表女,暂时不涉及其他类型性别 this.birthday = formatDate(date, "yyyy-MM-dd ");
else sex = 1; console.log(
return { "🚀 ~ file: page4.vue ~ line 630 ~ onbirthday ~ this.birthday",
age, this.birthday
sex, );
birth,
};
},
onbirthday(date) { this.setLocalStorge("birthday");
this.birthday = formatDate(date, "yyyy-MM-dd "); // this.getdate();
console.log( this.age = this.ages(formatDate(date, "yyyy-MM-dd "));
"🚀 ~ file: page4.vue ~ line 630 ~ onbirthday ~ this.birthday", this.showbirthday = false;
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>
......
<!-- <!--
* @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 15:59:15 * @LastEditTime: 2022-11-04 16:58:20
* @Description: * @Description:
--> -->
<template> <template>
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
} }
" v-model="HasPreviousHistory" direction="horizontal"> " v-model="HasPreviousHistory" direction="horizontal">
<van-radio :name="$t('have')">{{ $t("have") }}</van-radio> <van-radio :name="$t('have')">{{ $t("have") }}</van-radio>
<van-radio :name="$t('noHave')"></van-radio> <van-radio :name="$t('noHave')">{{ $t("noHave") }}</van-radio>
</van-radio-group> </van-radio-group>
</template> </template>
</van-field> </van-field>
......
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