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,6 +3643,7 @@ func (c *HisApiController) GetUploadDiag() {
3643 3643
 }
3644 3644
 
3645 3645
 type QueryResult struct {
3646
+	ID             int64
3646 3647
 	Name           string
3647 3648
 	Code           string
3648 3649
 	List_type_code string
@@ -3663,6 +3664,7 @@ func (c *HisApiController) GetCheckCode() {
3663 3664
 		drugs, _ := service.GetBatchDrugList(ids)
3664 3665
 		for _, item := range drugs {
3665 3666
 			result := QueryResult{
3667
+				ID:             item.ID,
3666 3668
 				Name:           item.DrugName,
3667 3669
 				Code:           item.MedicalInsuranceNumber,
3668 3670
 				List_type_code: item.MedicalInsuranceNumber,
@@ -3675,6 +3677,7 @@ func (c *HisApiController) GetCheckCode() {
3675 3677
 
3676 3678
 		for _, item := range goods {
3677 3679
 			result := QueryResult{
3680
+				ID:             item.ID,
3678 3681
 				Name:           item.GoodName,
3679 3682
 				Code:           item.MedicalInsuranceNumber,
3680 3683
 				List_type_code: item.MedicalInsuranceNumber,
@@ -3685,6 +3688,7 @@ func (c *HisApiController) GetCheckCode() {
3685 3688
 		projects, _ := service.GetBathchMyPorjecgList(ids)
3686 3689
 		for _, item := range projects {
3687 3690
 			result := QueryResult{
3691
+				ID:             item.ID,
3688 3692
 				Name:           item.ProjectName,
3689 3693
 				Code:           item.MedicalCode,
3690 3694
 				List_type_code: item.MedicalCode,
@@ -3724,6 +3728,33 @@ func (c *HisApiController) GetCheckCode() {
3724 3728
 			} else {
3725 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,6 +3773,7 @@ func (c *HisApiController) UnCheckCode() {
3742 3773
 		drugs, _ := service.GetBatchDrugList(ids)
3743 3774
 		for _, item := range drugs {
3744 3775
 			result := QueryResult{
3776
+				ID:             item.ID,
3745 3777
 				Name:           item.DrugName,
3746 3778
 				Code:           item.MedicalInsuranceNumber,
3747 3779
 				List_type_code: item.MedicalInsuranceNumber,
@@ -3754,6 +3786,7 @@ func (c *HisApiController) UnCheckCode() {
3754 3786
 
3755 3787
 		for _, item := range goods {
3756 3788
 			result := QueryResult{
3789
+				ID:             item.ID,
3757 3790
 				Name:           item.GoodName,
3758 3791
 				Code:           item.MedicalInsuranceNumber,
3759 3792
 				List_type_code: item.MedicalInsuranceNumber,
@@ -3764,6 +3797,7 @@ func (c *HisApiController) UnCheckCode() {
3764 3797
 		projects, _ := service.GetBathchMyPorjecgList(ids)
3765 3798
 		for _, item := range projects {
3766 3799
 			result := QueryResult{
3800
+				ID:             item.ID,
3767 3801
 				Name:           item.ProjectName,
3768 3802
 				Code:           item.MedicalCode,
3769 3803
 				List_type_code: item.MedicalCode,
@@ -3798,16 +3832,41 @@ func (c *HisApiController) UnCheckCode() {
3798 3832
 		for _, item := range queryResult {
3799 3833
 
3800 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 3838
 			} else {
3805 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 3871
 func (c *HisApiController) GetPatientInfo() {
3813 3872
 	id_card_no := c.GetString("id_card_no")

+ 1 - 1
service/gdyb_service.go View File

@@ -1699,7 +1699,7 @@ func Gdyb2503(psnNo string, insutype string, org_name string, doctor string, fix
1699 1699
 	inputData["begndate"] = timeFormatTwo          // 医师编码
1700 1700
 	inputData["tel"] = ""                          // 医师编码
1701 1701
 	inputData["addr"] = ""                         // 医师编码
1702
-	inputData["enddate"] = ""                      // 医师编码
1702
+	inputData["enddate"] = "2099-12-31"            // 医师编码
1703 1703
 
1704 1704
 	input["data"] = inputData
1705 1705
 	inputMessage["input"] = input //交易输入