Browse Source

Merge branch 'dev' of yeshijie/patient-co-management into dev

yeshijie 7 years ago
parent
commit
8901cc9ecd

+ 6 - 2
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“当前没有可以申请续方的处方记录”
        //点击后判断,如果用户当前存在可申请续方的处方记录,则进入续方申请流程,若不存在可续方记录,alert“当前没有可以申请续方的处方记录”
        int num = 0;
        int num = 0;
        Patient p = patientDao.findByCode(patient);
        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);
        com.alibaba.fastjson.JSONArray pres =presModeAdapter.modeToPrescription(rp);
        Iterator iterator = pres.iterator();
        Iterator iterator = pres.iterator();
        while (iterator.hasNext()){
        while (iterator.hasNext()){
@ -1156,7 +1156,11 @@ public class ConsultTeamService extends ConsultService {
            prescriptionInfo.setPrice(CommonUtil.doubleToInt(info.getDouble("price")));//药品单价
            prescriptionInfo.setPrice(CommonUtil.doubleToInt(info.getDouble("price")));//药品单价
//            prescriptionInfo.setIsRefrigerate(0);//是否冷藏 1是 0否
//            prescriptionInfo.setIsRefrigerate(0);//是否冷藏 1是 0否
            prescriptionInfo.setJwSubCode(info.getString("jwSubCode"));//智业子处方号
            prescriptionInfo.setJwSubCode(info.getString("jwSubCode"));//智业子处方号
            prescriptionInfo.setSubjectClass(info.getString("subjectClass"));//科目编码
            String subjectClass = info.getString("subjectClass");
            if(StringUtils.isBlank(subjectClass)){//处理默认药品的科目类型为空
                subjectClass = zyDictService.getSubjectClass(info.getString("drugCode"));
            }
            prescriptionInfo.setSubjectClass(subjectClass);//科目编码
            prescriptionInfo.setDrugNumUnit(info.getString("drugNumUnit"));//数量单位编码
            prescriptionInfo.setDrugNumUnit(info.getString("drugNumUnit"));//数量单位编码
            prescriptionInfo.setDrugNumUnitName(info.getString("drugNumUnitName"));//数量单位名称
            prescriptionInfo.setDrugNumUnitName(info.getString("drugNumUnitName"));//数量单位名称
            prescriptionInfo.setCost(CommonUtil.doubleToInt(info.getDouble("cost")));//金额
            prescriptionInfo.setCost(CommonUtil.doubleToInt(info.getDouble("cost")));//金额

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

@ -159,7 +159,7 @@ public class PrescriptionInfoService extends BaseService {
            if ("1".equals(type)) {
            if ("1".equals(type)) {
                Patient p = patientDao.findByCode(patient);
                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);
                com.alibaba.fastjson.JSONArray pres = presModeAdapter.modeToPrescription(rp);
                if(pres==null||pres.size()==0){
                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;
package com.yihu.wlyy.service.third.jw;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
@ -16,7 +17,9 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.List;
import java.util.Map;
/**
/**
 * 基位长处方接口
 * 基位长处方接口
@ -87,6 +90,7 @@ public class JwPrescriptionService {
        params.add(new BasicNameValuePair("applyTimeEnd", applyTimeEnd));
        params.add(new BasicNameValuePair("applyTimeEnd", applyTimeEnd));
        String response = httpClientUtil.post(url, params, "UTF-8");
        String response = httpClientUtil.post(url, params, "UTF-8");
//        String sql = "SELECT h.response from wlyy_http_log h WHERE h.id = 806287";
//        String sql = "SELECT h.response from wlyy_http_log h WHERE h.id = 806287";
//        List<Map<String ,Object>> list = jdbcTemplate.queryForList(sql);
//        List<Map<String ,Object>> list = jdbcTemplate.queryForList(sql);
//        String response = list.get(0).get("response").toString();
//        String response = list.get(0).get("response").toString();
@ -97,6 +101,62 @@ public class JwPrescriptionService {
        return response;
        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
     * @param recipeNo

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

@ -125,6 +125,23 @@ public class ZyDictService {
        return isRefrigerate;
        return isRefrigerate;
    }
    }
    /**
     * 获取药品科目类型
     * @param physicCodde
     * @return
     */
    public String getSubjectClass(String physicCodde){
        StringBuffer sql = new StringBuffer("SELECT subject_class from zy_iv_physic_dict WHERE physic_code = ?");
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql.toString(),physicCodde);
        if(list!=null&&list.size()>0){
            Object subject_class = list.get(0).get("subject_class");
            if(subject_class!=null){
                return subject_class.toString();
            }
        }
        return "";
    }
    /**
    /**
     * 获取药品字典
     * 获取药品字典