|
@@ -9,11 +9,120 @@ $( function(){
|
|
|
|
|
|
printClock();
|
|
printClock();
|
|
|
|
|
|
- $( "input[type='tel']" ).on("keydown", function() {
|
|
|
|
- onlyNumber();
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * 블루투스 기기연동 공통 이벤트 처리 health1, 2, 3, 4.jsp
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ $( "span.insert-type" ).on( "click", function(){
|
|
|
|
+ var $this = $( this );
|
|
|
|
+
|
|
|
|
+ if( !$this.hasClass( "readonly" ) ) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var checkbt = $this.siblings('.switch').find('.checkbt');
|
|
|
|
+
|
|
|
|
+ if( $this.hasClass( "device" ) ){
|
|
|
|
+ checkbt.prop('checked', true );
|
|
|
|
+ } else if ( $this.hasClass( "direct" ) ) {
|
|
|
|
+ checkbt.prop('checked', false );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ bluetoothCheck();
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ $( "#bluetooth-checkbox" ).on( "change", function(){
|
|
|
|
+ bluetoothCheck();
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ $( "span.insert-type" ).toggleClass( "readonly", true );
|
|
|
|
+
|
|
|
|
+ if( typeof phrLocalStorageName != "undefined" ) {
|
|
|
|
+ if( localStorage.getItem( phrLocalStorageName ) == "true" ) {
|
|
|
|
+ $( "span.insert-type.device" ).click();
|
|
|
|
+ } else {
|
|
|
|
+ $( "span.insert-type.direct" ).click();
|
|
|
|
+ };
|
|
|
|
+ };
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+function bluetoothCheck(){
|
|
|
|
+ var bluetoothCheck = $( "#bluetooth-checkbox" ).is( ":checked" );
|
|
|
|
+
|
|
|
|
+ $( "span.insert-type" ).toggleClass( "readonly", true );
|
|
|
|
+
|
|
|
|
+ if( bluetoothCheck === true ){
|
|
|
|
+ //기기연동
|
|
|
|
+ $( "span.insert-type.device" ).toggleClass( "readonly", false );
|
|
|
|
+ $( "div.data input" ).prop( "readonly", true ).val( "" );
|
|
|
|
+
|
|
|
|
+ localStorage.setItem( phrLocalStorageName, "true" );
|
|
|
|
+
|
|
|
|
+ console.log( "기기연동 app 호출 : " + phrCallBackType );
|
|
|
|
+ phrValue( "getPhrValue", phrCallBackType );
|
|
|
|
+ } else {
|
|
|
|
+ //직접입력
|
|
|
|
+ $( "span.insert-type.direct" ).toggleClass( "readonly", false );
|
|
|
|
+ $( "div.data input" ).prop( "readonly", false ).val( "" );
|
|
|
|
+
|
|
|
|
+ localStorage.setItem( phrLocalStorageName, "false" );
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * App에서 호출하는 callbackFunction
|
|
|
|
+ * ex)getPhrValue( "temperature", val1, val2, val3 )
|
|
|
|
+ * 앱에서 javascript 호출
|
|
|
|
+ * - phrType :
|
|
|
|
+ * == 기기 연동화면 ==
|
|
|
|
+ * 측정메뉴로 이동시 해당하는 메뉴 tonative 정의
|
|
|
|
+ * currentDevice
|
|
|
|
+ * 혈당계 : bloodsugar
|
|
|
|
+ * 산소포화도 : oxysaturation
|
|
|
|
+ * 혈압계 : bloodpressure
|
|
|
|
+ * 체온계 : thermometer
|
|
|
|
+ * * 혈압/맥박수에서는 phrType이 무조건 bloodPressure 임
|
|
|
|
+ *
|
|
|
|
+ * - value1 : 체온, 산소포화도, 혈당, 혈압수축기
|
|
|
|
+ * - value2 : 혈압이완기
|
|
|
|
+ * - value3 : 맥박수
|
|
|
|
+ */
|
|
|
|
+function getPhrValue( phrType , value1, value2, value3 ) {
|
|
|
|
+ if( phrType == "thermometer" ) {
|
|
|
|
+ //체온
|
|
|
|
+ $( "input[name='temperature']" ).val( value1 ).prop( "readonly", true );
|
|
|
|
+
|
|
|
|
+ } else if( phrType == "bloodpressure" ){
|
|
|
|
+ //혈압, 맥박수
|
|
|
|
+ $( "input[name='bloodPressure']" ).val( value1 ).prop( "readonly", true );
|
|
|
|
+ $( "input[name='bloodPressure2']" ).val( value2 ).prop( "readonly", true );
|
|
|
|
+ $( "input[name='pulseRate']" ).val( value3 ).prop( "readonly", true );
|
|
|
|
+
|
|
|
|
+ } else if( phrType == "oxysaturation" ){
|
|
|
|
+ //산소포화도
|
|
|
|
+ $( "input[name='oxygenSaturation']" ).val( value1 ).prop( "readonly", true );
|
|
|
|
+
|
|
|
|
+ } else if( phrType == "bloodsugar" ){
|
|
|
|
+ //혈당
|
|
|
|
+ $( "input[name='bloodSugar']" ).val( value1 ).prop( "readonly", true );
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function phrValue(callbackFnName, phrType) {
|
|
|
|
+ var jsonMsg = {
|
|
|
|
+ "type":"command",
|
|
|
|
+ "functionType":"currentDevice",
|
|
|
|
+ "value" : {
|
|
|
|
+ "callbackFn" : callbackFnName,
|
|
|
|
+ "phrType" : phrType
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ toNative(jsonMsg);
|
|
|
|
+}
|
|
|
|
+
|
|
function printClock() {
|
|
function printClock() {
|
|
var currentDate = new Date(); // 현재시간
|
|
var currentDate = new Date(); // 현재시간
|
|
var calendar = currentDate.getFullYear() + "-" + (currentDate.getMonth()+1) + "-" + currentDate.getDate() // 현재 날짜
|
|
var calendar = currentDate.getFullYear() + "-" + (currentDate.getMonth()+1) + "-" + currentDate.getDate() // 현재 날짜
|