Przeglądaj źródła

处方状态变更

zdm 5 lat temu
rodzic
commit
6dab61d4d7

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/OutpatientDao.java

@ -2,7 +2,6 @@ package com.yihu.jw.hospital.prescription.dao;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
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;
@ -21,4 +20,5 @@ public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatient
    List<WlyyOutpatientDO> findByDoctor(String doctor);
    WlyyOutpatientDO findById(String id);
    List<WlyyOutpatientDO> findByAdmNo(String admNo);
}

+ 104 - 14
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -43,6 +43,8 @@ import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.security.Code16;
import com.yihu.jw.util.security.MD5;
import com.yihu.mysql.query.BaseJpaService;
import jxl.write.*;
import net.sf.json.JSONArray;
@ -57,6 +59,7 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.io.IOException;
import java.io.OutputStream;
@ -118,6 +121,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private WlyyDoctorClinicRoomDao wlyyDoctorClinicRoomDao;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    
    @Autowired
    private PrescriptionExpressageService sfexpressService;
    
@ -295,7 +301,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            prescriptionDOs = prescriptionDao.findById(prescriptionId);
        }else{
            prescriptionDOs = prescriptionDao.findByOutpatientId(outpatientId);
        }
        List<WlyyPrescriptionVO> prescriptionVOs = new ArrayList<>();
        if(prescriptionDOs!=null&&prescriptionDOs.size()>0){
@ -1761,7 +1766,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //删除门诊号源
        List<WlyyPatientRegisterTimeDO> list = patientRegisterTimeDao.findByOutpatientId(wlyyOutpatientDO.getId());
        patientRegisterTimeDao.delete(list);
        if(list!=null&&list.size()>0){
            patientRegisterTimeDao.delete(list);
        }
        rs.put("code",1);
        rs.put("mes","取消成功");
@ -2259,20 +2266,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    @Autowired
    private HttpClientUtil httpClientUtil;
    public String test() {
        /**
         * http://www.mstpay.com:1811/ehcService/gateway.do
         public String app_id = "1BQA48ETK000A718A8C000001FFAA482";
         public String app_key = "1BQA48ETK001A718A8C00000FE996B9B";
         public String term_id = "35020010001";
         */
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("method", "ehc.ehealthcard.authurl"));
        params.add(new BasicNameValuePair("app_id", "1BQA48ETK000A718A8C000001FFAA482"));
        params.add(new BasicNameValuePair("term_id", "b60bab0617c04b23b7fa0a059cc83eb6"));
        params.add(new BasicNameValuePair("version","o0hubt3byGmNYLyC-UvmSVyUuZkI"));
        params.add(new BasicNameValuePair("timestamp", "ihealth_pa8DIRJasL"));
        params.add(new BasicNameValuePair("sign_type", "jkzl1h7aj39dnasyi23fnkv92"));
        params.add(new BasicNameValuePair("sign", "b60bab0617c04b23b7fa0a059cc83eb6"));
        params.add(new BasicNameValuePair("enc_type","o0hubt3byGmNYLyC-UvmSVyUuZkI"));
        params.add(new BasicNameValuePair("biz_content", "ihealth_pa8DIRJasL"));
        String res = httpClientUtil.post("http://172.16.1.21:6601/ehcService/gateway.do", params, "UTF-8");
        params.add(new BasicNameValuePair("term_id", "35020010001"));
        params.add(new BasicNameValuePair("version","X.M.0.1"));
        params.add(new BasicNameValuePair("timestamp", DateUtil.dateToStr(new Date(),"yyyyMMddHHmmss")));
        params.add(new BasicNameValuePair("sign_type", "MD5"));
        params.add(new BasicNameValuePair("sign", getSign()));
        params.add(new BasicNameValuePair("enc_type","AES"));
        params.add(new BasicNameValuePair("biz_content", ""));
        String res = httpClientUtil.post("http://www.mstpay.com:1811/ehcService/gateway.do", params, "UTF-8");
        return res;
@ -2282,7 +2293,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
//        com.alibaba.fastjson.JSONObject object1 = com.alibaba.fastjson.JSONObject.parseObject(responseMsg);
//        return object1.toString();
    }
    
    public String getSign(){
        String str ="app_id=1BQA48ETK000A718A8C000001FFAA482" +
                "&enc_type=AES" +
                "&method=ehc.ehealthcard.authurl" +
                "&sign_type=MD5" +
                "&term_id=35020010001" +
                "&timestamp=" +DateUtil.dateToStr(new Date(),"yyyyMMddHHmmss")+
                "&version=X.M.0.1key=<你的密钥>";
        String md5str =  MD5.GetMD5Code(str);
        String str16 = Code16.toStringHex1(md5str);
        return str16.substring(0,16).toUpperCase();
    }
    
    /**
     * 获取正在进行中的视频复诊/协同门诊
@ -2468,4 +2492,70 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return result;
        
    }
    
    
    /**
     * 根据门诊唯一号,处方号,到顺丰下单,下单成功返回面单信息
     * @param admNo 门诊唯一号
     * @param realOrder 处方号
     * @return
     */
    public String getSFExpressInfo(String admNo,String realOrder)throws Exception {
    
        //根据门诊唯一号取就诊记录
        List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByDoctor(admNo);
        
        String result = "";
        
        if(!wlyyOutpatientDOs.isEmpty() && wlyyOutpatientDOs.size()>0){
            List<WlyyPrescriptionExpressageDO> expressageDOList = sfexpressService.findByField("outpatientId",wlyyOutpatientDOs.get(0).getId());
            WlyyPrescriptionExpressageDO sfexpress_obj = null;
            if(CollectionUtils.isEmpty(expressageDOList)){
                throw new Exception("顺丰快递下单失败,未找到该处方的派送地址!");
            }else{
                sfexpress_obj = expressageDOList.get(0);
                //如果该处方的快递单号已生成,则说明已经下单成功,不需要重复下单,直接返回面单信息
                if(org.apache.commons.lang.StringUtils.isNotBlank(sfexpress_obj.getMailno())){
                    //处方已下单成功
                }else{
                    //如果该处方的快递单号未生成,则继续下单
                    //根据业务订单号判断是否已经下单成功
                    boolean go_on = sfexpressService.sfOrderSearchService(sfexpress_obj);
            
                    //如果该业务订单号未下单成功过,则重新下单
                    if(go_on){
                        //请求顺丰接口下单,成功下单后,返回快递单号
                        sfexpress_obj = sfexpressService.postSFOrderService(sfexpress_obj);
                        //保存快递单号和增加处方物流记录为配送
                        sfexpressService.updatePrescriptionExpressage(sfexpress_obj);
                    }
                }
                
                if(sfexpress_obj != null && StringUtils.isNoneBlank(sfexpress_obj.getMailno())){
                    com.alibaba.fastjson.JSONObject sfJsonObject = new com.alibaba.fastjson.JSONObject();
    
                    sfJsonObject.put("mailno", sfexpress_obj.getMailno());
                    sfJsonObject.put("mailtype", "标准快递");
                    sfJsonObject.put("destcode", "592");
                    sfJsonObject.put("j_name", "厦门大学附属中山医院");
                    sfJsonObject.put("j_provinceName", "福建省");
                    sfJsonObject.put("j_cityName", "厦门市");
                    sfJsonObject.put("j_townName", "思明区");
                    sfJsonObject.put("j_address", "湖滨南路201-209号");
                    sfJsonObject.put("j_phone", "4003008888");
                    sfJsonObject.put("d_name", sfexpress_obj.getName());
                    sfJsonObject.put("d_provinceName", sfexpress_obj.getProvinceName());
                    sfJsonObject.put("d_cityName", sfexpress_obj.getCityName());
                    sfJsonObject.put("d_address", sfexpress_obj.getAddress());
                    sfJsonObject.put("d_phone",sfexpress_obj.getMobile());
                    sfJsonObject.put("express_type",11);
                    sfJsonObject.put("pay_method",2);
                    sfJsonObject.put("dispensaryType",2);
                    result = sfJsonObject.toJSONString();
                }
            }
        }
        return result;
    }
}

