yeshijie il y a 7 ans
Parent
commit
40f7d08a1e

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

@ -178,7 +178,7 @@ public class ConsultTeamService extends ConsultService {
        //点击后判断,如果用户当前存在可申请续方的处方记录,则进入续方申请流程,若不存在可续方记录,alert“当前没有可以申请续方的处方记录”
        int num = 0;
        Patient p = patientDao.findByCode(patient);
        String rp= jwPrescriptionService.getLastRecipe(p.getSsc(),null,null,null);
        String rp= jwPrescriptionService.getRecipeList(p.getSsc(),null,null,null);
        com.alibaba.fastjson.JSONArray pres =presModeAdapter.modeToPrescription(rp);
        Iterator iterator = pres.iterator();
        while (iterator.hasNext()){

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

@ -158,7 +158,7 @@ public class PrescriptionInfoService extends BaseService {
            if ("1".equals(type)) {
                Patient p = patientDao.findByCode(patient);
                String rp = jwPrescriptionService.getLastRecipe(p.getSsc(), null, startDate, endDate);
                String rp = jwPrescriptionService.getRecipeList(p.getSsc(), null, startDate, endDate);
                com.alibaba.fastjson.JSONArray pres = presModeAdapter.modeToPrescription(rp);
                if(pres==null||pres.size()==0){

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

@ -1,6 +1,7 @@
package com.yihu.wlyy.service.third.jw;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
@ -16,7 +17,9 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 基位长处方接口
@ -87,6 +90,7 @@ public class JwPrescriptionService {
        params.add(new BasicNameValuePair("applyTimeEnd", applyTimeEnd));
        String response = httpClientUtil.post(url, params, "UTF-8");
//        String sql = "SELECT h.response from wlyy_http_log h WHERE h.id = 806287";
//        List<Map<String ,Object>> list = jdbcTemplate.queryForList(sql);
//        String response = list.get(0).get("response").toString();
@ -97,6 +101,62 @@ public class JwPrescriptionService {
        return response;
    }
    /**
     * 获取处方列表
     * @param cardNo
     * @param recipeNo
     * @param applyTimeFrom
     * @param applyTimeEnd
     * @return
     */
    public String getRecipeList(String cardNo,String recipeNo,String applyTimeFrom,String applyTimeEnd){
        JSONObject recipeJson = new JSONObject();
        try{
            Map<String,String> map = new HashMap<>();
            JSONArray jsonArray = new JSONArray();
            for (int i=0;i<20;i++){
                if(!map.containsKey(recipeNo)){
                    map.put(recipeNo,recipeNo);
                    String response = getLastRecipe(cardNo,recipeNo,applyTimeFrom,applyTimeEnd);
                    JSONObject json = JSONObject.parseObject(response);
                    if(json.getInteger("status")==200){
                        //智业接口每次返回一条数据,需要遍历请求
                        JSONObject data = json.getJSONObject("data");
                        String code = data.getString("CODE");
                        if("1".equals(code)){
                            JSONArray returnData = data.getJSONArray("returnData");
                            if(returnData.size()>0){
                                JSONObject recipe = returnData.getJSONArray(0).getJSONObject(0);//获取最后一条处方
                                jsonArray.add(recipe);
                                recipeNo = recipe.getString("RECIPE_NO");
                                if(recipeJson.isEmpty()){
                                    recipeJson = json;
                                }else {
                                    recipeJson.getJSONObject("data").getJSONArray("returnData").getJSONArray(0).add(recipe);
                                }
                            }
                        }
                    }
                }
            }
            if(jsonArray.size()>1){
                JSONObject re = new JSONObject();
                re.put("status",200);
                re.put("msg","调阅历史处方接口!");
                JSONObject data = new JSONObject();
                data.put("CODE","1");
                JSONArray returnData = new JSONArray();
                returnData.add(jsonArray);
                data.put("returnData",returnData);
                re.put("data",data);
                return re.toString();
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        return recipeJson.toString();
    }
    /**
     * 获取单条历史处方
     * @param recipeNo