| 
					
				 | 
			
			
				@ -65,21 +65,8 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patientId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String getPatientById(String patientId) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isEmpty(patientId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("result","parameter patientId is null"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result.toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<BasePatientDO> patientDOList = this.findByField("id",patientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(CollectionUtils.isEmpty(patientDOList)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("result","not exist patient for id:"+patientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result.toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("patient",patientDOList.get(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<PatientMedicareCardDO> cards = basePatientMedicardCardService.findPatientCardByCode(patientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("medicareCard",cards); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result.toJSONString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public BasePatientDO findPatientById(String patientId) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return basePatientDao.findById(patientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -87,26 +74,24 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patientId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String findPatientById(String patientId) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String getPatientById(String patientId) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isEmpty(patientId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("result","parameter patientId is null"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result.toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patientDO = basePatientDao.findById(patientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(patientDO == null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<BasePatientDO> patientDOList = this.findByField("id",patientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(CollectionUtils.isEmpty(patientDOList)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("result","not exist patient for id:"+patientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result.toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PatientMedicareCardDO card = basePatientMedicardCardService.findByTypeAndPatientCodeAndDel("A_01",patientId,"1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(card != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patientDO.setSsc(card.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("patient",patientDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("patient",patientDOList.get(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<PatientMedicareCardDO> cards = basePatientMedicardCardService.findPatientCardByCode(patientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("medicareCard",cards); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result.toJSONString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取用户基础信息,参数为空查全部 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param nameOrIdcard 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -187,6 +172,67 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return ConstantUtils.SUCCESS; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 新增档案 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param jsonData 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String createArchive(String jsonData) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject jsonObject = JSONObject.parseObject(jsonData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject patient = jsonObject.getJSONObject("patient"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(null == patient){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ConstantUtils.FAIL; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patientDO = objectMapper.readValue(patient.toJSONString(),BasePatientDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        this.save(patientDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return ConstantUtils.SUCCESS; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 修改档案 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param jsonData 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String updateArchive(String jsonData) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO basePatientDO = objectMapper.readValue(jsonData,BasePatientDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isEmpty(basePatientDO.getId())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ConstantUtils.FAIL; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO basePatientDO1 = basePatientDao.findById(basePatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null!=basePatientDO1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setName(basePatientDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setMobile(basePatientDO.getMobile()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setIdcard(basePatientDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setSex(basePatientDO.getSex()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setBirthday(basePatientDO.getBirthday()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setNational(basePatientDO.getNational()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setNationalName(basePatientDO.getNationalName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setMarriage(basePatientDO.getMarriage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setProvinceCode(basePatientDO.getProvinceCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setCityCode(basePatientDO.getCityCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setTownCode(basePatientDO.getTownCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setProvinceName(basePatientDO.getProvinceName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setTownName(basePatientDO.getTownName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setCityName(basePatientDO.getCityName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setMedicareNumber(basePatientDO.getMedicareNumber()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setMobileRemarks(basePatientDO.getMobileRemarks()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setBlood(basePatientDO.getBlood()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setSsc(basePatientDO.getSsc()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setCommitteeCode(basePatientDO.getCommitteeCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setCommitteeName(basePatientDO.getCommitteeName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setArchiveType(basePatientDO.getArchiveType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setAddress(basePatientDO.getAddress()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setPhoto(basePatientDO.getPhoto()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            basePatientDO1.setArchiveStatus(basePatientDO.getArchiveStatus()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // 保存修改的居民信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            this.save(basePatientDO1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return ConstantUtils.SUCCESS; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 修改居民 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param jsonData 
			 |