Quellcode durchsuchen

打卡并完成护理业务

qinyan vor 4 Monaten
Ursprung
Commit
ef96d797b0

+ 10 - 1
ruoyi-system/src/main/java/com/ruoyi/care/domain/CareNurseClocks.java

@@ -36,8 +36,17 @@ public class CareNurseClocks extends BaseEntity
 
     /** 删除标志(0代表存在 2代表删除) */
     private String delFlag;
+    private String applyId;
 
-    public void setClockId(Long clockId) 
+    public String getApplyId() {
+        return applyId;
+    }
+
+    public void setApplyId(String applyId) {
+        this.applyId = applyId;
+    }
+
+    public void setClockId(Long clockId)
     {
         this.clockId = clockId;
     }

+ 37 - 2
ruoyi-system/src/main/java/com/ruoyi/care/service/impl/CareNurseClocksServiceImpl.java

@@ -1,12 +1,21 @@
 package com.ruoyi.care.service.impl;
 
+import java.util.Date;
 import java.util.List;
+
+import com.ruoyi.care.domain.CareApplications;
+import com.ruoyi.care.domain.CareNurseRecords;
+import com.ruoyi.care.mapper.CareApplicationsMapper;
+import com.ruoyi.care.mapper.CareNurseRecordsMapper;
+import com.ruoyi.common.enums.CareApplyStatus;
 import com.ruoyi.common.utils.DateUtils;
+import org.apache.commons.lang3.time.FastDateFormat;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.care.mapper.CareNurseClocksMapper;
 import com.ruoyi.care.domain.CareNurseClocks;
 import com.ruoyi.care.service.ICareNurseClocksService;
+import org.springframework.transaction.annotation.Transactional;
 
 /**
  * 护理任务打卡Service业务层处理
@@ -19,7 +28,10 @@ public class CareNurseClocksServiceImpl implements ICareNurseClocksService
 {
     @Autowired
     private CareNurseClocksMapper careNurseClocksMapper;
-
+    @Autowired
+    private CareApplicationsMapper careApplicationsMapper;
+    @Autowired
+    private CareNurseRecordsMapper careNurseRecordsMapper;
     /**
      * 查询护理任务打卡
      * 
@@ -51,10 +63,33 @@ public class CareNurseClocksServiceImpl implements ICareNurseClocksService
      * @return 结果
      */
     @Override
