diff --git a/README.md b/README.md index d526977..9768d95 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ WeChat: #微信公众号相关配置 用户端需要在微信内打开 此参数 个人信息登记、个人信息二维码展示、检测结果查询 -目前可以支持不使用微信平台来进行用户数据录入功能,添加了一套独立的用户登录功能(开关位于`UserLoginConfig.useWechet`),请使用nat_with_v2_system.sql数据库文件来兼容独立用户登录 +目前可以支持不使用微信平台来进行用户数据录入功能,添加了一套独立的用户登录功能(开关位于`UserLoginConfig.useWechet`),请使用nat.sql数据库文件来兼容独立用户登录功能和硬件节点信息功能 ### 采集端 @@ -72,6 +72,10 @@ enabled 并填入要授信的域名。 单位账号可进行本单位下的试管管理、任务管理和采集人员管理 +### 硬件节点 + +位于hardwareNode文件夹中,采用ESP12F Arduino开发,需要配置ssid和pwd,还有WebSocket的ip + ## 参考项目 https://github.com/dragonir/h5-scan-qrcode diff --git a/hardwareNode/sketch_mar20a/pcr_test_node/pcr_test_node.ino b/hardwareNode/sketch_mar20a/pcr_test_node/pcr_test_node.ino new file mode 100644 index 0000000..39230af --- /dev/null +++ b/hardwareNode/sketch_mar20a/pcr_test_node/pcr_test_node.ino @@ -0,0 +1,220 @@ +#include +#include +#include +#include +#include +#include + +#define OLED_ADDR 0x3C + +Adafruit_SSD1306 display(128, 64, &Wire, -1); + +unsigned long lastHeartbeatMillis = 0; +const unsigned long heartbeatInterval = 5000; // 5 seconds + +const char* ssid = "bydb123456789"; +const char* password = "12345678"; +const char* websocket_server = "localhost"; +const uint16_t websocket_port = 8888; +const char* websocket_path = "/node-endpoint"; + +WebSocketsClient webSocket; + +int material_tube_num = 0; +int staff_num = 0; +int material_swab_num = 0; +int material_alcohol_num = 0; + +void sendMessage(const char* opt) { + DynamicJsonDocument jsonDoc(1024); + jsonDoc["apiPort"] = opt; + JsonObject nodeLog = jsonDoc.createNestedObject("nodeLog"); + nodeLog["opt_id"] = 15; + nodeLog["material_tube_num"] = material_tube_num; + nodeLog["staff_num"] = staff_num; + nodeLog["material_swab_num"] = material_swab_num; + nodeLog["material_alcohol_num"] = material_alcohol_num; + String jsonString; + serializeJson(jsonDoc, jsonString); + webSocket.sendTXT(jsonString); +} +void updateBaseInfoDisplay(){ + setDisplayText(">>PCR TEST SYSTEM<<"); + addDisplayText(("Stuff Num:" + std::to_string(staff_num)).c_str(), false); + addDisplayText(("Swab Num:" + std::to_string(material_swab_num)).c_str(), false); + addDisplayText(("Tube Num:" + std::to_string(material_tube_num)).c_str(), false); + addDisplayText(("Alcohol Num:" + std::to_string(material_alcohol_num)).c_str(), false); +} + +void countDown(int seconds, void (*callback)()) { + int remainingSeconds = seconds; + + while (remainingSeconds > 0) { + Serial.println(remainingSeconds); + delay(1000); + remainingSeconds--; + } + + if (callback != nullptr) { + callback(); + } +} + +void parsingMessage(const char* msg){ + DynamicJsonDocument jsonDoc(1024); + DeserializationError error = deserializeJson(jsonDoc, msg); + if (error) { + Serial.println("Failed to parse JSON"); + return; + } + const char* apiPort = jsonDoc["apiPort"]; // "sync_data" + if (strcmp(apiPort, "sync_data") == 0) { + JsonObject nodeLog = jsonDoc["nodeLog"]; + material_tube_num = nodeLog["material_tube_num"]; + staff_num = nodeLog["staff_num"]; + material_swab_num = nodeLog["material_swab_num"]; + material_alcohol_num = nodeLog["material_alcohol_num"]; + updateBaseInfoDisplay(); + } + if (strcmp(apiPort, "instruction") == 0){ + int Instruction = jsonDoc["instruction"]; + addDisplayText(("Receive Instruction "+std::to_string(Instruction)).c_str(), true); + countDown(5,updateBaseInfoDisplay); + } +} + +void sendHeartbeatMessage() { + StaticJsonDocument<64> jsonDoc; + jsonDoc["apiPort"] = "heartbeat"; + String message; + serializeJson(jsonDoc, message); + webSocket.sendTXT(message); +} +int textStarY = 0; +void setDisplayText(const char* text){ + display.clearDisplay(); + textStarY = 0; + display.setTextSize(1); + display.setTextColor(WHITE); + display.setCursor(getTextCenterX(text), textStarY); + display.println(text); + display.display(); +} + +void addDisplayText(const char* text,bool isCentered){ + textStarY += 8; + if (isCentered) { + display.setCursor(getTextCenterX(text), textStarY); + } else { + display.setCursor(0, textStarY); + } + display.println(text); + display.display(); +} + +int getTextCenterX(const char* text) { + int textLength = strlen(text) * 1 * 6; + int padding = (display.width() - textLength) / 2; + return padding; +} + +void webSocketEvent(WStype_t type, uint8_t *payload, size_t length) { + switch (type) { + case WStype_DISCONNECTED: + Serial.printf("[WSc] Disconnected!\n"); + digitalWrite(LED_BUILTIN, HIGH); + break; + case WStype_CONNECTED: + Serial.printf("[WSc] Connected to url: %s\n", payload); + sendMessage("RoL"); + digitalWrite(LED_BUILTIN, LOW); + break; + case WStype_TEXT: + Serial.printf("[WSc] Received text: %s\n", payload); + parsingMessage((const char*)payload); + break; + case WStype_BIN: + Serial.printf("[WSc] Received binary data\n"); + break; + } +} +void setup() { + //init pin + pinMode(LED_BUILTIN, OUTPUT); + pinMode(D0, INPUT_PULLDOWN_16); + pinMode(D6, INPUT_PULLUP); + pinMode(D7, INPUT_PULLUP); + pinMode(D8, INPUT_PULLUP); + // + Serial.begin(115200); + display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR); + randomSeed(analogRead(0)); + Serial.setDebugOutput(true); + setDisplayText(">>PCR TEST SYSTEM<<"); + + Serial.println(); + Serial.println(); + Serial.print("Connecting to "); + Serial.println(ssid); + + WiFi.begin(ssid, password); + + while (WiFi.status() != WL_CONNECTED) { + delay(500); + Serial.print("."); + } + Serial.println(""); + Serial.println("WiFi connected"); + Serial.println("IP address: "); + Serial.println(WiFi.localIP()); + + webSocket.begin(websocket_server, websocket_port,websocket_path); + digitalWrite(LED_BUILTIN, HIGH); + webSocket.onEvent(webSocketEvent); + + setDisplayText(">>PCR TEST SYSTEM<<"); +} + +void loop() { + webSocket.loop(); + + //心跳包 + if (millis() - lastHeartbeatMillis > heartbeatInterval) { + sendHeartbeatMessage(); + lastHeartbeatMillis = millis(); + } + + int buttonMaterialTubeNum = digitalRead(D0);//material_tube_num + int buttonStaffNum = digitalRead(D6);//staff_num + int buttonMaterialSwabNum = digitalRead(D7);//material_swab_num + int buttonMaterialAlcoholNnum = digitalRead(D8);//material_alcohol_num + + if (buttonMaterialTubeNum == HIGH) { + Serial.println("buttonMaterialTubeNum"); + material_tube_num = random(1, 10001); + sendMessage("material_tube_num"); + delay(1000); + } + + if (buttonStaffNum == LOW) { + Serial.println("buttonStaffNum"); + staff_num = random(1, 10001); + sendMessage("staff_num"); + delay(1000); + } + + if (buttonMaterialSwabNum == LOW) { + Serial.println("buttonMaterialSwabNum"); + material_swab_num = random(1, 10001); + sendMessage("material_swab_num"); + delay(1000); + } + + if (buttonMaterialAlcoholNnum == HIGH) { + Serial.println("buttonMaterialAlcoholNnum"); + material_alcohol_num = random(1, 10001); + sendMessage("material_alcohol_num"); + delay(1000); + } + +} diff --git a/nat.sql b/nat.sql index 2c9f20d..fd30e81 100644 --- a/nat.sql +++ b/nat.sql @@ -1,46 +1,137 @@ -/* - Navicat Premium Data Transfer +-- MySQL dump 10.13 Distrib 5.5.62, for Linux (x86_64) +-- +-- Host: localhost Database: nat +-- ------------------------------------------------------ +-- Server version 5.5.62-log - Source Server : centos.kwok.fun - Source Server Type : MySQL - Source Server Version : 50650 - Source Host : centos.kwok.fun:3306 - Source Schema : nat +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - Target Server Type : MySQL - Target Server Version : 50650 - File Encoding : 65001 +-- +-- Table structure for table `job` +-- - Date: 17/01/2022 16:30:36 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for job --- ---------------------------- DROP TABLE IF EXISTS `job`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `job` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) DEFAULT NULL, `groupId` int(11) DEFAULT NULL, `status` tinyint(4) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Records of job --- ---------------------------- -BEGIN; -INSERT INTO `job` VALUES (6, 'XX小区1月17日', 8, 0); -INSERT INTO `job` VALUES (7, 'XXX小区1月18日', 8, 0); -COMMIT; - --- ---------------------------- --- Table structure for systemuser --- ---------------------------- +) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `job` +-- + +LOCK TABLES `job` WRITE; +/*!40000 ALTER TABLE `job` DISABLE KEYS */; +INSERT INTO `job` VALUES (6,'XX小区1月17日',8,1),(7,'XXX小区1月18日',8,0),(8,'测试测试',8,0),(9,'123123',13,1),(10,'一号测试',13,0),(11,'采集东西-1',13,0); +/*!40000 ALTER TABLE `job` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `node_log` +-- + +DROP TABLE IF EXISTS `node_log`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `node_log` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `session_id` varchar(100) DEFAULT NULL, + `group_id` int(11) DEFAULT NULL, + `opt_id` int(11) NOT NULL, + `material_tube_num` int(11) DEFAULT NULL, + `staff_num` int(11) DEFAULT NULL, + `material_swab_num` int(11) DEFAULT NULL, + `material_alcohol_num` int(11) DEFAULT NULL, + `last_time` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `node_log_un` (`opt_id`) +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `node_log` +-- + +LOCK TABLES `node_log` WRITE; +/*!40000 ALTER TABLE `node_log` DISABLE KEYS */; +INSERT INTO `node_log` VALUES (6,'',NULL,14,NULL,NULL,NULL,NULL,'2023-04-03 20:50:58'),(7,'',NULL,15,6973,3097,462,3311,'2023-05-06 11:26:48'); +/*!40000 ALTER TABLE `node_log` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `system_v2_uer_record` +-- + +DROP TABLE IF EXISTS `system_v2_uer_record`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `system_v2_uer_record` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_name` varchar(255) NOT NULL, + `idcardnum` varchar(18) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `system_v2_uer_record_un` (`idcardnum`) +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `system_v2_uer_record` +-- + +LOCK TABLES `system_v2_uer_record` WRITE; +/*!40000 ALTER TABLE `system_v2_uer_record` DISABLE KEYS */; +INSERT INTO `system_v2_uer_record` VALUES (1,'123','411111111111111112'),(2,'123','411111111111111113'),(5,'123','411111111111111110'),(7,'phc','411111111111111011'); +/*!40000 ALTER TABLE `system_v2_uer_record` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `system_v2_user` +-- + +DROP TABLE IF EXISTS `system_v2_user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `system_v2_user` ( + `id` int(11) NOT NULL, + `username` varchar(255) CHARACTER SET utf8 NOT NULL, + `password` varchar(255) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `system_v2_user_un` (`username`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `system_v2_user` +-- + +LOCK TABLES `system_v2_user` WRITE; +/*!40000 ALTER TABLE `system_v2_user` DISABLE KEYS */; +INSERT INTO `system_v2_user` VALUES (1,'123','123'),(7,'phc','phc'); +/*!40000 ALTER TABLE `system_v2_user` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `systemuser` +-- + DROP TABLE IF EXISTS `systemuser`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `systemuser` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(255) DEFAULT NULL, @@ -49,24 +140,26 @@ CREATE TABLE `systemuser` ( `role` varchar(255) DEFAULT NULL, `groupid` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Records of systemuser --- ---------------------------- -BEGIN; -INSERT INTO `systemuser` VALUES (2, 'admin', 'e10adc3949ba59abbe56e057f20f883e', '2022-01-17 16:22:20', '0', NULL); -INSERT INTO `systemuser` VALUES (8, '医院A', 'e10adc3949ba59abbe56e057f20f883e', '2022-01-17 16:04:19', '1', NULL); -INSERT INTO `systemuser` VALUES (9, '采集员A', 'e10adc3949ba59abbe56e057f20f883e', '2022-01-17 15:59:23', '2', 8); -INSERT INTO `systemuser` VALUES (10, '医院B', 'e10adc3949ba59abbe56e057f20f883e', NULL, '1', NULL); -INSERT INTO `systemuser` VALUES (11, '采集员A2', 'e10adc3949ba59abbe56e057f20f883e', NULL, '2', 8); -INSERT INTO `systemuser` VALUES (12, '采集员B', 'e10adc3949ba59abbe56e057f20f883e', NULL, '2', 10); -COMMIT; - --- ---------------------------- --- Table structure for tube --- ---------------------------- +) ENGINE=InnoDB AUTO_INCREMENT=98 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `systemuser` +-- + +LOCK TABLES `systemuser` WRITE; +/*!40000 ALTER TABLE `systemuser` DISABLE KEYS */; +INSERT INTO `systemuser` VALUES (2,'admin','e10adc3949ba59abbe56e057f20f883e','2023-05-06 10:52:09','0',NULL),(8,'医院A','e10adc3949ba59abbe56e057f20f883e','2022-01-17 16:04:19','1',NULL),(9,'采集员A','e10adc3949ba59abbe56e057f20f883e','2023-05-06 11:09:17','2',8),(10,'医院B','e10adc3949ba59abbe56e057f20f883e',NULL,'1',NULL),(11,'采集员A2','e10adc3949ba59abbe56e057f20f883e',NULL,'2',8),(12,'采集员B','e10adc3949ba59abbe56e057f20f883e','2023-04-01 15:05:40','2',10),(13,'新余医院','e10adc3949ba59abbe56e057f20f883e',NULL,'1',NULL),(14,'00','c6f057b86584942e415435ffb1fa93d4','2023-03-12 23:30:57','2',13),(15,'node-1','e10adc3949ba59abbe56e057f20f883e','2023-03-20 21:47:53','2',13),(97,'node-xy','e10adc3949ba59abbe56e057f20f883e',NULL,'2',13); +/*!40000 ALTER TABLE `systemuser` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `tube` +-- + DROP TABLE IF EXISTS `tube`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `tube` ( `tubeId` varchar(255) NOT NULL, `operatorId` int(11) DEFAULT NULL, @@ -77,39 +170,50 @@ CREATE TABLE `tube` ( `status` tinyint(4) DEFAULT NULL, PRIMARY KEY (`tubeId`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `tube` +-- + +LOCK TABLES `tube` WRITE; +/*!40000 ALTER TABLE `tube` DISABLE KEYS */; +INSERT INTO `tube` VALUES ('123456',9,8,7,'2023-05-05 22:12:51',NULL,0),('Kwok666',9,8,6,'2022-01-17 15:59:57','2023-03-12 00:11:45',1),('试管1',14,13,9,'2023-03-12 23:31:57','2023-03-12 23:32:50',2); +/*!40000 ALTER TABLE `tube` ENABLE KEYS */; +UNLOCK TABLES; --- ---------------------------- --- Records of tube --- ---------------------------- -BEGIN; -INSERT INTO `tube` VALUES ('Kwok666', 9, 8, 6, '2022-01-17 15:59:57', '2022-01-17 16:04:35', 1); -COMMIT; +-- +-- Table structure for table `tubeuser` +-- --- ---------------------------- --- Table structure for tubeuser --- ---------------------------- DROP TABLE IF EXISTS `tubeuser`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `tubeuser` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `tubeId` varchar(255) DEFAULT NULL, `idcardnum` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Records of tubeuser --- ---------------------------- -BEGIN; -INSERT INTO `tubeuser` VALUES (21, 'Kwok666', '411111111111111114'); -INSERT INTO `tubeuser` VALUES (22, 'Kwok666', '411111111111111113'); -INSERT INTO `tubeuser` VALUES (23, 'Kwok666', '411111111111111112'); -INSERT INTO `tubeuser` VALUES (24, 'Kwok666', '411111111111111111'); -COMMIT; - --- ---------------------------- --- Table structure for userinfo --- ---------------------------- +) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `tubeuser` +-- + +LOCK TABLES `tubeuser` WRITE; +/*!40000 ALTER TABLE `tubeuser` DISABLE KEYS */; +INSERT INTO `tubeuser` VALUES (21,'Kwok666','411111111111111114'),(22,'Kwok666','411111111111111113'),(23,'Kwok666','411111111111111112'),(24,'Kwok666','411111111111111111'),(25,'试管1','111111111111111111'),(26,'123456','411111111111111011'); +/*!40000 ALTER TABLE `tubeuser` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `userinfo` +-- + DROP TABLE IF EXISTS `userinfo`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `userinfo` ( `idcardnum` varchar(18) NOT NULL, `tname` varchar(255) NOT NULL, @@ -119,35 +223,58 @@ CREATE TABLE `userinfo` ( `address` varchar(255) NOT NULL, PRIMARY KEY (`idcardnum`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `userinfo` +-- + +LOCK TABLES `userinfo` WRITE; +/*!40000 ALTER TABLE `userinfo` DISABLE KEYS */; +INSERT INTO `userinfo` VALUES ('360555555555555555','海晨',1,'1234564567899','内蒙古自治区/呼和浩特市/托克托县','一个地方'),('411111111111111011','mac',1,'11111111111','北京市/北京市/丰台区','捍卫者路'),('411111111111111100','探路者',1,'11111111111','澳门特别行政区/离岛/圣方济各堂区','破碎月亮'),('411111111111111110','Apex',1,'11111111111','甘肃省/甘南藏族自治州/临潭县','捍卫者路'),('411111111111111112','李四',1,'13888888888','北京市/北京市/东城区','XXX小区'),('411111111111111113','王五',1,'13222222222','北京市/北京市/东城区','XX小区'),('411111111111111114','赵六',1,'13333333333','北京市/北京市/东城区','Xx小区'),('411111111111188888','海晨',1,'11111111112','山西省/太原市/小店区','一条路'); +/*!40000 ALTER TABLE `userinfo` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `wechatuser` +-- --- ---------------------------- --- Records of userinfo --- ---------------------------- -BEGIN; -INSERT INTO `userinfo` VALUES ('411111111111111111', '张三', 1, '18888888888', '北京市/北京市/东城区', 'XXX小区5号楼2单元1601'); -INSERT INTO `userinfo` VALUES ('411111111111111112', '李四', 1, '13888888888', '北京市/北京市/东城区', 'XXX小区'); -INSERT INTO `userinfo` VALUES ('411111111111111113', '王五', 1, '13222222222', '北京市/北京市/东城区', 'XX小区'); -INSERT INTO `userinfo` VALUES ('411111111111111114', '赵六', 1, '13333333333', '北京市/北京市/东城区', 'Xx小区'); -COMMIT; - --- ---------------------------- --- Table structure for wechatuser --- ---------------------------- DROP TABLE IF EXISTS `wechatuser`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `wechatuser` ( `openid` varchar(255) DEFAULT NULL, `idcardnum` varchar(18) DEFAULT NULL, `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `wechatuser` +-- + +LOCK TABLES `wechatuser` WRITE; +/*!40000 ALTER TABLE `wechatuser` DISABLE KEYS */; +INSERT INTO `wechatuser` VALUES ('oukBP58WB6rvw1qD-m6tJWyr7c5A','411111111111111111',17),('oukBP58WB6rvw1qD-m6tJWyr7c5A','411111111111111112',18),('oukBP58WB6rvw1qD-m6tJWyr7c5A','411111111111111113',19); +/*!40000 ALTER TABLE `wechatuser` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Dumping events for database 'nat' +-- + +-- +-- Dumping routines for database 'nat' +-- +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; --- ---------------------------- --- Records of wechatuser --- ---------------------------- -BEGIN; -INSERT INTO `wechatuser` VALUES ('oukBP58WB6rvw1qD-m6tJWyr7c5A', '411111111111111111', 17); -INSERT INTO `wechatuser` VALUES ('oukBP58WB6rvw1qD-m6tJWyr7c5A', '411111111111111112', 18); -INSERT INTO `wechatuser` VALUES ('oukBP58WB6rvw1qD-m6tJWyr7c5A', '411111111111111113', 19); -COMMIT; +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -SET FOREIGN_KEY_CHECKS = 1; +-- Dump completed on 2023-05-07 19:56:51 diff --git a/nat_with_v2_system.sql b/nat_with_v2_system.sql deleted file mode 100644 index 9bb5474..0000000 --- a/nat_with_v2_system.sql +++ /dev/null @@ -1,248 +0,0 @@ --- MySQL dump 10.13 Distrib 8.0.24, for Linux (x86_64) --- --- Host: localhost Database: nat --- ------------------------------------------------------ --- Server version 8.0.24 - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!50503 SET NAMES utf8mb4 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - --- --- Table structure for table `job` --- - -DROP TABLE IF EXISTS `job`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `job` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(255) DEFAULT NULL, - `groupId` int DEFAULT NULL, - `status` tinyint DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb3; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `job` --- - -LOCK TABLES `job` WRITE; -/*!40000 ALTER TABLE `job` DISABLE KEYS */; -INSERT INTO `job` VALUES (6,'XX小区1月17日',8,1),(7,'XXX小区1月18日',8,0),(8,'测试测试',8,0),(9,'123123',13,0); -/*!40000 ALTER TABLE `job` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `system_v2_uer_record` --- - -DROP TABLE IF EXISTS `system_v2_uer_record`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `system_v2_uer_record` ( - `id` int NOT NULL AUTO_INCREMENT, - `user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `idcardnum` varchar(18) COLLATE utf8mb4_general_ci NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `system_v2_uer_record_un` (`idcardnum`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `system_v2_uer_record` --- - -LOCK TABLES `system_v2_uer_record` WRITE; -/*!40000 ALTER TABLE `system_v2_uer_record` DISABLE KEYS */; -INSERT INTO `system_v2_uer_record` VALUES (1,'123','411111111111111112'),(2,'123','411111111111111113'),(5,'123','411111111111111110'); -/*!40000 ALTER TABLE `system_v2_uer_record` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `system_v2_user` --- - -DROP TABLE IF EXISTS `system_v2_user`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `system_v2_user` ( - `id` int NOT NULL AUTO_INCREMENT, - `username` varchar(255) COLLATE utf8mb4_general_ci NOT NULL, - `password` varchar(255) COLLATE utf8mb4_general_ci NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `system_v2_user_un` (`username`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='第二套登录系统表'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `system_v2_user` --- - -LOCK TABLES `system_v2_user` WRITE; -/*!40000 ALTER TABLE `system_v2_user` DISABLE KEYS */; -INSERT INTO `system_v2_user` VALUES (1,'123','123'); -/*!40000 ALTER TABLE `system_v2_user` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `systemuser` --- - -DROP TABLE IF EXISTS `systemuser`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `systemuser` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `username` varchar(255) DEFAULT NULL, - `password` varchar(255) DEFAULT NULL, - `lastlogintime` datetime DEFAULT NULL, - `role` varchar(255) DEFAULT NULL, - `groupid` int DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb3; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `systemuser` --- - -LOCK TABLES `systemuser` WRITE; -/*!40000 ALTER TABLE `systemuser` DISABLE KEYS */; -INSERT INTO `systemuser` VALUES (2,'admin','e10adc3949ba59abbe56e057f20f883e','2023-03-12 23:32:29','0',NULL),(8,'医院A','e10adc3949ba59abbe56e057f20f883e','2022-01-17 16:04:19','1',NULL),(9,'采集员A','e10adc3949ba59abbe56e057f20f883e','2023-03-12 22:48:34','2',8),(10,'医院B','e10adc3949ba59abbe56e057f20f883e',NULL,'1',NULL),(11,'采集员A2','e10adc3949ba59abbe56e057f20f883e',NULL,'2',8),(12,'采集员B','e10adc3949ba59abbe56e057f20f883e',NULL,'2',10),(13,'新余医院','e10adc3949ba59abbe56e057f20f883e',NULL,'1',NULL),(14,'00','c6f057b86584942e415435ffb1fa93d4','2023-03-12 23:30:57','2',13); -/*!40000 ALTER TABLE `systemuser` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `tube` --- - -DROP TABLE IF EXISTS `tube`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `tube` ( - `tubeId` varchar(255) NOT NULL, - `operatorId` int DEFAULT NULL, - `groupId` int DEFAULT NULL, - `jobId` int DEFAULT NULL, - `startTime` datetime DEFAULT NULL, - `endTime` datetime DEFAULT NULL, - `status` tinyint DEFAULT NULL, - PRIMARY KEY (`tubeId`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `tube` --- - -LOCK TABLES `tube` WRITE; -/*!40000 ALTER TABLE `tube` DISABLE KEYS */; -INSERT INTO `tube` VALUES ('Kwok666',9,8,6,'2022-01-17 15:59:57','2023-03-12 00:11:45',1),('试管1',14,13,9,'2023-03-12 23:31:57','2023-03-12 23:32:50',2); -/*!40000 ALTER TABLE `tube` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `tubeuser` --- - -DROP TABLE IF EXISTS `tubeuser`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `tubeuser` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `tubeId` varchar(255) DEFAULT NULL, - `idcardnum` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb3; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `tubeuser` --- - -LOCK TABLES `tubeuser` WRITE; -/*!40000 ALTER TABLE `tubeuser` DISABLE KEYS */; -INSERT INTO `tubeuser` VALUES (21,'Kwok666','411111111111111114'),(22,'Kwok666','411111111111111113'),(23,'Kwok666','411111111111111112'),(24,'Kwok666','411111111111111111'),(25,'试管1','111111111111111111'); -/*!40000 ALTER TABLE `tubeuser` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `userinfo` --- - -DROP TABLE IF EXISTS `userinfo`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `userinfo` ( - `idcardnum` varchar(18) NOT NULL, - `tname` varchar(255) NOT NULL, - `sex` tinyint NOT NULL, - `phonenum` varchar(255) NOT NULL, - `area` varchar(255) NOT NULL, - `address` varchar(255) NOT NULL, - PRIMARY KEY (`idcardnum`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `userinfo` --- - -LOCK TABLES `userinfo` WRITE; -/*!40000 ALTER TABLE `userinfo` DISABLE KEYS */; -INSERT INTO `userinfo` VALUES ('411111111111111100','探路者',1,'11111111111','澳门特别行政区/离岛/圣方济各堂区','破碎月亮'),('411111111111111110','Apex',1,'11111111111','甘肃省/甘南藏族自治州/临潭县','捍卫者路'),('411111111111111112','李四',1,'13888888888','北京市/北京市/东城区','XXX小区'),('411111111111111113','王五',1,'13222222222','北京市/北京市/东城区','XX小区'),('411111111111111114','赵六',1,'13333333333','北京市/北京市/东城区','Xx小区'); -/*!40000 ALTER TABLE `userinfo` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `wechatuser` --- - -DROP TABLE IF EXISTS `wechatuser`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!50503 SET character_set_client = utf8mb4 */; -CREATE TABLE `wechatuser` ( - `openid` varchar(255) DEFAULT NULL, - `idcardnum` varchar(18) DEFAULT NULL, - `id` int NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb3; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `wechatuser` --- - -LOCK TABLES `wechatuser` WRITE; -/*!40000 ALTER TABLE `wechatuser` DISABLE KEYS */; -INSERT INTO `wechatuser` VALUES ('oukBP58WB6rvw1qD-m6tJWyr7c5A','411111111111111111',17),('oukBP58WB6rvw1qD-m6tJWyr7c5A','411111111111111112',18),('oukBP58WB6rvw1qD-m6tJWyr7c5A','411111111111111113',19); -/*!40000 ALTER TABLE `wechatuser` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Dumping events for database 'nat' --- - --- --- Dumping routines for database 'nat' --- -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - --- Dump completed on 2023-03-19 9:43:27 diff --git a/natserver/src/main/java/fun/kwok/natserver/NatserverApplication.java b/natserver/src/main/java/fun/kwok/natserver/NatserverApplication.java index 3307144..16f2bd2 100644 --- a/natserver/src/main/java/fun/kwok/natserver/NatserverApplication.java +++ b/natserver/src/main/java/fun/kwok/natserver/NatserverApplication.java @@ -1,16 +1,29 @@ package fun.kwok.natserver; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; import org.springframework.scheduling.annotation.EnableScheduling; +import javax.sql.DataSource; + @SpringBootApplication @EnableScheduling -public class NatserverApplication { +public class NatserverApplication implements CommandLineRunner { + + + @Autowired + DataSource dataSource; public static void main(String[] args) { SpringApplication.run(NatserverApplication.class, args); } + @Override + public void run(String... args) throws Exception { + System.out.println("数据源连接成功:" + dataSource.getConnection()); + } + } diff --git a/natserver/src/main/resources/application.yaml b/natserver/src/main/resources/application.yaml index 165a482..b1ee0f0 100644 --- a/natserver/src/main/resources/application.yaml +++ b/natserver/src/main/resources/application.yaml @@ -6,9 +6,9 @@ spring: main: allow-circular-references: true datasource: - url: jdbc:mysql://192.168.157.131:3306/nat?serverTimezone=GMT%2B8 + url: jdbc:mysql://localhost:3306/nat?serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&useSSL=false username: nat - password: ZAGeeCnAAnzyxGNj + password: f7m5re6i43p2hcJx driver-class-name: com.mysql.cj.jdbc.Driver server: port: 8888 diff --git a/natweb/public/config.js b/natweb/public/config.js index 5743e76..f6ea416 100644 --- a/natweb/public/config.js +++ b/natweb/public/config.js @@ -1,6 +1,6 @@ const GlobeConfig = { appid: "wxf44ef71e1634358a", //微信公众平台appid - baseURL: "http://192.168.0.108:8888" + baseURL: "http://localhost:8888" } const UserLoginConfig = { useWechet: false diff --git a/natweb/src/components/admin/common/Header.vue b/natweb/src/components/admin/common/Header.vue index 4a8e952..23ae916 100644 --- a/natweb/src/components/admin/common/Header.vue +++ b/natweb/src/components/admin/common/Header.vue @@ -5,7 +5,7 @@ - +