Forráskód Böngészése

Merge remote-tracking branch 'origin/dev' into dev

wangxingwang 7 éve
szülő
commit
12430484bb
46 módosított fájl, 1462 hozzáadás és 773 törlés
  1. 42 0
      common/common-entity/src/main/java/com/yihu/mm/entity/yueren/MedicineStroresNo.java
  2. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java
  3. 8 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/Patient.java
  4. 3 3
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionInfo.java
  5. 9 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/service/ServiceItem.java
  6. 37 6
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/controller/medicine/PhysicalExaminationController.java
  7. 17 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/mm/exam/MedicineStroresNoDao.java
  8. 22 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/MedicineStroresNoService.java
  9. 61 13
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PhysicalExaminationService.java
  10. 53 10
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/User.java
  11. 112 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/common/util/CommonUtil.java
  12. 7 7
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java
  13. 8 7
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/ZysoftBaseService.java
  14. 42 27
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java
  15. 2 2
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/extract/DBExtract.java
  16. 49 37
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/SignJob.java
  17. 1 1
      patient-co/patient-co-wlyy/pom.xml
  18. 32 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java
  19. 5 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java
  20. 23 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/redis/RedisThread.java
  21. 4 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java
  22. 0 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientDao.java
  23. 7 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionInfoDao.java
  24. 10 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java
  25. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java
  26. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDiagnosisService.java
  27. 27 20
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java
  28. 402 377
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  29. 173 25
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java
  30. 0 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  31. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/TokenService.java
  32. 0 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java
  33. 8 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/ZyDictService.java
  34. 15 15
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java
  35. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SystemData.java
  36. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/PCLoginController.java
  37. 16 12
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java
  38. 8 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionCodeController.java
  39. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionExpressageController.java
  40. 124 109
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java
  41. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescriptionPC/PrescriptionExpressagePCController.java
  42. 8 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java
  43. 49 44
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java
  44. 51 11
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java
  45. 4 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/PatientSignFamilyServiceController.java
  46. 10 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/util/WeiXinTagUtil.java

+ 42 - 0
common/common-entity/src/main/java/com/yihu/mm/entity/yueren/MedicineStroresNo.java

@ -0,0 +1,42 @@
package com.yihu.mm.entity.yueren;
import com.yihu.mm.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by Administrator on 2017/8/9.
 */