+ 8 - 0
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -1116,6 +1116,14 @@ public class ImService {
			if(wlyyOutpatientDO != null && wlyyOutpatientDO.getId() != null){
				wlyyOutpatientDO.setStatus("2");
			}
			
			List<WlyyHospitalWaitingRoomDO> wlyyHospitalWaitingRoomDOS = hospitalWaitingRoomDao.findByOutpatientId(cons.getRelationCode());
			if(!wlyyHospitalWaitingRoomDOS.isEmpty()){
				for (WlyyHospitalWaitingRoomDO wlyyHospitalWaitingRoomDO:wlyyHospitalWaitingRoomDOS){
					wlyyHospitalWaitingRoomDO.setVisitStatus(2);
					hospitalWaitingRoomDao.save(wlyyHospitalWaitingRoomDO);
				}
			}
		}
		return 1;

+ 25 - 0
common/common-util/src/main/java/com/yihu/jw/util/security/Code16.java

@ -0,0 +1,25 @@
package com.yihu.jw.util.security;
/**
 * Created by Trick on 2019/7/25.
 */
public class Code16 {
    // 转化十六进制编码为字符串
    public static String toStringHex1(String s) {
        byte[] baKeyword = new byte[s.length() / 2];
        for (int i = 0; i < baKeyword.length; i++) {
            try {
                baKeyword[i] = (byte) (0xff & Integer.parseInt(s.substring(
                        i * 2, i * 2 + 2), 16));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        try {
            s = new String(baKeyword, "utf-8");// UTF-16le:Not
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        return s;
    }
}

+ 1 - 1
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -625,7 +625,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    }
    @RequestMapping(value = "/oauth/getHwlyyDecrypt", method = RequestMethod.POST)
    public ObjEnvelop getHwlyyDecrypt(String openid,String idcard,String wechatId,HttpSession httpSession){
    public ObjEnvelop getHwlyyDecrypt(String openid,String idcard,String wechatId){
        Map<String,Object> rs = new HashedMap();
        try{
            OauthKeypairDO keypairDO = oauthKeypairDao.findByCode("hwlyyKey");

Plik diff jest za duży
+ 1 - 0
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/third/PrescriptionUpdateController.java


+ 1 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -28,7 +28,7 @@ import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2019/5/16.
 * Created by Trick on 2019/5/16
 */
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.Prescription.PREFIX)