Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into sudve

mengkang 5 years ago
parent
commit
0293122026

+ 2 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -1929,15 +1929,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
            if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
                outpatientDO.setStatus("2");
                outpatientDO.setStatus("2");
                outpatientDao.save(outpatientDO);
                outpatientDao.save(outpatientDO);
                businessOrderService.savePrescriptionOrder(prescription.getId());
                BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                BusinessOrderDO businessOrderDO1 = businessOrderDao.selectByRelationCode(prescription.getId());
                BusinessOrderDO businessOrderDO1 = businessOrderDao.selectByRelationCode(prescription.getId());
                ykyyEntranceService.findByRealOrder(prescription.getId());
                ykyyEntranceService.findByRealOrder(prescription.getId());
                List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findById(prescription.getId());
                List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findById(prescription.getId());
                businessOrderService.savePrescriptionOrder(prescription.getId());
                if(prescriptionDOList!=null&&prescriptionDOList.size()!=0){
                if(prescriptionDOList!=null&&prescriptionDOList.size()!=0){
                    WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDOList.get(0);
                    WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDOList.get(0);
                    ykyyService.updateDrugorderInfo(businessOrderDO.getOrderNo(),businessOrderDO1.getYkOrderId(),wlyyPrescriptionDO.getRealOrder());
                    ykyyService.updateDrugorderInfo(businessOrderDO.getOrderNo(),businessOrderDO1.getYkOrderId(),wlyyPrescriptionDO.getRealOrder());
                }
                }
                result.put("code", 1);
                result.put("code", 1);
                result.put("mes", "诊断完成");
                result.put("mes", "诊断完成");
                return result;
                return result;

+ 1 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java

@ -1395,6 +1395,7 @@ public class YkyyEntranceService {
                            if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
                            if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
                                WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
                                WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
                                wlyyPrescriptionDO.setRealOrder(cfsb);
                                wlyyPrescriptionDO.setRealOrder(cfsb);
                                wlyyPrescriptionDO.setOrderId(hlwCf01DO.getGUID());
                                wlyyPrescriptionDO.setOriginRealOrder(cfhm);
                                wlyyPrescriptionDO.setOriginRealOrder(cfhm);
                                prescriptionDao.save(wlyyPrescriptionDO);
                                prescriptionDao.save(wlyyPrescriptionDO);
                            }
                            }

+ 3 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/ykyy/service/YkyyService.java

