|  | @@ -47,6 +47,8 @@ public class MedicalViewApiController {
 | 
	
		
			
				|  |  |      private APatientMiService aPatientMiService;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private ZdMzClassService zdMzClassService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private MzyRequestService mzyRequestService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      //海慈身份证类型
 | 
	
	
		
			
				|  | @@ -205,6 +207,7 @@ public class MedicalViewApiController {
 | 
	
		
			
				|  |  |          mzPatientMi.setPhoneNo(haicipat.getPatMobile());
 | 
	
		
			
				|  |  |          mzPatientMi.setSocialNo(haicipat.getPatIdNo());
 | 
	
		
			
				|  |  |          mzPatientMi.setContractHz(haicipat.getGuardIdNo());
 | 
	
		
			
				|  |  | +        mzPatientMi.setResponseType("01");
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              int num = mzPatientMiService.saveMzPatientMi(mzPatientMi);
 | 
	
		
			
				|  |  |              if (num == 1) {
 | 
	
	
		
			
				|  | @@ -872,6 +875,76 @@ public class MedicalViewApiController {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 预约号源统计信息查询
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @RequestMapping(value = "/getNumByDateAndDept", method = {RequestMethod.GET})
 | 
	
		
			
				|  |  | +    public Map<String, Object> getNumByDateAndDept(@RequestParam("beginDate") String beginDate, @RequestParam("endDate") String endDate, @RequestParam("unitCode")String unitCode ) {
 | 
	
		
			
				|  |  | +        Map<String, Object> results = new HashMap<>();
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            if(StringUtils.isBlank(beginDate)){
 | 
	
		
			
				|  |  | +                results.put("resultCode", -1);
 | 
	
		
			
				|  |  | +                results.put("resultMessage", "开始时间不能为空");
 | 
	
		
			
				|  |  | +                return results;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if(StringUtils.isBlank(endDate)){
 | 
	
		
			
				|  |  | +                results.put("resultCode", -1);
 | 
	
		
			
				|  |  | +                results.put("resultMessage", "结束时间不能为空");
 | 
	
		
			
				|  |  | +                return results;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if(StringUtils.isBlank(unitCode)){
 | 
	
		
			
				|  |  | +                results.put("resultCode", -1);
 | 
	
		
			
				|  |  | +                results.put("resultMessage", "科室编码不能为空");
 | 
	
		
			
				|  |  | +                return results;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            Date beginDateD = DateUtil.pase(beginDate,"yyyy-MM-dd");
 | 
	
		
			
				|  |  | +            Date endDateD = DateUtil.pase(endDate,"yyyy-MM-dd");
 | 
	
		
			
				|  |  | +            List<Map<String,Object>> list=mzyRequestService.queryNumByDateAndDept(beginDateD,endDateD,unitCode);
 | 
	
		
			
				|  |  | +            if (list == null || list.size() == 0) {
 | 
	
		
			
				|  |  | +                results.put("resultCode", -1);
 | 
	
		
			
				|  |  | +                results.put("resultMessage", "预约号源统计信息查询失败");
 | 
	
		
			
				|  |  | +                return results;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            Map<String, Map<String,Object>> tempMap= new HashMap<>();
 | 
	
		
			
				|  |  | +            for(Map map :list){
 | 
	
		
			
				|  |  | +                tempMap.put((String) map.get("scheduleDate"),map);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            //获取时间区间内的日期集合
 | 
	
		
			
				|  |  | +            List<Date> days = DateUtil.getBetweenDates(beginDateD, endDateD);
 | 
	
		
			
				|  |  | +            List<Map<String,Object>> resultMap= new ArrayList<>();
 | 
	
		
			
				|  |  | +            for (Date date : days){
 | 
	
		
			
				|  |  | +               String key=DateUtil.fomart(date,"yyyy-MM-dd");
 | 
	
		
			
				|  |  | +                Map<String,Object> item=tempMap.get(key);
 | 
	
		
			
				|  |  | +                if(item==null){
 | 
	
		
			
				|  |  | +                    item=new HashMap<>();
 | 
	
		
			
				|  |  | +                    item.put("scheduleDate",key);
 | 
	
		
			
				|  |  | +                    item.put("status",2);
 | 
	
		
			
				|  |  | +                }else {
 | 
	
		
			
				|  |  | +                    Integer leftNum=(Integer)item.get("leftNum");
 | 
	
		
			
				|  |  | +                    if(leftNum==null || leftNum<=0){
 | 
	
		
			
				|  |  | +                        item.put("status",2);
 | 
	
		
			
				|  |  | +                        item.remove("leftNum");
 | 
	
		
			
				|  |  | +                        item.remove("totalNum");
 | 
	
		
			
				|  |  | +                    }else {
 | 
	
		
			
				|  |  | +                        item.put("status",1);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                resultMap.add(item);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            results.put("resultCode", 0);
 | 
	
		
			
				|  |  | +            results.put("resultMessage", "预约号源统计信息查询成功");
 | 
	
		
			
				|  |  | +            results.put("data", resultMap);
 | 
	
		
			
				|  |  | +            return results;
 | 
	
		
			
				|  |  | +        }catch (Exception e){
 | 
	
		
			
				|  |  | +            results.put("resultCode", -1);
 | 
	
		
			
				|  |  | +            results.put("resultMessage", "预约号源统计信息查询失败");
 | 
	
		
			
				|  |  | +            return results;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 |