|
@ -1,6 +1,7 @@
|
|
|
package com.yihu.jw.base.service.a3service;
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.sun.org.apache.xpath.internal.operations.Bool;
|
|
@ -1341,16 +1342,21 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 线下订单药柜取药回调发药
|
|
|
* 线下订单同步
|
|
|
* 线上续方 可只传处方号
|
|
|
线下续方 无处方号 机构、单据号必传
|
|
|
* @param recipeNo
|
|
|
* @param orgCode
|
|
|
* @param applyNo
|
|
|
* @param execOperator
|
|
|
线下续方 无处方号 机构、病人卡号都必传
|
|
|
* @param deviceId
|
|
|
* @param cardNo
|
|
|
* @return
|
|
|
*/
|
|
|
public boolean getPhysicApplyWaitExecList(String recipeNo,String orgCode,String applyNo,String execOperator){
|
|
|
public boolean getPhysicApplyWaitExecList(String deviceId,String cardNo){
|
|
|
Mediicinedevice mediicinedevice = deviceDao.findMediicinedeviceByEquNum(deviceId);
|
|
|
String orgCode = "";
|
|
|
String community = "";
|
|
|
if (mediicinedevice!=null){
|
|
|
orgCode = mediicinedevice.getBelongCommunity();
|
|
|
community = mediicinedevice.getCommunity();
|
|
|
}
|
|
|
OauthWlyyConfigDO oauthWlyyConfigDO = oauthWlyyConfigDao.findOne("getPhysicApplyWaitExecList");
|
|
|
//token获取accesstoken
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
@ -1367,9 +1373,8 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
|
|
|
|
|
|
//设置入参
|
|
|
List<NameValuePair> p = new ArrayList<>();
|
|
|
p.add(new BasicNameValuePair("recipeNo", recipeNo));
|
|
|
p.add(new BasicNameValuePair("orgCode", orgCode));
|
|
|
p.add(new BasicNameValuePair("applyNo", applyNo));
|
|
|
p.add(new BasicNameValuePair("cardNo", cardNo));
|
|
|
|
|
|
//设置头部
|
|
|
token = rsjson.getJSONObject("result").getString("accesstoken");
|
|
@ -1385,10 +1390,65 @@ public class MedicineOrderService extends BaseJpaService<Mediicineorder, Mediici
|
|
|
wlyyHttpLogDO.setStatus("1");
|
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
|
httpLogDao.save(wlyyHttpLogDO);
|
|
|
|
|
|
logger.info("getPhysicApplyWaitExecList:"+rs);
|
|
|
if (rs!=null&&rs!=""){
|
|
|
JSONObject ehc = JSONObject.parseObject(rs);
|
|
|
if (ehc.getString("status").equalsIgnoreCase("200")){
|
|
|
JSONObject data = ehc.getJSONObject("data");
|
|
|
String code = data.getString("CODE");
|
|
|
if (code.equalsIgnoreCase("1")){
|
|
|
JSONArray array = data.getJSONArray("returnData");
|
|
|
if (array!=null&&array.size()!=0){
|
|
|
JSONArray jsonArray = array.getJSONArray(0);
|
|
|
for (int i=0;i<jsonArray.size();i++){
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
String realOrder = jsonObject.getString("RECIPE_NO");
|
|
|
String alyNo = jsonObject.getString("APPLY_NO");
|
|
|
Mediicineorder mediicineorder = orderDao.findByOrderNum(realOrder);
|
|
|
if (mediicineorder==null){
|
|
|
mediicineorder = new Mediicineorder();
|
|
|
mediicineorder.setOrderNum(realOrder);
|
|
|
mediicineorder.setApplyNo(alyNo);
|
|
|
mediicineorder.setOrderSource("智业系统");
|
|
|
mediicineorder.setOrderState("1");
|
|
|
mediicineorder.setPickUpNum(realOrder);
|
|
|
mediicineorder.setPrescribeNum(realOrder);
|
|
|
mediicineorder.setSellState("0");
|
|
|
mediicineorder.setInfo("慢病");
|
|
|
mediicineorder.setSocialSecurityCardNum(cardNo);
|
|
|
mediicineorder.setBelongCommunity(orgCode);
|
|
|
mediicineorder.setCommunity(community);
|
|
|
mediicineorder.setDoctorName(jsonObject.getString("APPLY_OPERATOR_NAME"));
|
|
|
mediicineorder = orderDao.save(mediicineorder);
|
|
|
JSONArray drugList = jsonObject.getJSONArray("APPLY_DETAIL");
|
|
|
for (int j =0;j<drugList.size();j++){
|
|
|
JSONObject drugObj = drugList.getJSONObject(j);
|
|
|
Mediicineorderdetail mediicineorderdetail = new Mediicineorderdetail();
|
|
|
mediicineorderdetail.setIdOrder(mediicineorder.getId());
|
|
|
mediicineorderdetail.setDrugCode(drugObj.getString("ITEM_CODE"));
|
|
|
mediicineorderdetail.setOrderNo(realOrder);
|
|
|
mediicineorderdetail.setPrice(drugObj.getFloat("ITEM_PRICE"));
|
|
|
mediicineorderdetail.setQuantity(drugObj.getString("ITEM_QUANTITY"));
|
|
|
mediicineorderdetail.setGoodsName(drugObj.getString("ITEM_NAME"));
|
|
|
mediicineorderdetail.setOrderState("1");
|
|
|
mediicineorderdetail.setPickUpNum(realOrder);
|
|
|
mediicineorderdetail.setPrescribeNum(realOrder);
|
|
|
mediicineorderdetail.setCreateTime(new Date());
|
|
|
mediicineorderdetail.setDrugNum(drugObj.getString("ITEM_QUANTITY"));
|
|
|
mediicineorderdetail.setSpecif(drugObj.getString("ITEM_SPEC"));
|
|
|
mediicineorderdetail.setUseRate(drugObj.getString("FREQUENCY_NAME"));
|
|
|
mediicineorderdetail.setUseWay(drugObj.getString("USAGE_NAME"));
|
|
|
mediicineorderdetail.setUseDose(drugObj.getString("PHYSIC_DOSE"));
|
|
|
mediicineorderdetail.setUnit(drugObj.getString("PHYSIC_DOSE_UNIT_NAME"));
|
|
|
mediicineorderdetail.setOrgCode(orgCode);
|
|
|
mediicineorderdetail.setSocialSecurityCardNum(cardNo);
|
|
|
orderdetailDao.save(mediicineorderdetail);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
}else {
|