|
@ -4,6 +4,7 @@ import com.yihu.wlyy.adapter.PresModeAdapter;
|
|
|
import com.yihu.wlyy.entity.dict.SystemDict;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
|
|
|
import com.yihu.wlyy.entity.followup.Followup;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
import com.yihu.wlyy.entity.patient.prescription.*;
|
|
@ -19,20 +20,25 @@ import com.yihu.wlyy.service.BaseService;
|
|
|
import com.yihu.wlyy.service.system.Icd10DictServcie;
|
|
|
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
|
import com.yihu.wlyy.util.HttpUtil;
|
|
|
import com.yihu.wlyy.util.ImUtill;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.http.NameValuePair;
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
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.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@ -99,6 +105,12 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
private PrescriptionAdjustReasonDao prescriptionAdjustReasonDao;
|
|
|
@Autowired
|
|
|
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);
|
|
|
|
|
@ -495,6 +507,8 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
String rs = jwPrescriptionService.getRecipe(code, p.getSsc());
|
|
|
com.alibaba.fastjson.JSONObject r = presModeAdapter.modelToSinglePrescription(rs);
|
|
|
|
|
|
Followup followup = followUpDao.getFollowupByPrescriptionCode(code);
|
|
|
String rState = presCheckStateObj(code);
|
|
|
if ("1".equals(rState)) {
|
|
|
r.put("reviewedState", 1);
|
|
@ -503,6 +517,7 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
r.put("reviewedState", 0);
|
|
|
r.put("prescriptionCode", rState);
|
|
|
}
|
|
|
r.put("followup",followup);
|
|
|
|
|
|
return r;
|
|
|
}
|
|
@ -908,6 +923,32 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
|
|
|
//审核不通过模板消息
|
|
|
sendRMess(p.getCode(), 0);
|
|
|
|
|
|
//取消长处方关联的随访记录
|
|
|
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);
|
|
|
prescriptionDao.save(p);
|
|
@ -1850,4 +1891,22 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
}
|
|
|
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());
|
|
|
}
|
|
|
}
|
|
|
}
|