瀏覽代碼

代码修改

yeshijie 8 年之前
父節點
當前提交
70f9a4c147

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

@ -65,7 +65,8 @@ public class CommonUtil {
    }
    /**
     * double*100转int
     * double转字符串,在转int
     * double*100转int 有bug 34.3会会变成3429
     * @param d
     * @return
     */
@ -73,7 +74,25 @@ public class CommonUtil {
        if(d==null){
            return 0;
        }
        return new Double(d*100).intValue();
        String currency = String.valueOf(d);
        int index = currency.indexOf(".");
        int length = currency.length();
        Integer amLong = 0;
        if(index == -1){
            amLong = Integer.valueOf(currency+"00");
        }else if(length - index >= 3){
            amLong = Integer.valueOf((currency.substring(0, index+3)).replace(".", ""));
            if(length-index>3){
                if(Integer.valueOf(currency.substring(index+3,index+4))>=5){
                    amLong++;
                }
            }
        }else if(length - index == 2){
            amLong = Integer.valueOf((currency.substring(0, index+2)).replace(".", "")+0);
        }else{
            amLong = Integer.valueOf((currency.substring(0, index+1)).replace(".", "")+"00");
        }
        return amLong;
    }
    /**

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

@ -25,10 +25,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * 长处方接口
@ -118,10 +115,10 @@ public class PrescriptionService extends ZysoftBaseService{
                    //调整续方的药品信息
                    JSONArray prescription_detail = pre.getJSONArray("PRESCRIPTION_DETAIL");
                    List<PrescriptionInfo> infoList = new ArrayList<>();
                    for(int i =0;i<prescription_detail.size();i++){
                        JSONObject info = prescription_detail.getJSONObject(i);
                        String infoCode = info.getString("SUB_NO");
                        PrescriptionInfo prescriptionInfo = prescriptionInfoDao.findByCode(infoCode);
                        PrescriptionInfo prescriptionInfo = new PrescriptionInfo();
                        prescriptionInfo.setRemark(info.getString("REMARK"));
                        prescriptionInfo.setBindFlag(info.getString("BIND_FLAG"));
                        prescriptionInfo.setDirection(info.getString("USAGE_NAME"));//药品用法
@ -130,9 +127,9 @@ public class PrescriptionService extends ZysoftBaseService{
                        prescriptionInfo.setDrugRate(info.getString("FREQUENCY"));//吃药频率 FREQUENCY
                        prescriptionInfo.setDrugRateName(info.getString("FREQUENCY_NAME"));
                        prescriptionInfo.setDrugFormat(info.getString("ITEM_SPEC"));//药品规格
                        prescriptionInfo.setPrice(info.getInteger("ITEM_PRICE"));//药品单价
                        prescriptionInfo.setPrice(CommonUtil.doubleToInt(info.getDouble("ITEM_PRICE")));//药品单价
                        prescriptionInfo.setNum(info.getInteger("ITEM_QUANTITY"));//药品数目
                        prescriptionInfo.setJwSubCode("");//智业子处方号
                        prescriptionInfo.setJwSubCode(info.getString("SUB_NO"));//智业子处方号
                        prescriptionInfo.setDrugNumUnit(info.getString("ITEM_UNIT"));//数量单位编码
                        prescriptionInfo.setDrugNumUnitName(info.getString("ITEM_UNIT_NAME"));//数量单位名称
                        prescriptionInfo.setCost(CommonUtil.doubleToInt(info.getDouble("COST")));//金额
@ -147,13 +144,20 @@ public class PrescriptionService extends ZysoftBaseService{
                        prescriptionInfo.setPhysicAmount(info.getString("PHYSIC_AMOUNT"));//用药总量
                        prescriptionInfo.setPhysicAmountUnit(info.getString("PHYSIC_AMOUNT_UNIT"));//总量单位编码
                        prescriptionInfo.setPhysicAmountUnitName(info.getString("PHYSIC_AMOUNT_UNIT_NAME"));//总量单位名称
                        prescriptionInfo.setPhysicInjectPlace("");//注射地点编码
                        prescriptionInfo.setPhysicInjectPlaceName("");//注射地点名称
                        prescriptionInfo.setPhysicInjectPlace(info.getString("PHYSIC_INJECT_PLACE"));//注射地点编码
                        prescriptionInfo.setPhysicInjectPlaceName(info.getString("PHYSIC_INJECT_PLACE_NAME"));//注射地点名称
                        prescriptionInfo.setPhysicSkinTest(info.getString("PHYSIC_SKIN_TEST"));//皮试类型名称
                        prescriptionInfo.setPhysicSkinTestName(info.getString("PHYSIC_SKIN_TEST_NAME"));//皮试类型名称
                        prescriptionInfoDao.save(prescriptionInfo);
                        prescriptionInfo.setPrescriptionCode(prescription.getCode());
                        infoList.add(prescriptionInfo);
                    }
                    //删除所有药品
                    StringBuffer sql = new StringBuffer("UPDATE wlyy_prescription_info SET del = 0 WHERE prescription_code = '" + prescription.getCode() + "'");
                    jdbcTemplate.execute(sql.toString());
                    //保存新的药品
                    prescriptionInfoDao.save(infoList);
                    // redis 的发布 {tilte:redisAddPrescription   state: 1 ,//1:成功,2.失败 mes:'开方成功' prescription : "0001" //续方CODE  }
                    JSONObject message = new JSONObject();
                    message.put("title","adjustPrescription");
@ -284,9 +288,9 @@ public class PrescriptionService extends ZysoftBaseService{
                message.put("prescription",prescription.getCode());
                message.put("mes","success");
//                redisTemplate.convertAndSend(channelTopic,message.toString());
                redisTemplate.watch(channelTopic);
//                redisTemplate.watch(channelTopic);
                redisTemplate.opsForList().leftPush(channelTopic,message.toString());
                redisTemplate.unwatch();
//                redisTemplate.unwatch();
            }
        }catch (JSONException ex){
@ -560,7 +564,8 @@ public class PrescriptionService extends ZysoftBaseService{
            json.put("DIAGNOSE_SUB_CODE",prescriptionDiagnosisList.get(1).getCode());//"DIAGNOSE_CODE": "次诊断编码",
        }
        if(prescription.getCaCertData()!=null){
            json.put("ORIGINAL_DATA",prescription.getStrOriginalData());//原文
//            json.put("ORIGINAL_DATA",prescription.getStrOriginalData());//原文
            json.put("ORIGINAL_DATA",null);
            json.put("ORIGINAL_DATA_MD5",prescription.getOriginalDataAbstract());//原文的MD5摘要
            json.put("CA_SIGN_DATA",prescription.getCaMessage());//签名值
            json.put("CA_CERTMAIN_DATA",prescription.getCaCertData());//签名证书主体数据
@ -787,7 +792,8 @@ public class PrescriptionService extends ZysoftBaseService{
        JSONObject json = new JSONObject();
        json.put("recipeNo",prescription.getRecipeNo());// "recipeNo": "医嘱号",
        if(prescription.getCaCertData()!=null){
            json.put("ORIGINAL_DATA",prescription.getStrOriginalData());//原文
//            json.put("ORIGINAL_DATA",prescription.getStrOriginalData());//原文
            json.put("ORIGINAL_DATA",null);
            json.put("ORIGINAL_DATA_MD5",prescription.getOriginalDataAbstract());//原文的MD5摘要
            json.put("CA_SIGN_DATA",prescription.getCaMessage());//签名值
            json.put("CA_CERTMAIN_DATA",prescription.getCaCertData());//签名证书主体数据