Browse Source

医院维护和删除处方医保撤销

lihong 1 year ago
parent
commit
37d559dc91

+ 96 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/AHospitalController.java

@@ -0,0 +1,96 @@
+package cn.hnthyy.thmz.controller.mz;
+
+
+import cn.hnthyy.thmz.Utils.R;
+import cn.hnthyy.thmz.Utils.Tools;
+import cn.hnthyy.thmz.entity.his.mz.AHospital;
+import cn.hnthyy.thmz.service.his.mz.AHospitalService;
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * (AHospital)表控制层
+ *
+ * @author lihong
+ * @since 2023-12-28 10:49:46
+ */
+@RestController
+@RequestMapping("aHospital")
+public class AHospitalController {
+    /**
+     * 服务对象
+     */
+    @Resource
+    private AHospitalService service;
+
+    /**
+     * 分页查询所有数据
+     *
+     * @param page 分页对象
+     * @param aHospital 查询实体
+     * @return 所有数据
+     */
+    @PostMapping("/selectAll")
+    public R selectAll(Page<AHospital> page, AHospital aHospital) {
+        Page<AHospital> result = service.page(page, new QueryWrapper<>(aHospital));
+        Tools.trimCollectionStrField(result.getRecords());
+        return R.ok().put("data", result);
+    }
+
+    /**
+     * 通过主键查询单条数据
+     *
+     * @param id 主键
+     * @return 单条数据
+     */
+    @GetMapping("/selectById")
+    public R selectById(String id) {
+        return  R.ok().put("data", BeanUtil.trimStrFields(service.getById(id)));
+    }
+
+    /**
+     * 新增数据
+     *
+     * @param aHospital 实体对象
+     * @return 新增结果
+     */
+    @PostMapping("/save")
+    public R save(@RequestBody List<AHospital> aHospital) {
+        service.saveBatch(aHospital);
+        return R.ok();
+    }
+
+    /**
+     * 修改数据
+     *
+     * @param aHospital 实体对象
+     * @return 修改结果
+     */
+    @PostMapping("/update")
+    public R update(@RequestBody AHospital aHospital) {
+        service.updateById(aHospital);
+        return R.ok();
+    }
+
+    /**
+     * 删除数据
+     *
+     * @param idList 主键结合
+     * @return 删除结果
+     */
+    @PostMapping("/deleteByIds")
+    public R delete(@RequestBody List<String> idList) {
+        service.removeByIds(idList);
+        return  R.ok();
+    }
+}
+

+ 55 - 0
src/main/java/cn/hnthyy/thmz/entity/his/mz/AHospital.java

@@ -0,0 +1,55 @@
+package cn.hnthyy.thmz.entity.his.mz;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * (AHospital)表实体类
+ *
+ * @author makejava
+ * @since 2023-12-28 10:49:48
+ */
+@SuppressWarnings("serial")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+@TableName("a_hospital")
+public class AHospital extends Model<AHospital> {
+    @TableId
+    private String hospitalId;
+    
+    private String shortName;
+    
+    private String fullName;
+    
+    private String activity;
+    
+    private String partCode;
+    
+    private String ybYybh;
+    
+    private String ybYybh2;
+    
+    private String hzylYybh;
+
+
+
+    /**
+     * 获取主键值
+     *
+     * @return 主键值
+     */
+    @Override
+    protected Serializable pkVal() {
+        return this.hospitalId;
+    }
+    }
+

+ 15 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/mz/AHospitalDao.java

@@ -0,0 +1,15 @@
+package cn.hnthyy.thmz.mapper.his.mz;
+
+import cn.hnthyy.thmz.entity.his.mz.AHospital;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * (AHospital)表数据库访问层
+ *
+ * @author lihong
+ * @since 2023-12-28 10:49:47
+ */
+public interface AHospitalDao extends BaseMapper<AHospital> {
+
+}
+

+ 15 - 0
src/main/java/cn/hnthyy/thmz/service/his/mz/AHospitalService.java

@@ -0,0 +1,15 @@
+package cn.hnthyy.thmz.service.his.mz;
+
+import cn.hnthyy.thmz.entity.his.mz.AHospital;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * (AHospital)表服务接口
+ *
+ * @author lihong
+ * @since 2023-12-28 10:49:48
+ */
+public interface AHospitalService extends IService<AHospital> {
+
+}
+

+ 19 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/AHospitalServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.hnthyy.thmz.service.impl.his.mz;
+
+import cn.hnthyy.thmz.entity.his.mz.AHospital;
+import cn.hnthyy.thmz.mapper.his.mz.AHospitalDao;
+import cn.hnthyy.thmz.service.his.mz.AHospitalService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * (AHospital)表服务实现类
+ *
+ * @author lihong
+ * @since 2023-12-28 10:49:49
+ */
+@Service("aHospitalService")
+public class AHospitalServiceImpl extends ServiceImpl<AHospitalDao, AHospital> implements AHospitalService {
+
+}
+

+ 11 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzChargeDetailServiceImpl.java

@@ -1352,6 +1352,17 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         if (!clinic.getOpId().equals(tokenUser.getUserIdCode())) {
             throw new MzException("删除处方失败,禁止删除非本人开立处方!");
         }
+        //撤销医保结算
+        int count = mzPatientMiMapper.countYbZf(clinic.getPatientId(), clinic.getTimes());
+        if( count > 0){
+            PayInfo retractInfo = tsmzService.retractFees(clinic.getOpId(), clinic.getPatientId(), clinic.getTimes(), 1);
+            if (retractInfo == null) {
+                log.info("删除处方失败,医保撤销失败门诊号:{}就诊次数:{}", clinic.getPatientId(),clinic.getTimes());
+            }
+            if (retractInfo.getCode() != 0) {
+                log.info("删除处方失败,医保撤销失败门诊号:{}就诊次数:{}[错误信息:{}]", clinic.getPatientId(),clinic.getTimes(),retractInfo.getErrorMessage());
+            }
+        }
         int num = clinicMapper.deleteById(clnicId);
         mzVisitTableMapper.deleteByPatientIdAndTimes(clinic.getPatientId(), clinic.getTimes());
         mzBaRecordMapper.deleteByPatientIdAndTimes(clinic.getPatientId(), clinic.getTimes());