[2017.05.20]
業(yè)務(wù)流:
量表-添加量表(從系統(tǒng)庫(kù)中進(jìn)行添加,addTFromBase.php),查看量表(查看自己的量表,)
1、量表數(shù)據(jù)庫(kù)
量表id和擁有者的id作為雙主鍵(test_id+test_source);
添加量表部分:
醫(yī)生在添加系統(tǒng)量表時(shí)將原系統(tǒng)量表的id+自己的id進(jìn)行添加記錄;
修改upload_test函數(shù):
function upload_test($doctorId,$json){
$testInfo = json_decode($json,true);
//添加到系統(tǒng)庫(kù)
$sql = "insert into system_test (test_id,test_type,test_title,test_source,create_time,question_index,question_amount,content_before,content_after)
values({$testInfo['test_id']},{$testInfo['test_type']},'{$testInfo['test_title']}','$doctorId',
now(),{$testInfo['question_index']},{$testInfo['question_amount']},
'{$testInfo['content_before']}','{$testInfo['content_after']}')";
return insert_datas($sql);
}
醫(yī)生添加過(guò)的系統(tǒng)量表不能重復(fù)添加,到時(shí)候需要提醒;
2、推送量表
ps: php內(nèi)在進(jìn)行json解析時(shí)一定要記得加第二個(gè)參數(shù)true,否則會(huì)解析失??;
json_decode($json,true);
3、js獲取url參數(shù)(通過(guò)正則表達(dá)式)
function GetQueryString(name){
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if(r!=null)return unescape(r[2]); return null;
}
調(diào)用函數(shù)得到參數(shù):
// 調(diào)用方法
alert(GetQueryString("參數(shù)名1"));
alert(GetQueryString("參數(shù)名2"));
alert(GetQueryString("參數(shù)名3"));