|
@ -1,14 +1,23 @@
|
|
|
package com.yihu.wlyy.service.third.jw;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.wlyy.entity.patient.prescription.Prescription;
|
|
|
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
|
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.http.NameValuePair;
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* 基位长处方接口
|
|
@ -17,11 +26,16 @@ import java.util.List;
|
|
|
@Service
|
|
|
public class JwPrescriptionService {
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(JwPrescriptionService.class);
|
|
|
//基卫服务地址
|
|
|
@Value("${sign.check_upload}")
|
|
|
private String jwUrl;
|
|
|
@Autowired
|
|
|
private HttpClientUtil httpClientUtil;
|
|
|
@Autowired
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
@Autowired
|
|
|
private PrescriptionDao prescriptionDao;
|
|
|
|
|
|
/**
|
|
|
* 获取字典列表
|
|
@ -41,18 +55,14 @@ public class JwPrescriptionService {
|
|
|
|
|
|
/**
|
|
|
* 获取处方模板
|
|
|
* @param deptCode 科室编码
|
|
|
* @param staffCode 人员code
|
|
|
* @param hospital 医院code
|
|
|
* @param doctor 医生code
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String getRecipeTemplate(String deptCode,String staffCode, String hospital) throws Exception{
|
|
|
public String getRecipeTemplate(String doctor) throws Exception{
|
|
|
String url = jwUrl + "/third/prescription/getRecipeTemplate";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("deptCode", deptCode));
|
|
|
params.add(new BasicNameValuePair("staffCode", staffCode));
|
|
|
params.add(new BasicNameValuePair("hospital", hospital));
|
|
|
params.add(new BasicNameValuePair("doctor", doctor));
|
|
|
|
|
|
String response = httpClientUtil.post(url, params, "UTF-8");
|
|
|
|
|
@ -77,27 +87,57 @@ public class JwPrescriptionService {
|
|
|
params.add(new BasicNameValuePair("applyTimeFrom", applyTimeFrom));
|
|
|
params.add(new BasicNameValuePair("applyTimeEnd", applyTimeEnd));
|
|
|
|
|
|
String response = httpClientUtil.post(url, params, "UTF-8");
|
|
|
|
|
|
// String response = httpClientUtil.post(url, params, "UTF-8");
|
|
|
String sql = "SELECT h.response from wlyy_http_log h WHERE h.id = 806287";
|
|
|
List<Map<String ,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
String response = list.get(0).get("response").toString();
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("status",200);
|
|
|
jsonObject.put("data",response);
|
|
|
response = jsonObject.toString();
|
|
|
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 处方开方接口
|
|
|
* @param prescriptionCode 续方code
|
|
|
* 获取单条历史处方
|
|
|
* @param recipeNo
|
|
|
* @param cardNo
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String saveRecipe(String prescriptionCode) throws Exception{
|
|
|
String url = jwUrl + "/third/prescription/saveRecipe";
|
|
|
public String getRecipe(String recipeNo,String cardNo){
|
|
|
String url = jwUrl + "/third/prescription/getRecipe";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("prescriptionCode", prescriptionCode));
|
|
|
params.add(new BasicNameValuePair("recipeNo", recipeNo));
|
|
|
params.add(new BasicNameValuePair("cardNo", cardNo));
|
|
|
|
|
|
String response = httpClientUtil.post(url, params, "UTF-8");
|
|
|
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 处方开方接口
|
|
|
* @param prescriptionCode 续方code
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String saveRecipe(String prescriptionCode){
|
|
|
String response = null;
|
|
|
try {
|
|
|
String url = jwUrl + "/third/prescription/saveRecipe";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("prescriptionCode", prescriptionCode));
|
|
|
|
|
|
response = httpClientUtil.post(url, params, "UTF-8");
|
|
|
return response;
|
|
|
}catch (Exception e){
|
|
|
logger.info("处方开方接口saveRecipe:"+response);
|
|
|
throw e;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 待结算费用列表接口
|
|
|
* @param cardNo
|
|
@ -116,33 +156,65 @@ public class JwPrescriptionService {
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
public String executeSickSettle(String dictName) throws Exception{
|
|
|
/**
|
|
|
* 院内结算确认接口
|
|
|
* @param prescriptionCode 处方CODE
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String executeSickSettle(String prescriptionCode) throws Exception{
|
|
|
String url = jwUrl + "/third/prescription/executeSickSettle";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("dictName", dictName));
|
|
|
|
|
|
params.add(new BasicNameValuePair("prescriptionCode", prescriptionCode));
|
|
|
String response = httpClientUtil.post(url, params, "UTF-8");
|
|
|
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 挂号作废处方接口
|
|
|
* @param visitNo 挂号号
|
|
|
* @param fadeDept 作废科室编码
|
|
|
* @param fadeOperator 作废人员编码
|
|
|
* @param prescriptionCode 续方号码
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String fadeRecipe(String visitNo,String fadeDept,String fadeOperator)throws Exception{
|
|
|
String url = jwUrl + "/third/prescription/fadeRecipe";
|
|
|
public String fadeRecipe(String prescriptionCode)throws Exception{
|
|
|
|
|
|
Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
|
|
|
|
|
|
if(StringUtils.isNotBlank(prescription.getVisitNo())){
|
|
|
String url = jwUrl + "/third/prescription/fadeRecipe";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("visitNo", prescription.getVisitNo()));//挂号号
|
|
|
params.add(new BasicNameValuePair("fadeDept", prescription.getJwDeptCode()));//作废科室编码
|
|
|
params.add(new BasicNameValuePair("fadeOperator", prescription.getJwDoctorCode()));//作废人员编码
|
|
|
String response = httpClientUtil.post(url, params, "UTF-8");
|
|
|
if(StringUtils.isNotBlank(response)){
|
|
|
JSONObject reobj = JSON.parseObject(response);
|
|
|
Integer status = reobj.getInteger("status");
|
|
|
String errmsg = reobj.getString("msg");
|
|
|
if(-1 == status){
|
|
|
throw new Exception("基卫接口(挂号作废)请求失败,"+errmsg);
|
|
|
}
|
|
|
}else{
|
|
|
throw new Exception("基卫接口(挂号作废)请求失败,无数据返回!");
|
|
|
}
|
|
|
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* ca认证接口
|
|
|
* @param code 续方code
|
|
|
* @return
|
|
|
*/
|
|
|
public String affirmCARecipe(String code){
|
|
|
String url = jwUrl + "/third/prescription/affirmCARecipe";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("visitNo", visitNo));//挂号号
|
|
|
params.add(new BasicNameValuePair("fadeDept", fadeDept));//作废科室编码
|
|
|
params.add(new BasicNameValuePair("fadeOperator", fadeOperator));//作废人员编码
|
|
|
params.add(new BasicNameValuePair("code", code));//续方code
|
|
|
String response = httpClientUtil.post(url, params, "UTF-8");
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|