|
@ -20,20 +20,25 @@ import com.yihu.wlyy.service.BaseService;
|
|
import com.yihu.wlyy.service.system.Icd10DictServcie;
|
|
import com.yihu.wlyy.service.system.Icd10DictServcie;
|
|
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
|
|
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
import com.yihu.wlyy.util.HttpUtil;
|
|
import com.yihu.wlyy.util.HttpUtil;
|
|
import com.yihu.wlyy.util.ImUtill;
|
|
import com.yihu.wlyy.util.ImUtill;
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.http.NameValuePair;
|
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -100,6 +105,12 @@ public class PrescriptionInfoService extends BaseService {
|
|
private PrescriptionAdjustReasonDao prescriptionAdjustReasonDao;
|
|
private PrescriptionAdjustReasonDao prescriptionAdjustReasonDao;
|
|
@Autowired
|
|
@Autowired
|
|
private FollowUpDao followUpDao;
|
|
private FollowUpDao followUpDao;
|
|
|
|
@Value("${doctorAssistant.api}")
|
|
|
|
private String doctorAssistant;
|
|
|
|
@Value("${doctorAssistant.target_url}")
|
|
|
|
private String targetUrl;
|
|
|
|
@Autowired
|
|
|
|
private HttpClientUtil httpClientUtil;
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(HttpUtil.class);
|
|
private static final Logger logger = LoggerFactory.getLogger(HttpUtil.class);
|
|
|
|
|
|
@ -551,10 +562,6 @@ public class PrescriptionInfoService extends BaseService {
|
|
if (s > 86400) {
|
|
if (s > 86400) {
|
|
prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue());
|
|
prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue());
|
|
prescriptionDao.save(prescription);
|
|
prescriptionDao.save(prescription);
|
|
|
|
|
|
//取消长处方关联的随访记录
|
|
|
|
canclePrescriptionFollowup(code);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
//rs.put("time","");
|
|
//rs.put("time","");
|
|
@ -619,9 +626,6 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
|
|
|
//同步智业接口
|
|
//同步智业接口
|
|
jwPrescriptionService.fadeRecipe(code);
|
|
jwPrescriptionService.fadeRecipe(code);
|
|
|
|
|
|
//取消长处方关联的随访记录
|
|
|
|
canclePrescriptionFollowup(code);
|
|
|
|
|
|
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
@ -919,9 +923,32 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
|
|
|
//审核不通过模板消息
|
|
//审核不通过模板消息
|
|
sendRMess(p.getCode(), 0);
|
|
sendRMess(p.getCode(), 0);
|
|
|
|
|
|
//取消长处方关联的随访记录
|
|
|
|
canclePrescriptionFollowup(code);
|
|
|
|
|
|
|
|
|
|
//取消长处方关联的随访记录
|
|
|
|
canclePrescriptionFollowup(code);
|
|
|
|
|
|
|
|
try {
|
|
|
|
// 新增发送医生助手模板消息 v1.4.0 by wujunjie
|
|
|
|
Doctor doctor = doctorDao.findByCode(p.getDoctor());
|
|
|
|
String doctorOpenID = doctor.getOpenid();
|
|
|
|
if (StringUtils.isNotEmpty(doctorOpenID)) {
|
|
|
|
String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
|
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
|
params.add(new BasicNameValuePair("type", "1"));
|
|
|
|
params.add(new BasicNameValuePair("openId", doctorOpenID));
|
|
|
|
params.add(new BasicNameValuePair("url", targetUrl));
|
|
|
|
params.add(new BasicNameValuePair("first", doctor.getName() + "医生您好。您有一个您有1个续方申请处方开立失败。"));
|
|
|
|
params.add(new BasicNameValuePair("remark", "请进入手机APP查看"));
|
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
|
|
|
|
String date = format.format(new Date());
|
|
|
|
String keywords = doctor.getName() +","+ p.getPatientName() +"," + date;
|
|
|
|
params.add(new BasicNameValuePair("keywords", keywords));
|
|
|
|
|
|
|
|
httpClientUtil.post(url, params, "UTF-8");
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
}
|
|
}
|
|
prescriptionReviewedDao.save(reviewed);
|
|
prescriptionReviewedDao.save(reviewed);
|
|
prescriptionDao.save(p);
|
|
prescriptionDao.save(p);
|
|
@ -1864,22 +1891,22 @@ public class PrescriptionInfoService extends BaseService {
|
|
}
|
|
}
|
|
return jsonObject;
|
|
return jsonObject;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
* 根据长处方CODE,取消关联的随访记录
|
|
|
|
* @param prescriptionCode
|
|
|
|
*/
|
|
|
|
private void canclePrescriptionFollowup(String prescriptionCode){
|
|
|
|
try {
|
|
|
|
//续方取消,随访记录也取消,这里如果出错则直接捕获,记录日志,不往外抛,避免影响长处方逻辑
|
|
|
|
Followup followup = followUpDao.getFollowupByPrescriptionCode(prescriptionCode);
|
|
|
|
if(followup !=null){
|
|
|
|
followup.setStatus("0");
|
|
|
|
followUpDao.save(followup);
|
|
|
|
}
|
|
|
|
}catch (Exception e){
|
|
|
|
logger.info("续方取消,随访记录同步取消失败:"+e.getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 根据长处方CODE,取消关联的随访记录
|
|
|
|
* @param prescriptionCode
|
|
|
|
*/
|
|
|
|
private void canclePrescriptionFollowup(String prescriptionCode){
|
|
|
|
try {
|
|
|
|
//续方取消,随访记录也取消,这里如果出错则直接捕获,记录日志,不往外抛,避免影响长处方逻辑
|
|
|
|
Followup followup = followUpDao.getFollowupByPrescriptionCode(prescriptionCode);
|
|
|
|
if(followup !=null){
|
|
|
|
followup.setStatus("0");
|
|
|
|
followUpDao.save(followup);
|
|
|
|
}
|
|
|
|
}catch (Exception e){
|
|
|
|
logger.info("续方取消,随访记录同步取消失败:"+e.getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|