yh 2 дней назад
Родитель
Сommit
c5e6916aa2

+ 7 - 0
fs-service/src/main/java/com/fs/his/service/IFsHealthTongueService.java

@@ -74,6 +74,13 @@ public interface IFsHealthTongueService
 
     R insertFsHealthTongueByImgUrl(FsHealthTongueUParam param);
 
+    /**
+     * 爱看舌-旧版的舌诊功能
+     * @param param
+     * @return
+     */
+    R insertFsHealthTongueByImgUrlOld(FsHealthTongueUParam param);
+
     FsHealthTongueUVO selectFsHealthTongueByUserId(long userId);
 
     List<FsHealthTongueListVO> selectFsHealthTongueListVO(FsHealthTongueParam param);

+ 70 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsHealthTongueServiceImpl.java

@@ -25,6 +25,8 @@ import com.fs.his.vo.FsHealthTongueUVO;
 import com.qiniu.util.Json;
 import org.redisson.api.RLock;
 import org.redisson.api.RedissonClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.fs.his.mapper.FsHealthTongueMapper;
@@ -40,6 +42,8 @@ import com.fs.his.service.IFsHealthTongueService;
 @Service
 public class FsHealthTongueServiceImpl implements IFsHealthTongueService
 {
+    private static final Logger log = LoggerFactory.getLogger(FsHealthTongueServiceImpl.class);
+
     @Autowired
     private FsHealthTongueMapper fsHealthTongueMapper;
     @Autowired
@@ -186,6 +190,72 @@ public class FsHealthTongueServiceImpl implements IFsHealthTongueService
         }
     }
 
+    @Override
+    public R insertFsHealthTongueByImgUrlOld(FsHealthTongueUParam param) {
+
+        QueryQuanXi queryQuanXi = new QueryQuanXi();
+        if (param.getName()!=null&&!param.getName().equals("")) {
+            queryQuanXi.setName(param.getName());
+        } else {
+            queryQuanXi.setName("匿名");
+        }
+        if (param.getAge()!=null) {
+            queryQuanXi.setAge(param.getAge()+"");
+        } else {
+            queryQuanXi.setAge("55");
+        }
+
+        queryQuanXi.setFile(param.getTongueUrl());
+        if (param.getSex()!=null) {
+            queryQuanXi.setMale(param.getSex()==1?"1":"0");
+        } else {
+            queryQuanXi.setMale("0");
+        }
+
+        AITongueResult<TongueData> tongueDataAITongueResult = aiTongueService.quanXiTongue(queryQuanXi);
+
+        if (tongueDataAITongueResult.getCode().equals("40001")) {
+            FsHealthTongue fsHealthTongue = new FsHealthTongue();
+            fsHealthTongue.setAge(param.getAge());
+            fsHealthTongue.setPatientId(param.getPatientId());
+            fsHealthTongue.setName(param.getName());
+            fsHealthTongue.setSex(param.getSex());
+            fsHealthTongue.setStatus(0);
+            fsHealthTongue.setUserId(param.getUserId());
+            fsHealthTongue.setTongueUrl(param.getTongueUrl());
+            TongueData data = tongueDataAITongueResult.getData();
+            fsHealthTongue.setTongueId(data.getId());
+            fsHealthTongue.setCreateTime(new Date());
+            fsHealthTongue.setTypeName(data.getTypeName()+"质");
+
+            fsHealthTongue.setBotai(data.getBotai());
+            fsHealthTongue.setBotaiDesc(data.getBotaiDesc());
+            fsHealthTongue.setChihen(data.getChihen());
+            fsHealthTongue.setChihenDesc(data.getChihenDesc());
+            fsHealthTongue.setLiewen(data.getLiewen());
+            fsHealthTongue.setLiewenDesc(data.getLiewenDesc());
+            fsHealthTongue.setShemianName(data.getShemianName());
+            fsHealthTongue.setShemianDesc(data.getShemianDesc());
+            fsHealthTongue.setTaiseName(data.getTaiseName());
+            fsHealthTongue.setTaiseDesc(data.getTaiseDesc());
+            String json =fsHealthTongueMapper.selectTypeJSON();
+            String typeName = fsHealthTongue.getTypeName();
+            String itemTypeJSonValue="[]";
+            List<Map<String, Object>> itemTypeJsonList = (List<Map<String, Object>>) JSON.parse(json);
+            for (Map<String, Object> stringStringMap : itemTypeJsonList) {
+                String itemType = (String) stringStringMap.get("itemType");
+                if (itemType.equals(typeName)){
+                    itemTypeJSonValue= Json.encode(stringStringMap.get("item"));
+                }
+            }
+            fsHealthTongue.setTypeJson(itemTypeJSonValue);
+            fsHealthTongueMapper.insertFsHealthTongue(fsHealthTongue);
+            return R.ok().put("data",fsHealthTongue);
+        } else {
+            return R.error(tongueDataAITongueResult.getMeta().getMsg());
+        }
+    }
+
     @Override
     public FsHealthTongueUVO selectFsHealthTongueByUserId(long userId) {
         return fsHealthTongueMapper.selectFsHealthTongueByUserId(userId);

+ 10 - 1
fs-user-app/src/main/java/com/fs/app/controller/HealthTongueController.java

@@ -5,6 +5,7 @@ import com.fs.common.annotation.Log;
 import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
 import com.fs.common.enums.BusinessType;
+import com.fs.config.cloud.CloudHostProper;
 import com.fs.his.domain.FsDoctorArticle;
 import com.fs.his.domain.FsHealthTongue;
 import com.fs.his.domain.FsPatient;
@@ -49,6 +50,8 @@ public class HealthTongueController extends AppBaseController
     private IFsPatientService fsPatientService;
     @Autowired
     private FsDoctorArticleMapper fsDoctorArticleMapper;
+    @Autowired
+    private CloudHostProper cloudHostProper;
     /**
      * 查询舌苔列表
      */
@@ -152,6 +155,12 @@ public class HealthTongueController extends AppBaseController
 //            }
 //        }
         param.setUserId(Long.parseLong(getUserId()));
-        return fsHealthTongueService.insertFsHealthTongueByImgUrl(param);
+        R result;
+        if("金牛明医".equals(cloudHostProper.getCompanyName())){
+            result = fsHealthTongueService.insertFsHealthTongueByImgUrlOld(param);
+        } else {
+            result = fsHealthTongueService.insertFsHealthTongueByImgUrl(param);
+        }
+        return result;
     }
 }