| 
					
				 | 
			
			
				@ -19,6 +19,9 @@ import com.yihu.jw.entity.base.patient.PatientMedicareCardDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.score.BaseEvaluateDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.score.BaseEvaluateScoreDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.healthCare.YlzMedicalIcdDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.healthCare.YlzMedicalMxDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.mapping.PatientMappingDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.prescription.*; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -27,6 +30,9 @@ import com.yihu.jw.evaluate.score.dao.BaseEvaluateScoreDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.file_upload.FileUploadService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.dict.YkDictIcd10Dao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.healthCare.YlzMedicailIcdDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.healthCare.YlzMedicailMxDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.healthCare.YlzMedicailRelationDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.mapping.dao.PatientMappingDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.dao.*; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -163,6 +169,12 @@ public class YkyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private DictHospitalDeptDao dictHospitalDeptDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PrescriptionExpressageDao prescriptionExpressageDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private YlzMedicailRelationDao ylzMedicailRelationDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private YlzMedicailMxDao ylzMedicailMxDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private YlzMedicailIcdDao ylzMedicailIcdDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1576,10 +1588,12 @@ public class YkyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "yp.ypmc2 AS \"ypmc2\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "yp.gyffmc as \"gyffmc\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "yp.pzwh as \"pzwh\","+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "yp.gjbm as \"gjbm\","+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "yp.gjmc as \"gjmc\","+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "yp.yfsb as \"yfsb\""+" FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "V_hlwyy_MZ_YPXX yp where 1=1 and yp.yfsb in(3,6)  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(ypdm)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" and lower(yp.ypdm) like '%"+ypdm.toLowerCase()+"%' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" and lower(yp.ypxh) like '%"+ypdm.toLowerCase()+"%' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(ypmc)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" and lower(yp.ypmc) like '%"+ypmc.toLowerCase()+"%' "; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2631,6 +2645,8 @@ public class YkyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String doctor = wlyyPrescriptionVO.getDoctor(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patient = wlyyPrescriptionVO.getPatientCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String outpatientId = wlyyPrescriptionVO.getOutpatientId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patientDO = basePatientDao.findById(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2743,6 +2759,8 @@ public class YkyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setRegisterNo(GHXH+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDao.save(outpatientDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer icd10Flag = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //诊断删除v_hlwys_mz_jzls 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3670,6 +3688,17 @@ public class YkyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //获取调用hospital-entrance createSQLQuery 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String getSql(String sql) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> params = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("sql", sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpResponse response = HttpUtils.doGet(url, params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String content = response.getContent(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("sql:" + sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("response:" + content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return content; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //判断居民是否建过档,没有就建档 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject patientJDKH(String idcard, String name, String phoneNum, String medicare,String clinicId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject res = new JSONObject(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3792,4 +3821,176 @@ public class YkyyEntranceService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //医保结算================================== 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public YlzMedicalRelationDO getSettlementInfo(String cardno, String outpatientId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        YlzMedicalRelationDO ylzMedicalRelationDO =new YlzMedicalRelationDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionDO wlyyPrescriptionDO = new WlyyPrescriptionDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new Exception("无待结算数据"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //查询余额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String balance = "0"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       /* JSONObject jsonObject = selectCardInfo(cardno); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (jsonObject!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            balance = jsonObject.getString("ZHYE"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String deptSql = " select code as \"code\",name as \"name\" from V_HLW_KSXX where code='"+wlyyPrescriptionDO.getDept()+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String res = getSql(deptSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String dept= wlyyPrescriptionDO.getDept(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String deptName = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(res)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject rs = JSONObject.parseObject(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer status = rs.getInteger("status"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (status != null && status == 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONArray array = rs.getJSONArray("detailModelList"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (array!=null&&array.size()!=0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    JSONObject object = array.getJSONObject(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    deptName = object.getString("name"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BaseDoctorDO doctorDO = baseDoctorDao.findById(wlyyPrescriptionDO.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (ylzMedicalRelationDO==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO = new YlzMedicalRelationDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setLogNo(wlyyPrescriptionDO.getRealOrder()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setMedicalState(Integer.parseInt(outpatientDO.getMedicalState())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setRelationCode(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setName(wlyyPrescriptionDO.getPatientName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setTotalAmount(wlyyPrescriptionDO.getDrugFee()+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setPersonCash(wlyyPrescriptionDO.getDrugFee()+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setHisSerial(wlyyPrescriptionDO.getRealOrder()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setHisBillSerial(wlyyPrescriptionDO.getRealOrder()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setDeptCode(dept); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setDeptName(deptName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setHisDeptCode(dept); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setHisDeptName(deptName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setStatus(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setState(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setDel(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setDataSource("54"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setIdcard(outpatientDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setBalance(balance); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setPersonAccount("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setMedicalPrice("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setCertType("01"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setMedicalMode("10"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setRegionCode("350200"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNoneBlank(outpatientDO.getDiseaseCode())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ylzMedicalRelationDO.setMedicalType("13"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ylzMedicalRelationDO.setMedicalType("11"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setHisSettleNo(wlyyPrescriptionDO.getRealOrder()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setCardNo(outpatientDO.getCardNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setDate(wlyyPrescriptionDO.getCreateTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setBcwkje(wlyyPrescriptionDO.getDrugFee()+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setLogNo(wlyyPrescriptionDO.getRealOrder()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setRelationCode(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setDataSource("54"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setDel(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setMedicalState(Integer.parseInt(outpatientDO.getMedicalState())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setName(wlyyPrescriptionDO.getPatientName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setTotalAmount(wlyyPrescriptionDO.getDrugFee()+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setPersonCash(wlyyPrescriptionDO.getDrugFee()+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setHisSerial(outpatientDO.getRegisterNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setHisBillSerial(outpatientDO.getRealOrder()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setDeptCode(dept); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setDeptName(deptName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setHisDeptCode(dept); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setHisDeptName(deptName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setPersonAccount("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setMedicalPrice("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setBalance(balance); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setCertType("01"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setMedicalMode("10"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setRegionCode("350200"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNoneBlank(outpatientDO.getDiseaseCode())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ylzMedicalRelationDO.setMedicalType("13"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ylzMedicalRelationDO.setMedicalType("11"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setIdcard(outpatientDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setHisSettleNo(wlyyPrescriptionDO.getRealOrder()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setCardNo(outpatientDO.getCardNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setDate(wlyyPrescriptionDO.getCreateTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ylzMedicalRelationDO.setBcwkje(wlyyPrescriptionDO.getDrugFee()+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ylzMedicailMxDao.deleteByMedicalId(ylzMedicalRelationDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      /*  //获取结算明细 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String infoSql = "select * from v_ms_dd02 where cfsb ='"+wlyyPrescriptionDO.getRealOrder()+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String infoRes = getSql(infoSql);*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<YlzMedicalMxDO> mxDOList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (WlyyPrescriptionInfoDO infoDO:wlyyPrescriptionInfoDOS){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            YlzMedicalMxDO medicalMxDO = new YlzMedicalMxDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setDel(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setMedicalId(ylzMedicalRelationDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setInvoiceType("01"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setItemName(infoDO.getGjmc()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setHisDetailSn(infoDO.getHisCode()+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setItemCode(infoDO.getGjbm()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setPrescriptionCode(wlyyPrescriptionDO.getRealOrder()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setChargeUnit(infoDO.getUnit()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setSpecificationType(infoDO.getSpecification()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setAmount(infoDO.getQuantity()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setPrice(infoDO.getPackRetprice()+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setPrescriptionCode(wlyyPrescriptionDO.getRealOrder()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setDosageForm(infoDO.getDosage());//剂型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setPrescriptionDate(wlyyPrescriptionDO.getCreateTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setActgDate(wlyyPrescriptionDO.getCreateTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setClerkDays(wlyyPrescriptionDO.getCreateTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setPeopleType(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setSingleDose(infoDO.getDosage()+infoDO.getUnit()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setUseFrequency(infoDO.getFrequency()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setMedicationDays(infoDO.getDays()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setMedicalWay(infoDO.getSupplyName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setDeptCode(dept); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setDeptName(deptName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setHisDeptCode(dept); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setHisDeptName(deptName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setMedicalPerId(doctorDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setMedicalPerName(doctorDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNoneBlank(infoDO.getSfybxm())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                medicalMxDO.setLimitType(infoDO.getSfybxm()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setHisItemCode(infoDO.getGjbm()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setHisItemName(infoDO.getGjmc()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO.setTotalMoney((Integer.parseInt(infoDO.getQuantity())*infoDO.getPackRetprice())+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            medicalMxDO = ylzMedicailMxDao.save(medicalMxDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            mxDOList.add(medicalMxDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer itemCount = wlyyPrescriptionInfoDOS.size(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ylzMedicalRelationDO.setItemCount(itemCount+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ylzMedicalRelationDO.setYlzMedicalMxDOList(mxDOList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<YlzMedicalIcdDO> icdDOS = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ylzMedicailIcdDao.deleteByMedicalId(ylzMedicalRelationDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionDiagnosisDO> diagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //获取诊断 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (WlyyPrescriptionDiagnosisDO diagnosisDO:diagnosisDOS){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            YlzMedicalIcdDO icdDO = new YlzMedicalIcdDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            icdDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            icdDO.setDel(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            icdDO.setDiseaseCodeIcd10(diagnosisDO.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            icdDO.setDiseaseNameIcd10(diagnosisDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            icdDO.setDiseaseType(diagnosisDO.getType()+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            icdDO.setDiseaseOrder(diagnosisDO.getType()+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            icdDO.setMedicalId(ylzMedicalRelationDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            icdDO = ylzMedicailIcdDao.save(icdDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            icdDOS.add(icdDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ylzMedicalRelationDO.setYlzMedicalIcdDOList(icdDOS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return  ylzMedicalRelationDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |