|
@ -1,11 +1,20 @@
|
|
package com.yihu.wlyy.web.common.util;
|
|
package com.yihu.wlyy.web.common.util;
|
|
|
|
|
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
import com.yihu.wlyy.util.HttpUtil;
|
|
import com.yihu.wlyy.util.HttpUtil;
|
|
|
|
import com.yihu.wlyy.util.SOAPUtil;
|
|
import com.yihu.wlyy.util.SystemConf;
|
|
import com.yihu.wlyy.util.SystemConf;
|
|
import com.yihu.wlyy.web.BaseController;
|
|
import com.yihu.wlyy.web.BaseController;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import jdk.nashorn.internal.parser.JSONParser;
|
|
|
|
import net.sf.json.JSON;
|
|
|
|
import net.sf.json.util.JSONUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.dom4j.Document;
|
|
|
|
import org.dom4j.DocumentHelper;
|
|
|
|
import org.dom4j.Element;
|
|
|
|
import org.json.JSONArray;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@ -13,6 +22,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Created by lyr on 2016/9/29.
|
|
* Created by lyr on 2016/9/29.
|
|
*/
|
|
*/
|
|
@ -179,4 +191,108 @@ public class WlyySerivceController extends BaseController{
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 转诊预约医生特殊号源获取
|
|
|
|
* @param OrgCode 医院编号
|
|
|
|
* @param DeptCode 科室编号
|
|
|
|
* @param strStart 开始时间
|
|
|
|
* @param strEnd 结束时间
|
|
|
|
* @param DocCode 医生编号
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@RequestMapping(value = "/third/smjk/RegDeptSpeDoctorSectionList",method = RequestMethod.POST)
|
|
|
|
@ApiOperation("转诊预约获取特殊号源接口")
|
|
|
|
public String getSpeDoctorSectionList(@RequestParam("OrgCode") String OrgCode,@RequestParam("DeptCode") String DeptCode,@RequestParam("DocCode") String DocCode){
|
|
|
|
try{
|
|
|
|
SimpleDateFormat sm = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
Date nowDate =new Date();
|
|
|
|
Date tenDateAfter = getDateAfter(nowDate,10);
|
|
|
|
String strStart = sm.format(nowDate);
|
|
|
|
String strEnd = sm.format(tenDateAfter);
|
|
|
|
String checkUrl = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
|
|
|
|
String param = "?OrgCode="+OrgCode+"&DeptCode="+DeptCode+"&strStart="+strStart+"&strEnd="+strEnd+"&DocCode="+DocCode;
|
|
|
|
String jsonString = HttpUtil.sendPost(checkUrl + "/third/smjk/RegDeptSpeDoctorSectionList"+param,"" );
|
|
|
|
if(StringUtils.isEmpty(jsonString)){
|
|
|
|
return write(-1,"医生排班时间获取失败");
|
|
|
|
}else{
|
|
|
|
JSONObject myJsonObject = new JSONObject(jsonString);
|
|
|
|
return write(200,"医生排班时间获取成功","data",parseXmlForSpe(myJsonObject.get("data").toString()));
|
|
|
|
}
|
|
|
|
}catch (Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
return error(-1,"医生排班时间获取失败");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 转诊预约医生号源转换
|
|
|
|
* @param xml
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
private List<Map<String,Object>> parseXmlForSpe(String xml) {
|
|
|
|
List<Map<String,Object>> re = new ArrayList<>();
|
|
|
|
Document document = null;
|
|
|
|
try{
|
|
|
|
document = DocumentHelper.parseText(xml);
|
|
|
|
}catch (Exception e){
|
|
|
|
throw new RuntimeException("解析数据失败!");
|
|
|
|
}
|
|
|
|
Element root = document.getRootElement();
|
|
|
|
List<?> child = root.elements();//取出root的子集合
|
|
|
|
for (Object o : child) {
|
|
|
|
List<?> dataList = ((Element) o).elements();
|
|
|
|
for(Object dataElement:dataList) {
|
|
|
|
|
|
|
|
Element e = (Element) dataElement;
|
|
|
|
// 日期
|
|
|
|
String date = e.attributeValue("date");
|
|
|
|
// a或者p
|
|
|
|
String time = e.attributeValue("time");
|
|
|
|
// 限号
|
|
|
|
String max = e.attributeValue("max");
|
|
|
|
// 已使用的号
|
|
|
|
String used = e.attributeValue("used");
|
|
|
|
// 1正常、2满号、3已过期
|
|
|
|
String status = e.attributeValue("status");
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
map.put("date", date);
|
|
|
|
map.put("time", time);
|
|
|
|
map.put("max", max);
|
|
|
|
map.put("used", used);
|
|
|
|
map.put("status", status);
|
|
|
|
// 排班信息
|
|
|
|
List<?> sections = e.elements();
|
|
|
|
List<Map<String, String>> arrangeList = new ArrayList<>();
|
|
|
|
for (Object s : sections) {
|
|
|
|
Element section = (Element) s;
|
|
|
|
// 限号
|
|
|
|
String s_max = section.attributeValue("max");
|
|
|
|
// 已使用的号
|
|
|
|
String s_used = section.attributeValue("used");
|
|
|
|
// 一次专家坐诊时间段的开始时间
|
|
|
|
String start_time = section.attributeValue("start_time");
|
|
|
|
// 结束时间
|
|
|
|
String end_time = section.attributeValue("end_time");
|
|
|
|
|
|
|
|
Map<String, String> item = new HashMap<>();
|
|
|
|
item.put("max", s_max);
|
|
|
|
item.put("used", s_used);
|
|
|
|
item.put("startTime", start_time);
|
|
|
|
item.put("endTime", end_time);
|
|
|
|
arrangeList.add(item);
|
|
|
|
}
|
|
|
|
map.put("sections", arrangeList);
|
|
|
|
re.add(map);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return re;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static Date getDateAfter(Date d, int day) {
|
|
|
|
Calendar now = Calendar.getInstance();
|
|
|
|
now.setTime(d);
|
|
|
|
now.set(Calendar.DATE, now.get(Calendar.DATE) + day);
|
|
|
|
return now.getTime();
|
|
|
|
}
|
|
}
|
|
}
|