浏览代码

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

chenyongxing 7 年之前
父节点
当前提交
84240bd5e8
共有 28 个文件被更改,包括 443 次插入150 次删除
  1. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java
  2. 8 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/Patient.java
  3. 9 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/service/ServiceItem.java
  4. 33 9
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/yueren/YueRenController.java
  5. 14 9
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java
  6. 33 30
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java
  7. 32 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java
  8. 5 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java
  9. 23 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/redis/RedisThread.java
  10. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java
  11. 0 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientDao.java
  12. 7 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionInfoDao.java
  13. 3 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/service/ServiceItemDao.java
  14. 11 15
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java
  15. 10 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  16. 127 24
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java
  17. 0 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  18. 9 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignFamilyServiceService.java
  19. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/TokenService.java
  20. 0 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java
  21. 8 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/ZyDictService.java
  22. 15 15
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java
  23. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SystemData.java
  24. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescriptionPC/PrescriptionExpressagePCController.java
  25. 8 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java
  26. 51 11
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java
  27. 18 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/PatientSignFamilyServiceController.java
  28. 10 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/util/WeiXinTagUtil.java

文件差异内容过多而无法显示
+ 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{

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

+ 33 - 9
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/yueren/YueRenController.java

@ -7,11 +7,16 @@ import io.swagger.annotations.Api;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.FileSystemResource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
/**
@ -55,17 +60,36 @@ public class YueRenController extends BaseController {
    //--预约模块 end
    //--四诊模块 begin
    /**
     * 上传图片音频等附件
     * @param jsonString 附件
     * @param file
     * @return
     */
    @RequestMapping(value = "/uploadattachment", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String uploadAttachment(@RequestBody String jsonString) {
        JSONObject params = new JSONObject();
        String postStr = remoteCall("/yueren/uploadattachment", params);
        return postStr;
    public String uploadAttachment(@RequestParam MultipartFile file) {
        MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
        String fileName = file.getOriginalFilename();
        String filePath =Class.class.getClass().getResource("/").getPath() + "temp/" + System.currentTimeMillis() + fileName;
        File dest = new File(filePath);
        if (!dest.getParentFile().exists()) {
            dest.getParentFile().mkdirs();
        }
        try {
            file.transferTo(dest);
            RestTemplate rest = new RestTemplate();
            FileSystemResource resource = new FileSystemResource(filePath);
            param.add("file", resource);
            String postStr = rest.postForObject(api + "/yueren/uploadattachment", param, String.class);
            if (dest.exists() && dest.isFile()) {
                dest.delete();
            }
            return postStr;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "{\"status\":500,\"exception\":\"上传文件出错\"}";
    }
    /**

文件差异内容过多而无法显示
+ 14 - 9
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java


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

@ -283,7 +283,10 @@ public class PrescriptionService extends ZysoftBaseService{
                message.put("state",1);
                message.put("prescription",prescription.getCode());
                message.put("mes","success");
                redisTemplate.convertAndSend(channelTopic,message.toString());
//                redisTemplate.convertAndSend(channelTopic,message.toString());
                redisTemplate.watch(channelTopic);
                redisTemplate.opsForList().leftPush(channelTopic,message.toString());
                redisTemplate.unwatch();
            }
        }catch (JSONException ex){
@ -643,13 +646,15 @@ public class PrescriptionService extends ZysoftBaseService{
     */
    public String getDispUnSettleFeeInfoList(String cardNo, String visitNo)  throws Exception
    {
        String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
        Prescription prescription = prescriptionDao.findByVisitNo(visitNo);
        String[] hospitalMapping = getHospitalMapping(prescription.getHospital()); //获取机构映射
        String hospital = hospitalMapping[0];
        String licence = hospitalMapping[1];
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE","350211A1025");
        header.put("LICENCE","5YGl5bq35LmL6Lev");
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("cardNo",cardNo);
@ -662,24 +667,21 @@ public class PrescriptionService extends ZysoftBaseService{
    /**
     * 7.6 院内结算确认接口
     * @param hospital
     * @param licence
     * @return
     * @param  prescriptionCode 处方号
     * @throws Exception
     */
    public String executeSickSettle(String prescriptionCode, String hospital, String licence)  throws Exception
    public String executeSickSettle(String prescriptionCode)  throws Exception
    {
        if(hospital==null){
            String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
            hospital = hospitalMapping[0];
            licence = hospitalMapping[1];
        }
        Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
        String[] hospitalMapping = getHospitalMapping(prescription.getHospital()); //获取机构映射
        String hospital = hospitalMapping[0];
        String licence = hospitalMapping[1];
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
        if(prescription == null){
            throw new Exception("未找到该处方!");
        }
@ -694,12 +696,8 @@ public class PrescriptionService extends ZysoftBaseService{
        //拼接结算参数
        JSONObject json = new JSONObject();
        json.put("cardNo",prescription.getSsc());// "cardNo": "病人卡号",
//            "saveDept": "开单科室编码",
//            "REGISTER_TYPE": "挂号类型编码",
//            "RATE_TYPE": "费别类型编码",
        json.put("settleDept","结算科室编码");//结算科室编码--------待处理
        String jwdoctor = doctorMappingDao.findByDocotrCodeAndJwDoctorHospital(prescription.getDoctor(),hospital);
        json.put("saveOperator",jwdoctor);// "saveOperator": "开单人员编码",
        json.put("settleDept",prescription.getJwDeptCode());//结算科室编码
        json.put("saveOperator",prescription.getJwDoctorCode());// "saveOperator": "开单人员编码",
        json.put("visitNo",prescription.getVisitNo());// "院内挂号号,取费用列表中最小的院内挂号号
        //医保支付需要组装以下参数
@ -738,22 +736,27 @@ public class PrescriptionService extends ZysoftBaseService{
    /**
     * 挂号作废处方接口
     * @param json
     * @param hospital
     * @param licence @return
     * @param visitNo 挂号号
     * @param fadeDept  科室编码
     * @param fadeOperator 医生编码
     */
    public String fadeRecipe(JSONObject json, String hospital, String licence) throws Exception{
        if(hospital==null){
            String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
            hospital = hospitalMapping[0];
            licence = hospitalMapping[1];
        }
    public String fadeRecipe(String visitNo, String fadeDept, String fadeOperator) throws Exception{
        Prescription prescription = prescriptionDao.findByVisitNo(visitNo);
        String[] hospitalMapping = getHospitalMapping(prescription.getHospital()); //获取机构映射
        String hospital = hospitalMapping[0];
        String licence = hospitalMapping[1];
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        String response = postSecond("fadeRecipe","挂号作废处方接口",null,json,header,false,2);
        Map<String,String> params = new HashMap<>();
        params.put("visitNo",visitNo);
        params.put("fadeDept",fadeDept);
        params.put("fadeOperator",fadeOperator);
        String response = postSecond("fadeRecipe","挂号作废处方接口",params,null,header,false,2);
        return response;
    }

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

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

@ -67,6 +67,7 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("select count(a) from Message a where a.read = 0 and a.over ='0'  and a.receiver=?1 and a.type=?2 ")
    int findMessageNum(String doctor, Integer type);
    @Modifying
    @Query("update Message a set a.prescriptionStatus=?2 where a.relationCode = ?1 and a.type=?3 ")
    int updatePreScriptionMessage(String relateCode,String prescriptionStatus,Integer type);
@ -86,6 +87,6 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    int findTzMessage(String patient);
    //根据续方关联code查询团队长分配健管师消息
    @Query("from Message a where a.type = 3 and a.state=0 and a.del='1' and a.over='0' and relationCode = ?1  ")
    @Query("from Message a where a.type = 8 and a.state=0 and a.del='1' and a.over='0' and relationCode = ?1  ")
    Message findByRelationCode(String relationCode);
}

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

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

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

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

+ 3 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/service/ServiceItemDao.java

@ -13,4 +13,7 @@ import java.util.List;
public interface ServiceItemDao extends PagingAndSortingRepository<ServiceItem, Long>, JpaSpecificationExecutor<ServiceItem> {
    @Query(" from ServiceItem where serviceCode=?1 and del=1")
    List<ServiceItem> findByServiceCode(String serviceCode);
    @Query(" from ServiceItem where code=?1")
    ServiceItem findByItemCode(String itemCode);
}

+ 11 - 15
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java

@ -1,39 +1,26 @@
package com.yihu.wlyy.service.app.prescription;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionDispensaryCode;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDispensaryCodeDao;
import com.yihu.wlyy.repository.prescription.PrescriptionInfoDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.common.QrcodeService;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.util.QrcodeUtil;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.fastdfs.FastDFSUtil;
import org.apache.axis.encoding.*;
import org.apache.axis.encoding.Base64;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.io.InputStream;
import java.util.*;
/**
@ -55,6 +42,8 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    private HttpUtil httpUtil;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private MessageDao messageDao;
    private static Object obj = new Object();
    private static Object obj2 = new Object();
@ -251,6 +240,13 @@ public class PrescriptionDispensaryCodeService extends BaseService {
            prescriptionDispensaryCode.setIsUse(1);
            prescriptionDispensaryCodeDao.save(prescriptionDispensaryCode);
            Prescription prescription = prescriptionDao.findByCode(prescriptionDispensaryCode.getPrescriptionCode());
            if(prescription.getDispensaryType()==3){
                //健管师配送
                //修改系统的续方消息的审核状态
                messageDao.updatePreScriptionMessage(prescription.getCode(), "1", 7);
            }
        }else{
            throw new Exception("二维码输入错误或者已过期!");
        }

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

@ -88,6 +88,8 @@ public class PrescriptionInfoService extends BaseService {
    private static final String tnb = "HP0047";
    @Autowired
    private PrescriptionExpressageService expressageService;
    @Autowired
    private PrescriptionService prescriptionService;
    private static final Logger logger = LoggerFactory.getLogger(HttpUtil.class);
@ -305,7 +307,7 @@ public class PrescriptionInfoService extends BaseService {
        }
        if (prescription != null && prescription.getStatus() == 10) {
        if (prescription != null && prescription.getStatus() == PrescriptionLog.PrescriptionLogStatus.wait_pay.getValue()) {
            Long s = (prescription.getCreateTime().getTime() - new Date().getTime()) / 1000;
            //rs.put("time",s);
            if (s > 172800) {
@ -385,6 +387,12 @@ public class PrescriptionInfoService extends BaseService {
                //审核通过模板消息
                sendRMess(code, 1);
                //修改系统的续方消息的审核状态
                messageDao.updatePreScriptionMessage(p.getConsult(), "1", 6);
                //获取智业待结算接口,更新药品金额
                prescriptionService.getPerscriptionInfoCostFromPayInfo(p.getCode());
                return 1;
            } else {
                p.setStatus(PrescriptionLog.PrescriptionLogStatus.add_error.getValue());
@ -525,7 +533,7 @@ public class PrescriptionInfoService extends BaseService {
                reviewed.setStatus(PrescriptionReviewed.PrescriptionReviewedStatus.del.getValue());
                //修改系统的续方消息的审核状态
                messageDao.updatePreScriptionMessage(code, "2", 6);
                messageDao.updatePreScriptionMessage(p.getConsult(), "2", 6);
                //审核不用过发送消息
                //发送Im消息

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

@ -6,18 +6,11 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeam;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionDiagnosis;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionExpressage;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
import com.yihu.wlyy.repository.doctor.DoctorMappingDao;
import com.yihu.wlyy.entity.patient.prescription.*;
import com.yihu.wlyy.repository.doctor.DoctorTeamDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDiagnosisDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDispensaryCodeDao;
import com.yihu.wlyy.repository.prescription.PrescriptionExpressageDao;
import com.yihu.wlyy.repository.prescription.*;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.third.jw.JwPrescriptionService;
import com.yihu.wlyy.task.PushMsgTask;
@ -27,10 +20,13 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
 * Created by chenweida on 2017/7/27.
@ -40,6 +36,9 @@ public class PrescriptionService extends BaseService {
    private static Logger logger = LoggerFactory.getLogger(PrescriptionService.class);
    @Value("${wechat.wechat_base_url}")
    private String wechat_base_url;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
@ -55,15 +54,17 @@ public class PrescriptionService extends BaseService {
    @Autowired
    private JwPrescriptionService jwPrescriptionService;
    @Autowired
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    @Value("${wechat.wechat_base_url}")
    private String wechat_base_url;
    @Autowired
    private PrescriptionDispensaryCodeDao prescriptionDispensaryCodeDao;
    @Autowired
    private DoctorTeamDao doctorTeamDao;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private JpaTransactionManager transactionManager;
    @Autowired
    private com.yihu.wlyy.util.CommonUtil CommonUtil;
    /**
@ -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
@ -215,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);
@ -250,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();
@ -258,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"));//药品频率
@ -286,4 +315,78 @@ 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());
            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);
                }
            }else {
                throw new Exception("请求基卫接口报错,无数据返回!");
            }
            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;
    }

+ 9 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignFamilyServiceService.java

@ -160,7 +160,12 @@ public class SignFamilyServiceService {
     */
    public List<ServiceItem> getPatientServiceItem(String patient, String serviceCode) throws Exception {
        StringBuffer sql = new StringBuffer(" SELECT " +
                "   s.* " +
                "   s.code," +
                "   s.name," +
                "   s.sub_name, " +
                "   s.image, " +
                "   s.type, " +
                "   s.mobile " +
                " FROM " +
                "   wlyy_service_item s, " +
                "   wlyy_sign_family_service_item si " +
@ -344,4 +349,7 @@ public class SignFamilyServiceService {
    }
    public ServiceItem getItemByItemCode(String itemCode) {
        return serviceItemDao.findByItemCode(itemCode);
    }
}

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

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

+ 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, "发送失败!");
        }
    }
}

+ 18 - 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);
@ -44,4 +48,18 @@ public class PatientSignFamilyServiceController extends BaseController {
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value = "/getItemByItemCode", method = RequestMethod.GET)
    @ApiOperation("根据ItemCode获取服务详情")
    public String getItemByItemCode(
            @RequestParam(required = true, value = "itemCode") @ApiParam(required = true, value = "itemCode", name = "itemCode") String itemCode
    ) {
        try {
            ServiceItem serviceItems = signFamilyServiceService.getItemByItemCode(itemCode);
            return write(200, "请求成功", "data", serviceItems);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
}

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