+    @Transactional
     public int insertCareNurseClocks(CareNurseClocks careNurseClocks)
     {
         careNurseClocks.setCreateTime(DateUtils.getNowDate());
-        return careNurseClocksMapper.insertCareNurseClocks(careNurseClocks);
+        // 判断当天任务是否一开始
+        String  date=careNurseClocks.getNursingTime().substring(0,10);
+        CareNurseRecords careNurseRecords= new CareNurseRecords();
+        careNurseRecords.setNursingTime(date);
+        careNurseRecords.setApplyId(Long.parseLong(careNurseClocks.getApplyId()));
+        List<CareNurseRecords> lst=careNurseRecordsMapper.selectCareNurseRecordsList(careNurseRecords);
+        if(lst.size()>0){
+           //已经开始了直接新增打卡记录
+           return careNurseClocksMapper.insertCareNurseClocks(careNurseClocks);
+        }else{
+          //修改申请状态为正在进行,并添加护理记录级打卡记录
+           CareApplications careApplications=careApplicationsMapper.selectCareApplicationsByApplyId(Long.parseLong(careNurseClocks.getApplyId()));
+           careApplications.setDealStatus("in_progress");
+           careApplicationsMapper.updateCareApplications(careApplications);
+
+           careNurseRecords=new CareNurseRecords();
+           careNurseRecords.setNursingTime(careNurseClocks.getNursingTime().substring(0,10));
+           careNurseRecords.setApplyId(Long.parseLong(careNurseClocks.getApplyId()));
+           careNurseRecordsMapper.insertCareNurseRecords(careNurseRecords);
+
+           return careNurseClocksMapper.insertCareNurseClocks(careNurseClocks);
+        }
+
     }
 
     /**

+ 1 - 1
ruoyi-system/src/main/resources/mapper/care/CareNurseClocksMapper.xml

@@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectCareNurseClocksVo"/>
         <where>  
             <if test="nursingRecordId != null "> and nursing_record_id = #{nursingRecordId}</if>
-            <if test="nursingTime != null  and nursingTime != ''"> and nursing_time = #{nursingTime}</if>
+            <if test="nursingTime != null  and nursingTime != ''"> and nursing_time like concat('%', #{nursingTime}, '%')</if>
             <if test="imgPaths != null  and imgPaths != ''"> and img_paths = #{imgPaths}</if>
             <if test="imgNum != null "> and img_num = #{imgNum}</if>
         </where>

+ 21 - 46
ruoyi-vue/src/views/care/clocks/index.vue

@@ -32,9 +32,6 @@
     <el-table v-loading="loading" :data="clocksList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="护理时间" align="center" prop="nursingTime" width="180">
-        <template #default="scope">
-          <span>{{ parseTime(scope.row.nursingTime, '{y}-{m}-{d}') }}</span>
-        </template>
       </el-table-column>
       <el-table-column label="图片路径" align="center" prop="imgPaths" />
       <el-table-column label="图片数量" align="center" prop="imgNum" />
@@ -61,23 +58,26 @@
         <el-form-item label="护理时间" prop="nursingTime">
           <el-date-picker clearable
             v-model="form.nursingTime"
-            type="date"
-            value-format="YYYY-MM-DD"
+            type="datetime"
+            value-format="YYYY-MM-DD HH:mm:ss"
             placeholder="请选择护理时间">
           </el-date-picker>
         </el-form-item>
         <el-form-item label="图片路径" prop="imgPaths">
           <el-upload
               v-model:file-list="fileList"
-              :action="uploadImgUrl"
-              :headers="uploadHeaders"
-              list-type="picture-card"
+              class="upload-demo"
+              :action=uploadImgUrl
               :on-preview="handlePreview"
               :on-remove="handleRemove"
-              :before-upload="beforeUpload"
-              :on-success="handleSuccess"
+              list-type="picture"
           >
-            <el-icon><Plus /></el-icon>
+            <el-button type="primary">Click to upload</el-button>
+            <template #tip>
+              <div class="el-upload__tip">
+                jpg/png files with a size less than 500kb
+              </div>
+            </template>
           </el-upload>
         </el-form-item>
 
@@ -102,8 +102,6 @@
 <script setup name="Clocks">
 import { listClocks, getClocks, delClocks, addClocks, updateClocks } from "@/api/care/clocks";
 import { ref } from 'vue'
-import { Plus } from '@element-plus/icons-vue'
-import { getToken } from '@/utils/auth'
 const { proxy } = getCurrentInstance();
 
 const clocksList = ref([]);
@@ -116,11 +114,8 @@ const multiple = ref(true);
 const total = ref(0);
 const title = ref("");
 const uploadImgUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 上传的图片服务器地址
-const uploadHeaders={Authorization: 'Bearer ' + getToken()};
 const fileList =ref([]);
 
-const dialogImageUrl = ref('')
-const dialogVisible = ref(false)
 // 定义 props
 const props = defineProps({
   applyId: {
@@ -134,7 +129,7 @@ const data = reactive({
   queryParams: {
     pageNum: 1,
     pageSize: 10,
-    nursingRecordId: props.applyId,
+    applyId: props.applyId,
     nursingTime: null,
     imgPaths: null,
     imgNum: null,
@@ -183,7 +178,8 @@ function reset() {
     createTime: null,
     updateBy: null,
     updateTime: null,
-    remark: null
+    remark: null,
+    applyId:props.applyId
   };
   proxy.resetForm("clocksRef");
 }
@@ -227,13 +223,13 @@ function handleUpdate(row) {
 
 /** 提交按钮 */
 function submitForm() {
-  form.value.imgNum=0;
-
-  fileList.forEach(item => {
-    console.info(item);
-    form.value.imgNum++;
-    form.value.imgPaths+=item.url;
-  });
+  form.value.imgNum=1;
+  form.value.imgPaths="11111"
+  // fileList.forEach(item => {
+  //   console.info(item);
+  //   form.value.imgNum++;
+  //   form.value.imgPaths+=item.url;
+  // });
 
   proxy.$refs["clocksRef"].validate(valid => {
     if (valid) {
@@ -280,26 +276,5 @@ function handlePreview(file) {
 function handleRemove(file, fileList) {
   console.log('移除文件:', file, '剩余文件:', fileList);
 }
-function beforeUpload(file) {
-  const isJPGOrPNG = file.type === 'image/jpeg' || file.type === 'image/png';
-  const isLt500K = file.size / 1024 < 500;
-
-  if (!isJPGOrPNG) {
-    this.$message.error('只能上传 JPG 或 PNG 格式的图片!');
-  }
-  if (!isLt500K) {
-    this.$message.error('图片大小不能超过 500KB!');
-  }
-
-  return isJPGOrPNG && isLt500K;
-}
-function handleSuccess(response, file, fileList)
-{
-  if(response.code==200){
-    console.log('上传成功:', response, file, fileList);
-    fileList.value = fileList;
-  }
-
-}
 getList();
 </script>

+ 14 - 0
ruoyi-vue/src/views/care/clocks/index_task.vue

@@ -61,6 +61,7 @@
         <template #default="scope">
           <el-button link type="primary" icon="Edit" @click="look(scope.row)" v-hasPermi="['care:applications:look']">查看</el-button>
           <el-button link type="primary" icon="Edit" @click="clock(scope.row)" v-hasPermi="['care:applications:clock']">打卡</el-button>
+          <el-button link type="primary" icon="Edit" @click="finish(scope.row)" v-hasPermi="['care:applications:finish']">完成</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -158,8 +159,10 @@
 import {
   getApplications,
   listApplications,
+    updateApplications
 } from "@/api/care/applications";
 import clockIndex from './index.vue';
+import {delAssignments} from "@/api/care/assignments";
 
 const { proxy } = getCurrentInstance();
 const {deal_status,sys_user_sex } = proxy.useDict('deal_status','sys_user_sex');
@@ -272,6 +275,17 @@ function clock(row){
   };
   openClock.value=true
 }
+
+function finish(row){
+  proxy.$modal.confirm('是否确认该客户:"' + row.personName + '"已经完成?').then(function() {
+    row.dealStatus="complete"
+    row.payStatus="dis_pay"
+    return updateApplications(row);
+  }).then(() => {
+    getList();
+    proxy.$modal.msgSuccess("操作成功");
+  }).catch(() => {});
+}
 getList();
 
 </script>