<%@ page language="java" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%
String sample_id = request.getParameter("sample_id");
%>
<head>
<title>扫描入库</title>
<%@ include file="/busi/qui_head.jsp"%>
<!--面板-->
<script type="text/javascript" src="<%=path%>/libs/js/popup/drag.js"></script>
<script type="text/javascript" src="<%=path%>/libs/js/popup/dialog.js"></script>
<script src="<%=path%>/libs/js/table/quiGrid.js" type="text/javascript"></script>
<script src="<%=path%>/libs/js/form/form.js" type="text/javascript"></script>
<!--弹出式提示框start-->
<script type="text/javascript" src="<%=path%>/libs/js/popup/messager.js"></script>
<!--弹出式提示框end-->
<link rel="stylesheet" type="text/css" href="<%=path%>/busi/sample/css/index2.css" />
<link rel="stylesheet" type="text/css" href="<%=path%>/busi/sample/css/main.css" />
</head>
<body >
<div class="wrapper">
<div class="con">
<div class="layout">
<ul>
<li class="box1">病历号</li>
<li class="box2">病名</li>
<li class="box3">标本类型</li>
<li class="box4">状态</li>
<li class="box5">操作</li>
</ul>
</div>
<div id="scanList">
</div>
<div class="layout_b"><input type="text" id="scan" class="input_text" name="scan" /><input type="button" value="录入" onclick="enter()"/></div>
<div class="layout_c">
<input type="button" class="btn" value="智能计算存放位置" onclick="searchplace()"/>
<input type="button" class="btn" value="提交" onclick="formSubmit()"/>
<input type="button" class="btn btn_1" value="取消" onclick="parent.Dialog.close()"/>
</div>
</div>
</div>
<script language="javascript" type="text/javascript" charset="utf-8">
function initComplete(){
//光标锁定
document.getElementById("scan").focus() ;
}
//扫描录入
function enter(){
var sample_id=‘<%=sample_id%>‘;
var param={};
$.post(‘/busi/sampleAction.ered?reqCode=enter‘,{sample_id:sample_id},function(result){
var resultData=eval("("+result+")");
var html=[];
for(var i=0; i<resultData.length; i++) {
html.push(‘<div class="layout_a"><ul><li>‘);
html.push(‘<input type="hidden" value="‘+resultData[i].sampleinfo_id+‘" id="sampleinfo_id" name="sampleinfo_id"/>‘);
html.push(‘<input type="hidden" value="" id="boxice_id" name="boxice_id"/>‘);
html.push(‘<span class="box1">‘+resultData[i].sample_patient+‘</span>‘);
html.push(‘<span class="box2">‘+resultData[i].diseasename+‘</span>‘);
html.push(‘<span class="box3">‘+resultData[i].intance_type+‘</span>‘);
html.push(‘<span class="box4">‘+"扫描成功"+‘</span>‘);
html.push(‘<span class="box5" onclick="searchbyhand(\‘‘+resultData[i].sampleinfo_id+‘\‘)">手工设置存放位置</span>‘);
html.push(‘</li></ul>‘);
html.push(‘ <div class="msg"><p>‘+"所在位置:"+‘</p></div>‘);
html.push(‘</div>‘);
}
$("#scanList").append(html.join(""));
$("#scanList").render();
});
}
//智能计算存放位置
function searchplace(){
var param=[];
$("#scanList .layout_a").each(function(){
var boxice_id=$(this).find("input[name=boxice_id]").val();
if(!boxice_id){
var diseasename=$(this).find(".box2").text();
var intance_type=$(this).find(".box3").text();
param.push(intance_type);
param.push(diseasename);
}
});
$.post(‘/busi/sampleAction.ered?reqCode=searchplace‘,{disease : param.join(",")},function(result){
var resultData=eval("("+result+")");
var i=0;
$("#scanList .layout_a").each(function(){
var boxice_id=$(this).find("input[name=boxice_id]").val();
if(!boxice_id){
if(resultData[i].boxice_id){
var position="所在位置:实验室id:"+resultData[i].lab_id+"冰箱id:"+resultData[i].ice_id+"位置id"+resultData[i].boxice_id;
$(this).find(".msg").html("<span style=‘color:gray‘>"+position+"</span>");
$(this).find("input[name=boxice_id]").val(resultData[i].boxice_id);
}else{
$(this).find(".msg").html("<span style=‘color:gray‘>"+resultData[i].tip+"</span>");
}
}
i++;
});
});
}
var boxice_idArr=‘‘//用于判断是否已被选
//手动设置存放位置
function searchbyhand(sampleinfo_id) {
viewDialog = new parent.Dialog();
viewDialog.URL = "/busi/intanceAction.ered?reqCode=Init&rownumber="+sampleinfo_id+"&boxice_idArr="+boxice_idArr;
viewDialog.Title = "手动设置存放位置";
viewDialog.Width = 1300;
viewDialog.Height = 700;
viewDialog.show();
}
function searchbyhandok(paramboxice,boxice_id,sampleinfo_id) {
boxice_idArr+=boxice_id;
var position="所在位置:实验室id:"+paramboxice.lab_id+"冰箱id:"+paramboxice.ice_id+"位置id"+boxice_id;
$("#scanList .layout_a").each(function(){
var sampleinfo_idbak=$(this).find("input[name=sampleinfo_id]").val();
if(sampleinfo_id==sampleinfo_idbak){
$(this).find(".msg").html("<span style=‘color:gray‘>"+position+"</span>");
$(this).find("input[name=boxice_id]").val(boxice_id);
}
});
}
function formSubmit() {
var jsonArray = [];
$("#scanList .layout_a").each(function(){
var sampleinfo_id=$(this).find("input[name=sampleinfo_id]").val();
var boxice_id=$(this).find("input[name=boxice_id]").val();
if(!boxice_id){
parent.Dialog.alert("还有标本没有位置,请全部确定位置后再做此操作!");
return false;
}
var sample_patient=$(this).find(".box1").text();
var diseasename=$(this).find(".box2").text();
var intance_type=$(this).find(".box3").text();
jsonArray.push(‘{"sampleinfo_id":"‘+sampleinfo_id+‘","boxice_id":"‘+boxice_id+‘","sample_patient":"‘+sample_patient+‘","diseasename":"‘+diseasename+‘","intance_type":"‘+intance_type+‘"}‘);
});
if(jsonArray.length == 0) {
parent.Dialog.alert("无保存数据!",null,null,null,5);
return;
}
$.post(‘/busi/sampleAction.ered?reqCode=saveScan‘,{dirtydata:"["+jsonArray.join(",")+"]"},function(data){
if(data==‘success‘){
parent.$.messager.show(0, "保存成功");
parent.location.reload();
parent.Dialog.close();
}
})
}
</script>
</body>
</html>