Prechádzať zdrojové kódy

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

yeshijie 7 rokov pred
rodič
commit
b0b53ef4f3
17 zmenil súbory, kde vykonal 230 pridanie a 76 odobranie
  1. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java
  2. 8 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/Patient.java
  3. 5 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java
  4. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java
  5. 0 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientDao.java
  6. 7 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionInfoDao.java
  7. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  8. 106 24
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java
  9. 0 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  10. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/TokenService.java
  11. 8 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/ZyDictService.java
  12. 15 15
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java
  13. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SystemData.java
  14. 8 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java
  15. 51 11
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java
  16. 4 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/PatientSignFamilyServiceController.java
  17. 10 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/util/WeiXinTagUtil.java

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java


+ 8 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/Patient.java

@ -96,6 +96,8 @@ public class Patient extends IdEntity implements Serializable {
	private Date sicardTime;
	//是否分配过微信标签  1分配过 0或者空没有
	private Integer isWxtag;
	//微信iagId
	private Integer wxtagid;
	public Integer getSicardStatus() {
@ -401,7 +403,13 @@ public class Patient extends IdEntity implements Serializable {
		this.isWxtag = isWxtag;
	}
	public Integer getWxtagid() {
		return wxtagid;
	}
	public void setWxtagid(Integer wxtagid) {
		this.wxtagid = wxtagid;
	}
	//---------------------------常量----------------------------
	public enum isWchatTage{

+ 5 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java

@ -115,7 +115,9 @@ public class DoctorInterceptor extends BaseInterceptor {
            Map<String, Token> tempMap = null;
            if (platform == 2) {
                tempMap = SystemData.doctorTokens;
            } else {
            }else if (platform == 5) {
                tempMap = SystemData.prescriptionPCTokens;
            }else {
                tempMap = SystemData.doctorPCTokens;
            }
            token = tempMap.get(uid);
@ -126,7 +128,8 @@ public class DoctorInterceptor extends BaseInterceptor {
                    tempMap.put(uid, token);
                }
            }
            if (token == null || (token.getPlatform() != 2&&token.getPlatform() != 4)) {
            //1、患者端,2、医生端app,3、微信公众号wechat,4、医生端pc,5、PC端取药系统
            if (token == null || (token.getPlatform() != 2&&token.getPlatform() != 4&&token.getPlatform() != 5)) {
                // 未登录
                response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
                flag = false;

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java

@ -86,6 +86,6 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    int findTzMessage(String patient);
    //根据续方关联code查询团队长分配健管师消息
    @Query("from Message a where a.type = 3 and a.state=0 and a.del='1' and a.over='0' and relationCode = ?1  ")
    @Query("from Message a where a.type = 8 and a.state=0 and a.del='1' and a.over='0' and relationCode = ?1  ")
    Message findByRelationCode(String relationCode);
}

+ 0 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientDao.java

@ -64,8 +64,4 @@ public interface PatientDao extends PagingAndSortingRepository<Patient, Long> {
    //获取所有的openid并排重
    @Query("select distinct p.openid from Patient p where p.openid is not null and p.openid <> '' ")
    List<String> findOpenids();
    @Modifying
    @Query("update Patient p set p.isWxtag=?2 where p.code=?1")
    void updateIsWXTagByCode(String patient, Integer status);
}

+ 7 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionInfoDao.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.repository.prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -14,4 +15,10 @@ import java.util.List;
public interface PrescriptionInfoDao extends PagingAndSortingRepository<PrescriptionInfo, Long>, JpaSpecificationExecutor<PrescriptionInfo> {
    @Query("from PrescriptionInfo p where p.prescriptionCode=?1 and p.del=1")
    List<PrescriptionInfo> findByPrescriptionCode(String prescriptionCode);
    @Modifying
    @Query("update PrescriptionInfo p set p.code=?2 where p.cost=?1")
    void updateStatus(String code,Integer cost);
}

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

@ -307,7 +307,7 @@ public class PrescriptionInfoService extends BaseService {
        }
        if (prescription != null && prescription.getStatus() == 10) {
        if (prescription != null && prescription.getStatus() == PrescriptionLog.PrescriptionLogStatus.wait_pay.getValue()) {
            Long s = (prescription.getCreateTime().getTime() - new Date().getTime()) / 1000;
            //rs.put("time",s);
            if (s > 172800) {
@ -530,7 +530,7 @@ public class PrescriptionInfoService extends BaseService {
                reviewed.setStatus(PrescriptionReviewed.PrescriptionReviewedStatus.del.getValue());
                //修改系统的续方消息的审核状态
                messageDao.updatePreScriptionMessage(code, "2", 6);
                messageDao.updatePreScriptionMessage(p.getConsult(), "2", 6);
                //审核不用过发送消息
                //发送Im消息

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

@ -6,18 +6,11 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeam;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
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.DoctorMappingDao;
import com.yihu.wlyy.entity.patient.prescription.*;
import com.yihu.wlyy.repository.doctor.DoctorTeamDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDiagnosisDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDispensaryCodeDao;
import com.yihu.wlyy.repository.prescription.PrescriptionExpressageDao;
import com.yihu.wlyy.repository.prescription.*;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
import com.yihu.wlyy.task.PushMsgTask;
@ -27,10 +20,13 @@ 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.orm.jpa.JpaTransactionManager;
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
 * Created by chenweida on 2017/7/27.
@ -40,6 +36,9 @@ public class PrescriptionService extends BaseService {
    private static Logger logger = LoggerFactory.getLogger(PrescriptionService.class);
    @Value("${wechat.wechat_base_url}")
    private String wechat_base_url;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
@ -55,15 +54,17 @@ public class PrescriptionService extends BaseService {
    @Autowired
    private JwPrescriptionService jwPrescriptionService;
    @Autowired
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    @Value("${wechat.wechat_base_url}")
    private String wechat_base_url;
    @Autowired
    private PrescriptionDispensaryCodeDao prescriptionDispensaryCodeDao;
    @Autowired
    private DoctorTeamDao doctorTeamDao;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private JpaTransactionManager transactionManager;
    @Autowired
    private com.yihu.wlyy.util.CommonUtil CommonUtil;
    /**
@ -235,19 +236,19 @@ public class PrescriptionService extends BaseService {
                    // "yszjdj":"医师诊金级别","bqbm00":"病情编码","sfygwd":"是否医改网点"}
                    JSONObject jsonObject = new JSONObject();
                    jsonObject.put("yyksbm",zyCfinfoObj.getString("VISIT_DEPT"));//医生科室编号
                    jsonObject.put("bcsfcs",1);//本次收费次数
                    jsonObject.put("bcsfcs","1");//本次收费次数
                    jsonObject.put("yszjhm",zyCfinfoObj.getString("VISIT_IDENTITY_CARD_NO"));//医生证件号码
                    jsonObject.put("ysxm00",prescription.getDoctorName());//医生姓名
                    jsonObject.put("mzlb00",zyCfinfoObj.getString("INSUR_DISP_REGISTER_TYPE"));//门诊类别---普通门诊默认为101
                    jsonObject.put("sfydgh","N");//是否药店挂号,默认为N,不是药店挂号
                    jsonObject.put("bcghcs",1);//本次挂号次数
                    jsonObject.put("bcghcs","1");//本次挂号次数
                    jsonObject.put("ghksmc",prescription.getDeptName());//挂号科室名称
                    jsonObject.put("mzlsh0","");//医保挂号流水号
                    jsonObject.put("ghfy00",0);//挂号费用
                    jsonObject.put("ghfy00","0");//挂号费用
                    jsonObject.put("bqbm00","");//病情编码---可为空,不传递
                    jsonObject.put("sfygwd","N");//是否医改网点--默认为否
                    jsonObject.put("yszjdj",zyCfinfoObj.getString("INSUR_DOCTOR_RANK"));//医师诊金级别
                    jsonObject.put("cfxms0",zySettleDetailList.size());//明细上传数量
                    jsonObject.put("cfxms0",""+zySettleDetailList.size());//明细上传数量
                    json.put("recipeContent",jsonObject);
@ -270,7 +271,7 @@ public class PrescriptionService extends BaseService {
                    // "sptxbm":"商品条形编码","xmmc00":"项目名称","fpxmbh":"发票项目编号","xmsl00":"项目数量","ypyl00":"药品用量","qyzldw":"取药单位","xmdw00":"项目单位",
                    // "jx0000":"剂型"}
                    for (int j= 0; i < zySettleDetailList.size(); j++) {
                    for (int j= 0; j < zySettleDetailList.size(); j++) {
                        JSONObject zySettleDetailObj = zySettleDetailList.getJSONObject(j);
                        JSONObject j2 = new JSONObject();
@ -278,11 +279,19 @@ public class PrescriptionService extends BaseService {
                        j2.put("xmmc00",zySettleDetailObj.getString("INSUR_ITEM_NAME"));//项目名称
                        j2.put("fpxmbh","");//发票项目编号
                        j2.put("sfybxm",zySettleDetailObj.getString("INSUR_FLAG"));//是否医保项目
                        j2.put("xmdj00",zySettleDetailObj.getString("INSUR_ITEM_PRICE"));//项目单价
                        Double _price = Double.parseDouble(zySettleDetailObj.getString("INSUR_ITEM_PRICE"));
                        Integer infoprice = CommonUtil.doubleToInt(_price);
                        j2.put("xmdj00",String.valueOf(infoprice));//项目单价
                        j2.put("xmdw00",zySettleDetailObj.getString("INSUR_ITEM_UNIT_NAME"));//项目单位
                        j2.put("xmgg00",zySettleDetailObj.getString("INSUR_ITEM_SPEC"));//项目规格(医保)
                        j2.put("xmsl00",zySettleDetailObj.getString("ITEM_QUANTITY"));//项目数量
                        j2.put("xmje00",zySettleDetailObj.getString("COST"));//项目金额
                        Double _cost = Double.parseDouble(zySettleDetailObj.getString("COST"));
                        Integer infocost = CommonUtil.doubleToInt(_cost);
                        j2.put("xmje00",String.valueOf(infocost));//项目金额
                        j2.put("ysxm00",zySettleDetailObj.getString("APPLY_OPERATOR_NAME"));//医生姓名
                        j2.put("sptxbm","");//商品条形编码
                        j2.put("yppl00",zySettleDetailObj.getString("FREQUENCY"));//药品频率
@ -306,4 +315,77 @@ public class PrescriptionService extends BaseService {
        return json;
    }
    /**
     *从待结算列表获取药品明细和总金额,更新到处方药品明细表
     *@author huangwenjie
     *@date 2017/8/16 19:15
     */
    public void getPerscriptionInfoCostFromPayInfo(String prescriptionCode){
        try {
            //根据挂号号获取处方明细
            Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
            Map<String,String> zyInfoCodeAndCost = new HashMap<>();
            //根据医保卡号和挂号号从基卫获取待结算明细
            String result = jwPrescriptionService.getDispUnSettleFeeInfoList(prescription.getSsc(),prescription.getVisitNo());
            JSONObject json = new JSONObject();
            if(StringUtils.isNotBlank(result)){
                JSONObject jwobj =  JSON.parseObject(result);
                JSONObject zyCfinfo = jwobj.getJSONObject("data");
                Integer code = zyCfinfo.getInteger("CODE");
                if( 1 == code){
                    JSONArray zyCfinfoListReturnData = zyCfinfo.getJSONArray("returnData");
                    JSONArray zyCfinfoList = zyCfinfoListReturnData.getJSONArray(0);
                    for (int i = 0; i < zyCfinfoList.size(); i++) {
                        //支付明细
                        JSONArray zySettleDetailList = zyCfinfoList.getJSONObject(i).getJSONArray("SETTLE_DETAIL");
                        for (int j= 0; j < zySettleDetailList.size(); j++) {
                            JSONObject zySettleDetailObj = zySettleDetailList.getJSONObject(j);
                            //药品编码
                            String zyinfoKey = zySettleDetailObj.getString("INSUR_ITEM_CODE");
                            //总金额
                            String cost = zySettleDetailObj.getString("COST");
                            if(StringUtils.isNotBlank(zyinfoKey)){
                                zyInfoCodeAndCost.put(zyinfoKey,cost);
                            }
                        }
                    }
                }else{
                    String errormessage = zyCfinfo.getString("MESSAGE");
                    throw new Exception(errormessage);
                }
            }
            if(!zyInfoCodeAndCost.keySet().isEmpty()){
                //使用事务控制批量更新
                DefaultTransactionDefinition def = new DefaultTransactionDefinition();
                def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); // 事物隔离级别,开启新事务
                TransactionStatus status = transactionManager.getTransaction(def); // 获得事务状态
                try {
                    for (String infoCode : zyInfoCodeAndCost.keySet()) {
                        Double _cost = Double.parseDouble(zyInfoCodeAndCost.get(infoCode));
                        Integer infocost = CommonUtil.doubleToInt(_cost);
                        prescriptionInfoDao.updateStatus(infoCode,infocost);
                    }
                    //事务提交
                    transactionManager.commit(status);
                } catch (Exception ex) {
                    //报错事务回滚
                    transactionManager.rollback(status);
                }
            }
        }catch (Exception e){
            logger.info("从待结算列表获取药品明细和总金额失败:"+e.getMessage());
        }
    }
}

+ 0 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -33,7 +33,6 @@ import com.yihu.wlyy.task.SignUploadTask;
import com.yihu.wlyy.util.*;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import com.yihu.wlyy.wechat.util.WeiXinTagUtil;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.sql.Select;
import org.json.JSONArray;
@ -128,8 +127,6 @@ public class FamilyContractService extends BaseService {
    private SignFamilyRenewDao signFamilyRenewDao;
    @Autowired
    private SignFamilyMappingDao signFamilyMappingDao;
    @Autowired
    private WeiXinTagUtil weiXinTagUtil;
    @Autowired
    private ImUtill ImUtill;
@ -1187,7 +1184,6 @@ public class FamilyContractService extends BaseService {
        //签约成功之后给患者新增标签
        String openId=sf.getOpenid();
       hospital=sf.getHospital();
        weiXinTagUtil.addTagWithOpenid(openId,hospital,sf.getPatient(),sf.getName());
        return temp;
    }
@ -1535,7 +1531,6 @@ public class FamilyContractService extends BaseService {
        //签约成功之后给患者新增标签
        String openId=sf.getOpenid();
        String hospital=sf.getHospital();
        weiXinTagUtil.addTagWithOpenid(openId,hospital,sf.getPatient(),sf.getName());
        return result;
    }
@ -1672,7 +1667,6 @@ public class FamilyContractService extends BaseService {
        //根据openId给患者清掉标签
        String openId=sf.getOpenid();
        String hospital=sf.getHospital();
        weiXinTagUtil.deleteTagWithOpenid(openId,hospital,sf.getPatient(),sf.getName());
        return 1;
    }

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/TokenService.java

@ -64,6 +64,8 @@ public class TokenService extends BaseService {
			SystemData.wxPatientTokens.put(user, token);
		}else if(platform == 4){
			SystemData.doctorPCTokens.put(user,token);
		}else if(platform == 5){
			SystemData.prescriptionPCTokens.put(user,token);
		}
		return token;
	}

+ 8 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/ZyDictService.java

@ -93,22 +93,24 @@ public class ZyDictService {
     * @return
     */
    public List<Map<String, Object>> findDictByDoctorAndName(String doctor,String name){
        String sql = "SELECT " +
                " yp.physic_code drugCode, " +
        String sql = "SELECT  yp.physic_code drugCode, " +
                " yp.physic_name drugName, " +
                " yp.physic_spec drugFormat, " +
                " yp.subject_class subjectClass, " +
                " yp.pack_unit packUnit, " +
                " com3.`name` packUnitName, " +
                " yp.min_dose minDose, " +
                " yp.pack_spec pakeSpec, " +
                " class.class_name className, " +
                " yp.dose_unit physicDoseUnit, " +
                " com1.`name` physicDoseUnitName, " +
                " yp.quantity_unit drugNumUnit, " +
                " com2.`name` drugNumUnitName " +
                " com2.`name` drugNumUnitName, " +
                " yp.retail_price retailPrice " +
                " FROM " +
                " (SELECT code,name FROM zy_common_dict WHERE dict_name = 'IV_MEASURE_UNIT_DICT') com1, " +
                " (SELECT code,name FROM zy_common_dict WHERE dict_name = 'IV_MEASURE_UNIT_DICT') com2, " +
                " (SELECT code,name FROM zy_common_dict WHERE dict_name = 'IV_MEASURE_UNIT_DICT') com3, " +
                "  zy_iv_subject_class_dict class,  " +
                "  (  " +
                "    SELECT  " +
@ -120,7 +122,8 @@ public class ZyDictService {
                "   p.quantity_unit, " +
                "   p.pack_unit, " +
                "   p.min_dose, " +
                "   p.pack_spec " +
                "   p.pack_spec," +
                "   p.retail_price " +
                "    FROM  " +
                "   zy_iv_physic_dict p, " +
                "  ( " +
@ -147,6 +150,7 @@ public class ZyDictService {
                "WHERE " +
                " com1.`code` = yp.dose_unit " +
                " AND com2.`code` = yp.quantity_unit " +
                " AND com3.`code` = yp.pack_unit " +
                " AND class.class_code = yp.subject_class";
//        subjectClass
//        drugNumUnit":"224","drugNumUnitName":"支",

+ 15 - 15
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java

@ -119,6 +119,7 @@ public class PushMsgTask {
            }
        }
    }
    @PostConstruct
    private void run() {
        new Thread(new ConsumerTask(httpUtil)).start();
@ -205,7 +206,6 @@ public class PushMsgTask {
     *             type==11时:{"first":"消息主题","name":"患教标题","doctorName":"医生名","date":"发送时间","remark":"消息备注"}
     *             type==19时:{"first":"消息主题","keyword1":"审核结果","keyword2":"审核医生","remark":"消息备注"}
     *             type==20时:{"first":"消息主题","keyword1":"服务项目","keyword2":"操作医生","keyword3":"服务时间","remark":"消息备注"}
     *
     * @return
     */
//    private boolean sendWeixinMessage(String access_token, int type, String openid, String name, JSONObject json) {
@ -286,9 +286,9 @@ public class PushMsgTask {
                m.put("keyword3", keyword3);
            } else if (type == 1 || type == 2) {
                if (type == 1) {
                    temp_id =template_sign_success;
                    temp_id = template_sign_success;
                } else {
                    temp_id =template_sign_failed;
                    temp_id = template_sign_failed;
                }
                String isRenew = "0";
                if (json.has("isRenew")) {
@ -374,7 +374,7 @@ public class PushMsgTask {
                m.put("keyword4", keyword4);
            } else if (type == 6) {
                temp.setUrl(url + "wdyy/html/detail-appointment.html?openid=" + openid + "&orgCode=" + json.get("orgCode") + "&id=" + json.getString("id") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp_id =template_appoint_success;
                temp_id = template_appoint_success;
                temp.setTemplate_id(temp_id);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
@ -394,7 +394,7 @@ public class PushMsgTask {
                m.put("planstarttime", keyword4);
            } else if (type == 7) {
                temp.setUrl(url + "wdyy/html/my-appointment.html?openid=" + openid + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp_id =template_appoint_failed;
                temp_id = template_appoint_failed;
                temp.setTemplate_id(temp_id);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
@ -457,9 +457,10 @@ public class PushMsgTask {
                keyword5.setValue(json.getString("remark"));
                m.put("remark", keyword5);
            } else if (type == 10) {
                temp.setUrl(url + "qygl/html/signing-doctors.html?openid=" + openid + "&state=" + openid + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                if (json.has("url")){
                if (json.has("url")) {
                    temp.setUrl(url + json.getString("url"));
                }else {
                    temp.setUrl(url + "qygl/html/signing-doctors.html?openid=" + openid + "&state=" + openid + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                }
                temp.setTemplate_id(template_doctor_change);
                WechatTemplateData keyword1 = new WechatTemplateData();
@ -477,11 +478,12 @@ public class PushMsgTask {
                keyword3.setValue(json.getString("keyword3"));
                m.put("keyword3", keyword3);
            } else if (type == 11) {
                String xinurl = url + "survey/html/survey_info.html?openid=" + openid + "&state=" + openid + "&survey_id=" + json.getString("survey_id") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented");
//                temp.setUrl(url + "survey/html/survey_info.html?openid=" + openid + "&state=" + openid + "&survey_id=" + json.getString("survey_id") + "&toUser=" + json.getString("toUser") + "&toName=" + name);
                temp.setUrl(xinurl);
                if (json.has("url")){
                if (json.has("url")) {
                    temp.setUrl(url + json.getString("url"));
                } else {
                    String xinurl = url + "survey/html/survey_info.html?openid=" + openid + "&state=" + openid + "&survey_id=" + json.getString("survey_id") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented");
//                temp.setUrl(url + "survey/html/survey_info.html?openid=" + openid + "&state=" + openid + "&survey_id=" + json.getString("survey_id") + "&toUser=" + json.getString("toUser") + "&toName=" + name);
                    temp.setUrl(xinurl);
                }
                temp.setTemplate_id(template_doctor_survey);
                WechatTemplateData keyword1 = new WechatTemplateData();
@ -494,8 +496,6 @@ public class PushMsgTask {
                keyword2.setValue(json.getString("keyword2"));
                m.put("keyword2", keyword2);
                logger.info("type=====>openId " + openid);
                System.out.println("url=======type =11 =====================>" + xinurl);
                logger.error("url=======type =11 =====================>" + xinurl);
            } else if (type == 12) {
                temp.setUrl(url + "jtgx/html/application-msg-list.html?openid=" + openid + "&member=" + json.getString("member") + "&toUser=" + json.getString("member") + "&toName=" + name);
@ -596,7 +596,7 @@ public class PushMsgTask {
                keyword2.setColor("#000000");
                keyword2.setValue(json.getString("keyword2"));
                m.put("keyword2", keyword2);
            }else if (type == 19) {
            } else if (type == 19) {
                temp.setUrl(url + json.getString("url"));
                temp.setTemplate_id(template_doctor_audit);
                WechatTemplateData keyword1 = new WechatTemplateData();
@ -607,7 +607,7 @@ public class PushMsgTask {
                keyword2.setColor("#000000");
                keyword2.setValue(json.getString("keyword2"));
                m.put("keyword2", keyword2);
            }else if (type == 20) {
            } else if (type == 20) {
                temp.setUrl(url + json.getString("url"));
                temp.setTemplate_id(template_doctor_service);
                WechatTemplateData keyword1 = new WechatTemplateData();

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SystemData.java

@ -15,5 +15,6 @@ public class SystemData {
	public static Map<String, Token> patientTokens = new HashMap<String, Token>();
	// 患者公众号验证信息
	public static Map<String, Token> wxPatientTokens = new HashMap<String, Token>();
	// PC端取药系统验证信息
	public static Map<String, Token> prescriptionPCTokens = new HashMap<String, Token>();
}

+ 8 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java

@ -18,6 +18,7 @@ import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.common.account.TokenService;
import com.yihu.wlyy.util.*;
import com.yihu.wlyy.web.WeixinBaseController;
import com.yihu.wlyy.wechat.util.WeiXinTagUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
@ -69,6 +70,8 @@ public class PatientController extends WeixinBaseController {
    private SMSService smsService;
    @Autowired
    private SignFamilyServerDao signFamilyServerDao;
    @Autowired
    private WeiXinTagUtil weiXinTagUtil;
    /**
     * 患者基本信息查询接口
@ -391,6 +394,11 @@ public class PatientController extends WeixinBaseController {
                token.setDel("0");
                tokenDao.save(token);
                SystemData.wxPatientTokens.remove(getUID());
                //清空患者的微信标签
                weiXinTagUtil.deleteTagWithOpenid(patient.getOpenid(),patient.getWxtagid());
                patient.setIsWxtag(Patient.isWchatTage.no.getValue());
                patient.setWxtagid(null);
                patientInfoService.updatePatient(patient);
                return success("已成功退出!");
            }
        } catch (Exception e) {

+ 51 - 11
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.web.patient.prescription;
import com.yihu.wlyy.service.app.prescription.PatientPrescriptionPayService;
import com.yihu.wlyy.service.app.prescription.PrescriptionNoticesService;
import com.yihu.wlyy.service.app.prescription.PrescriptionService;
import com.yihu.wlyy.web.WeixinBaseController;
import io.swagger.annotations.Api;
@ -30,11 +31,13 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
    @Autowired
    private PrescriptionService prescriptionService;
    @Autowired
    private PrescriptionNoticesService noticesService;
    /**
     * 患者长处方支付接口 可配送方式查询
     *
     * @param orgCode 居民签约社区code
     * @param orgCode          居民签约社区code
     * @param prescriptionCode 续方code
     * @return
     * @throws Exception
@ -45,8 +48,8 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            @RequestParam(required = true) @ApiParam(value = "续方code", name = "prescriptionCode") String prescriptionCode,
            @RequestParam(required = true) @ApiParam(value = "居民签约社区code", name = "orgCode") String orgCode) throws Exception {
        try {
            com.alibaba.fastjson.JSONObject result = payService.dispatch(prescriptionCode,orgCode);
            return write(200, "获取成功!","data",result);
            com.alibaba.fastjson.JSONObject result = payService.dispatch(prescriptionCode, orgCode);
            return write(200, "获取成功!", "data", result);
        } catch (Exception e) {
            return error(-1, "获取失败!");
        }
@ -70,7 +73,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            @RequestParam(required = true) @ApiParam(value = "居民社区code", name = "orgCode") String orgCode,
            @RequestParam(required = true) @ApiParam(value = "续方code", name = "prescriptionCode") String prescriptionCode,
            @RequestParam(required = true) @ApiParam(value = "配送方式", name = "type") int type,
            @RequestParam(required = true) @ApiParam(value = "配送地址json", name = "addressJson",defaultValue = "{\"townName\":\"海沧区\",\"code\":\"3502050100\",\"address\":" +
            @RequestParam(required = true) @ApiParam(value = "配送地址json", name = "addressJson", defaultValue = "{\"townName\":\"海沧区\",\"code\":\"3502050100\",\"address\":" +
                    "\"冰岛\",\"cityName\":\"厦门市\",\"townCode\":\"350205\",\"provinceCode\":\"350000\",\"cityCode\":\"350200\",\"name\":\"海沧区嵩屿街道社区卫生服务中心\"," +
                    "\"provinceName\":\"福建省\",\"streeCode\":\"35020501\",\"streeName\":\"皇后大道东\",\"phone\":\"13253541190\"}") String addressJson,
            @RequestParam(required = true) @ApiParam(value = "页面回调地址", name = "returnUrl") String returnUrl,
@ -78,8 +81,12 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
        try {
            String accessToken = getAccessToken();
            String patient = getUID();
            Map result = payService.charge(type,addressJson,orgCode, prescriptionCode, totalAmount, patient, accessToken,returnUrl);
            return write(200, "支付成功!","data",result);
            Map result = payService.charge(type, addressJson, orgCode, prescriptionCode, totalAmount, patient, accessToken, returnUrl);
            if ("-1".equals(result.get("status").toString())) {
                return error(-1, "续方居民信息与微信支付身份信息不一致!");
            } else {
                return write(200, "支付成功!", "data", result);
            }
        } catch (Exception e) {
            return error(-1, "支付失败!");
        }
@ -97,7 +104,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
        try {
            String accessToken = getAccessToken();
            String result = payService.chargeQuery(outChargeNo, accessToken);
            return write(200, "获取成功!","data",result);
            return write(200, "获取成功!", "data", result);
        } catch (Exception e) {
            return error(-1, "获取失败!");
        }
@ -116,7 +123,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
        try {
            String accessToken = getAccessToken();
            Map result = payService.recipeReturnUrl(request, response, accessToken);
            return write(200, "页面回调成功!","data",result);
            return write(200, "页面回调成功!", "data", result);
        } catch (Exception e) {
            return error(-1, "页面回调失败!");
        }
@ -143,13 +150,46 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            @ApiParam(name = "cardNo", value = "社保卡号", defaultValue = "D21085562")
            @RequestParam(value = "cardNo", required = true) String cardNo,
            @ApiParam(name = "visitNo", value = "挂号号", defaultValue = "3277865")
            @RequestParam(value = "visitNo", required = true) String visitNo){
            @RequestParam(value = "visitNo", required = true) String visitNo) {
        try {
            com.alibaba.fastjson.JSONObject jsonParams = prescriptionService.getPayInfo(cardNo,visitNo);
            return write(200, "获取成功!","data",jsonParams);
            com.alibaba.fastjson.JSONObject jsonParams = prescriptionService.getPayInfo(cardNo, visitNo);
            return write(200, "获取成功!", "data", jsonParams);
        } catch (Exception e) {
            return error(-1, "获取失败!");
        }
    }
    /**
     * 测试长处方相关模板通知消息
     *
     * @param patient   要发送对象居民code
     * @param doctName  相关医生姓名(type=1审核医生、type=2 null、type=3配送健管师、type=4审核医生)
     * @param ordenTime 订单完成时间(type=1 null、type=2 null、type=3 null、type=4 订单完成时间)
     * @param type      1:续方审核通知 2:取药代办通知 3:配送中信息变更 4:已完成服务结果
     * @param status    续方通知状态 0不通过 1通过 2调整处方  其余状态均为0
     * @param url       带参数的模板跳转链接
     */
    @RequestMapping(value = "/testSendMassages", method = RequestMethod.POST)
    @ApiOperation(value = "测试长处方相关模板通知消息")
    public String testSendMassages(
            @ApiParam(name = "patient", value = "要发送对象居民code")
            @RequestParam(value = "patient", required = true) String patient,
            @ApiParam(name = "doctName", value = "相关医生姓名(type=1审核医生、type=2 null、type=3配送健管师、type=4审核医生)")
            @RequestParam(value = "doctName", required = false) String doctName,
            @ApiParam(name = "ordenTime", value = "订单完成时间(type=1 null、type=2 null、type=3 null、type=4 订单完成时间)")
            @RequestParam(value = "ordenTime", required = false) String ordenTime,
            @ApiParam(name = "type", value = "1:续方审核通知 2:取药代办通知 3:配送中信息变更 4:已完成服务结果")
            @RequestParam(value = "type", required = true) int type,
            @ApiParam(name = "status", value = "续方通知状态 0不通过 1通过 2调整处方  其余状态均为0")
            @RequestParam(value = "status", required = true) int status,
            @ApiParam(name = "url", value = "带参数的模板跳转链接")
            @RequestParam(value = "url", required = true) String url) {
        try {
            noticesService.sendMessages(patient, doctName, ordenTime, type, status, url);
            return write(200, "发送成功!");
        } catch (Exception e) {
            return error(-1, "发送失败!");
        }
    }
}

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/PatientSignFamilyServiceController.java

@ -10,6 +10,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
@ -34,6 +35,9 @@ public class PatientSignFamilyServiceController extends BaseController {
    ) {
        try {
            JSONObject jo = new JSONObject();
            if (StringUtils.isEmpty(patientCode)) {
                patientCode = getUID();
            }
            Service service = signFamilyServiceService.getPatientService(patientCode, null);
            List<ServiceItem> serviceItems = signFamilyServiceService.getPatientServiceItem(patientCode, null);
            jo.put("service", service);

+ 10 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/util/WeiXinTagUtil.java

@ -118,9 +118,10 @@ public class WeiXinTagUtil {
                    throw new Exception("创建失败," + result);
                }
                //更新患者表
                patientDao.updateIsWXTagByCode(patient, Patient.isWchatTage.yes.getValue());
                Patient patientObj = patientDao.findByCode(patient);
                patientObj.setIsWxtag(Patient.isWchatTage.yes.getValue());
                patientObj.setWxtagid(tagId);
            }
            return result;
        } catch (Exception e) {
            logger.error(e.getMessage());
@ -156,8 +157,9 @@ public class WeiXinTagUtil {
            } else {
                saveLog(openid, patient, patientName, null, 1, "wx_tag中不存在区是" + town + "的标签");
            }
            //更新患者表
            patientDao.updateIsWXTagByCode(patient, Patient.isWchatTage.yes.getValue());
            Patient patientObj = patientDao.findByCode(patient);
            patientObj.setIsWxtag(Patient.isWchatTage.yes.getValue());
            patientObj.setWxtagid(tagId.getTagId());
            return str;
        } catch (Exception e) {
            logger.error(e.getMessage());
@ -220,7 +222,9 @@ public class WeiXinTagUtil {
            } else {
                saveLog(openid, patient, patientName, null, 2, "wx_tag中不存在区是" + town + "的标签");
            }
            patientDao.updateIsWXTagByCode(patient, Patient.isWchatTage.no.getValue());
            Patient patientObj = patientDao.findByCode(patient);
            patientObj.setIsWxtag(Patient.isWchatTage.no.getValue());
            patientObj.setWxtagid(null);
            return str;
        } catch (Exception e) {
            logger.error(e.getMessage());
@ -268,6 +272,7 @@ public class WeiXinTagUtil {
     */
    public String deleteTagWithOpenid(String openIds, Integer tagId) {
        try {
            net.sf.json.JSONObject params = new net.sf.json.JSONObject();
            net.sf.json.JSONArray ja = new JSONArray();
            ja.add(openIds);