package com.zsy.hospital.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.zsy.hospital.mapper.HospitalSetMapper;
import com.zsy.hospital.mapper.ScheduleMapper;
import com.zsy.hospital.model.HospitalSet;
import com.zsy.hospital.model.Schedule;
import com.zsy.hospital.service.ApiService;
import com.zsy.hospital.util.BeanUtils;
import com.zsy.hospital.util.HttpRequestHelper;
import com.zsy.hospital.util.YyghException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.ConnectException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
@Service
@Slf4j
public class ApiServiceImpl implements ApiService {
@Autowired
private ScheduleMapper scheduleMapper;
@Autowired
private HospitalSetMapper hospitalSetMapper;
@Autowired
private ApiService apiService;
@Value("classpath:hospital.json")
private Resource hospitalResource;
@Override
public String getHoscode() {
HospitalSet hospitalSet = hospitalSetMapper.selectById(1);
return hospitalSet.getHoscode();
}
@Override
public String getSignKey() {
HospitalSet hospitalSet = hospitalSetMapper.selectById(1);
return hospitalSet.getSignKey();
}
private String getApiUrl() {
HospitalSet hospitalSet = hospitalSetMapper.selectById(1);
return hospitalSet.getApiUrl();
}
@Override
public JSONObject getHospital() {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("hoscode", this.getHoscode());
paramMap.put("timestamp", HttpRequestHelper.getTimestamp());
paramMap.put("sign", HttpRequestHelper.getSign(paramMap, this.getSignKey()));
JSONObject respone = HttpRequestHelper.sendRequest(paramMap, this.getApiUrl() + "/api/hosp/hospital/show");
System.out.println(respone.toJSONString());
if (null != respone && 200 == respone.getIntValue("code")) {
JSONObject jsonObject = respone.getJSONObject("data");
return jsonObject;
}
return null;
}
@Override
public boolean saveHospital(String data) {
JSONObject jsonObject = JSONObject.parseObject(data);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("hoscode", this.getHoscode());
paramMap.put("hosname", jsonObject.getString("hosname"));
paramMap.put("hostype", jsonObject.getString("hostype"));
paramMap.put("provinceCode", jsonObject.getString("provinceCode"));
paramMap.put("cityCode", jsonObject.getString("cityCode"));
paramMap.put("districtCode", jsonObject.getString("districtCode"));
paramMap.put("address", jsonObject.getString("address"));
paramMap.put("intro", jsonObject.getString("intro"));
paramMap.put("route", jsonObject.getString("route"));
//图片
paramMap.put("logoData", jsonObject.getString("logoData"));
JSONObject bookingRule = jsonObject.getJSONObject("bookingRule");
paramMap.put("bookingRule", bookingRule.toJSONString());
paramMap.put("timestamp", HttpRequestHelper.getTimestamp());
paramMap.put("sign", HttpRequestHelper.getSign(paramMap, this.getSignKey()));
JSONObject respone = HttpRequestHelper.sendRequest(paramMap, this.getApiUrl() + "/api/hosp/saveHospital");
System.out.println(respone.toJSONString());
if (null != respone && 200 == respone.getIntValue("code")) {
return true;
} else {
throw new YyghException(respone.getString("message"), 201);
}
}
@Override
public Map<String, Object> findDepartment(int pageNum, int pageSize) {
Map<String, Object> result = new HashMap();
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("hoscode", this.getHoscode());
//paramMap.put("depcode",depcode);
paramMap.put("page", pageNum);
paramMap.put("limit", pageSize);
paramMap.put("timestamp", HttpRequestHelper.getTimestamp());
paramMap.put("sign", HttpRequestHelper.getSign(paramMap, this.getSignKey()));
JSONObject respone = HttpRequestHelper.sendRequest(paramMap, this.getApiUrl() + "/api/hosp/department/list");
if (null != respone && 200 == respone.getIntValue("code")) {
JSONObject jsonObject = respone.getJSONObject("data");
result.put("total", jsonObject.getLong("totalElements"));
result.put("pageNum", pageNum);
result.put("list", jsonObject.getJSONArray("content"));
} else {
throw new YyghException(respone.getString("message"), 201);
}
return result;
}
@Override
public boolean saveDepartment(String data) {
JSONArray jsonArray = new JSONArray();
if (!data.startsWith("[")) {
JSONObject jsonObject = JSONObject.parseObject(data);
jsonArray.add(jsonObject);
} else {
jsonArray = JSONArray.parseArray(data);
}
for (int i = 0, len = jsonArray.size(); i < len; i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("hoscode", this.getHoscode());
paramMap.put("depcode", jsonObject.getString("depcode"));
paramMap.put("depname", jsonObject.getString("depname"));
paramMap.put("intro", jsonObject.getString("intro"));
paramMap.put("bigcode", jsonObject.getString("bigcode"));
paramMap.put("bigname", jsonObject.getString("bigname"));
paramMap.put("timestamp", HttpRequestHelper.getTimestamp());
paramMap.put("sign", HttpRequestHelper.getSign(paramMap, this.getSignKey()));
JSONObject respone = HttpRequestHelper.sendRequest(paramMap, this.getApiUrl() + "/api/hosp/saveDepartment");
System.out.println(respone.toJSONString());
if (null == respone || 200 != respone.getIntValue("code")) {
throw new YyghException(respone.getString("message"), 201);
}
}
return true;
}
@Override
public boolean removeDepartment(String depcode) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("hoscode", this.getHoscode());
paramMap.put("depcode", depcode);
paramMap.put("timestamp", HttpRequestHelper.getTimestamp());
paramMap.put("sign", HttpRequestHelper.getSign(paramMap, this.getSignKey()));
JSONObject respone = HttpRequestHelper.sendRequest(paramMap, this.getApiUrl() + "/api/hosp/department/remove");
System.out.println(respone.toJSONString());
if (null != respone && 200 == respone.getIntValue("code")) {
return true;
} else {
throw new YyghException(respone.getString("message"), 201);
}
}
@Override
public Map<String, Object> findSchedule(int pageNum, int pageSize) {
Map<String, Object> result = new HashMap();
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("hoscode", this.getHoscode());
//paramMap.put("depcode",depcode);
paramMap.put("page", pageNum);
paramMap.put("limit", pageSize);
paramMap.put("timestamp", HttpRequestHelper.getTimestamp());
paramMap.put("sign", HttpRequestHelper.getSign(paramMap, this.getSignKey()));
JSONObject respone = HttpRequestHelper.sendRequest(paramMap, this.ge
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
本项目是基于Java的尚医通线上医院预约挂号系统设计源码,共有631个文件,包括174个Java文件、83个JS文件等。系统包含后台管理系统和前台用户系统,采用前后端分离开发模式。技术应用广泛,涵盖微服务、全栈、集群、分布式、高并发等,技术应用场景合理,业务场景贴近实际,完全按照市场需求开发。
资源推荐
资源详情
资源评论
收起资源包目录
基于Java的尚医通线上医院预约挂号系统设计源码 (629个子文件)
.babelrc 229B
index.css 227KB
chunk.css 193KB
summernote-bs3.css 143KB
bootstrap.min14ed.css 118KB
bootstrap.min.css 118KB
style.min862f.css 98KB
style.min.css 97KB
app.css 90KB
animate.min.css 46KB
hospital.css 41KB
datepicker3.css 33KB
vis.css 32KB
vis.css 32KB
font-awesome.min93e3.css 26KB
ambiance.css 25KB
style.min.css 25KB
vis.min.css 23KB
vis.min.css 23KB
personal.css 21KB
hospital_personal.css 20KB
sweetalert.css 18KB
simditor.css 17KB
ui.jqgridffe4.css 16KB
vis-timeline-graph2d.min.css 15KB
vis-timeline-graph2d.min.css 15KB
vis-network.min.css 14KB
vis-network.min.css 14KB
jasny-bootstrap.min.css 14KB
chosen.css 12KB
dropzone.css 11KB
layer.css 11KB
fullcalendar.css 11KB
main.css 10KB
summernote.css 10KB
plyr.css 10KB
iconfont.css 9KB
awesome.css 8KB
layout-sd.css 8KB
codemirror.css 7KB
blueimp-gallery.min.css 7KB
awesome-bootstrap-checkbox.css 7KB
toastr.min.css 7KB
metroStyle.css 6KB
zTreeStyle.css 6KB
webuploader-demo.min.css 6KB
jquery.steps.css 6KB
footable.core.css 5KB
dataTables.bootstrap.css 5KB
bootstrap-table.min.css 4KB
clockpicker.css 4KB
basic.css 4KB
style.css 4KB
datepicker.css 4KB
bootstrap-colorpicker.min.css 3KB
datepicker.css 3KB
cropper.min.css 3KB
ion.rangeSlider.css 3KB
jquery.nouislider.css 3KB
layer.ext.css 3KB
bootstrap-markdown.min.css 3KB
index.css 3KB
layout.css 2KB
reset.css 2KB
demo.css 2KB
ion.rangeSlider.skinFlat.css 2KB
login.min.css 1KB
custom.css 1KB
show.css 1KB
show.css 1KB
bootstrap-treeview.css 1KB
fullcalendar.print.css 660B
switchery.css 611B
createTest.css 557B
base.css 540B
webuploader.css 515B
morris-0.4.3.min.css 443B
WdatePicker.css 149B
xuetong_main.css 81B
main.css 81B
sso.css 0B
.editorconfig 243B
.editorconfig 207B
fontawesome-webfontd41d.eot 67KB
fontawesome-webfont93e3.eot 67KB
glyphicons-halflings-regular.eot 20KB
glyphicons-halflings-regulard41d.eot 20KB
footable.eot 5KB
footabled41d.eot 5KB
.eslintignore 34B
loading-0.gif 6KB
zTreeStandard.gif 5KB
metro.gif 5KB
loading.gif 4KB
loading-2.gif 2KB
loading-upload.gif 2KB
img.gif 2KB
img.gif 2KB
datePicker.gif 1KB
loading-1.gif 701B
共 629 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
沐知全栈开发
- 粉丝: 5743
- 资源: 5223
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- #STM32进行界面开发使用LVGL源码包(版本:lvgl-8.3.10)
- 数据库课程设计-学生选课信息管理系统源代码+数据库(Java+MySQL)
- 训练 YOLOv5,YOLOv9 检测视频中的火灾.zip
- 梦幻西游道人20241126f数据
- 消防隐患在线举报系统开发+ssm.zip
- 居住证申报系统+ssm.zip
- 培训机构客户管理系统的设计+ssm.zip
- 论文实现 - YOLOv7可训练的免费包为实时物体检测器树立了新标杆.zip
- 基于微信小程序的网上商城+ssm.zip
- 云上考场+ssm.zip
- 校园二手交易平台的小程序+ssm.zip
- 论文实现-YOLOv9使用可编程梯度信息学习你想学的东西.zip
- windows系统监控工具ProcessExplorer
- ENSP模拟器图文教程最终版(带对比图的).zip
- ENSP模拟器图文教程最终版(带对比图的) - 副本.zip
- ENSP模拟器图文教程最终版(带对比图的) - 副本 - 副本.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功