@ -331,11 +331,12 @@ public class YkyyService {
     * @return
     * @return
     */
     */
    public String addOrder4Jkzl(String drugType,String orderId,String userId,JSONArray array ){
    public String addOrder4Jkzl(String drugType,String orderId,String orderNo,String userId,JSONArray array ){
        String response="";
        String response="";
        JSONObject jsonObject = new JSONObject();
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("drugType",drugType);//药品类型【1,到院 2、到商城】
        jsonObject.put("drugType",drugType);//药品类型【1,到院 2、到商城】
        jsonObject.put("orderId","");//订单Id
        jsonObject.put("orderId",orderId);//订单Id
        jsonObject.put("orderNo",orderNo);//订单号
        jsonObject.put("userId",userId);//用户Id
        jsonObject.put("userId",userId);//用户Id
        jsonObject.put("Shopping",array);//药品列表
        jsonObject.put("Shopping",array);//药品列表
        String url = "http://www.yanketong.com:90/api/Doctor/AddOrder4Jkzl";
        String url = "http://www.yanketong.com:90/api/Doctor/AddOrder4Jkzl";

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java

@ -1297,7 +1297,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                jb.put("drug_use", info.get("supply_code") == null? "0": info.get("supply_code"));
                jb.put("drug_use", info.get("supply_code") == null? "0": info.get("supply_code"));
                jb.put("standard_desc", info.get("specification") == null? "0": info.get("specification"));
                jb.put("standard_desc", info.get("specification") == null? "0": info.get("specification"));
                jb.put("single_price",info.get("pack_retprice") == null? 0: info.get("pack_retprice"));
                jb.put("single_price",info.get("pack_retprice") == null? 0: info.get("pack_retprice"));
                BigDecimal pack_retprice = (BigDecimal)info.get("pack_retprice");
                Double pack_retprice = Double.parseDouble(info.get("pack_retprice").toString());
                Long quantity = Long.parseLong((String)info.get("quantity"));
                Long quantity = Long.parseLong((String)info.get("quantity"));
                Double price = pack_retprice.doubleValue()*quantity;
                Double price = pack_retprice.doubleValue()*quantity;

+ 3 - 3
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -115,7 +115,7 @@ public class BusinessOrderService {
                businessOrderDO.setCreateTime(new Date());
                businessOrderDO.setCreateTime(new Date());
                businessOrderDO.setUpdateTime(new Date());
                businessOrderDO.setUpdateTime(new Date());
                businessOrderDO.setStatus(0);
                businessOrderDO.setStatus(0);
                businessOrderDO.setOrderNo("VAS4"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
                businessOrderDO.setOrderNo("HLWLYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
                businessOrderDO.setUploadStatus(0);
                businessOrderDO.setUploadStatus(0);
                businessOrderDO.setPayType(1);
                businessOrderDO.setPayType(1);
                businessOrderDO.setRelationCode(code);
                businessOrderDO.setRelationCode(code);
@ -161,7 +161,7 @@ public class BusinessOrderService {
                if (patientDO!=null){
                if (patientDO!=null){
                    userId = patientDO.getUserId();
                    userId = patientDO.getUserId();
                }
                }
                String response = ykyyService.addOrder4Jkzl("1","",userId,array);
                String response = ykyyService.addOrder4Jkzl("1",wlyyPrescriptionDO.getOrderId(),businessOrderDO.getOrderNo(),userId,array);
                if (StringUtils.isNoneBlank(response)){
                if (StringUtils.isNoneBlank(response)){
                    JSONObject jsonObject = JSONObject.parseObject(response);
                    JSONObject jsonObject = JSONObject.parseObject(response);
                    if (jsonObject.getString("code").equalsIgnoreCase("10000")){
                    if (jsonObject.getString("code").equalsIgnoreCase("10000")){
@ -188,7 +188,7 @@ public class BusinessOrderService {
        businessOrderDO.setCreateTime(new Date());
        businessOrderDO.setCreateTime(new Date());
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setStatus(0);
        businessOrderDO.setStatus(0);
        businessOrderDO.setOrderNo("VAS"+businessOrderDO.getOrderType()+System.currentTimeMillis()+(int)(Math.random()*900)+100);
        businessOrderDO.setOrderNo("HLWLYY"+businessOrderDO.getOrderType()+System.currentTimeMillis()+(int)(Math.random()*900)+100);
        businessOrderDO.setUploadStatus(0);
        businessOrderDO.setUploadStatus(0);
        businessOrderDO.setPayType(1);
        businessOrderDO.setPayType(1);
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){

+ 14 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionDO.java

@ -233,6 +233,11 @@ public class WlyyPrescriptionDO extends UuidIdentityEntity {
     */
     */
    private String orderNo;
    private String orderNo;
    /**
     * 订单id
     */
    private String orderId;
    @Column(name = "outpatient_id")
    @Column(name = "outpatient_id")
    public String getOutpatientId() {
    public String getOutpatientId() {
        return outpatientId;
        return outpatientId;
@ -568,4 +573,13 @@ public class WlyyPrescriptionDO extends UuidIdentityEntity {
    public void setOrderNo(String orderNo) {
    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
        this.orderNo = orderNo;
    }
    }
    @Column(name = "order_id")
    public String getOrderId() {
        return orderId;
    }
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
}
}

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotPatientDeviceDO.java

@ -44,7 +44,7 @@ public class IotPatientDeviceDO extends UuidIdentityEntityWithOperator implement
    @Column(name = "user_type")
    @Column(name = "user_type")
    private String userType;//按键号
    private String userType;//按键号
    @Column(name = "del")
    @Column(name = "del")
    private Integer del;//删除标志
    private Integer del;//删除标志(1正常 0回收纳入库存 -1回收核销)
    @Column(name = "hospital")
    @Column(name = "hospital")
    private String hospital;//归属社区
    private String hospital;//归属社区

+ 3 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java

@ -162,6 +162,9 @@ public class IotRequestMapping {
        public static final String updateLocation= "updateLocation";
        public static final String updateLocation= "updateLocation";
        public static final String createPatientDevice = "createPatientDevice";
        public static final String createPatientDevice = "createPatientDevice";
        public static final String changePatientDevice = "changePatientDevice";
        public static final String getPatientDeviceList = "getPatientDeviceList";
        public static final String deleteDelPatientDevice = "deleteDelPatientDevice";
        //设备维修
        //设备维修
        public static final String createRepairDevice = "createRepairDevice";
        public static final String createRepairDevice = "createRepairDevice";

+ 30 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotPatientDeviceVO.java

@ -61,6 +61,12 @@ public class IotPatientDeviceVO extends BaseVO implements Serializable {
    private String damageImages;//申请维修附件图片,多个用逗号隔开
    private String damageImages;//申请维修附件图片,多个用逗号隔开
    @ApiModelProperty("维修说明")
    @ApiModelProperty("维修说明")
    private String repairDescription;//维修说明
    private String repairDescription;//维修说明
    @ApiModelProperty("删除标志(1正常 0回收纳入库存 -1回收核销)")
    private Integer del;
    @ApiModelProperty("sim卡")
    private String sim;
    @ApiModelProperty("领用协议,多个用逗号隔开")
    private String imgs;
    public String getPatient() {
    public String getPatient() {
@ -246,4 +252,28 @@ public class IotPatientDeviceVO extends BaseVO implements Serializable {
    public void setRepairDescription(String repairDescription) {
    public void setRepairDescription(String repairDescription) {
        this.repairDescription = repairDescription;
        this.repairDescription = repairDescription;
    }
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getSim() {
        return sim;
    }
    public void setSim(String sim) {
        this.sim = sim;
    }
    public String getImgs() {
        return imgs;
    }
    public void setImgs(String imgs) {
        this.imgs = imgs;
    }
}
}

+ 57 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotPatientDeviceController.java

@ -321,6 +321,23 @@ public class IotPatientDeviceController extends EnvelopRestEndpoint {
        }
        }
    }
    }
    @PostMapping(value = IotRequestMapping.PatientDevice.changePatientDevice)
    @ApiOperation(value = "设备更换", notes = "设备更换")
    public MixEnvelop<IotPatientDeviceVO, IotPatientDeviceVO> changePatientDevice(@ApiParam(name = "id", value = "居民设备id")
                                                                                      @RequestParam String id,
                                                                                  @ApiParam(name = "newDeviceSn", value = "新的设备sn码")
                                                                                  @RequestParam(value = "newDeviceSn", required = true) String newDeviceSn,
                                                                                  @ApiParam(name = "newDeviceId", value = "新的设备id")
                                                                                      @RequestParam(value = "newDeviceId", required = false) String newDeviceId) {
        try {
            IotPatientDeviceDO patientDevice =  iotPatientDeviceService.changePatientDevice(id, newDeviceSn, newDeviceId);
            return MixEnvelop.getSuccess(IotRequestMapping.Device.message_success_update, patientDevice);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.PatientDevice.createRepairDevice)
    @PostMapping(value = IotRequestMapping.PatientDevice.createRepairDevice)
    @ApiOperation(value = "新增编辑设备维修记录", notes = "新增编辑设备维修记录")
    @ApiOperation(value = "新增编辑设备维修记录", notes = "新增编辑设备维修记录")
    public MixEnvelop<IotPatientDeviceVO, IotPatientDeviceVO> createRepairDevice(@ApiParam(name = "deviceSn", value = "设备sn码")
    public MixEnvelop<IotPatientDeviceVO, IotPatientDeviceVO> createRepairDevice(@ApiParam(name = "deviceSn", value = "设备sn码")
@ -389,4 +406,44 @@ public class IotPatientDeviceController extends EnvelopRestEndpoint {
            return MixEnvelop.getError(e.getMessage());
            return MixEnvelop.getError(e.getMessage());
        }
        }
    }
    }
    @GetMapping(value = IotRequestMapping.PatientDevice.getPatientDeviceList)
    @ApiOperation(value = "获取居民设备发放和回收列表", notes = "获取居民设备发放和回收列表")
    public MixEnvelop<IotPatientDeviceVO, IotPatientDeviceVO> getDelPatientDeviceList(
            @ApiParam(name = "hospitalName", value = "机构名称", defaultValue = "")
            @RequestParam(value = "hospitalName", required = false) String hospitalName,
            @ApiParam(name = "deviceSn", value = "sn码", defaultValue = "")
            @RequestParam(value = "deviceSn", required = false) String deviceSn,
            @ApiParam(name = "deviceName", value = "设备名称", defaultValue = "")
            @RequestParam(value = "deviceName", required = false) String deviceName,
            @ApiParam(name = "categoryCode", value = "设备类型标识")
            @RequestParam(value = "categoryCode", required = false) String categoryCode,
            @ApiParam(name = "patientName", value = "居民姓名")
            @RequestParam(value = "patientName", required = false) String patientName,
            @ApiParam(name = "isDel", value = "是否是设备回收列表(1是 0否,设备发放列表)")
            @RequestParam(value = "isDel", required = false) Integer isDel,
            @ApiParam(name = "page", value = "第几页", defaultValue = "1")
            @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "pageSize", value = "每页记录数")
            @RequestParam(value = "pageSize", required = false) Integer pageSize) {
        try {
            return iotPatientDeviceService.getPatientDeviceList(deviceSn, deviceName, categoryCode, patientName,hospitalName, isDel, page, pageSize);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.PatientDevice.deleteDelPatientDevice)
    @ApiOperation(value = "删除设备回收记录", notes = "删除设备回收记录")
    public MixEnvelop<IotPatientDeviceVO, IotPatientDeviceVO> deleteDelPatientDevice(@ApiParam(name = "id", value = "居民设备id")
                                                                                 @RequestParam(value = "id", required = true) String id) {
        try {
            iotPatientDeviceService.deleteDelPatientDevice(id);
            return MixEnvelop.getSuccess(IotRequestMapping.Device.message_success_delete);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}
}

+ 3 - 1
svr/svr-iot/src/main/java/com/yihu/iot/controller/dict/HospitalController.java

@ -40,12 +40,14 @@ public class HospitalController extends EnvelopRestEndpoint {
    public MixEnvelop getListByName(
    public MixEnvelop getListByName(
            @ApiParam(name = "name", value = "机构名称")
            @ApiParam(name = "name", value = "机构名称")
            @RequestParam(value = "name", required = false) String name,
            @RequestParam(value = "name", required = false) String name,
            @ApiParam(name = "level", value = "级别,1医院,2社区医院")
            @RequestParam(value = "level", required = false) String level,
            @ApiParam(name = "page", value = "当前页,从1开始")
            @ApiParam(name = "page", value = "当前页,从1开始")
            @RequestParam(value = "page", required = false) Integer page,
            @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "pageSize", value = "页面大小")
            @ApiParam(name = "pageSize", value = "页面大小")
            @RequestParam(value = "pageSize", required = false) Integer pageSize){
            @RequestParam(value = "pageSize", required = false) Integer pageSize){
        try {
        try {
            List<IotHospitalDO> hospitalDOList = hospitalService.getListByName(name, page, pageSize);
            List<IotHospitalDO> hospitalDOList = hospitalService.getListByName(name, level, page, pageSize);
            return MixEnvelop.getSuccessList(IotRequestMapping.Company.message_success_find, hospitalDOList);
            return MixEnvelop.getSuccessList(IotRequestMapping.Company.message_success_find, hospitalDOList);
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();

+ 66 - 2
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java

@ -9,6 +9,7 @@ import com.yihu.iot.datainput.util.ConstantUtils;
import com.yihu.iot.service.common.ElasticSearchQueryGenerator;
import com.yihu.iot.service.common.ElasticSearchQueryGenerator;
import com.yihu.iot.service.dict.IotSystemDictService;
import com.yihu.iot.service.dict.IotSystemDictService;
import com.yihu.jw.device.LocationDataDO;
import com.yihu.jw.device.LocationDataDO;
import com.yihu.jw.entity.iot.device.IotDeviceDO;
import com.yihu.jw.entity.iot.device.IotDeviceOverhaulDO;
import com.yihu.jw.entity.iot.device.IotDeviceOverhaulDO;
import com.yihu.jw.entity.iot.device.IotPatientDeviceDO;
import com.yihu.jw.entity.iot.device.IotPatientDeviceDO;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
@ -409,6 +410,7 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
    public void delPatientDevice(String id, Integer del) {
    public void delPatientDevice(String id, Integer del) {
        IotPatientDeviceDO patientDeviceDO = iotPatientDeviceDao.findOne(id);
        IotPatientDeviceDO patientDeviceDO = iotPatientDeviceDao.findOne(id);
        patientDeviceDO.setDel(del);
        patientDeviceDO.setDel(del);
        patientDeviceDO.setUpdateTime(new Date());
        iotPatientDeviceDao.save(patientDeviceDO);
        iotPatientDeviceDao.save(patientDeviceDO);
        //更新设备绑定状态,加库存
        //更新设备绑定状态,加库存
        iotDeviceDao.updateIsGrantById(patientDeviceDO.getDeviceId(), 0);
        iotDeviceDao.updateIsGrantById(patientDeviceDO.getDeviceId(), 0);
@ -421,10 +423,10 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
    public MixEnvelop<IotPatientDeviceVO,IotPatientDeviceVO> getOverhaulDeviceList(String deviceSn, String patientName, Integer page, Integer pageSize) {
    public MixEnvelop<IotPatientDeviceVO,IotPatientDeviceVO> getOverhaulDeviceList(String deviceSn, String patientName, Integer page, Integer pageSize) {
        String sql = "SELECT DISTINCT d.* FROM `iot_patient_device` d , iot_device_overhaul o where d.del= 1 and  d.id = o.patient_device_id ";
        String sql = "SELECT DISTINCT d.* FROM `iot_patient_device` d , iot_device_overhaul o where d.del= 1 and  d.id = o.patient_device_id ";
        if(StringUtils.isNotBlank(deviceSn)){
        if(StringUtils.isNotBlank(deviceSn)){
            sql += "and d.device_sn like '%" + deviceSn + "'% ";
            sql += "and d.device_sn like '%" + deviceSn + "%' ";
        }
        }
        if(StringUtils.isNotBlank(patientName)){
        if(StringUtils.isNotBlank(patientName)){
            sql += "and d.patientName like '%" + patientName + "'% ";
            sql += "and d.patient_name like '%" + patientName + "%' ";
        }
        }
        //判断是否需要分页
        //判断是否需要分页
        if (page != null && pageSize != null) {
        if (page != null && pageSize != null) {
@ -437,4 +439,66 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
            return MixEnvelop.getSuccessList(IotRequestMapping.Common.message_success_find, deviceVOList);
            return MixEnvelop.getSuccessList(IotRequestMapping.Common.message_success_find, deviceVOList);
        }
        }
    }
    }
    public MixEnvelop<IotPatientDeviceVO,IotPatientDeviceVO> getPatientDeviceList(String deviceSn, String deviceName, String categoryCode, String patientName, String hospitalName, Integer isDel, Integer page, Integer pageSize) {
        String sql = "SELECT DISTINCT d.* FROM `iot_patient_device` d  where 1=1  ";
        if(isDel != null &&isDel == 1){
            sql += "and d.del != 1 ";
        }
        if(StringUtils.isNotBlank(deviceSn)){
            sql += "and d.device_sn like '%" + deviceSn + "%' ";
        }
        if(StringUtils.isNotBlank(patientName)){
            sql += "and d.patient_name like '%" + patientName + "%' ";
        }
        if(StringUtils.isNotBlank(deviceName)){
            sql += "and d.device_name like '%" + deviceName + "%' ";
        }
        if(StringUtils.isNotBlank(categoryCode)){
            sql += "and d.category_code = '" + categoryCode + "' ";
        }
        if(StringUtils.isNotBlank(hospitalName)){
            sql += "and d.hospital_name like '%" + hospitalName + "%' ";
        }
        //判断是否需要分页
        if (page != null && pageSize != null) {
            Long count = Long.valueOf(jdbcTempalte.queryForList(sql).size());
            sql += "limit " + (page - 1) * pageSize + "," + pageSize;
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find, deviceVOList, page, pageSize, count);
        } else {
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            return MixEnvelop.getSuccessList(IotRequestMapping.Common.message_success_find, deviceVOList);
        }
    }
    @Transactional
    public IotPatientDeviceDO changePatientDevice(String id, String newDeviceSn, String newDeviceId) {
        IotPatientDeviceDO patientDeviceDO = iotPatientDeviceDao.findOne(id);
        IotDeviceDO deviceDO = null;
        if(StringUtils.isNotBlank(newDeviceId)){
            deviceDO = iotDeviceDao.findById(newDeviceId);
        }else {
            deviceDO = iotDeviceDao.findByDeviceSn(newDeviceSn);
        }
        patientDeviceDO.setDeviceId(deviceDO.getId());
        patientDeviceDO.setDeviceName(deviceDO.getName());
        patientDeviceDO.setDeviceSn(deviceDO.getDeviceSn());
        patientDeviceDO.setSim(deviceDO.getSimNo());
        patientDeviceDO.setCategoryCode(deviceDO.getCategoryCode());
        patientDeviceDO.setCategoryName(deviceDO.getCategoryName());
        patientDeviceDO.setHospital(deviceDO.getHospital());
        patientDeviceDO.setHospitalName(deviceDO.getHospitalName());
        patientDeviceDO.setUpdateTime(new Date());
        iotPatientDeviceDao.save(patientDeviceDO);
        //更新设备绑定状态,减库存
        iotDeviceDao.updateIsGrantById(deviceDO.getId(), 1);
        return patientDeviceDO;
    }
    //删除居民设备回收记录
    public void deleteDelPatientDevice(String id) {
        iotPatientDeviceDao.delete(id);
    }
}
}

+ 4 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotHospitalService.java

@ -28,11 +28,14 @@ public class IotHospitalService extends BaseJpaService<IotHospitalDO, IotHospita
        return hospitalDO;
        return hospitalDO;
    }
    }
    public List<IotHospitalDO> getListByName(String name, Integer page, Integer pageSize) {
    public List<IotHospitalDO> getListByName(String name, String level, Integer page, Integer pageSize) {
        String sql = "SELECT * FROM `iot_hospital` h WHERE h.del = 1 ";
        String sql = "SELECT * FROM `iot_hospital` h WHERE h.del = 1 ";
        if(StringUtils.isNotBlank(name)){
        if(StringUtils.isNotBlank(name)){
            sql += "and h.name like '%" + name + "%' ";
            sql += "and h.name like '%" + name + "%' ";
        }
        }
        if(StringUtils.isNotBlank(level)){
            sql += "and h.level = '" + level + "' ";
        }
        if(page != null && pageSize != null){
        if(page != null && pageSize != null){
            sql += "limit " + (page-1)*pageSize + "," + pageSize;
            sql += "limit " + (page-1)*pageSize + "," + pageSize;
        }
        }

+ 42 - 15
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistScreenResultService.java

@ -139,23 +139,49 @@ public class SpecialistScreenResultService {
        List<SurveyTemplateQuestionsVo> questionList = jdbcTemplate.query(questionSql,new BeanPropertyRowMapper<>(SurveyTemplateQuestionsVo.class));
        List<SurveyTemplateQuestionsVo> questionList = jdbcTemplate.query(questionSql,new BeanPropertyRowMapper<>(SurveyTemplateQuestionsVo.class));
        String sql = "SELECT soa.*,sto.score,sto.content FROM "+basedb+".wlyy_survey_option_answers soa LEFT JOIN "+basedb+".wlyy_survey_template_options sto ON soa.options_code= sto.code WHERE soa.screen_result_code=? AND soa.patient=? AND soa.survey_code=?";
        String sql = "SELECT soa.*,sto.score,sto.content FROM "+basedb+".wlyy_survey_option_answers soa LEFT JOIN "+basedb+".wlyy_survey_template_options sto ON soa.options_code= sto.code WHERE soa.screen_result_code=? AND soa.patient=? AND soa.survey_code=?";
        List<Map<String,Object>> optionAnswersList = jdbcTemplate.queryForList(sql,new Object[]{code,patientCode,templateCode});
        List<Map<String,Object>> optionAnswersList = jdbcTemplate.queryForList(sql,new Object[]{code,patientCode,templateCode});
        //问答题答案
        String sqlQuestion = "SELECT sa.* FROM "+basedb+".wlyy_survey_answers sa LEFT JOIN "+basedb+".wlyy_survey_template_questions stq ON sa.question_code = stq.`code` WHERE sa.question_result_code=? AND sa.patient=? AND sa.survey_code=? ";
        List<Map<String, Object>> questionAnswersList = jdbcTemplate.queryForList(sqlQuestion, new Object[]{code, patientCode, templateCode});
        for (SurveyTemplateQuestionsVo surveyTemplateQuestionsVo : questionList){
        for (SurveyTemplateQuestionsVo surveyTemplateQuestionsVo : questionList){
            Map<String,Object> Qusmap = new HashMap<>();
            Map<String,Object> Qusmap = new HashMap<>();
            Qusmap.put("question",surveyTemplateQuestionsVo);
            Qusmap.put("question",surveyTemplateQuestionsVo);
            String qusCode = surveyTemplateQuestionsVo.getCode();
            String qusCode = surveyTemplateQuestionsVo.getCode();
            for (Map<String,Object> option : optionAnswersList){
            /*for (Map<String,Object> option : optionAnswersList){
                if (option.get("question_code").equals(qusCode)){
                if (option.get("question_code").equals(qusCode)){
                    Qusmap.put("option",option);
                    Qusmap.put("option",option);
                }
                }
            }*/
            if(surveyTemplateQuestionsVo.getQuestionType() == 2){//问答题答案放在wlyy_survey_answers
                for (Map<String, Object> question : questionAnswersList) {
                    if (question.get("question_code").equals(qusCode)) {
                        Qusmap.put("option", question);
                    }
                }
            }else if(surveyTemplateQuestionsVo.getQuestionType() == 0){
                for (Map<String, Object> option : optionAnswersList) {
                    if (option.get("question_code").equals(qusCode)) {
                        Qusmap.put("option", option);
                    }
                }
            }else {
                List<Map<String, Object>> options = new ArrayList<>();
                for (Map<String, Object> option : optionAnswersList) {
                    if (option.get("question_code").equals(qusCode)) {
                        options.add(option);
                    }
                }
                Qusmap.put("option", options);
            }
            }
            //map.put(surveyTemplateQuestionsVo.getSort()+"",Qusmap);
            //map.put(surveyTemplateQuestionsVo.getSort()+"",Qusmap);
            answerMap.put(surveyTemplateQuestionsVo.getSort()+"",Qusmap);
            answerMap.put(surveyTemplateQuestionsVo.getSort()+"",Qusmap);
        }
        }
        map.put("answer",answerMap);
        map.put("answer",answerMap);
        //结果
        //结果
        int following = surveyScreenResultVo.getFollowing();
        String reultSql ="SELECT ssr.screen_result_score,ssr.screen_result,str.advice FROM "+basedb+".wlyy_survey_screen_result ssr LEFT JOIN "+basedb+".wlyy_survey_template_result str ON ssr.screen_result_code = str.code WHERE ssr.code='"+code+"'";
        Map<String,Object> resultMap = jdbcTemplate.queryForMap(reultSql);
        String reultSql = "SELECT ssr.screen_result_score,ssr.screen_result,str.advice,ssr.other_advice,ssr.third_advice FROM " + basedb + ".wlyy_survey_screen_result ssr LEFT JOIN " + basedb + ".wlyy_survey_template_result str ON ssr.screen_result_code = str.code WHERE ssr.code='" + code + "'";
        Map<String, Object> resultMap = jdbcTemplate.queryForMap(reultSql);
        if(surveyScreenResultVo.getFollowing() != null) {
            int following = surveyScreenResultVo.getFollowing();
        /*int following = surveyScreenResultVo.getFollowing();
        /*int following = surveyScreenResultVo.getFollowing();
        int order = surveyScreenResultVo.getOrder();
        int order = surveyScreenResultVo.getOrder();
        if (following==1){
        if (following==1){
@ -169,20 +195,21 @@ public class SpecialistScreenResultService {
            }
            }
            resultMap.put("advice",surveyAdviceList);
            resultMap.put("advice",surveyAdviceList);
        }*/
        }*/
        if (following==1){
            String adviceCodes = surveyScreenResultVo.getAdviceCode();
            List<Map<String,Object>> surveyAdviceList = new ArrayList<>();
            if (StringUtils.isNotEmpty(adviceCodes)){
                String[] advicesStr = adviceCodes.split(",");
                for (String adviceCode : advicesStr){
                    String advice ="SELECT * FROM wlyy.wlyy_survey_advice where code='"+adviceCode+"'";
                    surveyAdviceList.addAll(jdbcTemplate.queryForList(advice));
            if (following == 1) {
                String adviceCodes = surveyScreenResultVo.getAdviceCode();
                List<Map<String, Object>> surveyAdviceList = new ArrayList<>();
                if (StringUtils.isNotEmpty(adviceCodes)) {
                    String[] advicesStr = adviceCodes.split(",");
                    for (String adviceCode : advicesStr) {
                        String advice = "SELECT * FROM wlyy.wlyy_survey_advice where code='" + adviceCode + "'";
                        surveyAdviceList.addAll(jdbcTemplate.queryForList(advice));
                    }
                }
                }
                resultMap.put("doctorAdvice", surveyAdviceList);
                resultMap.put("doctorOtherAdvice", surveyScreenResultVo.getOtherAdvice());
            }
            }
            resultMap.put("doctorAdvice",surveyAdviceList);
            resultMap.put("doctorOtherAdvice",surveyScreenResultVo.getOtherAdvice());
        }
        }
        map.put("result",resultMap);
        map.put("result", resultMap);
        return MixEnvelop.getSuccess(SpecialistMapping.api_success,map);
        return MixEnvelop.getSuccess(SpecialistMapping.api_success,map);
    }
    }