Quellcode durchsuchen

Merge branch 'dev' of huangwenjie/patient-co-management into dev

chenweida vor 7 Jahren
Ursprung
Commit
bd0c603a1b

+ 8 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/FollowupDao.java

@ -18,4 +18,12 @@ public interface FollowupDao extends PagingAndSortingRepository<Followup, Long>,
    @Query("select a from Followup a where a.doctorCode = ?1 and a.followupDate between ?2 and ?3 and a.status <> '0'")
    List<Followup> findByDoctor(String doctor, Date begin, Date end, Pageable pageRequest) throws Exception;
    
    /**
     * 根据续方CODE获取随访记录
     * @param prescriptionCode
     * @return
     */
    @Query("select a from Followup a where a.prescriptionCode = ?1 and a.status <> '0'")
    Followup getFollowupByPrescriptionCode(String prescriptionCode);
}

+ 12 - 2
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/Followup.java

@ -50,8 +50,18 @@ public class Followup extends IdEntity {
	private String followupContentPhone;
	//创建时间
	private Date createTime;
	
	//关联的续方CODE
	private String prescriptionCode;
	
	public String getPrescriptionCode() {
		return prescriptionCode;
	}
	
	public void setPrescriptionCode(String prescriptionCode) {
		this.prescriptionCode = prescriptionCode;
	}
	
	public String getFollowupNo() {
		return followupNo;
	}

+ 14 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java

@ -79,6 +79,8 @@ public class PrescriptionService extends ZysoftBaseService{
    private AmoutUtils amoutUtils;
    @Autowired
    private ZyIvPhysicDictDao zyIvPhysicDictDao;
    @Autowired
    private FollowupDao followupDao;
    /**
     * 新增续方日志
@ -1130,6 +1132,18 @@ public class PrescriptionService extends ZysoftBaseService{
                log.setUserCode(prescription.getDoctor());
                log.setStatus(PrescriptionLog.PrescriptionLogStatus.pay_refund.getValue());
                prescriptionLogDao.save(log);
                
                try {
                    //续方取消,随访记录也取消,这里如果抛错,则捕获记录日志,不往外抛异常,避免影响长处方的逻辑
                    Followup followup = followupDao.getFollowupByPrescriptionCode(prescription.getCode());
                    if(followup !=null){
                        followup.setStatus("0");
                        followupDao.save(followup);
                    }
                }catch (Exception e){
                    logger.info("取消随访记录失败,:"+e.getMessage());
                }
                
            }
        
        }catch (JSONException ex){

+ 16 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/PrescriptionPayOverdueJob.java

@ -2,8 +2,10 @@ package com.yihu.wlyy.job;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.followup.Followup;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
import com.yihu.wlyy.repository.followup.FollowUpDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.util.HttpClientUtil;
import org.apache.commons.lang3.StringUtils;
@ -36,6 +38,8 @@ public class PrescriptionPayOverdueJob implements Job {
    private String jwUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private FollowUpDao followUpDao;
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    @Override
@ -117,6 +121,18 @@ public class PrescriptionPayOverdueJob implements Job {
                }
                prescription.setZyCancelState(1);
                prescriptionDao.save(prescription);
    
                try {
                    //续方取消,随访记录也取消,这里如果出错则直接捕获,记录日志,不往外抛,避免影响长处方逻辑
                    Followup followup = followUpDao.getFollowupByPrescriptionCode(prescriptionCode);
                    if(followup !=null){
                        followup.setStatus("0");
                        followUpDao.save(followup);
                    }
                }catch (Exception e){
                    logger.info("续方取消,随访记录同步取消失败:"+e.getMessage());
                }
                
            }else{
                throw new Exception("基卫接口(挂号作废)请求失败,无数据返回!");
            }

+ 8 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/followup/FollowUpDao.java

@ -35,4 +35,12 @@ public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>,
    
    @Query(value = "select a.* from wlyy_followup a INNER JOIN  wlyy_followup_mapping b on b.followup_id = a.id AND b.need_upload=?1",nativeQuery = true)
	List<Followup> findByFollowMappingNeedUpload(Integer need_upload);
    
    /**
     * 根据续方CODE获取随访记录
     * @param prescriptionCode
     * @return
     */
    @Query("select a from Followup a where a.prescriptionCode = ?1 and a.status <> '0'")
    Followup getFollowupByPrescriptionCode(String prescriptionCode);
}

+ 50 - 28
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -105,12 +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;
	@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);
@ -923,28 +923,32 @@ public class PrescriptionInfoService extends BaseService {
                //审核不通过模板消息
                sendRMess(p.getCode(), 0);
                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();
                }
	
	            //取消长处方关联的随访记录
	            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);
@ -1887,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());
		}
	}
}

+ 14 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeam;
import com.yihu.wlyy.entity.followup.Followup;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
@ -11,6 +12,7 @@ import com.yihu.wlyy.entity.patient.prescription.PrescriptionDiagnosis;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionExpressage;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
import com.yihu.wlyy.repository.doctor.DoctorTeamDao;
import com.yihu.wlyy.repository.followup.FollowUpDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
@ -73,9 +75,8 @@ public class PrescriptionService extends BaseService {
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private JpaTransactionManager transactionManager;
    @Autowired
    private com.yihu.wlyy.util.CommonUtil commonUtil;
    private FollowUpDao followUpDao;
    /**
@ -431,6 +432,17 @@ public class PrescriptionService extends BaseService {
                        statusObj.put("status",200);
                        statusObj.put("code",9);
                        statusObj.put("message","基卫处方为作废,已修改本地数据库该处方为线下取消");
    
                        try {
                            //续方取消,随访记录也取消,这里如果出错则直接捕获,记录日志,不往外抛,避免影响长处方逻辑
                            Followup followup = followUpDao.getFollowupByPrescriptionCode(prescriptionCode);
                            if(followup !=null){
                                followup.setStatus("0");
                                followUpDao.save(followup);
                            }
                        }catch (Exception e){
                            logger.info("续方取消,随访记录同步取消失败:"+e.getMessage());
                        }
                    }else{
                        statusObj.put("status",200);
                        statusObj.put("code",data.getString("RECIPE_STATUS_CODE"));