package jw.hmanage.hospitalmanage.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import jw.hmanage.hospitalmanage.mapper.HospitalSetMapper;
import jw.hmanage.hospitalmanage.mapper.ScheduleMapper;
import jw.hmanage.hospitalmanage.model.HospitalSet;
import jw.hmanage.hospitalmanage.model.Schedule;
import jw.hmanage.hospitalmanage.service.ApiService;
import jw.hmanage.hospitalmanage.utils.BeanUtils;
import jw.hmanage.hospitalmanage.utils.HospitalException;
import jw.hmanage.hospitalmanage.utils.HttpRequestHelper;
import jw.hmanage.hospitalmanage.utils.MD5;
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.Date;
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", MD5.encrypt(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", MD5.encrypt(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 HospitalException(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 HospitalException(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",MD5.encrypt(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 HospitalException(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 HospitalException(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()));
JSONO
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
本设计源码提供了一个基于Java的在线医疗预约挂号系统。项目包含1578个文件,主要使用Java、CSS、JavaScript、Vue和HTML编程语言。文件类型包括312个XML配置文件、191个Java类文件、184个Java源代码文件、166个CSS样式文件、162个JavaScript脚本文件、106个PNG图片文件、106个Vue组件文件、46个JPG图片文件、38个HTML页面文件和32个SVG文件。该系统允许用户登录后通过选择医院、科室、时间段进行挂号预约,并生成订单。系统还实现了微信支付订单后会收到成功短信提醒等功能,适合用于学习和实践Java、CSS、JavaScript、Vue和HTML技术,以及开发在线医疗预约挂号相关的系统。
资源推荐
资源详情
资源评论
收起资源包目录
基于Java的在线医疗预约挂号系统设计源码 (1560个子文件)
.babelrc 229B
.babelrc 229B
ScheduleServiceImpl.class 19KB
ApiServiceImpl.class 17KB
OrderServiceImpl.class 16KB
OrderInfo.class 12KB
Patient.class 12KB
HttpClientUtils.class 10KB
Patient.class 10KB
UserInfoServiceImpl.class 9KB
PageInfo.class 9KB
ScheduleOrderVo.class 8KB
HttpClient.class 8KB
ApiController.class 8KB
HospitalServiceImpl.class 8KB
DepartmentServiceImpl.class 8KB
Schedule.class 8KB
Hospital.class 8KB
WeixinServiceImpl.class 7KB
Schedule.class 7KB
Permission.class 7KB
Dict.class 7KB
ApiController.class 7KB
DictServiceImpl.class 7KB
HospitalSetController.class 7KB
PaymentInfo.class 6KB
RefundInfo.class 6KB
OrderInfo.class 6KB
UserInfo.class 6KB
PaymentServiceImpl.class 6KB
HospitalServiceImpl.class 6KB
OrderQueryVo.class 6KB
HospApiController.class 6KB
RedisConfig.class 6KB
RLYServiceImpl.class 5KB
Result.class 5KB
WeixinApiController.class 5KB
AuthGlobalFilter.class 5KB
HttpRequestHelper.class 5KB
HttpRequestHelper.class 5KB
Result.class 5KB
BookingScheduleRuleVo.class 5KB
HospitalSet.class 5KB
HospitalQueryVo.class 5KB
BigDecimalUtil.class 5KB
BookingRule.class 5KB
BaseEntity.class 4KB
PatientServiceImpl.class 4KB
OrderApiController.class 4KB
BaseEntity.class 4KB
BaseNoAutoEntity.class 4KB
Department.class 4KB
MsmServiceImpl.class 4KB
BaseMongoEntity.class 4KB
ResultCodeEnum.class 4KB
ScheduleQueryVo.class 4KB
UserInfoQueryVo.class 4KB
User.class 4KB
BeanUtils.class 4KB
DepartmentQueryVo.class 3KB
DictEeVo.class 3KB
HttpUtil.class 3KB
HttpUtil.class 3KB
Banner.class 3KB
PageModel.class 3KB
OrderMqVo.class 3KB
JwtHelper.class 3KB
UserAuthVo.class 3KB
PatientApiController.class 3KB
DictController.class 3KB
HospitalController.class 3KB
OrderStatusEnum.class 3KB
OrderCountQueryVo.class 3KB
BaseController.class 3KB
UserController.class 3KB
Swagger2Config.class 3KB
OrderController.class 3KB
DepartmentVo.class 3KB
MsmVo.class 3KB
LoginVo.class 3KB
HospitalSet.class 3KB
RefundInfoServiceImpl.class 3KB
HospitalController.class 3KB
HospitalReceiver.class 3KB
Swagger2Config.class 3KB
UserInfoApiController.class 3KB
RLYController.class 3KB
RegisterVo.class 2KB
RolePermission.class 2KB
UserLoginRecord.class 2KB
ResultCodeEnum.class 2KB
HospitalSetServiceImpl.class 2KB
FileServiceImpl.class 2KB
UserRole.class 2KB
RandomUtil.class 2KB
RandomUtil.class 2KB
AuthStatusEnum.class 2KB
WeixinController.class 2KB
HospitalException.class 2KB
Role.class 2KB
共 1560 条
- 1
- 2
- 3
- 4
- 5
- 6
- 16
资源评论
沐知全栈开发
- 粉丝: 5706
- 资源: 5215
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功