فهرست منبع

增加医学计算公式

xiezhiming 3 سال پیش
والد
کامیت
f0550bec84
2فایلهای تغییر یافته به همراه230 افزوده شده و 0 حذف شده
  1. 132 0
      src/css/staticInfo.less
  2. 98 0
      src/js/staticInfo.js

+ 132 - 0
src/css/staticInfo.less

@@ -521,4 +521,136 @@
   .name,.age,.sex,.cards{
     border-left: none;
   }
+}
+
+// 胎儿发育指数评估内容
+.computedgs{
+	margin-left:79px;
+	margin-top:35px;
+	.cgs_top{
+		display: flex;
+		justify-content: center;
+		flex-wrap: wrap;
+		.l_content{
+			
+			height: 100px;
+		}
+		.d_inpt{
+			display: inline-block;
+			position: relative;
+			
+		}
+		.yz{
+			position: absolute;
+			top:50px;
+			left:14px;
+			width: 150px;
+		}
+		
+		.gs_x{
+			color: #F45454;
+			margin-top: 5px;
+			margin-right: 4px;
+		}
+		.gs_wz{
+			display: inline-block;
+			height: 32px;
+			line-height: 32px;
+		}
+		
+		.gs_ipt{
+			width: 160px;
+			height: 32px;
+			background: #FFFFFF;
+			border-radius: 4px;
+			border: 1px solid #D8D8D8;
+			margin-left: 16px;
+			padding: 3px;
+			padding-left: 8px;
+			margin-right: 18px;
+			box-sizing: border-box;
+		}
+		.gs_iptq{
+			border-color: #F45454 !important;
+			color: #F45454 !important;
+		}
+		.r_content{
+			margin-left: 200px;
+			position: relative;
+			height: 100px;
+		}
+		.c_end{
+			width: 100%;
+			display: flex;
+			justify-content: flex-end;
+			.c_btn{
+				cursor: pointer;
+				width: 94px;
+				height: 34px;
+				background: #FFFFFF;
+				border-radius: 8px;
+				border: 1px solid #2A9BD5;
+				display: flex;
+				align-items: center;
+				justify-content: center;
+				color: #2A9BD5;
+			}
+		}
+		.b_content{
+			width: 100%;
+			background: #EDFAFF;
+			border-radius: 10px;
+			margin-top: 15px;
+			.m_w300{
+				margin: auto;
+				width: 30%;
+				margin-top: 20px;
+				margin-bottom: 20px;
+			}
+			.m_auto{
+				display: inline-block;
+				width: 100%;
+				margin-bottom: 3px;
+			}
+		}
+	}
+	
+}
+@media screen and (max-width: 960px) {
+    .computedgs{
+		.cgs_top{
+			.l_content{
+				height: 110px;
+				width: 100%;
+				display: flex;
+				justify-content: center;
+			}
+			.d_inpt {
+			    display: inline-block;
+			    position: relative;
+			    width: 30%;
+				
+			}
+			.gs_wzs{
+				margin-right: 16px;
+			}
+			.gs_wzl{
+				margin-left: 16px;
+			}
+			.gs_ipt{
+				margin: 0px;
+				width: 100%;
+			}
+			.r_content{
+				height: 110px;
+				width: 100%;
+				display: flex;
+				justify-content: center;
+				margin-left: 0px;
+			}
+			.yz{
+				left:0px;
+			}
+		}
+	}
 }

+ 98 - 0
src/js/staticInfo.js

@@ -123,6 +123,104 @@ function renderContent(list, contentWrapClassName) {
 //计算公式写死
 function renderCalculate(){
 
+	var gongGao='';
+	var pregnant='';
+	let str;
+	str=`<div class='computedgs'>
+			<div class='cgs_top'>
+				<div class='l_content'>
+					<label class='gs_x'>*</label><label class="gs_wz gs_wzs">宫高</label>
+					<div class='d_inpt'>
+						<input type="text" name="username" placeholder="请输入" class="gs_ipt" id='ipt1' maxlength='5'>
+						<label class='yz l_yz' style="color:red;display:none;">格式错误,请输入数字</label>
+					</div>
+					<label class="gs_wz  gs_wzl">cm</label>
+					
+				</div>
+				<div class='r_content'>
+					<label class='gs_x'>*</label><label class="gs_wz gs_wzs">孕月</label>
+					<div class='d_inpt'>
+						<input type="text" name="username" placeholder="请输入" class="gs_ipt" id='ipt2' maxlength='3'>
+						<label class='yz r_yz' style="color:red;display:none;">格式错误,请输入数字</label>
+					</div>
+					<label class="gs_wz  gs_wzl">月</label>
+				</div>
+				<div class='c_end'>
+					<span class="c_btn">结果</span>
+				</div>
+				<div class='b_content'>
+					<div class="m_w300">
+						<p class='b_end m_auto'>结果:<p>
+						<p class='m_auto'>胎儿发育指数=宫高(cm)-3*(孕月+1) <p>
+						<p class='m_auto'>正常值范围:指数在-3与+3之间为正常儿,低于-3则有FGR的可能<p>
+					<div>
+				<div>
+			</div>	
+		</div>`;
+	$('.infos-box').append(str);
+	let inpt1='';
+	let inpt2='';
+	var flag1=false;
+	var flag2=false;
+	let endNum='';
+	
+	// 输入判断是否为数字
+	function numCheck(val,node1,node2,flag){
+		var regs = new RegExp("^[0-9]*$");
+		if(!regs.test(val)|| !val){
+			$(node1).show()
+			$(node2).addClass("gs_iptq");
+			flag=false;
+			return flag
+		}else{
+			$(node1).hide()
+			$(node2).removeClass("gs_iptq");
+			flag=true;
+			return flag
+		}
+	}
+	// 输入数字
+	$('#ipt1').blur(function(){
+		let val=this.value
+		inpt1=val
+		flag1=numCheck(val,'.l_yz','#ipt1',flag1)
+		console.log(flag1)
+	})
+	$('#ipt2').blur(function(){
+		let val=this.value
+		inpt2=val
+		flag2=numCheck(val,'.r_yz','#ipt2',flag2)
+		
+	})
+	
+	// 点击结果
+	$('.c_btn').click(function(){
+		console.log(flag1,flag2)
+		if(flag1&&flag2){
+			endNum=inpt1-3*(inpt2*1+1);
+			// 将值显示在页面上
+			let str1=`<span class="end_child"><span>结果:胎儿发育指数</span><span class='end_ys'>${endNum}</span></span>`
+			$('.b_end').text('')
+			$('.b_end').append(str1)
+			// 颜色区分正常和不正常
+			// if(endNum<-3 ||endNum>3){
+			// 	$('.end_ys').css({
+			// 		color:'#F45454'
+			// 	})
+			// }else{
+			// 	$('.end_ys').css({
+			// 		color:'#333'
+			// 	})
+			// }
+		}else{
+			// 移除
+			if($('.end_child').length>0){
+				$('.end_child').remove()
+				$('.b_end').text('结果:')
+			}
+		}
+	})
+	
 }
 
 //量表评估内容