|
@ -0,0 +1,515 @@
|
|
|
|
package com.yihu.wlyy.service.service.prescription;
|
|
|
|
|
|
|
|
import com.yihu.wlyy.service.common.model.Result;
|
|
|
|
import com.yihu.wlyy.service.dao.HospitalDao;
|
|
|
|
import com.yihu.wlyy.service.dao.prescription.PrescriptionDao;
|
|
|
|
import com.yihu.wlyy.service.dao.prescription.PrescriptionExpressageDao;
|
|
|
|
import com.yihu.wlyy.service.dao.prescription.PrescriptionInfoDao;
|
|
|
|
import com.yihu.wlyy.service.dao.prescription.PrescriptionLogDao;
|
|
|
|
import com.yihu.wlyy.service.entity.Hospital;
|
|
|
|
import com.yihu.wlyy.service.entity.prescription.Prescription;
|
|
|
|
import com.yihu.wlyy.service.entity.prescription.PrescriptionExpressage;
|
|
|
|
import com.yihu.wlyy.service.entity.prescription.PrescriptionInfo;
|
|
|
|
import com.yihu.wlyy.service.entity.prescription.PrescriptionLog;
|
|
|
|
import com.yihu.wlyy.service.entity.prescription.VO.PrescriptionExpressageVO;
|
|
|
|
import com.yihu.wlyy.service.service.ZysoftBaseService;
|
|
|
|
import net.sf.json.JSONArray;
|
|
|
|
import net.sf.json.JSONException;
|
|
|
|
import net.sf.json.JSONObject;
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 长处方接口
|
|
|
|
* Created by yeshijie on 2017/8/3.
|
|
|
|
*/
|
|
|
|
@Service
|
|
|
|
@Transactional
|
|
|
|
public class PrescriptionService extends ZysoftBaseService{
|
|
|
|
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(PrescriptionService.class);
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private PrescriptionDao prescriptionDao;
|
|
|
|
@Autowired
|
|
|
|
private PrescriptionLogDao prescriptionLogDao;
|
|
|
|
@Autowired
|
|
|
|
private StringRedisTemplate redisTemplate;
|
|
|
|
@Autowired
|
|
|
|
private PrescriptionExpressageDao prescriptionExpressageDao;
|
|
|
|
@Autowired
|
|
|
|
private HospitalDao hospitalDao;
|
|
|
|
@Autowired
|
|
|
|
private PrescriptionInfoDao prescriptionInfoDao;
|
|
|
|
|
|
|
|
private String channelTopic = "redisPrescription";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 新增续方日志
|
|
|
|
* @param prescription
|
|
|
|
*/
|
|
|
|
public void addPrescriptionLog(Prescription prescription,String remark){
|
|
|
|
PrescriptionLog log = new PrescriptionLog();
|
|
|
|
log.setStatus(prescription.getStatus());
|
|
|
|
log.setPrescriptionCode(prescription.getCode());
|
|
|
|
log.setCode(getCode());
|
|
|
|
log.setCreateTime(new Date());
|
|
|
|
log.setType(PrescriptionLog.PrescriptionLogType.zy.getValue());
|
|
|
|
log.setFlag(1);
|
|
|
|
log.setHospital(prescription.getHospital());
|
|
|
|
log.setHospitalName(prescription.getHospitalName());
|
|
|
|
log.setRemark(remark);
|
|
|
|
log.setUserCode(prescription.getDoctor());
|
|
|
|
log.setUserName(prescription.getDoctorName());
|
|
|
|
log.setUserType(2);
|
|
|
|
prescriptionLogDao.save(log);
|
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************智业推送数据处理 start**************************************************/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 接收线下处方调整完成消息
|
|
|
|
*/
|
|
|
|
public Result prescriptionAdjustCompleted(String jsonObject){
|
|
|
|
String error = null;
|
|
|
|
String status = "1";
|
|
|
|
String errMsg = null;
|
|
|
|
String msg = "";
|
|
|
|
try{
|
|
|
|
JSONObject json = JSONObject.fromObject(jsonObject);
|
|
|
|
|
|
|
|
Integer CODE= json.getInt("CODE");
|
|
|
|
JSONObject pre = json.getJSONObject("Data");
|
|
|
|
String prescriptionCode = pre.getString("PRESCRIPTION_CODE");
|
|
|
|
Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
|
|
|
|
if(prescription.getStatus()==PrescriptionLog.PrescriptionLogStatus.changeing.getValue()||prescription.getStatus()==PrescriptionLog.PrescriptionLogStatus.change_error.getValue()){
|
|
|
|
if(CODE==1){
|
|
|
|
prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.change_success.getValue());
|
|
|
|
prescriptionDao.save(prescription);
|
|
|
|
|
|
|
|
//调整续方的药品信息
|
|
|
|
JSONArray prescription_detail = pre.getJSONArray("PRESCRIPTION_DETAIL");
|
|
|
|
for(int i =0;i<prescription_detail.size();i++){
|
|
|
|
JSONObject info = prescription_detail.getJSONObject(i);
|
|
|
|
String infoCode = info.getString("SUB_NO");
|
|
|
|
PrescriptionInfo prescriptionInfo = prescriptionInfoDao.findByCode(infoCode);
|
|
|
|
prescriptionInfo.setRemark(info.getString("REMARK"));
|
|
|
|
prescriptionInfo.setBindFlag(info.getString("BIND_FLAG"));
|
|
|
|
prescriptionInfo.setDirection("口服");//药品用法
|
|
|
|
prescriptionInfo.setDrugCode(info.getString("ITEM_CODE"));//药品code
|
|
|
|
prescriptionInfo.setDrugName(info.getString("ITEM_NAME"));//药品名称
|
|
|
|
prescriptionInfo.setDrugRate(info.getString("FREQUENCY"));//吃药频率 FREQUENCY
|
|
|
|
prescriptionInfo.setDrugRateName(info.getString("FREQUENCY_NAME"));
|
|
|
|
prescriptionInfo.setDrugFormat(info.getString("ITEM_SPEC"));//药品规格
|
|
|
|
prescriptionInfo.setPrice(info.getInt("ITEM_PRICE"));//药品单价
|
|
|
|
prescriptionInfo.setNum(info.getInt("ITEM_QUANTITY"));//药品数目
|
|
|
|
prescriptionInfo.setJwSubCode("");//智业子处方号
|
|
|
|
prescriptionInfo.setDrugNumUnit(info.getString("ITEM_UNIT"));//数量单位编码
|
|
|
|
prescriptionInfo.setDrugNumUnitName(info.getString("ITEM_UNIT_NAME"));//数量单位名称
|
|
|
|
prescriptionInfo.setCost(1);//金额
|
|
|
|
prescriptionInfo.setCharge(0);//自付
|
|
|
|
prescriptionInfo.setBindFlag("0");//成组标志, 0.非成组,1.成组
|
|
|
|
prescriptionInfo.setDayCount(info.getInt("DAY_COUNT"));//用药天数
|
|
|
|
prescriptionInfo.setDrugUsage(info.getString("USAGE"));//用药方法编码
|
|
|
|
prescriptionInfo.setUsageName(info.getString("USAGE_NAME"));//用药方法名称
|
|
|
|
prescriptionInfo.setPhysicDose(info.getString("PHYSIC_DOSE"));//用药剂量
|
|
|
|
prescriptionInfo.setPhysicDoseUnit(info.getString("PHYSIC_DOSE_UNIT"));//剂量单位编码
|
|
|
|
prescriptionInfo.setPhysicDoseUnitName(info.getString("PHYSIC_DOSE_UNIT_NAME"));//剂量单位名称
|
|
|
|
prescriptionInfo.setPhysicAmount(info.getString("PHYSIC_AMOUNT"));//用药总量
|
|
|
|
prescriptionInfo.setPhysicAmountUnit(info.getString("PHYSIC_AMOUNT_UNIT"));//总量单位编码
|
|
|
|
prescriptionInfo.setPhysicAmountUnitName(info.getString("PHYSIC_AMOUNT_UNIT_NAME"));//总量单位名称
|
|
|
|
prescriptionInfo.setPhysicInjectPlace("");//注射地点编码
|
|
|
|
prescriptionInfo.setPhysicInjectPlaceName("");//注射地点名称
|
|
|
|
prescriptionInfo.setPhysicSkinTest(info.getString("PHYSIC_SKIN_TEST"));//皮试类型名称
|
|
|
|
prescriptionInfo.setPhysicSkinTestName(info.getString("PHYSIC_SKIN_TEST_NAME"));//皮试类型名称
|
|
|
|
prescriptionInfoDao.save(prescriptionInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
// redis 的发布 {tilte:redisAddPrescription state: 1 ,//1:成功,2.失败 mes:'开方成功' prescription : "0001" //续方CODE }
|
|
|
|
JSONObject message = new JSONObject();
|
|
|
|
message.put("title","adjustPrescription");
|
|
|
|
message.put("state",1);
|
|
|
|
message.put("prescription",prescriptionCode);
|
|
|
|
message.put("mes","调整处方完成");
|
|
|
|
redisTemplate.convertAndSend(channelTopic,message.toString());
|
|
|
|
}else {
|
|
|
|
//调整失败
|
|
|
|
prescription.setStatus(4);
|
|
|
|
prescriptionDao.save(prescription);
|
|
|
|
msg = json.getString("MSG");
|
|
|
|
}
|
|
|
|
|
|
|
|
//新增续方日志
|
|
|
|
addPrescriptionLog(prescription,"接收线下处方调整完成消息-"+msg);
|
|
|
|
}
|
|
|
|
}catch (JSONException ex){
|
|
|
|
ex.printStackTrace();
|
|
|
|
error = ex.getMessage();
|
|
|
|
errMsg = ex.getMessage();
|
|
|
|
status = "0";
|
|
|
|
}catch (Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
error = e.getMessage();
|
|
|
|
status = "0";
|
|
|
|
}
|
|
|
|
//添加日志
|
|
|
|
return addZyPushLog(jsonObject,"prescriptionAdjustCompleted","接收线下处方调整完成消息",error,"POST",status,"1",errMsg);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 接收预结算完成消息
|
|
|
|
*/
|
|
|
|
public Result prePayCompletion(String jsonObject){
|
|
|
|
String error = null;
|
|
|
|
String status = "1";
|
|
|
|
String errMsg = null;
|
|
|
|
try{
|
|
|
|
JSONObject json = JSONObject.fromObject(jsonObject);
|
|
|
|
Integer code = json.getInt("CODE");
|
|
|
|
if(code==1){
|
|
|
|
String orderNo = json.getString("ORDER_NO");//挂号编号
|
|
|
|
String recipeNo = json.getString("RECIPE_NO");//处方编号
|
|
|
|
|
|
|
|
//修改续方表状态
|
|
|
|
// Prescription prescription = prescriptionDao.f
|
|
|
|
|
|
|
|
//修改续方审核表状态
|
|
|
|
|
|
|
|
|
|
|
|
// redis 的发布 {tilte:redisAddPrescription state: 1 ,//1:成功,2.失败 mes:'开方成功' prescription : "0001" //续方CODE }
|
|
|
|
JSONObject message = new JSONObject();
|
|
|
|
message.put("title","redisAddPrescription");
|
|
|
|
message.put("state",1);
|
|
|
|
message.put("prescription","fd3b137cd907456dbcc5b11ecd701741");
|
|
|
|
// message.put("mes","预结算完成完成");
|
|
|
|
message.put("mes","success");
|
|
|
|
redisTemplate.convertAndSend(channelTopic,message.toString());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}catch (JSONException ex){
|
|
|
|
ex.printStackTrace();
|
|
|
|
error = ex.getMessage();
|
|
|
|
errMsg = ex.getMessage();
|
|
|
|
status = "0";
|
|
|
|
}catch (Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
error = e.getMessage();
|
|
|
|
status = "0";
|
|
|
|
}
|
|
|
|
//添加日志
|
|
|
|
return addZyPushLog(jsonObject,"prePayCompletion","接收预结算完成消息",error,"POST",status,"1",errMsg);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 接收配药完成消息
|
|
|
|
*/
|
|
|
|
public Result dispensingComplete(String jsonObject){
|
|
|
|
String error = null;
|
|
|
|
String status = "1";
|
|
|
|
String errMsg = null;
|
|
|
|
try{
|
|
|
|
JSONObject json = JSONObject.fromObject(jsonObject);
|
|
|
|
Integer code = json.getInt("CODE");
|
|
|
|
if(code==1){
|
|
|
|
String orderNo = json.getString("ORDER_NO");//挂号编号
|
|
|
|
String recipeNo = json.getString("RECIPE_NO");//处方编号
|
|
|
|
|
|
|
|
//判断健管师配送要添加续方消息,提示健管师有续方代配送
|
|
|
|
JSONObject message = new JSONObject();
|
|
|
|
message.put("title","dispensingComplete");
|
|
|
|
message.put("state",1);
|
|
|
|
message.put("prescription","fd3b137cd907456dbcc5b11ecd701741");
|
|
|
|
// message.put("mes","预结算完成完成");
|
|
|
|
message.put("mes","success");
|
|
|
|
redisTemplate.convertAndSend(channelTopic,message.toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
}catch (JSONException ex){
|
|
|
|
ex.printStackTrace();
|
|
|
|
error = ex.getMessage();
|
|
|
|
errMsg = ex.getMessage();
|
|
|
|
status = "0";
|
|
|
|
}catch (Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
error = e.getMessage();
|
|
|
|
status = "0";
|
|
|
|
}
|
|
|
|
//添加日志
|
|
|
|
return addZyPushLog(jsonObject,"dispensingComplete","接收配药完成消息",error,"POST",status,"1",errMsg);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 接收药师审方完成及结果消息
|
|
|
|
*/
|
|
|
|
public Result pharmacistPrescriptionCompletion(String jsonObject){
|
|
|
|
String error = null;
|
|
|
|
String status = "1";
|
|
|
|
String errMsg = null;
|
|
|
|
try{
|
|
|
|
JSONObject json = JSONObject.fromObject(jsonObject);
|
|
|
|
Integer code = json.getInt("CODE");
|
|
|
|
if(code==1){
|
|
|
|
String orderNo = json.getString("ORDER_NO");//挂号编号
|
|
|
|
String recipeNo = json.getString("RECIPE_NO");//处方编号
|
|
|
|
}
|
|
|
|
|
|
|
|
}catch (JSONException ex){
|
|
|
|
ex.printStackTrace();
|
|
|
|
error = ex.getMessage();
|
|
|
|
errMsg = ex.getMessage();
|
|
|
|
status = "0";
|
|
|
|
}catch (Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
error = e.getMessage();
|
|
|
|
status = "0";
|
|
|
|
}
|
|
|
|
//添加日志
|
|
|
|
return addZyPushLog(jsonObject,"pharmacistPrescriptionCompletion","接收药师审方完成及结果消息",error,"POST",status,"1",errMsg);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/********************************************智业推送数据处理 end**************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************请求智业接口数据 start**************************************************/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 7.1字典获取接口
|
|
|
|
* @param dictName 字典名称
|
|
|
|
* @param hospital
|
|
|
|
* @param licence
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public String getDictForI(String dictName,String hospital,String licence) throws Exception
|
|
|
|
{
|
|
|
|
if(hospital==null){
|
|
|
|
String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
|
|
|
|
hospital = hospitalMapping[0];
|
|
|
|
licence = hospitalMapping[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<String,String> header = new HashMap<>();
|
|
|
|
header.put("ORGCODE",hospital);
|
|
|
|
header.put("LICENCE",licence);
|
|
|
|
|
|
|
|
Map<String,String> params = new HashMap<>();
|
|
|
|
params.put("dictName",dictName);
|
|
|
|
|
|
|
|
String response = postSecond("getDictForI","字典获取接口",params,null,header,false,2);
|
|
|
|
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 7.2 处方模板获取接口
|
|
|
|
* @param staffCode 员工编码
|
|
|
|
* @param deptCode 部门编码
|
|
|
|
* @param hospital
|
|
|
|
* @param licence
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public String getRecipeTemplate(String staffCode,String deptCode,String hospital,String licence) throws Exception
|
|
|
|
{
|
|
|
|
if(hospital==null){
|
|
|
|
String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
|
|
|
|
hospital = hospitalMapping[0];
|
|
|
|
licence = hospitalMapping[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<String,String> header = new HashMap<>();
|
|
|
|
header.put("ORGCODE",hospital);
|
|
|
|
header.put("LICENCE",licence);
|
|
|
|
|
|
|
|
Map<String,String> params = new HashMap<>();
|
|
|
|
params.put("staffCode",staffCode);
|
|
|
|
params.put("deptCode",deptCode);
|
|
|
|
|
|
|
|
String response = postSecond("getRecipeTemplate","处方模板获取接口",params,null,header,false,2);
|
|
|
|
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 调阅历史处方接口
|
|
|
|
* @param cardNo 卡号
|
|
|
|
* @param recipeNo 医嘱号
|
|
|
|
* @param hospital
|
|
|
|
* @param licence
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public String getLastRecipe(String cardNo,String recipeNo,String hospital,String licence) throws Exception
|
|
|
|
{
|
|
|
|
if(hospital==null){
|
|
|
|
String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
|
|
|
|
hospital = hospitalMapping[0];
|
|
|
|
licence = hospitalMapping[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<String,String> header = new HashMap<>();
|
|
|
|
header.put("ORGCODE",hospital);
|
|
|
|
header.put("LICENCE",licence);
|
|
|
|
|
|
|
|
Map<String,String> params = new HashMap<>();
|
|
|
|
params.put("cardNo",cardNo);
|
|
|
|
params.put("recipeNo",recipeNo);
|
|
|
|
|
|
|
|
String response = postSecond("getLastRecipe","调阅历史处方接口",params,null,header,false,2);
|
|
|
|
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 7.4 挂号开处方接口
|
|
|
|
* @param json
|
|
|
|
* @param hospital
|
|
|
|
* @param licence
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public String saveRecipe(JSONObject json, String hospital, String licence) throws Exception
|
|
|
|
{
|
|
|
|
if(hospital==null){
|
|
|
|
String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
|
|
|
|
hospital = hospitalMapping[0];
|
|
|
|
licence = hospitalMapping[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<String,String> header = new HashMap<>();
|
|
|
|
header.put("ORGCODE",hospital);
|
|
|
|
header.put("LICENCE",licence);
|
|
|
|
|
|
|
|
String response = postSecond("saveRecipe","挂号开处方接口",null,json,header,false,2);
|
|
|
|
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 7.5 查询处方结算结果列表
|
|
|
|
* @param cardNo
|
|
|
|
* @param hospital
|
|
|
|
* @param licence
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public String getDispUnSettleFeeList(String cardNo, String hospital, String licence) throws Exception
|
|
|
|
{
|
|
|
|
if(hospital==null){
|
|
|
|
String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
|
|
|
|
hospital = hospitalMapping[0];
|
|
|
|
licence = hospitalMapping[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<String,String> header = new HashMap<>();
|
|
|
|
header.put("ORGCODE",hospital);
|
|
|
|
header.put("LICENCE",licence);
|
|
|
|
|
|
|
|
Map<String,String> params = new HashMap<>();
|
|
|
|
params.put("cardNo",cardNo);
|
|
|
|
|
|
|
|
String response = postSecond("getDispUnSettleFeeList","查询处方结算结果列表",params,null,header,false,2);
|
|
|
|
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 7.6 院内结算确认接口
|
|
|
|
* @param json
|
|
|
|
* @param hospital
|
|
|
|
* @param licence
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public String executeSickSettle(JSONObject json, String hospital, String licence) throws Exception
|
|
|
|
{
|
|
|
|
if(hospital==null){
|
|
|
|
String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
|
|
|
|
hospital = hospitalMapping[0];
|
|
|
|
licence = hospitalMapping[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<String,String> header = new HashMap<>();
|
|
|
|
header.put("ORGCODE",hospital);
|
|
|
|
header.put("LICENCE",licence);
|
|
|
|
|
|
|
|
String response = postSecond("executeSickSettle","院内结算确认接口",null,json,header,false,2);
|
|
|
|
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************请求智业接口数据 end**************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************智业请求顺丰快递接口数据 START**************************************************/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 根据基卫处方编码获取顺丰快递相关信息
|
|
|
|
* @param jwCode
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public Result getSFExpressInfoByVisitNo(String visitNo) {
|
|
|
|
|
|
|
|
//根据基卫处方编号获取处方信息
|
|
|
|
Prescription prescription = prescriptionDao.findByVisitNo(visitNo);
|
|
|
|
|
|
|
|
if(prescription == null){
|
|
|
|
return Result.error(-1,"查询失败,未找到处方,挂号单为:"+visitNo);
|
|
|
|
}
|
|
|
|
//根据处方编码获取处方快递信息
|
|
|
|
PrescriptionExpressage prescriptionExpressage = prescriptionExpressageDao.findByPrescriptionPay(prescription.getCode());
|
|
|
|
|
|
|
|
if(prescriptionExpressage == null || StringUtils.isBlank(prescriptionExpressage.getMailno())){
|
|
|
|
return Result.error(-2,"查询失败,该处方的快递还未成功下单,挂号单为:"+visitNo);
|
|
|
|
}
|
|
|
|
//根据医院CODE,获取医院详细
|
|
|
|
Hospital hospital = hospitalDao.findByCode(prescription.getHospital());
|
|
|
|
//获取订单的药品详情
|
|
|
|
List<PrescriptionInfo> prescriptionInfolist = prescriptionInfoDao.findByPrescriptionCode(prescription.getCode());
|
|
|
|
|
|
|
|
PrescriptionExpressageVO vo = new PrescriptionExpressageVO();
|
|
|
|
|
|
|
|
vo.setMailno(prescriptionExpressage.getMailno());
|
|
|
|
vo.setMailtype("标准快递");
|
|
|
|
vo.setDestcode(prescriptionExpressage.getCityCode());
|
|
|
|
//-----寄方信息----
|
|
|
|
vo.setJ_name(hospital.getName());
|
|
|
|
vo.setJ_provinceName(hospital.getProvinceName());
|
|
|
|
vo.setJ_cityName(hospital.getCityName());
|
|
|
|
vo.setJ_townName(hospital.getTownName());
|
|
|
|
vo.setJ_address(hospital.getAddress());
|
|
|
|
vo.setJ_phone(hospital.getPhone());
|
|
|
|
|
|
|
|
//-----收方信息-----
|
|
|
|
vo.setD_name(prescriptionExpressage.getName());
|
|
|
|
vo.setD_provinceName(prescriptionExpressage.getProvinceName());
|
|
|
|
vo.setD_cityName(prescriptionExpressage.getCityName());
|
|
|
|
vo.setD_townName(prescriptionExpressage.getTownName());
|
|
|
|
vo.setD_address(prescriptionExpressage.getAddress());
|
|
|
|
vo.setD_phone(prescriptionExpressage.getPhone());
|
|
|
|
vo.setPay_method(2);
|
|
|
|
vo.setExpress_type(11);
|
|
|
|
|
|
|
|
vo.setInfos(prescriptionInfolist);
|
|
|
|
|
|
|
|
return Result.success("查询成功",vo);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************智业请求顺丰快递接口数据 END**************************************************/
|
|
|
|
}
|