@Entity
@Table(name = "wlyy_medicine_strores_no")
public class MedicineStroresNo extends IdEntity {
    private String distribute; //描述
    private String shId;    //门店编号
    private String city; //城市编号
    public String getDistribute() {
        return distribute;
    }
    public void setDistribute(String distribute) {
        this.distribute = distribute;
    }
    public String getShId() {
        return shId;
    }
    public void setShId(String shId) {
        this.shId = shId;
    }
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
}

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 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{

+ 3 - 3
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionInfo.java

@ -23,7 +23,7 @@ public class PrescriptionInfo extends IdEntity{
    private String drugRate;               //吃药频率
    private String drugRateName;          //用药频次名称
    private String drugFormat;             //药品规格
    private Integer num;                    //药品数目
    private Integer num;                    //药品总量(用来计算价格)
    private Integer isRefrigerate;         //是否冷藏 1是 0否
    private String direction;               //药品用法
    private Integer price;                    //药品单价 单位是分
@ -31,7 +31,7 @@ public class PrescriptionInfo extends IdEntity{
    private String jwSubCode;//智业子处方号
    private String drugNumUnit;//数量单位编码
    private String drugNumUnitName;//数量单位名称
    private Integer cost;//金额 单位是分
    private Integer cost;//计算总额(num*price) 单位是分
    private Integer charge;//自付 单位是分
    private String bindFlag;//成组标志, 0.非成组,1.成组
    private Integer dayCount;//用药天数
@ -40,7 +40,7 @@ public class PrescriptionInfo extends IdEntity{
    private String physicDose;//用药剂量
    private String physicDoseUnit;//剂量单位编码
    private String physicDoseUnitName;//剂量单位名称
    private String physicAmount;//用药总量
    private String physicAmount;//用药总量(实际用药量)
    private String physicAmountUnit;//总量单位编码
    private String physicAmountUnitName;//总量单位名称
    private String physicInjectPlace;//注射地点编码

+ 9 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/service/ServiceItem.java

@ -16,6 +16,7 @@ public class ServiceItem extends IdEntity {
    private String code; //非业务主键
    private String serviceCode;// 所属服务code 关联表 wlyy_Service
    private String name;       //	服务名称
    private String subName;//副标题
    private String image;   //图片的url
    private Integer type;   // 服务类型 1 热线电话 2 中医体检
    private String mobile;  //服务项对应的热线电话
@ -148,4 +149,12 @@ public class ServiceItem extends IdEntity {
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getSubName() {
        return subName;
    }
    public void setSubName(String subName) {
        this.subName = subName;
    }
}

+ 37 - 6
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/controller/medicine/PhysicalExaminationController.java

@ -13,12 +13,11 @@ import io.swagger.annotations.ApiParam;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.util.Date;
@ -63,6 +62,7 @@ public class PhysicalExaminationController extends BaseController {
        if(isSignJM==3){
            String insertslip = physicalExaminationService.insertslip(patient);
            JSONObject jsonQuestion = new JSONObject(insertslip);
            jsonQuestion.put("isSignJM",isSignJM);
            JSONObject recordset = jsonQuestion.getJSONObject("recordset");
            String ct_id = recordset.get("ct_id").toString();
@ -73,7 +73,7 @@ public class PhysicalExaminationController extends BaseController {
            patientExam.setTpId(examCode);
            patientExam.setCreateTime(new Date());
            patientExamService.save(patientExam);
            return insertslip;
            return jsonQuestion.toString();
        }else{
            return write(200,"未签约或者签约不在集美","isSignJM",isSignJM);
        }
@ -151,8 +151,39 @@ public class PhysicalExaminationController extends BaseController {
    public String findconconhealth(@ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = true, name = "ct_id") String ct_id){
        String result = physicalExaminationService.findconconhealth(ct_id);
        return result;
    }
        return null;
    @RequestMapping(value = "/testUploadFile", method = RequestMethod.POST)
    public String testUploadFile(@RequestParam("test") MultipartFile file) {
        if (file.isEmpty()) {
            return "文件为空";
        }
        // 获取文件名
        String fileName = file.getOriginalFilename();
        // 获取文件的后缀名
        String suffixName = fileName.substring(fileName.lastIndexOf("."));
        // 文件上传后的路径
        String filePath = "E://test//";
        // 解决中文问题,liunx下中文路径,图片显示问题
        // fileName = UUID.randomUUID() + suffixName;
        File dest = new File(filePath + fileName);
        // 检测是否存在目录
        if (!dest.getParentFile().exists()) {
            dest.getParentFile().mkdirs();
        }
        try {
            file.transferTo(dest);
            return "上传成功";
        } catch (IllegalStateException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "上传失败";
    }
}

+ 17 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/repository/mm/exam/MedicineStroresNoDao.java

@ -0,0 +1,17 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.mm.repository.mm.exam;
import com.yihu.mm.entity.yueren.MedicineStroresNo;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface MedicineStroresNoDao extends PagingAndSortingRepository<MedicineStroresNo, Long>,JpaSpecificationExecutor<MedicineStroresNo>  {
	// 根據CODE查詢医院名称
	@Query("select p from MedicineStroresNo p where p.city = ?1")
	MedicineStroresNo findByCity(String city);
}

+ 22 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/MedicineStroresNoService.java

@ -0,0 +1,22 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.mm.service;
import com.yihu.mm.entity.yueren.MedicineStroresNo;
import com.yihu.mm.repository.mm.exam.MedicineStroresNoDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class MedicineStroresNoService {
	@Autowired
	private MedicineStroresNoDao medicineStroresNoDao;
	public MedicineStroresNo findByCity(String city){
		return medicineStroresNoDao.findByCity(city);
	}
}

+ 61 - 13
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PhysicalExaminationService.java

@ -1,11 +1,21 @@
package com.yihu.mm.service;
import com.yihu.mm.entity.yueren.MedicineStroresNo;
import com.yihu.mm.util.HttpClientUtil;
import com.yihu.wlyy.entity.patient.Patient;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -15,16 +25,20 @@ public class PhysicalExaminationService {
    @Value(("${yuerenApi}"))
    private String yuerenApi;
    @Autowired
    private MedicineStroresNoService medicineStroresNoService;
    //查找试卷
    public String findExames(String type, String examCode) {
        JSONObject params = new JSONObject();
        params.put("tp_type", type);
        //TODO
        params.put("sh_id", "52");
        MedicineStroresNo medicineStroresNo = medicineStroresNoService.findByCity("350200");
        params.put("sh_id", medicineStroresNo.getShId());
        return HttpClientUtil.postBody(yuerenApi + "/findtest", params);
    }
    /**
     * 获取预约信息   ,并且将
     * 获取预约信息
     * @param patient
     * @return
     */
@ -45,9 +59,8 @@ public class PhysicalExaminationService {
            sexStr="女";
        }
        params.put("u_sex",sexStr );
        //todo    sh_id 需要从数据库获取   wlyy_medicine_strores_no
        params.put("sh_id", "52");
        MedicineStroresNo medicineStroresNo = medicineStroresNoService.findByCity("350200");
        params.put("sh_id", medicineStroresNo.getCity());
        params.put("u_idnum", patient.getIdcard());
        //params.put("u_native", u_native);//籍贯
        params.put("u_birthday", patient.getBirthday());
@ -59,6 +72,7 @@ public class PhysicalExaminationService {
        return HttpClientUtil.postBody(yuerenApi + "/insertslip", params);
    }
    //查找题目
    public String findQuestion(String tp_id, String pb_id, String ct_id) {
        JSONObject params = new JSONObject();
        params.put("ct_id", ct_id);
@ -68,6 +82,7 @@ public class PhysicalExaminationService {
        return postStr;
    }
    //提交保存答案
    public String handleExam(String tp_id, String pb_id, String dc_answer, String ct_id) {
        JSONObject params = new JSONObject();
@ -78,13 +93,7 @@ public class PhysicalExaminationService {
        return HttpClientUtil.postBody(yuerenApi+"/handleproblem", params);
    }
    public String findconconhealth(String ct_id) {
        JSONObject params = new JSONObject();
        params.put("ct_id", ct_id);
        params.put("reqtype", 1);
        return HttpClientUtil.postBody(yuerenApi+"/findconconhealth", params);
    }
    //四诊资料采集
    public String dillphoneimgdata(String at_id, String answer, String type, String ct_id) {
        JSONObject params = new JSONObject();
        params.put("at_id", at_id);
@ -98,4 +107,43 @@ public class PhysicalExaminationService {
        params.put("object_type",type);
        return HttpClientUtil.postBody(yuerenApi+"/dillphoneimgdata", params);
    }
    //处理题目
    public String centralizedproblem(String ctId){
        JSONObject params = new JSONObject();
        params.put("ct_id", ctId);
        return HttpClientUtil.postBody(yuerenApi+"/centralizedproblem", params);
    }
    //处理用户影响
    public String conclusionfactor(String ctId){
        JSONObject params = new JSONObject();
        params.put("ct_id", ctId);
        return HttpClientUtil.postBody(yuerenApi+"/conclusionfactor", params);
    }
    //生成报告单
    public String insertconconhealth(String ct_id) {
        JSONObject params = new JSONObject();
        params.put("ct_id", ct_id);
        params.put("reqtype", 1);
        return HttpClientUtil.postBody(yuerenApi+"/insertconconhealth", params);
    }
    //查找报告单
    public String findconconhealth(String ct_id) {
        JSONObject params = new JSONObject();
        params.put("ct_id", ct_id);
        params.put("reqtype", 1);
        return HttpClientUtil.postBody(yuerenApi+"/findconconhealth", params);
    }
    //查找状态要素结论积分图及个人信息
    public String findintegral(String ct_id) {
        JSONObject params = new JSONObject();
        params.put("ct_id", ct_id);
        params.put("reqtype", 1);
        return HttpClientUtil.postBody(yuerenApi+"/findintegral", params);
    }
}

+ 53 - 10
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/User.java

@ -1,19 +1,17 @@
package com.yihu.wlyy.entity;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.ImmutableList;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.ImmutableList;
import java.util.Date;
import java.util.List;
/**
 * 用户表
@ -36,7 +34,7 @@ public class User extends IdEntity {
    private String password;
    // 密码加密密钥
    private String salt;
    // 用户类型:1超级管理员,2医生
    // 用户类型:1超级管理员,2医生   3客服管理员   4普通客服
    private int type;
    //用户类型名称
    private String typeName;
@ -52,6 +50,19 @@ public class User extends IdEntity {
    // 所属机构名称
    private String organizationName;
    //客服工号
    private String jonNo;
    //客服坐席号
    private String seat;
    //客服电话
    private String phone;
    //是否在线 0不在线   1离开  2在线
    private String online;
    public String getCode() {
@ -168,6 +179,38 @@ public class User extends IdEntity {
        return ImmutableList.copyOf(StringUtils.split("", ","));
    }
    public String getJonNo() {
        return jonNo;
    }
    public void setJonNo(String jonNo) {
        this.jonNo = jonNo;
    }
    public String getSeat() {
        return seat;
    }
    public void setSeat(String seat) {
        this.seat = seat;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String getOnline() {
        return online;
    }
    public void setOnline(String online) {
        this.online = online;
    }
    /**
	 * 
	 */

+ 112 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/common/util/CommonUtil.java

@ -0,0 +1,112 @@
package com.yihu.wlyy.service.common.util;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import java.io.*;
@Component
public class CommonUtil {
    public  String getIdcardEncode(String idcard) {
        if (idcard != null) {
            if (idcard.length() == 18) {
                return idcard.substring(0, 9) + "*******" + idcard.substring(16, 18);
            } else if (idcard.length() == 15) {
                return idcard.substring(0, 8) + "***" + idcard.substring(11, 15);
            }
        }
        return idcard;
    }
    /**
     * 对象转数组
     *
     * @param obj
     * @return
     */
    public  byte[] toByteArray(Object obj) {
        byte[] bytes = null;
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        try {
            ObjectOutputStream oos = new ObjectOutputStream(bos);
            oos.writeObject(obj);
            oos.flush();
            bytes = bos.toByteArray();
            oos.close();
            bos.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        return bytes;
    }
    /**
     * 数组转对象
     *
     * @param bytes
     * @return
     */
    public  Object toObject(byte[] bytes) {
        Object obj = null;
        try {
            ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
            ObjectInputStream ois = new ObjectInputStream(bis);
            obj = ois.readObject();
            ois.close();
            bis.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        } catch (ClassNotFoundException ex) {
            ex.printStackTrace();
        }
        return obj;
    }
    /**
     * double*100转int
     * @param d
     * @return
     */
    public static Integer doubleToInt(Double d){
        if(d==null){
            return 0;
        }
        return new Double(d*100).intValue();
    }
    /**
     * 校验健康指标是否正常
     *
     * @param curValue    当前值
     * @param standardMax 最大标准值
     * @param standardMin 最小标准值
     * @return 0正常,1高,-1低
     */
    public  double checkHealthIndex(double curValue, double standardMax, double standardMin) {
        if (curValue <= 0) {
            return 0;
        }
        if (standardMax > 0 && curValue > standardMax) {
            return curValue;
        }
        // 低于标准值,暂不推
        // if (standardMin > 0 && curValue < standardMin) {
        // return -curValue;
        // }
        return 0;
    }
    public  String getSubString(String content,int min,int max){
        if(StringUtils.isBlank(content)){
            return "";
        }else if(content.length()<=max){
            return content;
        }else{
            return content.substring(min,max);
        }
    }
}

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 7 - 7
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java


+ 8 - 7
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/ZysoftBaseService.java

@ -1,5 +1,7 @@
package com.yihu.wlyy.service.service;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.service.common.SystemConfig;
import com.yihu.wlyy.service.common.http.HttpApiException;
@ -10,7 +12,6 @@ import com.yihu.wlyy.service.dao.ZyPushLogDao;
import com.yihu.wlyy.service.entity.HospitalMapping;
import com.yihu.wlyy.service.entity.ZyPushLog;
import com.zoe.phip.ssp.sdk.ApiException;
import net.sf.json.JSONObject;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -64,7 +65,7 @@ public class ZysoftBaseService {
    public Result addZyPushLog(String request, String api, String content, String error, String method, String status, String type,String errMsg){
        Result re = null;
        if(errMsg==null){
            re = Result.success("接收线下处方调整完成消息成功");
            re = Result.success(content);
        }else {
            re = Result.error(-1,errMsg);
        }
@ -75,7 +76,7 @@ public class ZysoftBaseService {
        log.setError(error);
        log.setMethod(method);
        log.setRequest(request);
        log.setResponse(JSONObject.fromObject(re).toString());
        log.setResponse(JSONObject.toJSONString(re,SerializerFeature.WriteMapNullValue));
        log.setRetryTimes(0);
        log.setStatus(status);
        log.setType(type);
@ -116,8 +117,8 @@ public class ZysoftBaseService {
        Map<String,String> paramsList = new HashMap<>();
        String msgBody = JSONObject.fromObject(params).toString();
        String msgHeader = JSONObject.fromObject(headers).toString();
        String msgBody = JSONObject.toJSONString(params, SerializerFeature.WriteMapNullValue);
        String msgHeader = JSONObject.toJSONString(headers, SerializerFeature.WriteMapNullValue);
        paramsList.put("msgHeader",msgHeader);
        paramsList.put("msgBody",msgBody);
@ -190,8 +191,8 @@ public class ZysoftBaseService {
        headers.put("INTERFACE",api);
        Map<String,String> paramsList = new HashMap<>();
        String msgBody = params==null?jsonParams.toString():JSONObject.fromObject(params).toString();
        String msgHeader = JSONObject.fromObject(headers).toString();
        String msgBody = params==null?JSONObject.toJSONString(jsonParams, SerializerFeature.WriteMapNullValue):JSONObject.toJSONString(params, SerializerFeature.WriteMapNullValue);
        String msgHeader = JSONObject.toJSONString(headers, SerializerFeature.WriteMapNullValue);
        paramsList.put("msgHeader",msgHeader);
        paramsList.put("msgBody",msgBody);

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 42 - 27
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java


+ 2 - 2
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/extract/DBExtract.java

@ -62,7 +62,7 @@ public class DBExtract<T> {
     * @return
     */
    public List<Object> extractByPage(Class<T> clazz,String sql,String countSql,Boolean isMultithreading)throws  Exception{
        int pageSize=10000;
        int pageSize=100000;
        return SpringUtil.getBean(DBPageExtract.class).extractByPage(clazz,sql,countSql,pageSize,isMultithreading);
    }
    /**
@ -72,7 +72,7 @@ public class DBExtract<T> {
     * @return
     */
    public List<Object> extractByPage(Class<T> clazz,String sql)throws  Exception{
        int pageSize=10000;
        int pageSize=100000;
        Boolean isMultithreading=false;
        String countSql="";
        return SpringUtil.getBean(DBPageExtract.class).extractByPage(clazz,sql,countSql,pageSize,isMultithreading);

+ 49 - 37
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/SignJob.java

@ -16,6 +16,8 @@ import com.yihu.wlyy.statistics.vo.WlyyJobConfigVO;
import com.yihu.wlyy.statistics.vo.WlyyQuotaVO;
import org.json.JSONObject;
import org.quartz.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.jdbc.core.JdbcTemplate;
@ -35,6 +37,8 @@ import java.util.Calendar;
@Scope("prototype")
@DisallowConcurrentExecution//防止到了执行时间点前一任务还在执行中,但是这时有空闲的线程,那么马上又会执行,这样一来就会存在同一job被并行执行
public class SignJob implements Job {
    private Logger logger = LoggerFactory.getLogger(SignJob.class);
    private WlyyQuotaVO wlyyQuota;//指标对象
    private WlyyJobConfigVO wlyyJobConfig;//配置对象
    @Autowired
@ -58,7 +62,7 @@ public class SignJob implements Job {
    @Override
    public void execute(JobExecutionContext context)
            throws JobExecutionException {
        try{
        try {
            SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
            //初始化参数
            JobDataMap map = context.getJobDetail().getJobDataMap();
@ -95,9 +99,10 @@ public class SignJob implements Job {
                    }
                }
            }
        }catch (Exception e){
        } catch (Exception e) {
            e.printStackTrace();
            //如果出錯立即重新執行
            JobExecutionException e2 =new JobExecutionException(e);
            JobExecutionException e2 = new JobExecutionException(e);
            e2.setRefireImmediately(true);
        }
    }
@ -109,38 +114,40 @@ public class SignJob implements Job {
    private void computequotaByPatientSex() {
        jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='" + yesterday + "' and quato_code='" + 6 + "'");
        try{
        try {
            //新建任务日志对象
            QuartzJobLog quartzJobLog = new QuartzJobLog();
            quartzJobLog.setJobStartTime(new Date());
            quartzJobLog.setJobId(wlyyJobConfig.getId());
            quartzJobLog.setJobName(wlyyJobConfig.getJobName());
            //从缓存取数据
            CacheModel cacheModel=cachePool.getSignFamilysWithExpenseStatus1ByDate(yesterday);
            CacheModel cacheModel = cachePool.getSignFamilysWithExpenseStatus1ByDate(yesterday);
            //清洗數據
            FilterModel etlModels= signDataFilter.filter(cacheModel.getSignFamilies(),SignDataFilter.level2Sex,cacheModel.getSql(),yesterday);
            FilterModel etlModels = signDataFilter.filter(cacheModel.getSignFamilies(), SignDataFilter.level2Sex, cacheModel.getSql(), yesterday);
            //统计数据 1级维度
            List<Map<String, List<ETLModel>>>  returnDatas= levelRole.elt(etlModels.getEtlModelList());
            List<Map<String, List<ETLModel>>> returnDatas = levelRole.elt(etlModels.getEtlModelList());
            //统计数据 二级维度
            List<Map<String, Map<String, List<ETLModel>>>>  level2Data= level2Role.elt(returnDatas);;
                //保存数据
            dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,3,1);
            List<Map<String, Map<String, List<ETLModel>>>> level2Data = level2Role.elt(returnDatas);
            ;
            //保存数据
            dbStorage.saveByLevel2(level2Data, yesterday, wlyyQuota, 3, 1);
            //保存日志
            quartzJobLog.setJobEndTime(new Date());
            quartzJobLog.setJobContent(JsonUtil.objToStr(etlModels.getLogModel()));
            quartzJobLog.setJobType(etlModels.getError()?"1":"0");
            quartzJobLog.setJobType(etlModels.getError() ? "1" : "0");
            quartzJobLogDao.save(quartzJobLog);
        }catch (Exception e){
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * 机构维度患者分组维度计算指标
     */
    @Transactional
    private void computequotaByPatientGroup() {
        try{
            jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='"+yesterday+"' and quato_code='"+7+"'");
        try {
            jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='" + yesterday + "' and quato_code='" + 7 + "'");
            //新建任务日志对象
            QuartzJobLog quartzJobLog = new QuartzJobLog();
            quartzJobLog.setJobStartTime(new Date());
@ -152,23 +159,23 @@ public class SignJob implements Job {
            //抽取數據
            //List<SignFamily> signFamilies= dbExtract.extract(SignFamily.class,sql);
            //从缓存取数据
            CacheModel cacheModel=cachePool.getSignFamilysWithExpenseStatus1ByDate(yesterday);
            CacheModel cacheModel = cachePool.getSignFamilysWithExpenseStatus1ByDate(yesterday);
            //清洗數據
            FilterModel etlModels= signDataFilter.filter(cacheModel.getSignFamilies(),SignDataFilter.level2Group,cacheModel.getSql(),yesterday);
            FilterModel etlModels = signDataFilter.filter(cacheModel.getSignFamilies(), SignDataFilter.level2Group, cacheModel.getSql(), yesterday);
            //统计数据 1级维度
            List<Map<String, List<ETLModel>>>  returnDatas= levelRole.elt(etlModels.getEtlModelList());
            List<Map<String, List<ETLModel>>> returnDatas = levelRole.elt(etlModels.getEtlModelList());
            //统计数据 二级维度
            List<Map<String, Map<String, List<ETLModel>>>>  level2Data= level2Role.elt(returnDatas);
            List<Map<String, Map<String, List<ETLModel>>>> level2Data = level2Role.elt(returnDatas);
            //保存数据 1 表示:从1开始循环 6表示:循环6次 3表示 2级维度是 3
             dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,7,3,-1);
            dbStorage.saveByLevel2(level2Data, yesterday, wlyyQuota, 7, 3, -1);
            //dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,6,3,-1);
            //保存日志
            quartzJobLog.setJobEndTime(new Date());
            quartzJobLog.setJobContent(JsonUtil.objToStr(etlModels.getLogModel()));
            quartzJobLog.setJobType(etlModels.getError()?"1":"0");
            quartzJobLog.setJobType(etlModels.getError() ? "1" : "0");
            quartzJobLogDao.save(quartzJobLog);
        }catch (Exception e){
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
@ -187,19 +194,21 @@ public class SignJob implements Job {
            quartzJobLog.setJobId(wlyyJobConfig.getId());
            quartzJobLog.setJobName(wlyyJobConfig.getJobName());
            //从缓存取数据
            CacheModel cacheModel=cachePool.getSignFamilysWithExpenseStatus1ByDate(yesterday);
            CacheModel cacheModel = cachePool.getSignFamilysWithExpenseStatus1ByDate(yesterday);
            //清洗數據
            FilterModel etlModels= signDataFilter.filter(cacheModel.getSignFamilies(),SignDataFilter.level2Age,cacheModel.getSql(),yesterday);
            FilterModel etlModels = signDataFilter.filter(cacheModel.getSignFamilies(), SignDataFilter.level2Age, cacheModel.getSql(), yesterday);
            //统计数据 1级维度
            List<Map<String, List<ETLModel>>>  returnDatas= levelRole.elt(etlModels.getEtlModelList());
            List<Map<String, List<ETLModel>>> returnDatas = levelRole.elt(etlModels.getEtlModelList());
            //统计数据 二级维度
            List<Map<String, Map<String, List<ETLModel>>>>  level2Data= level2Role.elt(returnDatas);;
            List<Map<String, Map<String, List<ETLModel>>>> level2Data = level2Role.elt(returnDatas);
            ;
            //保存数据
            dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,6,2);
            dbStorage.saveByLevel2(level2Data, yesterday, wlyyQuota, 6, 2);
            //保存日志
            quartzJobLog.setJobEndTime(new Date());;
            quartzJobLog.setJobEndTime(new Date());
            ;
            quartzJobLog.setJobContent(JsonUtil.objToStr(etlModels.getLogModel()));
            quartzJobLog.setJobType(etlModels.getError()?"1":"0");
            quartzJobLog.setJobType(etlModels.getError() ? "1" : "0");
            quartzJobLogDao.save(quartzJobLog);
        } catch (Exception e) {
            e.printStackTrace();
@ -211,7 +220,7 @@ public class SignJob implements Job {
     */
    @Transactional
    private void computequota() {
        try{
        try {
            jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='" + yesterday + "' and quato_code='" + 1 + "'");
            //新建任务日志对象
            QuartzJobLog quartzJobLog = new QuartzJobLog();
@ -219,26 +228,29 @@ public class SignJob implements Job {
            quartzJobLog.setJobId(wlyyJobConfig.getId());
            quartzJobLog.setJobName(wlyyJobConfig.getJobName());
            //找出今天的签约信息 yesterday,now
           // String sql=" select code,idcard,hospital,admin_team_code from wlyy_sign_family a where  a.type =2 and  a.expenses_time< '"+yesterday+ Constant.quota_date_last+"' and a.expenses_status=1 ";
            // String sql=" select code,idcard,hospital,admin_team_code from wlyy_sign_family a where  a.type =2 and  a.expenses_time< '"+yesterday+ Constant.quota_date_last+"' and a.expenses_status=1 ";
            //抽取數據
           // List<SignFamily> signFamilies= dbExtract.extract(SignFamily.class,sql);
            // List<SignFamily> signFamilies= dbExtract.extract(SignFamily.class,sql);
            //从缓存取数据
            CacheModel cacheModel=cachePool.getSignFamilysWithExpenseStatus1ByDate(yesterday);
            CacheModel cacheModel = cachePool.getSignFamilysWithExpenseStatus1ByDate(yesterday);
            logger.info("size:" + cacheModel.getSignFamilies().size());
            logger.info("sql:" + cacheModel.getSql());
            //清洗數據
            FilterModel etlModels= signDataFilter.filter(cacheModel.getSignFamilies(),cacheModel.getSql(),yesterday);
            FilterModel etlModels = signDataFilter.filter(cacheModel.getSignFamilies(), cacheModel.getSql(), yesterday);
            //统计数据
            List<Map<String, List<ETLModel>>>  returnDatas= levelRole.elt(etlModels.getEtlModelList());
            List<Map<String, List<ETLModel>>> returnDatas = levelRole.elt(etlModels.getEtlModelList());
            //保存数据
            dbStorage.saveByLevel1(returnDatas,yesterday,wlyyQuota);
            dbStorage.saveByLevel1(returnDatas, yesterday, wlyyQuota);
            //保存日志
            quartzJobLog.setJobEndTime(new Date());
            quartzJobLog.setJobContent(JsonUtil.objToStr(etlModels.getLogModel()));
            quartzJobLog.setJobType(etlModels.getError()?"1":"0");
            quartzJobLog.setJobType(etlModels.getError() ? "1" : "0");
            quartzJobLogDao.save(quartzJobLog);
        }catch (Exception e){
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /*
    得到昨天的日期字符串  yyyy-MM-dd
     */

+ 1 - 1
patient-co/patient-co-wlyy/pom.xml

@ -427,7 +427,7 @@
                    <target>1.8</target>
                    <compilerArguments>
                        <verbose/>
                        <bootclasspath>${java.home}/lib/rt.jar:${java.home}/lib/jce.jar</bootclasspath>
                        <bootclasspath>${java.home}/lib/rt.jar;${java.home}/lib/jce.jar</bootclasspath>
                    </compilerArguments>
                </configuration>
                <version>3.1</version>

+ 32 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java

@ -0,0 +1,32 @@
package com.yihu.wlyy.event;
import com.yihu.wlyy.redis.RedisThread;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Service;
/**
 * Created by lyr-pc on 2017/3/10.
 */
@Service
public class ApplicationEvent implements ApplicationListener<ContextRefreshedEvent> {
    private Logger logger = LoggerFactory.getLogger(ApplicationEvent.class);
    @Autowired
    private RedisThread redisThread;
    @Override
    public void onApplicationEvent(ContextRefreshedEvent ContextRefreshedEvent) {
        try {
            // 启动redis 消息队列线程
            logger.info("redis message start");
            new Thread(redisThread).start();
            logger.info("redis message end");
        } catch (Exception e) {
            logger.info("redis message start failed");
        }
    }
}

+ 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;

+ 23 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/redis/RedisThread.java

@ -1,10 +1,12 @@
package com.yihu.wlyy.redis;
import com.yihu.wlyy.service.app.prescription.PrescriptionService;
import com.yihu.wlyy.util.SystemConf;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import redis.clients.jedis.Jedis;
/**
 * Created by Trick on 2017/8/7.
@ -16,9 +18,27 @@ public class RedisThread implements Runnable {
    private String url;
    @Autowired
    private RedisMsgPubSubListener redisMsgPubSubListener;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private PrescriptionService prescriptionService;
    @Override
    public void run() {
        Jedis jedis = new Jedis(url);
        jedis.subscribe(redisMsgPubSubListener, SystemConf.getInstance().getSystemProperties().getProperty("redis_prescription_title"));
        String key = SystemConf.getInstance().getSystemProperties().getProperty("redis_prescription_title");
        while (true){
            redisTemplate.watch(key);
            String message = redisTemplate.opsForList().rightPop(key);
            redisTemplate.unwatch();
            if(StringUtils.isEmpty(message)){
                try{
                    Thread.sleep(1000L);//如果没有读取到记录,等待1秒
                }catch (Exception e){
                    e.printStackTrace();
                }
            }else {
                prescriptionService.redisMessage(message);
            }
        }
    }
}

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

@ -78,11 +78,14 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Modifying
    int setSysMessageReaded(String doctor);
    @Query("from Message a where a.receiver = ?1 and relationCode = ?2 and a.type=?3 ")
    List<Message> findByReceiverAndRelationCode(String receiver,String relationCode,Integer type);
    //查询患者最近7天的体征异常记录
    @Query(value = "SELECT COUNT(1) FROM wlyy_message WHERE type = '2' and sender = ?1 and create_time>=date_add(now(),interval -7 day) ", nativeQuery = true)
    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);
}

+ 10 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -1543,13 +1543,18 @@ public class DoctorInfoService extends BaseService {
    }
    @Transactional
    public void cancelAuthentication(String doctorCode) throws Exception{
    public boolean cancelAuthentication(String doctorCode) throws Exception{
        Doctor doctor = doctorDao.findByCode(doctorCode);
        doctor.setCheckPassword("");
        doctor.setIscertified(0);
        doctor.setCertifiedOvertime(null);
        doctorDao.save(doctor);
        boolean b = updateAuthenticationPassword(doctor.getIdcard(),doctor.getCheckPassword(),"11111111",doctorCode);
        if(b){
            doctor.setCheckPassword("");
            doctor.setIscertified(0);
            doctor.setCertifiedOvertime(null);
            doctorDao.save(doctor);
        }
        return b;
    }

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -1132,7 +1132,8 @@ public class ConsultTeamService extends ConsultService {
            prescriptionInfo.setNum(CommonUtil.doubleToInt(info.getDouble("num")));//药品数目
            prescriptionInfo.setPrice(CommonUtil.doubleToInt(info.getDouble("price")));//药品单价
            prescriptionInfo.setIsRefrigerate(0);//是否冷藏 1是 0否
            prescriptionInfo.setJwSubCode("");//智业子处方号
            prescriptionInfo.setJwSubCode(info.getString("jwSubCode"));//智业子处方号
            prescriptionInfo.setSubjectClass(info.getString("subjectClass"));//科目编码
            prescriptionInfo.setDrugNumUnit(info.getString("drugNumUnit"));//数量单位编码
            prescriptionInfo.setDrugNumUnitName(info.getString("drugNumUnitName"));//数量单位名称
            prescriptionInfo.setCost(CommonUtil.doubleToInt(info.getDouble("cost")));//金额

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

@ -50,8 +50,8 @@ public class PrescriptionDiagnosisService extends BaseService{
                    if(list!=null&&list.size()>0){
                        for (PrescriptionDiagnosis diagnosis:list){
                            JSONObject json = new JSONObject();
                            json.put("code",diagnosis.getCode());//疾病代码
                            json.put("name",diagnosis.getName());//疾病名称
                            json.put("code",diagnosis.getHealthProblem());//疾病代码
                            json.put("name",diagnosis.getHealthProblemName());//疾病名称
                            jsonArray.add(json);
                        }
                        re = jsonArray.toString();

+ 27 - 20
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java

@ -1,24 +1,21 @@
package com.yihu.wlyy.service.app.prescription;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.prescription.*;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.prescription.*;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.SystemConf;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
/**
 * Created by chenweida on 2017/7/27.
@ -38,9 +35,13 @@ public class PrescriptionExpressageService {
    private PrescriptionNoticesService prescriptionNoticesService;
    @Autowired
    private PrescriptionExpressageLogDao prescriptionExpressageLogDao;
    @Autowired
    private PrescriptionService prescriptionService;
    @Autowired
    private DoctorDao doctorDao;
    @Autowired
    private HospitalDao hospitalDao;
    @Autowired
    private PatientDao patientDao;
    @Value("${wechat.wechat_base_url}")
@ -205,11 +206,11 @@ public class PrescriptionExpressageService {
        prescriptionDispensaryCode.setIsUse(1);
        //发送模板消息通知患者药品开始配送
        String url="prescription/html/order_tracking.html?openid=" + patient.getOpenid() + "" +
                "&code=" + prescriptionDispensaryCode.getPrescriptionCode() + "&toUser=" + patient.getCode() + "&toName=" + patient.getName() ;
        String url = "prescription/html/order_tracking.html?openid=" + patient.getOpenid() + "" +
                "&code=" + prescriptionDispensaryCode.getPrescriptionCode() + "&toUser=" + patient.getCode() + "&toName=" + patient.getName();
        prescriptionNoticesService.sendMessages(userCode,doctor.getName(), DateUtil.dateToStrLong(expressageing),3, 0,url );
        prescriptionNoticesService.sendMessages(userCode, doctor.getName(), DateUtil.dateToStrLong(expressageing), 3, 0, url);
        return prescriptionDispensaryCode.getType();
    }
@ -253,11 +254,11 @@ public class PrescriptionExpressageService {
        //发送模板消息通知患者取药
        //发送模板消息通知患者药品开始配送
        String url="prescription/html/order_tracking.html?openid=" + patient.getOpenid() + "" +
                "&code=" + prescriptionDispensaryCode.getPrescriptionCode() + "&toUser=" + patient.getCode() + "&toName=" + patient.getName() ;
        String url = "prescription/html/order_tracking.html?openid=" + patient.getOpenid() + "" +
                "&code=" + prescriptionDispensaryCode.getPrescriptionCode() + "&toUser=" + patient.getCode() + "&toName=" + patient.getName();
        prescriptionNoticesService.sendMessages(prescription.getPatient(),doctor.getName(), DateUtil.dateToStrLong(expressage2hospitalDate),4, 0, url);
        prescriptionNoticesService.sendMessages(prescription.getPatient(), doctor.getName(), DateUtil.dateToStrLong(expressage2hospitalDate), 4, 0, url);
        return prescriptionDispensaryCode.getType();
@ -273,7 +274,7 @@ public class PrescriptionExpressageService {
     */
    public void updatePrescriptionExpressage(PrescriptionExpressage prescriptionExpressage) throws Exception {
        //修改处方状态为配送配送中
        prescriptionDao.updateStatus(prescriptionExpressage.getPrescriptionCode(),65);
        prescriptionDao.updateStatus(prescriptionExpressage.getPrescriptionCode(), 65);
        //保存处方物流记录
        prescriptionExpressageDao.save(prescriptionExpressage);
@ -294,18 +295,21 @@ public class PrescriptionExpressageService {
     * 全科医生分配健管师
     *
     * @param code             健管师code
     * @param name             健管师名称
     * @param mobile           健管师联系电话
     * @param prescriptionCode 处方code
     * @param doctorQK         分配的全科
     */
    @Transactional
    public void updateExpressageJGS(String code, String name, String mobile, String prescriptionCode, String doctorQK) {
    public void updateExpressageJGS(String code, String prescriptionCode, String doctorQK) {
        Doctor doctor = doctorDao.findByCode(code);
        Hospital hospital = hospitalDao.findByCode(doctor.getHospital());
        //更新配送表 新增配送人员记录
        PrescriptionExpressage prescriptionExpressage = prescriptionExpressageDao.findByPrescriptionPay(prescriptionCode);
        prescriptionExpressage.setExpressageCode(code);
        prescriptionExpressage.setExpressageMobile(mobile);
        prescriptionExpressage.setExpressageName(name);
        prescriptionExpressage.setExpressageMobile(doctor.getMobile());
        prescriptionExpressage.setExpressageName(doctor.getName());
        prescriptionExpressage.setExpressageHospitalAddress(hospital.getAddress());
        prescriptionExpressage.setExpressageHospitalCode(doctor.getHospital());
        prescriptionExpressage.setExpressageHospitalName(doctor.getHospitalName());
        //新增日志
        PrescriptionLog prescriptionLog = new PrescriptionLog();
@ -319,6 +323,9 @@ public class PrescriptionExpressageService {
        prescriptionLog.setUserType(2);
        prescriptionLog.setRemark("团队长分配健管师配送");
        prescriptionLogDao.save(prescriptionLog);
        //提醒健管师待取药
        prescriptionService.waitExpressageMessage(prescriptionCode,code);
    }
    @Transactional
@ -343,8 +350,8 @@ public class PrescriptionExpressageService {
        /**
         * 判断如果服务站和患者填写的服务站一致  那么就修改处方状态为送达服务站
         */
        if(hospital.equals(prescriptionExpressage.getPatientHospitalCode())){
            Prescription prescription=prescriptionDao.findByCode(prescriptionCode);
        if (hospital.equals(prescriptionExpressage.getPatientHospitalCode())) {
            Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
            prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.expressage2hospital.getValue());
            prescription.setExpressageTime(new Date());

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 402 - 377
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java


+ 173 - 25
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;
    /**
@ -75,6 +76,26 @@ public class PrescriptionService extends BaseService {
        return prescriptionDao.findByCode(prescriptionCode);
    }
    /**
     * redis 消息队列
     * @param message
     */
    public void redisMessage(String message){
        logger.info("redis_onMessage...:"+message);
        //this.unsubscribe();
        try{
            JSONObject json = JSONObject.parseObject(message);
            String title =  json.getString("title");
            if("dispensingComplete".equals(title)){//配药完成
                //药品配送完成,提醒取药
                String prescriptionCode = json.getString("prescription");
                dispensingComplete(prescriptionCode);
            }
        }catch (Exception e){
            logger.error("redis_error...",e);
        }
    }
    /**
     * 配药完成
     * @param code
@ -102,7 +123,7 @@ public class PrescriptionService extends BaseService {
            }else if(prescription.getDispensaryType()==3){
                //健管师配送
                PrescriptionExpressage expressage = prescriptionExpressageDao.findByPrescriptionCode(code);
                if(StringUtils.isEmpty(expressage.getExpressageCode())){
                if(StringUtils.isNotBlank(expressage.getExpressageCode())){
                    String content = "您有一条新的续方订单待取药!";
                    Message message = new Message();
                    message.setCzrq(new Date());
@ -132,6 +153,52 @@ public class PrescriptionService extends BaseService {
        logger.info("配药完成,提示居民或健管师取药:"+code+",status="+prescription.getStatus());
    }
    /**
     * 提醒健管师待取药
     * @param code
     * @param healthDoctor
     */
    public void waitExpressageMessage(String code,String healthDoctor){
        try{
            Prescription prescription = prescriptionDao.findByCode(code);
            if(PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue()==prescription.getStatus()){
                //配药完成之后才分配健管师,分配健管师后,提示健管师待取药
                List<Message> list = messageDao.findByReceiverAndRelationCode(healthDoctor,code,7);
                if(list.size()==0){
                    PrescriptionExpressage expressage = prescriptionExpressageDao.findByPrescriptionCode(code);
                    if(StringUtils.isNotBlank(expressage.getExpressageCode())){
                        String content = "您有一条新的续方订单待取药!";
                        Message message = new Message();
                        message.setCzrq(new Date());
                        message.setCreateTime(new Date());
                        message.setRead(1);//设置未读
                        message.setOver("1");
                        message.setReceiver(expressage.getExpressageCode());
                        message.setSender("system");
                        message.setCode(getCode());
                        message.setSenderName("系统");
                        message.setTitle("居民"+prescription.getPatientName()+"的续方订单待取药");
                        message.setContent("您有一条新的续方订单待取药!");
                        message.setType(7);//续方订单待取药
                        message.setReadonly(1);//是否只读消息
                        message.setDel("1");
                        message.setRelationCode(prescription.getCode());
                        message.setPrescriptionStatus("0");//待取药
                        //获取居民团队code
                        DoctorTeam dt = doctorTeamDao.findByParientCode(prescription.getPatient());
                        message.setData(dt.getCode());
                        messageDao.save(message);
                        pushMsgTask.put(expressage.getExpressageCode(), MessageType.MESSAGE_TYPE_PRESCRIPTION_WAIT_TAKE_DRUG.D_P_WRD.name(), MessageType.MESSAGE_TYPE_PRESCRIPTION_WAIT_TAKE_DRUG.续方消息.name(), content, prescription.getCode());
                    }
                }
            }
        }catch (Exception e){
            e.printStackTrace();
            logger.info("提醒健管师待取药,消息新增失败");
        }
    }
    /**
     * 返回支付信息
     * @param cardNo 医保卡号
@ -169,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);
@ -204,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();
@ -212,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"));//药品频率
@ -240,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;
	}

+ 0 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java

@ -124,11 +124,6 @@ public class JwPrescriptionService {
     * @throws Exception
     */
    public String saveRecipe(String prescriptionCode) throws Exception{
        try {
        }catch (Exception e){
        }
        String url = jwUrl + "/third/prescription/saveRecipe";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("prescriptionCode", prescriptionCode));

+ 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>();
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/PCLoginController.java

@ -75,7 +75,7 @@ public class PCLoginController extends BaseController {
     * @param password 密码
     * @return
     */
    @RequestMapping(value = "doctor",method = RequestMethod.POST)
    @RequestMapping(value = "doctor",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ResponseBody
    public String doctor(@ApiParam(required = false, name = "mobile", value = "手机号") @RequestParam(required = false,value = "mobile") String mobile,
                         @ApiParam(required = false, name = "captcha", value = "短信验证码") @RequestParam(required = false) String captcha,

+ 16 - 12
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java

@ -1856,7 +1856,7 @@ public class DoctorController extends BaseController {
        try {
//            Doctor doctor = doctorInfoService.findDoctorByCode(getRepUID());
            JSONObject data = doctorInfoService.getCAPastDue(getRepUID(),new JSONObject());
            JSONObject data = doctorInfoService.getCAPastDue(getUID(),new JSONObject());
            return write(200, "获取信息成功!", "data", data);
        }catch (Exception e) {
            error(e);
@ -1873,7 +1873,7 @@ public class DoctorController extends BaseController {
    public String isAuthentication(){
        try {
            //0de6a26a62dd11e69faffa163e8aee56
            JSONObject data = doctorInfoService.isAuthentication(getRepUID());
            JSONObject data = doctorInfoService.isAuthentication(getUID());
            return write(200, "获取信息成功!", "data", data);
        }catch (Exception e) {
            error(e);
@ -1890,8 +1890,8 @@ public class DoctorController extends BaseController {
            @RequestParam(value = "strOldCalledPasswd",required = true) String strOldCalledPasswd,
            @RequestParam(value = "strNewCalledPasswd",required = true) String strNewCalledPasswd){
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode(getRepUID());
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),strOldCalledPasswd,strNewCalledPasswd,getRepUID());
            Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),strOldCalledPasswd,strNewCalledPasswd,getUID());//hxmD201703150222
            if(b){
                return write(200, "修改密码成功!", "data", b);
            }
@ -1911,8 +1911,8 @@ public class DoctorController extends BaseController {
    @RequestMapping(value = "/installAuthenticationPassword", method = RequestMethod.POST)
    public String installAuthenticationPassword(@RequestParam(value = "strNewCalledPasswd",required = true) String strNewCalledPasswd){
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode(getRepUID());
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),"11111111",strNewCalledPasswd,getRepUID());
            Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),"11111111",strNewCalledPasswd,getUID());
            if(b){
                return write(200, "设置密码成功!", "data", b);
            }
@ -1933,8 +1933,8 @@ public class DoctorController extends BaseController {
    @RequestMapping(value = "/resetAuthenticationPassword", method = RequestMethod.POST)
    public String resetAuthenticationPassword(@RequestParam(value = "strNewCalledPasswd",required = true) String strNewCalledPasswd){
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode(getRepUID());
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),doctor.getCheckPassword(),strNewCalledPasswd,getRepUID());
            Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),doctor.getCheckPassword(),strNewCalledPasswd,getUID());
            if(b){
                return write(200, "重置密码成功!", "data", b);
            }
@ -1959,7 +1959,7 @@ public class DoctorController extends BaseController {
            @ApiParam(required = true, name = "prescriptionCode", value = "处方code") @RequestParam(value = "prescriptionCode",required = true) String prescriptionCode){
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode(getRepUID());
            Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
//            JSONObject obj = doctorInfoService.requestRealNameSoftCertAndSign(doctor.getIdcard(),strRealNameSoftCertCalledPasswd,strOriginalData,srcBusinessStreamNO);
            JSONObject jsonObject = doctorInfoService.requestRealNameSoftCertAndSign(doctor.getIdcard(),strRealNameSoftCertCalledPasswd,strOriginalData,prescriptionCode);
//            if(b){
@ -1984,7 +1984,7 @@ public class DoctorController extends BaseController {
            @ApiParam(required = true, name = "certificateNum", value = "证书编号") @RequestParam(value = "certificateNum",required = true) String certificateNum){
        try {
            boolean b = doctorInfoService.checkCertificate(getRepUID(),certificateNum);
            boolean b = doctorInfoService.checkCertificate(getUID(),certificateNum);
            return write(200, "获取信息成功!", "data", b);
        }catch (Exception e) {
            error(e);
@ -2020,8 +2020,12 @@ public class DoctorController extends BaseController {
    public String cancelAuthentication(){
        try {
            doctorInfoService.cancelAuthentication(getRepUID());
            return write(200, "取消认证成功!");
            if(doctorInfoService.cancelAuthentication(getUID())){
                return write(200, "取消认证成功!");
            }else{
                return error(-1, "取消认证失败!");
            }
        }catch (Exception e) {
            error(e);
            return error(-1, "取消认证失败!");

+ 8 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionCodeController.java

@ -124,7 +124,7 @@ public class PrescriptionCodeController extends BaseController{
            @ApiParam(required = true, name = "prescriptionCode", value = "处方code") @RequestParam(value = "prescriptionCode", required = true) String prescriptionCode) {
        try{
            Map<String, Object> map = prescriptionDispensaryCodeService.getQrcode(prescriptionCode,getRepUID(),2);
            Map<String, Object> map = prescriptionDispensaryCodeService.getQrcode(prescriptionCode,getUID(),2);
//            map.put("code", Base64.encode(map.get("code").toString().getBytes()));
            return write(200, "获取配送员取药码成功!", "data", map);
        } catch (Exception e) {
@ -146,9 +146,14 @@ public class PrescriptionCodeController extends BaseController{
            @ApiParam(required = true, name = "prescriptionCode", value = "处方code") @RequestParam(value = "prescriptionCode", required = true) String prescriptionCode) {
        try{
            Map<String, Object> map = prescriptionDispensaryCodeService.getQrcode(prescriptionCode,getRepUID(),3);
            Map<String, Object> map = prescriptionDispensaryCodeService.getQrcode(prescriptionCode,getUID(),3);
//            map.put("code",Base64.encode(map.get("code").toString().getBytes()));
            return write(200, "获取配送员配送码成功!", "data", map);
            if(map!=null&&map.size()>0){
                return write(200, "获取配送员配送码成功!", "data", map);
            }else{
                return error(-1, "获取配送员配送码失败!");
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "获取配送员配送码失败!");

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionExpressageController.java

@ -42,7 +42,7 @@ public class PrescriptionExpressageController extends WeixinBaseController {
            @ApiParam(required = true, name = "mobile", value = "健管师code") @RequestParam(value = "mobile", required = true) String mobile,
            @ApiParam(required = true, name = "prescriptionCode", value = "处方code") @RequestParam(value = "prescriptionCode", required = true) String prescriptionCode) throws Exception {
        try {
            expressageService.updateExpressageJGS(code, name, mobile, prescriptionCode, getUID());
            expressageService.updateExpressageJGS(code, prescriptionCode, getUID());
            return success("修改成功");
        } catch (Exception e) {
            return error(-1, "获取失败");

+ 124 - 109
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.prescription;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.adapter.PresModeAdapter;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
@ -16,7 +17,6 @@ import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -28,7 +28,7 @@ import java.util.List;
@RestController
@RequestMapping(value = "/doctor/prescriptionInfo")
@Api(description = "医生端-长处方接口")
public class PrescriptionInfoController extends BaseController{
public class PrescriptionInfoController extends BaseController {
    @Autowired
    private PrescriptionInfoService prescriptionInfoService;
@ -48,9 +48,9 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/getPrescriptionFilter", method = RequestMethod.GET)
    @ApiOperation(value = "获取过滤规则信息列表")
    public String getPrescriptionFilter(){
    public String getPrescriptionFilter() {
        try {
            return write(200, "查询成功!", "data",prescriptionInfoService.getPrescriptionFilter());
            return write(200, "查询成功!", "data", prescriptionInfoService.getPrescriptionFilter());
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -59,17 +59,17 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/getDoctorPrescription", method = RequestMethod.GET)
    @ApiOperation(value = "获取全科医生/建管师续方列表/搜索")
    public String getDoctorPrescription(@RequestParam(required = false)@ApiParam(value = "团队code", name = "teamCode") Integer teamCode,
                                        @RequestParam(required = false)@ApiParam(value = "续方状态", name = "state") String state,
                                        @RequestParam(required = false)@ApiParam(value = "所有诊断:1 糖尿病 2高血压", name = "dispensary") String diseases,
                                        @RequestParam(required = false)@ApiParam(name="startDate",value="开始时间")String startDate,
                                        @RequestParam(required = false)@ApiParam(name="endDate",value="结束时间")String endDate,
                                        @RequestParam(required = false)@ApiParam(name="nameKeyword",value="患者姓名模糊匹配")String nameKeyword,
                                        @RequestParam(required = false)@ApiParam(name="patient",value="患者Code")String patient,
                                        @RequestParam(required = false)@ApiParam(name="page",value="起始页")Integer page,
                                        @RequestParam(required = false)@ApiParam(name="size",value="每页条数")Integer size){
    public String getDoctorPrescription(@RequestParam(required = false) @ApiParam(value = "团队code", name = "teamCode") Integer teamCode,
                                        @RequestParam(required = false) @ApiParam(value = "续方状态", name = "state") String state,
                                        @RequestParam(required = false) @ApiParam(value = "所有诊断:1 糖尿病 2高血压", name = "dispensary") String diseases,
                                        @RequestParam(required = false) @ApiParam(name = "startDate", value = "开始时间") String startDate,
                                        @RequestParam(required = false) @ApiParam(name = "endDate", value = "结束时间") String endDate,
                                        @RequestParam(required = false) @ApiParam(name = "nameKeyword", value = "患者姓名模糊匹配") String nameKeyword,
                                        @RequestParam(required = false) @ApiParam(name = "patient", value = "患者Code") String patient,
                                        @RequestParam(required = false) @ApiParam(name = "page", value = "起始页") Integer page,
                                        @RequestParam(required = false) @ApiParam(name = "size", value = "每页条数") Integer size) {
        try {
            return write(200, "查询成功!", "data",prescriptionInfoService.getDoctorPrescription(teamCode,state,diseases,startDate,endDate,nameKeyword,patient,page,size));
            return write(200, "查询成功!", "data", prescriptionInfoService.getDoctorPrescription(teamCode, state, diseases, startDate, endDate, nameKeyword, patient, page, size));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -78,10 +78,10 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/getContinuedPrescriptionAsDoctor", method = RequestMethod.GET)
    @ApiOperation(value = "续方详情")
    public String getContinuedPrescriptionAsDoctor(@RequestParam(required = true)@ApiParam(value = "续方CODE", name = "code") String code,
                                                   @RequestParam(required = true)@ApiParam(value = "团队长标识:1:是;2否", name = "type") String type){
    public String getContinuedPrescriptionAsDoctor(@RequestParam(required = true) @ApiParam(value = "续方CODE", name = "code") String code,
                                                   @RequestParam(required = true) @ApiParam(value = "团队长标识:1:是;2否", name = "type") String type) {
        try {
            return write(200, "查询成功!", "data",prescriptionInfoService.getContinuedPrescriptionAsDoctor(code));
            return write(200, "查询成功!", "data", prescriptionInfoService.getContinuedPrescriptionAsDoctor(code));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -90,18 +90,18 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/reviewPrescription", method = RequestMethod.POST)
    @ApiOperation(value = "续方审核")
    public String reviewPrescription(@RequestParam(required = true)@ApiParam(value = "续方CODE", name = "code") String code,
                                     @RequestParam(required = false)@ApiParam(value = "不同意原因", name = "reason") String reason,
                                     @RequestParam(required = false)@ApiParam(value = "1同意,2不同意", name = "state") String state,
                                     @RequestParam(required = false)@ApiParam(value = "科室", name = "dept")String dept,
                                     @RequestParam(required = false)@ApiParam(value = "诊金", name = "registerFee")String registerFee,
                                     @RequestParam(required = false)@ApiParam(value = "诊金类型", name = "rateTypeCode")String rateTypeCode){
    public String reviewPrescription(@RequestParam(required = true) @ApiParam(value = "续方CODE", name = "code") String code,
                                     @RequestParam(required = false) @ApiParam(value = "不同意原因", name = "reason") String reason,
                                     @RequestParam(required = false) @ApiParam(value = "1同意,2不同意", name = "state") String state,
                                     @RequestParam(required = false) @ApiParam(value = "科室", name = "dept") String dept,
                                     @RequestParam(required = false) @ApiParam(value = "诊金", name = "registerFee") String registerFee,
                                     @RequestParam(required = false) @ApiParam(value = "诊金类型", name = "rateTypeCode") String rateTypeCode) {
        try {
            int rs = prescriptionInfoService.reviewPrescription(code,reason,state,dept,registerFee,rateTypeCode);
            if(rs==0){
                return write(200, "开方失败!", "data",rs);
            }else{
                return write(200, "成功提交开方", "data",rs);
            int rs = prescriptionInfoService.reviewPrescription(code, reason, state, dept, registerFee, rateTypeCode);
            if (rs == 0) {
                return write(200, "开方失败!", "data", rs);
            } else {
                return write(200, "成功提交开方", "data", rs);
            }
        } catch (Exception e) {
            error(e);
@ -112,12 +112,12 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/updatePresInfo", method = RequestMethod.POST)
    @ApiOperation(value = "调整处方")
    @ObserverRequired
    public String updatePresInfo(@RequestParam(required = true)@ApiParam(value = "续方CODE", name = "code") String code,
                                 @RequestParam(required = true)@ApiParam(value = "续方药品JSON", name = "infos") String infos,
                                 @RequestParam(required = false)@ApiParam(value = "疾病JSON", name = "diagnosis") String diagnosis,
                                 @RequestParam(required = false)@ApiParam(value = "调整原因", name = "reason") String reason ){
    public String updatePresInfo(@RequestParam(required = true) @ApiParam(value = "续方CODE", name = "code") String code,
                                 @RequestParam(required = true) @ApiParam(value = "续方药品JSON", name = "infos") String infos,
                                 @RequestParam(required = false) @ApiParam(value = "疾病JSON", name = "diagnosis") String diagnosis,
                                 @RequestParam(required = false) @ApiParam(value = "调整原因", name = "reason") String reason) {
        try {
            return write(200, "操作成功!", "data",prescriptionInfoService.updatePresInfo(code,infos,diagnosis,reason));
            return write(200, "操作成功!", "data", prescriptionInfoService.updatePresInfo(code, infos, diagnosis, reason));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -127,10 +127,10 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/findDictByName", method = RequestMethod.GET)
    @ApiOperation(value = "药品列表")
    public String findDictByName(@ApiParam(name = "name", value = "药品名称(中文或拼音首字母查询)", defaultValue = "胰岛素")
                                 @RequestParam(value = "name", required = false) String name){
                                 @RequestParam(value = "name", required = false) String name) {
        try {
//            return write(200, "操作成功!", "data",zyDictService.findDictByDoctorAndName("e3b3bfb3644011e69616fa163e424525",name));
            return write(200, "操作成功!", "data",zyDictService.findDictByDoctorAndName(getUID(),name));
            return write(200, "操作成功!", "data", zyDictService.findDictByDoctorAndName(getUID(), name));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -139,9 +139,9 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/getInfoTitle", method = RequestMethod.POST)
    @ApiOperation(value = "调整处方-药品分类及种类数目")
    public String getInfoTitle(){
    public String getInfoTitle() {
        try {
            return write(200, "操作成功!", "data","");
            return write(200, "操作成功!", "data", "");
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -150,9 +150,9 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/getInfoListByParentCode", method = RequestMethod.POST)
    @ApiOperation(value = "药品类别获取药品")
    private String getInfoListByParentCode(@RequestParam(required = true)@ApiParam(value = "药品类别Code", name = "code") String code){
    private String getInfoListByParentCode(@RequestParam(required = true) @ApiParam(value = "药品类别Code", name = "code") String code) {
        try {
            return write(200, "操作成功!", "data","");
            return write(200, "操作成功!", "data", "");
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -171,7 +171,7 @@ public class PrescriptionInfoController extends BaseController{
    public String prescriptionFollow(
            @RequestParam(required = true) @ApiParam(value = "处方code", name = "prescriptionCode") String prescriptionCode) {
        try {
            JSONObject jo = new JSONObject();
           JSONObject jo = new JSONObject();
            //获取处方信息
            Prescription prescription = prescriptionService.findByCode(prescriptionCode);
            //获取处方药品信息
@ -181,14 +181,15 @@ public class PrescriptionInfoController extends BaseController{
            //获取配送信息
            PrescriptionExpressage prescriptionExpressage = prescriptionExpressageService.findByPrescriptionCode(prescriptionCode);
            jo.put("prescriptionInfos", prescriptionInfos);
            jo.put("prescriptionPay", new JSONObject(prescriptionPay));
            jo.put("prescriptionExpressage", new JSONObject(prescriptionExpressage));
            jo.put("prescriptionHospital", prescription.getHospitalName());//出药机构
            jo.put("dispensaryDispensaryType", prescription.getDispensaryType());//处方配送方式
            jo.put("dispensaryDispensaryTypeName", prescription.getDispensaryTypeName());//处方配送方式
            jo.put("prescriptionStatus", prescription.getStatus());//处方状态
            jo.put("prescriptionStatusName", prescription.getStatusName(prescription.getStatus(),""));//处方状态名称
            jo.put("prescriptionPay", prescriptionPay);
            jo.put("prescriptionExpressage", prescriptionExpressage);
            if (prescription != null) {
                jo.put("prescriptionHospital", prescription.getHospitalName());//出药机构
                jo.put("dispensaryDispensaryType", prescription.getDispensaryType());//处方配送方式
                jo.put("dispensaryDispensaryTypeName", prescription.getDispensaryTypeName());//处方配送方式
                jo.put("prescriptionStatus", prescription.getStatus());//处方状态
                jo.put("prescriptionStatusName", prescription.getStatusName(prescription.getStatus(), ""));//处方状态名称
            }
            return write(200, "查询成功", "data", jo);
        } catch (Exception e) {
            error(e);
@ -198,9 +199,9 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/getDrugTimes", method = RequestMethod.GET)
    @ApiOperation(value = "药品品使用频次字典")
    public String getDrugTimes(){
    public String getDrugTimes() {
        try {
            return write(200, "操作成功!", "data",prescriptionInfoService.getDrugTimes());
            return write(200, "操作成功!", "data", prescriptionInfoService.getDrugTimes());
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -209,17 +210,18 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/getHDoctorPrescriptionExpressage", method = RequestMethod.GET)
    @ApiOperation(value = "获取健康管理师续方订单列表")
    public String getHDoctorPrescriptionExpressage(@RequestParam(required = false) @ApiParam(value = "团队Code", name = "teamCode")String teamCode,
                                                  @RequestParam(required = false) @ApiParam(value = "1:需跟踪;2:已接收", name = "type")  String type,
                                                  @RequestParam(required = false) @ApiParam(value = "患者姓名关键字", name = "nameKey")String nameKey,
                                                  @RequestParam(required = false) @ApiParam(value = "开始时间", name = "startDate")String startDate,
                                                  @RequestParam(required = false) @ApiParam(value = "结束时间", name = "endDate")String endDate,
                                                  @RequestParam(required = false) @ApiParam(value = "服务站", name = "hospital")String hospital,
                                                  @RequestParam(required = false) @ApiParam(value = "配送状态", name = "state")String state,
                                                  @RequestParam(required = false) @ApiParam(value = "页数", name = "page")Integer page,
                                                  @RequestParam(required = false) @ApiParam(value = "每页大小", name = "size")Integer size){
    public String getHDoctorPrescriptionExpressage
            (@RequestParam(required = false) @ApiParam(value = "团队Code", name = "teamCode") String teamCode,
             @RequestParam(required = false) @ApiParam(value = "1:需跟踪;2:已接收", name = "type") String type,
             @RequestParam(required = false) @ApiParam(value = "患者姓名关键字", name = "nameKey") String nameKey,
             @RequestParam(required = false) @ApiParam(value = "开始时间", name = "startDate") String startDate,
             @RequestParam(required = false) @ApiParam(value = "结束时间", name = "endDate") String endDate,
             @RequestParam(required = false) @ApiParam(value = "服务站", name = "hospital") String hospital,
             @RequestParam(required = false) @ApiParam(value = "配送状态", name = "state") String state,
             @RequestParam(required = false) @ApiParam(value = "页数", name = "page") Integer page,
             @RequestParam(required = false) @ApiParam(value = "每页大小", name = "size") Integer size) {
        try {
            return write(200, "操作成功!", "data",prescriptionInfoService.getHDoctorPrescriptionExpressage(teamCode,type,getRepUID(),nameKey,startDate,endDate,hospital,state,page,size));
            return write(200, "操作成功!", "data", prescriptionInfoService.getHDoctorPrescriptionExpressage(teamCode, type, getRepUID(), nameKey, startDate, endDate, hospital, state, page, size));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -228,19 +230,20 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/getPrescriptionExpressageFilter", method = RequestMethod.GET)
    @ApiOperation(value = "获取健康管理师续方订单列表过滤条件")
    public String getPrescriptionExpressageFilter(){
    public String getPrescriptionExpressageFilter() {
        try {
            return write(200, "操作成功!", "data",prescriptionInfoService.getPrescriptionExpressageFilter(getUID()));
            return write(200, "操作成功!", "data", prescriptionInfoService.getPrescriptionExpressageFilter(getUID()));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getPrescriptionExpressageAsdoctorFilter", method = RequestMethod.GET)
    @ApiOperation(value = "获取全科医生续方订单列表过滤条件")
    public String getPrescriptionExpressageAsdoctorFilter(){
    public String getPrescriptionExpressageAsdoctorFilter() {
        try {
            return write(200, "操作成功!", "data",prescriptionInfoService.getPrescriptionExpressageAsdoctorFilter());
            return write(200, "操作成功!", "data", prescriptionInfoService.getPrescriptionExpressageAsdoctorFilter());
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -249,20 +252,23 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/getDoctorPrescriptionExpressage", method = RequestMethod.GET)
    @ApiOperation(value = "获取全科医生续方订单列表")
    public String getDoctorPrescriptionExpressage(@RequestParam(required = false) @ApiParam(value = "团队Code", name = "teamCode")Integer teamCode,
                                                  @RequestParam(required = false) @ApiParam(value = "居民搜素关键字", name = "nameKey")String nameKey,
                                                  @RequestParam(required = false) @ApiParam(value = "开始时间", name = "startDate")String startDate,
                                                  @RequestParam(required = false) @ApiParam(value = "结束时间", name = "endDate")String endDate,
                                                  @RequestParam(required = false) @ApiParam(value = "机构", name = "hospital")String hospital,
                                                  @RequestParam(required = false) @ApiParam(value = "配送状态", name = "state")String state,
                                                  @RequestParam(required = false) @ApiParam(value = "配送方式:1 自取 2快递配送 3健管师配送", name = "dispensaryType")String dispensaryType,
                                                  @RequestParam(required = false) @ApiParam(value = "传1为未分配健管师", name = "AllocationType")String allocationType,
                                                  @RequestParam(required = false) @ApiParam(value = "起始页", name = "page")Integer page,
                                                  @RequestParam(required = false) @ApiParam(value = "每页大小", name = "size")Integer size){
    public String getDoctorPrescriptionExpressage
            (@RequestParam(required = false) @ApiParam(value = "团队Code", name = "teamCode") Integer teamCode,
             @RequestParam(required = false) @ApiParam(value = "居民搜素关键字", name = "nameKey") String nameKey,
             @RequestParam(required = false) @ApiParam(value = "开始时间", name = "startDate") String startDate,
             @RequestParam(required = false) @ApiParam(value = "结束时间", name = "endDate") String endDate,
             @RequestParam(required = false) @ApiParam(value = "机构", name = "hospital") String hospital,
             @RequestParam(required = false) @ApiParam(value = "配送状态", name = "state") String state,
             @RequestParam(required = false) @ApiParam(value = "配送方式:1 自取 2快递配送 3健管师配送", name = "dispensaryType") String
                     dispensaryType,
             @RequestParam(required = false) @ApiParam(value = "传1为未分配健管师", name = "AllocationType") String
                     allocationType,
             @RequestParam(required = false) @ApiParam(value = "起始页", name = "page") Integer page,
             @RequestParam(required = false) @ApiParam(value = "每页大小", name = "size") Integer size) {
        try {
            return write(200, "操作成功!", "data",
                    prescriptionInfoService.
                            getDoctorPrescriptionExpressage(teamCode, nameKey, startDate, endDate, hospital, state, dispensaryType,allocationType, page, size));
                            getDoctorPrescriptionExpressage(teamCode, nameKey, startDate, endDate, hospital, state, dispensaryType, allocationType, page, size));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -271,7 +277,8 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/getCountExpressage", method = RequestMethod.GET)
    @ApiOperation(value = "获取指定团队未分配建管师订单数目")
    public String getCountExpressage(@RequestParam(required = true) @ApiParam(value = "团队Code", name = "teamCode")String teamCode){
    public String getCountExpressage
            (@RequestParam(required = true) @ApiParam(value = "团队Code", name = "teamCode") String teamCode) {
        try {
            return write(200, "操作成功!", "data", prescriptionInfoService.getCountExpressage(teamCode));
        } catch (Exception e) {
@ -282,7 +289,8 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/getHospitalListTitle", method = RequestMethod.GET)
    @ApiOperation(value = "获取服务站列表")
    public String getHospitalListTitle(@RequestParam(required = true) @ApiParam(value = "团队Code", name = "teamCode")String teamCode){
    public String getHospitalListTitle
            (@RequestParam(required = true) @ApiParam(value = "团队Code", name = "teamCode") String teamCode) {
        try {
            return write(200, "操作成功!", "data", prescriptionInfoService.getHospitalListTitle(teamCode));
        } catch (Exception e) {
@ -293,7 +301,7 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/getTeamHealthDoctorCount", method = RequestMethod.GET)
    @ApiOperation(value = "获取医生同社区底下所有团队建管师数目")
    public String getTeamHealthDoctorCount(){
    public String getTeamHealthDoctorCount() {
        try {
            return write(200, "操作成功!", "data", prescriptionInfoService.getTeamHealthDoctorCount(getUID()));
        } catch (Exception e) {
@ -305,10 +313,11 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/getPrescriptionDurgDict", method = RequestMethod.GET)
    @ApiOperation(value = "获取基卫的药品字典")
    public String getPrescriptionDurgDict(
            @RequestParam(required = true,name = "dictName") @ApiParam(value = "字典名称", name = "dictName",required = true)  String dictName
    ){
            @RequestParam(required = true, name = "dictName") @ApiParam(value = "字典名称", name = "dictName", required = true) String
                    dictName
    ) {
        try {
            return write(200, "操作成功!", "data",jwPrescriptionService.getDictForI(dictName));
            return write(200, "操作成功!", "data", jwPrescriptionService.getDictForI(dictName));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -317,10 +326,12 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/distributionHealthDoctor", method = RequestMethod.POST)
    @ApiOperation(value = "配置建管师")
    public String distributionHealthDoctor(@RequestParam(required = true) @ApiParam(value = "续方Code字符串用','分割", name = "codes") String codes,
                                           @RequestParam(required = true) @ApiParam(value = "健康管理师Code", name = "healthDoctor")String healthDoctor){
    public String distributionHealthDoctor
            (@RequestParam(required = true) @ApiParam(value = "续方Code字符串用','分割", name = "codes") String codes,
             @RequestParam(required = true) @ApiParam(value = "健康管理师Code", name = "healthDoctor") String
                     healthDoctor) {
        try {
            return write(200, "操作成功!", "data",prescriptionInfoService.distributionHealthDoctor( codes, healthDoctor));
            return write(200, "操作成功!", "data", prescriptionInfoService.distributionHealthDoctor(codes, healthDoctor,getUID()));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -329,9 +340,9 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/testAdapter", method = RequestMethod.POST)
    @ApiOperation(value = "测试适配器")
    public String testAdapter(@RequestParam(required = true) @ApiParam(value = "字符串", name = "json") String json){
    public String testAdapter(@RequestParam(required = true) @ApiParam(value = "字符串", name = "json") String json) {
        try {
            return write(200, "操作成功!", "data",adapter.modeTopresInfo(json));
            return write(200, "操作成功!", "data", adapter.modeTopresInfo(json));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -340,9 +351,10 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/getIcd10Info", method = RequestMethod.GET)
    @ApiOperation(value = "获取诊断结果")
    public String getIcd10Info(@RequestParam(required = true) @ApiParam(value = "诊断结果关键字", name = "nameKey") String nameKey){
    public String getIcd10Info(@RequestParam(required = true) @ApiParam(value = "诊断结果关键字", name = "nameKey") String
                                       nameKey) {
        try {
            return write(200, "操作成功!", "data",prescriptionInfoService.getIcd10Info(nameKey));
            return write(200, "操作成功!", "data", prescriptionInfoService.getIcd10Info(nameKey));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -351,9 +363,9 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/getPrescriptionTemp", method = RequestMethod.GET)
    @ApiOperation(value = "获取调整处方模板")
    public String getPrescriptionTemp(){
    public String getPrescriptionTemp() {
        try {
            return write(200, "操作成功!", "data",prescriptionInfoService.getPrescriptionTemp(getUID()));
            return write(200, "操作成功!", "data", prescriptionInfoService.getPrescriptionTemp(getUID()));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -362,9 +374,9 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/initDrugData", method = RequestMethod.GET)
    @ApiOperation(value = "刷入redis平次数据")
    public String initDrugData(){
    public String initDrugData() {
        try {
            return write(200, "操作成功!", "data",prescriptionInfoService.initDrugData());
            return write(200, "操作成功!", "data", prescriptionInfoService.initDrugData());
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
@ -372,19 +384,20 @@ public class PrescriptionInfoController extends BaseController{
    }
    @RequestMapping(value = "/drugToRate", method = RequestMethod.GET)
    @ApiOperation(value ="频次翻译")
    public String drugToRate(@RequestParam(required = true)@ApiParam(name="code",value="频次CODE")String code){
    @ApiOperation(value = "频次翻译")
    public String drugToRate(@RequestParam(required = true) @ApiParam(name = "code", value = "频次CODE") String code) {
        try {
            return write(200, "操作成功!", "data",prescriptionInfoService.drugToRate(code));
            return write(200, "操作成功!", "data", prescriptionInfoService.drugToRate(code));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getPrescription" ,method = RequestMethod.GET)
    @RequestMapping(value = "/getPrescription", method = RequestMethod.GET)
    @ApiOperation(value = "获取长处方详细信息")
    public String getPrescription(@RequestParam(required = true)@ApiParam(name="code",value="处方CODE")String code){
    public String getPrescription(@RequestParam(required = true) @ApiParam(name = "code", value = "处方CODE") String
                                          code) {
        try {
            return write(200, "查询成功!", "data", prescriptionInfoService.getPrescription(code));
        } catch (Exception e) {
@ -393,9 +406,9 @@ public class PrescriptionInfoController extends BaseController{
        }
    }
    @RequestMapping(value = "/getRateList" ,method = RequestMethod.GET)
    @RequestMapping(value = "/getRateList", method = RequestMethod.GET)
    @ApiOperation(value = "查询频次列表")
    public String getRateList(){
    public String getRateList() {
        try {
            return write(200, "查询成功!", "data", prescriptionInfoService.getRateList());
        } catch (Exception e) {
@ -404,33 +417,35 @@ public class PrescriptionInfoController extends BaseController{
        }
    }
    @RequestMapping(value = "/getRegisterRee" ,method = RequestMethod.GET)
    @RequestMapping(value = "/getRegisterRee", method = RequestMethod.GET)
    @ApiOperation(value = "获取挂号费+诊察费下拉列表")
    public String getRegisterRee(@RequestParam(required = true)@ApiParam(name="jwHospital",value="开方机构")String jwHospital,
                                 @RequestParam(required = true)@ApiParam(name="jwDoctorCode",value="开方医生Code")String jwDoctorCode){
    public String getRegisterRee
            (@RequestParam(required = true) @ApiParam(name = "jwHospital", value = "开方机构") String jwHospital,
             @RequestParam(required = true) @ApiParam(name = "jwDoctorCode", value = "开方医生Code") String jwDoctorCode) {
        try {
            return write(200, "查询成功!", "data", prescriptionInfoService.getRegisterRee(jwHospital,jwDoctorCode));
            return write(200, "查询成功!", "data", prescriptionInfoService.getRegisterRee(jwHospital, jwDoctorCode));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getDeptList" ,method = RequestMethod.GET)
    @RequestMapping(value = "/getDeptList", method = RequestMethod.GET)
    @ApiOperation(value = "获取医生科室列表")
    public String getDeptList(@RequestParam(required = true)@ApiParam(name="jwHospital",value="开方机构")String jwHospital,
                                 @RequestParam(required = true)@ApiParam(name="jwDoctorCode",value="开方医生Code")String jwDoctorCode){
    public String getDeptList(@RequestParam(required = true) @ApiParam(name = "jwHospital", value = "开方机构") String
                                      jwHospital,
                              @RequestParam(required = true) @ApiParam(name = "jwDoctorCode", value = "开方医生Code") String jwDoctorCode) {
        try {
            return write(200, "查询成功!", "data", prescriptionInfoService.getDeptList(jwHospital,jwDoctorCode));
            return write(200, "查询成功!", "data", prescriptionInfoService.getDeptList(jwHospital, jwDoctorCode));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getUsageDict" ,method = RequestMethod.GET)
    @RequestMapping(value = "/getUsageDict", method = RequestMethod.GET)
    @ApiOperation(value = "获取药品用法列表")
    public String getUsageDict(){
    public String getUsageDict() {
        try {
            return write(200, "查询成功!", "data", prescriptionInfoService.getUsageDict());
        } catch (Exception e) {

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescriptionPC/PrescriptionExpressagePCController.java

@ -27,7 +27,7 @@ public class PrescriptionExpressagePCController extends BaseController {
    public String getMedicine(
            @ApiParam(required = true, name = "code", value = "二维码(居民取药码、健管师取药码)") @RequestParam(value = "code", required = true) String code){
        try{
            JSONObject jSONObject = prescriptionExpressagePCService.getMedicine(code,getRepUID());
            JSONObject jSONObject = prescriptionExpressagePCService.getMedicine(code,getUID());
//            jSONObject.toString().replace("\\","");
            return write(200, "获取信息成功!", "data", jSONObject);
        }catch (Exception e) {
@ -41,7 +41,7 @@ public class PrescriptionExpressagePCController extends BaseController {
    public String fetchingMedicine(
            @ApiParam(required = true, name = "code", value = "二维码(居民取药码、健管师取药码)") @RequestParam(value = "code", required = true) String code){
        try {
            prescriptionExpressagePCService.fetchingMedicine(code, getRepUID());
            prescriptionExpressagePCService.fetchingMedicine(code, getUID());
            return write(200, "更改成功!");
        }catch (Exception e) {
            error(e);

+ 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) {

+ 49 - 44
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.patient.prescription;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionExpressage;
@ -13,7 +14,6 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.axis.encoding.Base64;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@ -46,39 +46,40 @@ public class PatientPrescriptionController extends WeixinBaseController {
    /**
     * 生成取药码
     */
    @RequestMapping(value = "/dispensaryCode/saveQRCode",method = RequestMethod.POST)
    @RequestMapping(value = "/dispensaryCode/saveQRCode", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String saveQRCode2(
            @ApiParam(required = true ,name = "prescriptionCode",value = "处方code")@RequestParam(value = "prescriptionCode",required = true) String prescriptionCode){
            @ApiParam(required = true, name = "prescriptionCode", value = "处方code") @RequestParam(value = "prescriptionCode", required = true) String prescriptionCode) {
        try {
           boolean b = prescriptionDispensaryCodeService.saveQRCode(getAccessToken(),prescriptionCode);
           if(b){
               return write(200, "生成二维码成功!");
           }else{
               return error(-1, "生成二维码失败!");
           }
        }catch (Exception e) {
            boolean b = prescriptionDispensaryCodeService.saveQRCode(getAccessToken(), prescriptionCode);
            if (b) {
                return write(200, "生成二维码成功!");
            } else {
                return error(-1, "生成二维码失败!");
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "生成二维码失败!");
        }
    }
    /**
     *生成居民取药码
     * 生成居民取药码
     *
     * @return
     */
    @RequestMapping(value = "/dispensaryCode/savePatientQRCode",method = RequestMethod.GET)
    @RequestMapping(value = "/dispensaryCode/savePatientQRCode", method = RequestMethod.GET)
    @ResponseBody
    @ObserverRequired
    public String saveQRCode(
            //@RequestParam(value = "dispensaryType",required = true) Integer dispensaryType,
            @ApiParam(required = true ,name = "prescriptionCode",value = "处方code")@RequestParam(value = "prescriptionCode",required = true) String prescriptionCode){
            @ApiParam(required = true, name = "prescriptionCode", value = "处方code") @RequestParam(value = "prescriptionCode", required = true) String prescriptionCode) {
//        String token = getAccessToken();
        try {
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeService.savePatientQRCode(getAccessToken(),prescriptionCode);
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeService.savePatientQRCode(getAccessToken(), prescriptionCode);
            if (prescriptionDispensaryCode == null) {
                return error(-1, "生成居民取药码失败!");
            } else {
@ -91,18 +92,19 @@ public class PatientPrescriptionController extends WeixinBaseController {
    }
    /**
     *生成配送员取药码
     * 生成配送员取药码
     *
     * @return
     */
    @RequestMapping(value = "/dispensaryCode/saveDoctorQRCode",method = RequestMethod.GET)
    @RequestMapping(value = "/dispensaryCode/saveDoctorQRCode", method = RequestMethod.GET)
    @ResponseBody
    @ObserverRequired
    public String saveDoctorQRCode(
            @RequestParam(value = "prescriptionCode",required = true) String prescriptionCode,
            @RequestParam(value = "code",required = true) String code){
            @RequestParam(value = "prescriptionCode", required = true) String prescriptionCode,
            @RequestParam(value = "code", required = true) String code) {
        try {
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeService.saveQRCode(code,getAccessToken(),prescriptionCode,2);
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeService.saveQRCode(code, getAccessToken(), prescriptionCode, 2);
            if (prescriptionDispensaryCode == null) {
                return error(-1, "生成配送员取药码失败!");
            } else {
@ -116,18 +118,19 @@ public class PatientPrescriptionController extends WeixinBaseController {
    /**
     *生成配送员配送码
     * 生成配送员配送码
     *
     * @return
     */
    @RequestMapping(value = "/dispensaryCode/saveDoctorQRDeliveryCode",method = RequestMethod.GET)
    @RequestMapping(value = "/dispensaryCode/saveDoctorQRDeliveryCode", method = RequestMethod.GET)
    @ResponseBody
    @ObserverRequired
    public String saveDoctorQRDeliveryCode(
            @RequestParam(value = "prescriptionCode",required = true) String prescriptionCode,
            @RequestParam(value = "code",required = true) String code){
            @RequestParam(value = "prescriptionCode", required = true) String prescriptionCode,
            @RequestParam(value = "code", required = true) String code) {
        try {
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeService.saveQRCode(code,getAccessToken(),prescriptionCode,3);
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeService.saveQRCode(code, getAccessToken(), prescriptionCode, 3);
            if (prescriptionDispensaryCode == null) {
                return error(-1, "生成配送员配送码失败!");
            } else {
@ -142,17 +145,18 @@ public class PatientPrescriptionController extends WeixinBaseController {
    /**
     * 居民端获取取药码
     *
     * @param prescriptionCode
     * @return
     */
    @RequestMapping(value = "/dispensaryCode/getPatientQrcode", method = RequestMethod.GET)
    public String getPatientQrcode(@RequestParam(value = "prescriptionCode",required = true) String prescriptionCode) {
    public String getPatientQrcode(@RequestParam(value = "prescriptionCode", required = true) String prescriptionCode) {
        try{
            Map<String, Object> map = prescriptionDispensaryCodeService.getQrcode(prescriptionCode,getRepUID(),1);
        try {
            Map<String, Object> map = prescriptionDispensaryCodeService.getQrcode(prescriptionCode, getRepUID(), 1);
//            map.put("code",Base64.encode(map.get("code").toString().getBytes()));
            return write(200, "获取居民取药码成功!", "data", map);
        }catch (Exception e) {
        } catch (Exception e) {
            error(e);
            return error(-1, "获取取药码失败!");
        }
@ -160,24 +164,24 @@ public class PatientPrescriptionController extends WeixinBaseController {
    /**
     * 显示居民所有的取药码列表
     *
     * @param status
     * @param timeType
     * @param page
     * @param pagesize
     * type 1、居民端扫码列表 2、配送员(健管师)扫码列表
     * @param pagesize type 1、居民端扫码列表 2、配送员(健管师)扫码列表
     * @return
     */
    @RequestMapping(value = "/dispensaryCode/list",method = RequestMethod.GET)
    @RequestMapping(value = "/dispensaryCode/list", method = RequestMethod.GET)
    @ResponseBody
    //@ObserverRequired
    public String list(
            @RequestParam(value = "status",required = false) Integer status,
            @RequestParam(value = "timeType",required = false) Integer timeType,
            @RequestParam(value = "page",required = true) Integer page,
            @RequestParam(value = "pagesize",required = true) Integer pagesize) {
            @RequestParam(value = "status", required = false) Integer status,
            @RequestParam(value = "timeType", required = false) Integer timeType,
            @RequestParam(value = "page", required = true) Integer page,
            @RequestParam(value = "pagesize", required = true) Integer pagesize) {
        //getUID()"a663d0cf7f8c4d38a8327cedc921e65f"
        try {
            JSONArray result = prescriptionDispensaryCodeService.findByStatusAndTime(timeType,getRepUID(),status,page,pagesize,1);
            JSONArray result = prescriptionDispensaryCodeService.findByStatusAndTime(timeType, getRepUID(), status, page, pagesize, 1);
            return write(200, "获取信息成功!", "result", result);
        } catch (Exception e) {
@ -187,7 +191,6 @@ public class PatientPrescriptionController extends WeixinBaseController {
    }
    /**
     * 判断该居民是否有待取的药的接口
     * @return
@ -233,14 +236,16 @@ public class PatientPrescriptionController extends WeixinBaseController {
            PrescriptionPay prescriptionPay = prescriptionPayService.findByPrescriptionCode(prescriptionCode);
            //获取配送信息
            PrescriptionExpressage prescriptionExpressage = prescriptionExpressageService.findByPrescriptionCode(prescriptionCode);
            jo.put("prescriptionExpressage", new JSONObject(prescriptionExpressage));
            jo.put("prescriptionExpressage", prescriptionExpressage);
            jo.put("prescriptionPay", prescriptionPay);
            jo.put("prescriptionInfos", prescriptionInfos);
            jo.put("prescriptionPay", new JSONObject(prescriptionPay));
            jo.put("prescriptionHospital", prescription.getHospitalName());//出药机构
            jo.put("prescriptionDispensaryType", prescription.getDispensaryType());//处方配送方式
            jo.put("prescriptionDispensaryTypeName", prescription.getDispensaryTypeName());//处方配送方式
            jo.put("prescriptionStatus", prescription.getStatus());//处方状态
            jo.put("prescriptionStatusName", prescription.getStatusName(prescription.getStatus(),""));//处方状态名称
            if (prescription != null) {
                jo.put("prescriptionHospital", prescription.getHospitalName());//出药机构
                jo.put("dispensaryDispensaryType", prescription.getDispensaryType());//处方配送方式
                jo.put("dispensaryDispensaryTypeName", prescription.getDispensaryTypeName());//处方配送方式
                jo.put("prescriptionStatus", prescription.getStatus());//处方状态
                jo.put("prescriptionStatusName", prescription.getStatusName(prescription.getStatus(), ""));//处方状态名称
            }
            return write(200, "查询成功", "data", jo);
        } catch (Exception e) {
            return error(-1, "获取失败");

+ 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);