|
@ -5,6 +5,7 @@ import com.yihu.hos.config.Config;
|
|
import com.yihu.hos.gateway.model.rest.RestResponseResult;
|
|
import com.yihu.hos.gateway.model.rest.RestResponseResult;
|
|
import com.yihu.hos.gateway.util.RPCUtil;
|
|
import com.yihu.hos.gateway.util.RPCUtil;
|
|
import com.yihu.hos.resource.util.httpclient.HttpClientUtil;
|
|
import com.yihu.hos.resource.util.httpclient.HttpClientUtil;
|
|
|
|
import com.yihu.hos.resource.viewModel.SQLResponResult;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
@ -48,16 +49,23 @@ public class QLCController {
|
|
*/
|
|
*/
|
|
@RequestMapping(value = "/queryUserInfo", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/queryUserInfo", method = RequestMethod.POST)
|
|
@ApiOperation(value = "挂号事件推送", response = Object.class, produces = "application/json", notes = "院方挂号事件推送")
|
|
@ApiOperation(value = "挂号事件推送", response = Object.class, produces = "application/json", notes = "院方挂号事件推送")
|
|
public RestResponseResult queryUserInfo(@ApiParam(value = "事件类型:门诊、住院", required = true) @RequestParam(value = "EventType") String EventType,
|
|
|
|
@ApiParam(value = "事件编码:门诊号、住院号", required = true) @RequestParam(value = "EventNo") String EventNo,
|
|
|
|
@ApiParam(value = "卡类型", required = true) @RequestParam(value = "CardType") String CardType,
|
|
|
|
@ApiParam(value = "卡号", required = true) @RequestParam(value = "CardNo") String CardNo,
|
|
|
|
@ApiParam(value = "PatientId", required = true) @RequestParam(value = "PatientId") String PatientId,
|
|
|
|
@ApiParam(value = "医院ID", required = true) @RequestParam(value = "HospitalId") String HospitalId,
|
|
|
|
HttpServletRequest request) {
|
|
|
|
RestResponseResult restResponseResult = new RestResponseResult();
|
|
|
|
|
|
public SQLResponResult queryUserInfo(@ApiParam(value = "事件类型:门诊、住院", required = true) @RequestParam(value = "EventType") String EventType,
|
|
|
|
@ApiParam(value = "事件编码:门诊号、住院号", required = true) @RequestParam(value = "EventNo") String EventNo,
|
|
|
|
@ApiParam(value = "卡类型", required = true) @RequestParam(value = "CardType") String CardType,
|
|
|
|
@ApiParam(value = "卡号", required = true) @RequestParam(value = "CardNo") String CardNo,
|
|
|
|
@ApiParam(value = "PatientId", required = true) @RequestParam(value = "PatientId") String PatientId,
|
|
|
|
@ApiParam(value = "医院ID", required = true) @RequestParam(value = "HospitalId") String HospitalId,
|
|
|
|
HttpServletRequest request) {
|
|
|
|
SQLResponResult restResponseResult = new SQLResponResult();
|
|
Object s = null;
|
|
Object s = null;
|
|
try {
|
|
try {
|
|
|
|
isEmpty(EventType, "EventType is null");
|
|
|
|
isEmpty(EventNo, "EventNo is null");
|
|
|
|
isEmpty(CardType, "CardType is null");
|
|
|
|
isEmpty(CardNo, "CardNo is null");
|
|
|
|
isEmpty(PatientId, "PatientId is null");
|
|
|
|
isEmpty(HospitalId, "HospitalId is null");
|
|
|
|
|
|
String param = "<Req><TransactionCode>5001</TransactionCode><Data><CardType>" + CardType + "</CardType><CardNo>" + CardNo + "</CardNo><PatientId>" + PatientId + "</PatientId></Data></Req>";
|
|
String param = "<Req><TransactionCode>5001</TransactionCode><Data><CardType>" + CardType + "</CardType><CardNo>" + CardNo + "</CardNo><PatientId>" + PatientId + "</PatientId></Data></Req>";
|
|
String apiparam = "{\"ChannelId\"=\"" + Config.channelId + "\"," +
|
|
String apiparam = "{\"ChannelId\"=\"" + Config.channelId + "\"," +
|
|
"\"ParamType\"=1," +
|
|
"\"ParamType\"=1," +
|
|
@ -83,40 +91,51 @@ public class QLCController {
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
params.put("dataset", "HDSA00_01");
|
|
params.put("dataset", "HDSA00_01");
|
|
params.put("data", obj.toString());
|
|
params.put("data", obj.toString());
|
|
httpClientUtil.doPost(Config.monogoUrl, params, null, null);
|
|
|
|
|
|
String monogoUrl = httpClientUtil.doPost(Config.monogoUrl, params, null, null);
|
|
|
|
monogoUrlValid(monogoUrl);
|
|
//出發採集上傳
|
|
//出發採集上傳
|
|
params = new HashMap<String, Object>();
|
|
params = new HashMap<String, Object>();
|
|
params.put("orgCode", HospitalId);
|
|
params.put("orgCode", HospitalId);
|
|
params.put("cardNo", CardNo);
|
|
params.put("cardNo", CardNo);
|
|
params.put("eventNo", PatientId);
|
|
params.put("eventNo", PatientId);
|
|
httpClientUtil.doPost(Config.startCollect, params, null, null);
|
|
|
|
|
|
String startCollect = httpClientUtil.doPost(Config.startCollect, params, null, null);
|
|
|
|
monogoUrlValid(startCollect);
|
|
} else {
|
|
} else {
|
|
throw new Exception("RPC返回RespCode:" + root.element("RespCode").getText());
|
|
|
|
|
|
throw new Exception(s.toString());
|
|
}
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
restResponseResult.setResponseCode("20000");
|
|
|
|
restResponseResult.setResponseMessage(e.getMessage() + "RPC:返回" + s);
|
|
|
|
|
|
restResponseResult.setStatus("1");
|
|
|
|
restResponseResult.setStatusInfo(e.getMessage() + "RPC:返回" + s);
|
|
return restResponseResult;
|
|
return restResponseResult;
|
|
}
|
|
}
|
|
return restResponseResult;
|
|
return restResponseResult;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 院方_检查/检验报告单推送---数据说明
|
|
* 院方_检查/检验报告单推送---数据说明
|
|
* localhost:8890/gateway/transfer?api=patientInformationPush¶m={CardType:"",CardNo:"000021341249",ReportType:"0",ReportId:"201405228-A-110B",State:"2",HospitalId:"1026333"}&requestId="目前没用随便写"
|
|
* localhost:8890/gateway/transfer?api=patientInformationPush¶m={CardType:"",CardNo:"000021341249",ReportType:"0",ReportId:"201405228-A-110B",State:"2",HospitalId:"1026333"}&requestId="目前没用随便写"
|
|
*/
|
|
*/
|
|
@RequestMapping(value = "/patientInformation", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/patientInformation", method = RequestMethod.POST)
|
|
@ApiOperation(value = "检查/检验报告单推送-", response = Object.class, produces = "application/json", notes = "检查/检验报告单推送-")
|
|
@ApiOperation(value = "检查/检验报告单推送-", response = Object.class, produces = "application/json", notes = "检查/检验报告单推送-")
|
|
public RestResponseResult patientInformation(@ApiParam(value = "卡类型", required = true) @RequestParam(value = "CardType") String CardType,
|
|
|
|
@ApiParam(value = "卡号", required = true) @RequestParam(value = "CardNo") String CardNo,
|
|
|
|
@ApiParam(value = "报告单类型1检验报告2检查报告", required = true) @RequestParam(value = "ReportType") String ReportType,
|
|
|
|
@ApiParam(value = "报告单号", required = true) @RequestParam(value = "ReportId") String ReportId,
|
|
|
|
@ApiParam(value = "报告单状态1 报告未出 2报告已出", required = true) @RequestParam(value = "State") String State,
|
|
|
|
@ApiParam(value = "医院ID", required = true) @RequestParam(value = "HospitalId") String HospitalId,
|
|
|
|
HttpServletRequest request) {
|
|
|
|
RestResponseResult restResponseResult = new RestResponseResult();
|
|
|
|
|
|
public SQLResponResult patientInformation(@ApiParam(value = "卡类型", required = true) @RequestParam(value = "CardType") String CardType,
|
|
|
|
@ApiParam(value = "卡号", required = true) @RequestParam(value = "CardNo") String CardNo,
|
|
|
|
@ApiParam(value = "报告单类型1检验报告2检查报告", required = true) @RequestParam(value = "ReportType") String ReportType,
|
|
|
|
@ApiParam(value = "报告单号", required = true) @RequestParam(value = "ReportId") String ReportId,
|
|
|
|
@ApiParam(value = "报告单状态1 报告未出 2报告已出", required = true) @RequestParam(value = "State") String State,
|
|
|
|
@ApiParam(value = "医院ID", required = true) @RequestParam(value = "HospitalId") String HospitalId,
|
|
|
|
HttpServletRequest request) {
|
|
|
|
SQLResponResult restResponseResult = new SQLResponResult();
|
|
Object s = null;
|
|
Object s = null;
|
|
try {
|
|
try {
|
|
|
|
isEmpty(CardType, "CardType is null");
|
|
|
|
isEmpty(CardNo, "CardNo is null");
|
|
|
|
isEmpty(ReportType, "ReportType is null");
|
|
|
|
isEmpty(ReportId, "ReportId is null");
|
|
|
|
isEmpty(State, "State is null");
|
|
|
|
isEmpty(HospitalId, "HospitalId is null");
|
|
|
|
|
|
if ("1".equals(State)) {
|
|
if ("1".equals(State)) {
|
|
throw new Exception("报告未出,结束");
|
|
throw new Exception("报告未出,结束");
|
|
}
|
|
}
|
|
@ -158,24 +177,26 @@ public class QLCController {
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
params.put("dataset", "HDSD01_01");
|
|
params.put("dataset", "HDSD01_01");
|
|
params.put("data", objData.toString());
|
|
params.put("data", objData.toString());
|
|
httpClientUtil.doPost(Config.monogoUrl, params, null, null);
|
|
|
|
|
|
String monogoUrl = httpClientUtil.doPost(Config.monogoUrl, params, null, null);
|
|
|
|
monogoUrlValid(monogoUrl);
|
|
//出發採集上傳
|
|
//出發採集上傳
|
|
params = new HashMap<String, Object>();
|
|
params = new HashMap<String, Object>();
|
|
params.put("orgCode", HospitalId);
|
|
params.put("orgCode", HospitalId);
|
|
params.put("cardNo", CardNo);
|
|
params.put("cardNo", CardNo);
|
|
params.put("eventNo", StringUtils.isEmpty(objData.get("ClinicNo")) ? objData.get("HosUserNo") : objData.get("ClinicNo"));
|
|
params.put("eventNo", StringUtils.isEmpty(objData.get("ClinicNo")) ? objData.get("HosUserNo") : objData.get("ClinicNo"));
|
|
httpClientUtil.doPost(Config.startCollect, params, null, null);
|
|
|
|
|
|
String startCollect = httpClientUtil.doPost(Config.startCollect, params, null, null);
|
|
|
|
monogoUrlValid(startCollect);
|
|
}
|
|
}
|
|
|
|
|
|
} else {
|
|
} else {
|
|
throw new Exception("RPC返回数据格式不合法:" + dataXml.getText());
|
|
throw new Exception("RPC返回数据格式不合法:" + dataXml.getText());
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
throw new Exception("RPC返回RespCode:" + root.element("RespCode").getText());
|
|
|
|
|
|
throw new Exception(s.toString());
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
restResponseResult.setResponseCode("20000");
|
|
|
|
restResponseResult.setResponseMessage(e.getMessage() + "RPC:返回" + s);
|
|
|
|
|
|
restResponseResult.setStatus("2");
|
|
|
|
restResponseResult.setStatusInfo(e.getMessage() + "RPC:返回" + s);
|
|
return restResponseResult;
|
|
return restResponseResult;
|
|
}
|
|
}
|
|
return restResponseResult;
|
|
return restResponseResult;
|
|
@ -237,4 +258,25 @@ public class QLCController {
|
|
return obj;
|
|
return obj;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 判断是否为空
|
|
|
|
*
|
|
|
|
* @param EventType
|
|
|
|
* @param message
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
private void isEmpty(String EventType, String message) throws Exception {
|
|
|
|
if (StringUtils.isEmpty(EventType)) {
|
|
|
|
throw new Exception(message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private boolean monogoUrlValid(String monogoUrl) throws Exception {
|
|
|
|
JSONObject jo = JSONObject.fromObject(monogoUrl);
|
|
|
|
if ("true".equals(jo.get("successFlg"))) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
throw new Exception(jo.get("message").toString());
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|