소스 검색

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

huangwenjie 7 년 전
부모
커밋
9ee3641eb3

+ 9 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/kit/KitService.java

@ -369,11 +369,13 @@ public class KitService extends BaseService {
     * 本月用药情况
     * @param useDrugStatus (1、按时,2、超时,3、漏用)
     */
    public Map<String,Object> currentMonthDrugUse(String patientCode,Integer useDrugStatus,String deviceSn) throws Exception{
    public Map<String,Object> currentMonthDrugUse(String patientCode,Integer useDrugStatus,String deviceSn,String month) throws Exception{
        Map<String,Object> resultMap = new HashMap<>();
        Date monthStart = DateUtil.strToDate(DateUtil.getFristDayOfMonthThisDate(new Date()));
        Date monthEnd = new Date();
//        Date monthStart = DateUtil.strToDate(DateUtil.getFristDayOfMonthThisDate(new Date()));
//        Date monthEnd = new Date();
        Date monthStart = DateUtil.strToDate(month,"yyyy-MM");
        Date monthEnd = DateUtil.strToDate(DateUtil.getLastDayOfMonthThisDate(monthStart)+" 23:59:59");
        Integer onTimeCount = kitDrugUseRecordDao.findStatisticsCount(patientCode,1,deviceSn,monthStart,monthEnd);//按时次数
        Integer overTimeCount = kitDrugUseRecordDao.findStatisticsCount(patientCode,2,deviceSn,monthStart,monthEnd);//超时次数
        Integer leakageCount = kitDrugUseRecordDao.findStatisticsCount(patientCode,3,deviceSn,monthStart,monthEnd);//漏用次数
@ -404,7 +406,7 @@ public class KitService extends BaseService {
        Map<String,Map<String,Object>> map = new LinkedHashMap<>();
        for(KitDrugUseRecord one:list){
            String dateStr = DateUtil.dateToStr(one.getUseTime(),"MM-dd");
            String dateStr = DateUtil.dateToStr(one.getUseTime(),"yyyy-MM-dd");
            Map<String,Object> oneMap = null;
            if(map.containsKey(dateStr)){
                oneMap = map.get(dateStr);
@ -437,8 +439,8 @@ public class KitService extends BaseService {
        Collections.sort(resultList, new Comparator<Map<String,Object>>() {
            @Override
            public int compare(Map<String,Object> o1, Map<String,Object> o2) {
                Long day1 =  DateUtil.strToDate(o1.get("day").toString(), "MM-dd").getTime();
                Long day2 =  DateUtil.strToDate(o2.get("day").toString(), "MM-dd").getTime();
                Long day1 =  DateUtil.strToDate(o1.get("day").toString(), "yyyy-MM-dd").getTime();
                Long day2 =  DateUtil.strToDate(o2.get("day").toString(), "yyyy-MM-dd").getTime();
                if(day1-day2>0){
                    return -1;
                }else if(day1-day2<0){
@ -489,6 +491,7 @@ public class KitService extends BaseService {
            Map<String,Object> temp = new HashMap<>();
            temp.put("useTime",DateUtil.dateToStr(one.getUseTime(),"HH:mm"));
            temp.put("drugDetail",JSONArray.fromObject(one.getDrugDetail()));
            temp.put("useDrugStatus",one.getUseDrugStatus());
            resultList.add(temp);
        }
        return resultList;

+ 3 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/kit/DoctorKitController.java

@ -64,9 +64,10 @@ public class DoctorKitController extends BaseController {
    public String currentMonthDrugUse(
            @ApiParam(name = "patientCode", value = "居民code", required = true) @RequestParam(value = "patientCode", required = true) String patientCode,
            @ApiParam(name = "useDrugStatus", value = "居民用药记录情况(1、按时,2、超时,3、漏用)", required = false) @RequestParam(value = "useDrugStatus", required = false) Integer useDrugStatus,
            @ApiParam(name = "deviceSn", value = "药盒设备sn码", required = false) @RequestParam(value = "deviceSn", required = false) String deviceSn){
            @ApiParam(name = "deviceSn", value = "药盒设备sn码", required = false) @RequestParam(value = "deviceSn", required = false) String deviceSn,
            @ApiParam(name = "month", value = "月份 yyyy-MM", required = false) @RequestParam(value = "month", required = false) String month){
        try {
            Map<String,Object> result =  kitService.currentMonthDrugUse(patientCode,useDrugStatus,deviceSn);
            Map<String,Object> result =  kitService.currentMonthDrugUse(patientCode,useDrugStatus,deviceSn,month);
            return write(200,"获取信息成功!","data",result);
        }catch (Exception e) {
            e.printStackTrace();

+ 7 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/kit/PatientKitController.java

@ -9,6 +9,7 @@ import io.swagger.annotations.ApiParam;
import net.sf.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
@ -32,9 +33,13 @@ public class PatientKitController extends BaseController {
    @ApiOperation("药盒绑定 ")
    public String kitBinding(
            @ApiParam(name = "deviceSn", value = "药盒设备sn码", required = true) @RequestParam(value = "deviceSn", required = true) String deviceSn,
            @ApiParam(name = "type", value = "1、绑定,2、解绑", required = true) @RequestParam(value = "type", required = true) String type){
            @ApiParam(name = "type", value = "1、绑定,2、解绑", required = true) @RequestParam(value = "type", required = true) String type,
            @ApiParam(name = "patientCode", value = "1、绑定,2、解绑", required = false) @RequestParam(value = "patientCode", required = false) String patientCode){
        try {
            kitService.kitBinding(deviceSn,type,getUID());
            if(StringUtils.isEmpty(patientCode)){
                patientCode=getUID();
            }
            kitService.kitBinding(deviceSn,type,patientCode);
            return write(200,"绑定成功!");
        }catch (Exception e) {
            e.printStackTrace();