1.一体机排号:
1.1接口应用场景
一体机点击取号,扫描二维码,获取登记台排号小票
1.2接口信息
http://localhost:8080/vaccinate/api/bsRegQueue/getRegQueue?unicode=9999999999&description=test&localCode2=3609830102
参数说明:
unicode:儿童编码(二维码扫描出来的18儿童编码) Varchar(18) 不可为空
localCode2:10位门诊编号 Varchar(10) 不可为空
//成功返回结果
{ "code":"200", --成功 "msg":"排号成功", --成功信息 "result":true, --排号结果 "success":true, --排号成功 "data":{ --排号信息 "id":"c97d41608dee441bb8dd2b7707b1f331", "isNewRecord":false, "localCode":"3609830102", "localCode2":"3609830102", // "createDate":"2019-05-06 08:53:39", "updateDate":"2019-05-06 08:53:39", "queue":"A001", -- 排号号码 "unicode":"360983010220180995", --唯一标识(儿童编码) "status":"0", --状态 0:未被叫号 1:过号 "wait":0, --等待人数 "name":"万里", //儿童姓名 "childcode":"360983010220180995", --儿童编码 "sort":10, "type":"A" --A临时号 V预约号 } }
//失败返回结果 { "code": "415", --编码 "msg": "当前凭证不可重复排号哦!", --失败信息 "result": false, "success": false }
Msg几种情况:
1 缺少排号凭证 --参数缺失
1 缺少站点编码 --参数缺失
2 二维码无效,请用接种证首页二维码扫描 --二维码无效
3 自助取号不在服务时间内 --可以修改服务时间
4 当前凭证不可重复排号哦! -- unicode重复使用
2.登记台
2.1.登记台叫号
2.2登记台下一号
接口:synchronized public JSONMessage nextRegQueue(BsRegQueue bsRegQueue) {}
之后同样调用叫号接口方法
2.3插入数据到阿里的消息队列MQ
登记台叫号保存数据格式?
//参数说明: 第一个表示Message 所属的 Topic
第二个表示Message 标签
第三个表示消息体
boolean sendMqttMsg(String topic, String tag, String txt){
Message msg = new Message( topic, "MQ2MQTT", txt.getBytes("UTF-8"));
}
//数据格式
topic |
qbkj_queue_mqtt |
备注 |
tag |
MQ2MQTT |
|
txt |
格式如: { "reg":[ { "room":"1", "no":"A001", "call":"1", "childname":"王小" } ], "childname":"王小", "localcode":"3609830102", "roomcode":"1", "type":"1", "queueno":"A001" } |
room/roomcode: 1 登记台1 2 登记台2 3 登记台3 4 登记台4 5 登记台5 6 登记台6 localcode:门诊编码 |
3.接种台
3.1接种台叫号
接口: public @ResponseBody String callNumber(Quene quene) {
3.2 接种台下一号
接种台页面jsp:inoculateConsole.jsp
下一号是在前端处理获取到队列quene,再调用上面的叫号接口
3.3插入数据到阿里的消息队列MQ
登记台叫号保存数据格式?
//参数说明: 第一个表示Message 所属的 Topic
第二个表示Message 标签
第三个表示消息体
boolean sendMqttMsg(String topic, String tag, String txt){
Message msg = new Message( topic, "MQ2MQTT", txt.getBytes("UTF-8"));
}
//保存数据格式:
topic: qbkj_queue_mqtt
tag: MQ2MQTT
txt:
{ "childname":"余一", "localcode":"3609830102", "roomcode":"1", "nextChildname":"", "type":"2", "queue":[ { "code":"1", "list":[ { "queueno":"1005", "childid":"360983010220180999", "childname":"余一", "roomcode":"1", "ispass":"N" } ] }, { "code":"2", "list":[ { "queueno":"2003", "childid":"360983010220180912", "childname":"万一", "roomcode":"2", "ispass":"N" } ] }, { "code":"3", "list":[ ] }, { "code":"4", "list":[ ] }, { "code":"5", "list":[ ] }, { "code":"djt", "list":[ ] } ], "queueno":"1005", "nextQueueno":"" }
说明:
roomcode: 1 接种台1
2 接种台2
3 接种台3
4 接种台4
5 接种台5
queueno:排号编码
childname:儿童姓名
localcode:门诊编码
4.mq订阅:ConsumerTest.java 订阅
package com.thinkgem.jeesite.test; import java.util.Properties; import com.aliyun.openservices.ons.api.Action; import com.aliyun.openservices.ons.api.ConsumeContext; import com.aliyun.openservices.ons.api.Consumer; import com.aliyun.openservices.ons.api.Message; import com.aliyun.openservices.ons.api.MessageListener; import com.aliyun.openservices.ons.api.ONSFactory; import com.aliyun.openservices.ons.api.PropertyKeyConst; public class ConsumerTest { public static void main(String[] args){ Properties properties = new Properties(); // 您在 MQ 控制台创建的 Consumer ID properties.put(PropertyKeyConst.ConsumerId, "CID_qbkj_queue"); // 鉴权用 AccessKey,在阿里云服务器管理控制台创建 properties.put(PropertyKeyConst.AccessKey, "LTAIiPuk24iD3klb"); // 鉴权用 SecretKey,在阿里云服务器管理控制台创建 properties.put(PropertyKeyConst.SecretKey, "nRk5Y1R9zdjEm9p5QdkA54pAPQrrId"); // 设置 TCP 接入域名(此处以公共云生产环境为例) properties.put(PropertyKeyConst.ONSAddr, "http://onsaddr-internet.aliyun.com/rocketmq/nsaddr4client-internet"); // 集群订阅方式 (默认) // properties.put(PropertyKeyConst.MessageModel, PropertyValueConst.CLUSTERING); // 广播订阅方式 // properties.put(PropertyKeyConst.MessageModel, PropertyValueConst.BROADCASTING); Consumer consumer = ONSFactory.createConsumer(properties); consumer.subscribe("qbkj_queue_mqtt", "MQ2MQTT", new MessageListener() { //订阅多个 Tag MQ2MQTT 3609830102 public Action consume(Message message, ConsumeContext context) { System.out.println("Receive: " + new String(message.getBody())); return Action.CommitMessage; } }); // //订阅另外一个 Topic // consumer.subscribe("TopicTestMQ-Other", "*", new MessageListener() { //订阅全部 Tag // public Action consume(Message message, ConsumeContext context) { // System.out.println("Receive: " + message); // return Action.CommitMessage; // } // }); consumer.start(); System.out.println("Consumer Started"); } }
5.RocketMQ控制台