Browse Source

Merge branch 'master' of http://git.shengws.com/csx/gdyb

csx 4 years ago
parent
commit
a2d0526480
2 changed files with 65 additions and 6 deletions
  1. 64 5
      controllers/sg/his_api_controller.go
  2. 1 1
      service/gdyb_service.go

+ 64 - 5
controllers/sg/his_api_controller.go View File

3643
 }
3643
 }
3644
 
3644
 
3645
 type QueryResult struct {
3645
 type QueryResult struct {
3646
+	ID             int64
3646
 	Name           string
3647
 	Name           string
3647
 	Code           string
3648
 	Code           string
3648
 	List_type_code string
3649
 	List_type_code string
3663
 		drugs, _ := service.GetBatchDrugList(ids)
3664
 		drugs, _ := service.GetBatchDrugList(ids)
3664
 		for _, item := range drugs {
3665
 		for _, item := range drugs {
3665
 			result := QueryResult{
3666
 			result := QueryResult{
3667
+				ID:             item.ID,
3666
 				Name:           item.DrugName,
3668
 				Name:           item.DrugName,
3667
 				Code:           item.MedicalInsuranceNumber,
3669
 				Code:           item.MedicalInsuranceNumber,
3668
 				List_type_code: item.MedicalInsuranceNumber,
3670
 				List_type_code: item.MedicalInsuranceNumber,
3675
 
3677
 
3676
 		for _, item := range goods {
3678
 		for _, item := range goods {
3677
 			result := QueryResult{
3679
 			result := QueryResult{
3680
+				ID:             item.ID,
3678
 				Name:           item.GoodName,
3681
 				Name:           item.GoodName,
3679
 				Code:           item.MedicalInsuranceNumber,
3682
 				Code:           item.MedicalInsuranceNumber,
3680
 				List_type_code: item.MedicalInsuranceNumber,
3683
 				List_type_code: item.MedicalInsuranceNumber,
3685
 		projects, _ := service.GetBathchMyPorjecgList(ids)
3688
 		projects, _ := service.GetBathchMyPorjecgList(ids)
3686
 		for _, item := range projects {
3689
 		for _, item := range projects {
3687
 			result := QueryResult{
3690
 			result := QueryResult{
3691
+				ID:             item.ID,
3688
 				Name:           item.ProjectName,
3692
 				Name:           item.ProjectName,
3689
 				Code:           item.MedicalCode,
3693
 				Code:           item.MedicalCode,
3690
 				List_type_code: item.MedicalCode,
3694
 				List_type_code: item.MedicalCode,
3724
 			} else {
3728
 			} else {
3725
 				fmt.Println(err)
3729
 				fmt.Println(err)
3726
 			}
3730
 			}
3731
+
3732
+			userJSONBytes, _ := json.Marshal(dat)
3733
+			var res ResultSix
3734
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
3735
+				utils.ErrorLog("解析失败:%v", err)
3736
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3737
+				return
3738
+			}
3739
+			if res.Infcode == 0 {
3740
+				if record_type == 1 {
3741
+					service.UpdateBaseDrugById(item.ID)
3742
+				} else if record_type == 2 {
3743
+					service.UpdateGoodInformaitonByDetail(item.ID)
3744
+				} else if record_type == 3 {
3745
+					service.UpdateProjectById(item.ID)
3746
+				}
3747
+				c.ServeSuccessJSON(map[string]interface{}{
3748
+					"failed_code": 0,
3749
+					"msg":         "目录对照成功",
3750
+				})
3751
+			} else {
3752
+				c.ServeSuccessJSON(map[string]interface{}{
3753
+					"failed_code": -10,
3754
+					"msg":         res.ErrMsg,
3755
+				})
3756
+
3757
+			}
3727
 		}
3758
 		}
3728
 	}
3759
 	}
3729
 }
3760
 }
3742
 		drugs, _ := service.GetBatchDrugList(ids)
3773
 		drugs, _ := service.GetBatchDrugList(ids)
3743
 		for _, item := range drugs {
3774
 		for _, item := range drugs {
3744
 			result := QueryResult{
3775
 			result := QueryResult{
3776
+				ID:             item.ID,
3745
 				Name:           item.DrugName,
3777
 				Name:           item.DrugName,
3746
 				Code:           item.MedicalInsuranceNumber,
3778
 				Code:           item.MedicalInsuranceNumber,
3747
 				List_type_code: item.MedicalInsuranceNumber,
3779
 				List_type_code: item.MedicalInsuranceNumber,
3754
 
3786
 
3755
 		for _, item := range goods {
3787
 		for _, item := range goods {
3756
 			result := QueryResult{
3788
 			result := QueryResult{
3789
+				ID:             item.ID,
3757
 				Name:           item.GoodName,
3790
 				Name:           item.GoodName,
3758
 				Code:           item.MedicalInsuranceNumber,
3791
 				Code:           item.MedicalInsuranceNumber,
3759
 				List_type_code: item.MedicalInsuranceNumber,
3792
 				List_type_code: item.MedicalInsuranceNumber,
3764
 		projects, _ := service.GetBathchMyPorjecgList(ids)
3797
 		projects, _ := service.GetBathchMyPorjecgList(ids)
3765
 		for _, item := range projects {
3798
 		for _, item := range projects {
3766
 			result := QueryResult{
3799
 			result := QueryResult{
3800
+				ID:             item.ID,
3767
 				Name:           item.ProjectName,
3801
 				Name:           item.ProjectName,
3768
 				Code:           item.MedicalCode,
3802
 				Code:           item.MedicalCode,
3769
 				List_type_code: item.MedicalCode,
3803
 				List_type_code: item.MedicalCode,
3798
 		for _, item := range queryResult {
3832
 		for _, item := range queryResult {
3799
 
3833
 
3800
 			result := service.Gdyb3302(baseParams, item.Name, item.Code, item.List_type_code)
3834
 			result := service.Gdyb3302(baseParams, item.Name, item.Code, item.List_type_code)
3801
-			var dat map[string]interface{}
3802
-			if err := json.Unmarshal([]byte(result), &dat); err == nil {
3803
-				fmt.Println(dat)
3835
+			var dat2 map[string]interface{}
3836
+			if err := json.Unmarshal([]byte(result), &dat2); err == nil {
3837
+				fmt.Println(dat2)
3804
 			} else {
3838
 			} else {
3805
 				fmt.Println(err)
3839
 				fmt.Println(err)
3806
 			}
3840
 			}
3807
-		}
3808
 
3841
 
3809
-	}
3842
+			userJSONBytes, _ := json.Marshal(dat2)
3843
+			var res ResultSix
3844
+			if err := json.Unmarshal(userJSONBytes, &res); err != nil {
3845
+				utils.ErrorLog("解析失败:%v", err)
3846
+				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
3847
+				return
3848
+			}
3849
+			if res.Infcode == 0 {
3850
+				if record_type == 1 {
3851
+					service.UpdateDrugByIdDetail(item.ID)
3852
+				} else if record_type == 2 {
3853
+					service.UpdateGoodInfoById(item.ID)
3810
 
3854
 
3855
+				} else if record_type == 3 {
3856
+					service.UpdateMyProjectById(item.ID)
3857
+				}
3858
+				c.ServeSuccessJSON(map[string]interface{}{
3859
+					"failed_code": 0,
3860
+					"msg":         "撤销目录对照成功",
3861
+				})
3862
+			} else {
3863
+				c.ServeSuccessJSON(map[string]interface{}{
3864
+					"failed_code": -10,
3865
+					"msg":         res.ErrMsg,
3866
+				})
3867
+			}
3868
+		}
3869
+	}
3811
 }
3870
 }
3812
 func (c *HisApiController) GetPatientInfo() {
3871
 func (c *HisApiController) GetPatientInfo() {
3813
 	id_card_no := c.GetString("id_card_no")
3872
 	id_card_no := c.GetString("id_card_no")

+ 1 - 1
service/gdyb_service.go View File

1699
 	inputData["begndate"] = timeFormatTwo          // 医师编码
1699
 	inputData["begndate"] = timeFormatTwo          // 医师编码
1700
 	inputData["tel"] = ""                          // 医师编码
1700
 	inputData["tel"] = ""                          // 医师编码
1701
 	inputData["addr"] = ""                         // 医师编码
1701
 	inputData["addr"] = ""                         // 医师编码
1702
-	inputData["enddate"] = ""                      // 医师编码
1702
+	inputData["enddate"] = "2099-12-31"            // 医师编码
1703
 
1703
 
1704
 	input["data"] = inputData
1704
 	input["data"] = inputData
1705
 	inputMessage["input"] = input //交易输入
1705
 	inputMessage["input"] = input //交易输入