csx 4 years ago
parent
commit
2174bf1cdb
1 changed files with 49 additions and 49 deletions
  1. 49 49
      controllers/his_api_controller.go

+ 49 - 49
controllers/his_api_controller.go View File

@@ -589,8 +589,8 @@ func (c *HisApiController) GetRegisterInfo() {
589 589
 			count, _ := service.FindHisRegisterRecord(theTime.Unix(), patient.ID, adminInfo.CurrentOrgId)
590 590
 			department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
591 591
 			doctor_id := strconv.FormatInt(patientPrescription.DoctorId, 10)
592
-			//diagnosisConfig, _ := service.FindDiagnoseById(patientPrescription.Diagnosis)
593
-			//sickConfig, _ := service.FindSickById(patientPrescription.SickType)
592
+			diagnosisConfig, _ := service.FindDiagnoseById(patientPrescription.Diagnosis)
593
+			sickConfig, _ := service.FindSickById(patientPrescription.SickType)
594 594
 
595 595
 			IdCardNo := ""
596 596
 			if id_card_type == 1 {
@@ -659,53 +659,53 @@ func (c *HisApiController) GetRegisterInfo() {
659 659
 				his.Status = 1
660 660
 				err := service.CreateHisPatientTwo(&his)
661 661
 				if err == nil {
662
-					//api2 := "http://127.0.0.1:9532/" + "gdyb/four?psn_no=" + his.PsnNo +
663
-					//	"&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&department=" + department.Name +
664
-					//	"&diag=" + diagnosisConfig.ClassName + "&org_name=" + miConfig.OrgName + "&med_type=" + strconv.FormatInt(patientPrescription.RegisterType, 10) + "&doctor_id=" + strconv.FormatInt(patientPrescription.DoctorId, 10) + "&fixmedins_code=" + miConfig.Code + "&diag_code=" + diagnosisConfig.CountryCode +
665
-					//	"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&sick_code=" + sickConfig.CountryCode + "&sick_name=" + sickConfig.ClassName
666
-					//resp2, requestErr2 := http.Get(api2)
667
-					//if requestErr2 != nil {
668
-					//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
669
-					//	return
670
-					//}
671
-					//body2, ioErr2 := ioutil.ReadAll(resp2.Body)
672
-					//if ioErr2 != nil {
673
-					//	utils.ErrorLog("接口返回数据读取失败: %v", ioErr2)
674
-					//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
675
-					//	return
676
-					//}
677
-					//var respJSON2 map[string]interface{}
678
-					//if err := json.Unmarshal([]byte(string(body2)), &respJSON2); err != nil {
679
-					//	utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
680
-					//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
681
-					//	return
682
-					//}
683
-					//respJSON2 = respJSON2["data"].(map[string]interface{})["pre"].(map[string]interface{})
684
-					//userJSONBytes2, _ := json.Marshal(respJSON2)
685
-					//
686
-					//var res2 ResultSix
687
-					//if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
688
-					//	utils.ErrorLog("解析失败:%v", err)
689
-					//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
690
-					//	return
691
-					//}
692
-					//if res2.Infcode == -1 {
693
-					//	adminUser := c.GetAdminUserInfo()
694
-					//	errlog := &models.HisOrderError{
695
-					//		UserOrgId:  adminUser.CurrentOrgId,
696
-					//		Ctime:      time.Now().Unix(),
697
-					//		Mtime:      time.Now().Unix(),
698
-					//		ErrMsg:     res2.ErrMsg,
699
-					//		Status:     1,
700
-					//		PatientId:  id,
701
-					//		RecordTime: recordDateTime,
702
-					//		Stage:      3,
703
-					//	}
704
-					//	service.CreateErrMsgLog(errlog)
705
-					//
706
-					//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterThreeException)
707
-					//	return
708
-					//}
662
+					api2 := "http://127.0.0.1:9532/" + "gdyb/four?psn_no=" + his.PsnNo +
663
+						"&mdtrt_id=" + his.Number + "&doctor=" + patientPrescription.Doctor + "&department=" + department.Name +
664
+						"&diag=" + diagnosisConfig.ClassName + "&org_name=" + miConfig.OrgName + "&med_type=" + strconv.FormatInt(patientPrescription.RegisterType, 10) + "&doctor_id=" + strconv.FormatInt(patientPrescription.DoctorId, 10) + "&fixmedins_code=" + miConfig.Code + "&diag_code=" + diagnosisConfig.CountryCode +
665
+						"&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&sick_code=" + sickConfig.CountryCode + "&sick_name=" + sickConfig.ClassName
666
+					resp2, requestErr2 := http.Get(api2)
667
+					if requestErr2 != nil {
668
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
669
+						return
670
+					}
671
+					body2, ioErr2 := ioutil.ReadAll(resp2.Body)
672
+					if ioErr2 != nil {
673
+						utils.ErrorLog("接口返回数据读取失败: %v", ioErr2)
674
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
675
+						return
676
+					}
677
+					var respJSON2 map[string]interface{}
678
+					if err := json.Unmarshal([]byte(string(body2)), &respJSON2); err != nil {
679
+						utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
680
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
681
+						return
682
+					}
683
+					respJSON2 = respJSON2["data"].(map[string]interface{})["pre"].(map[string]interface{})
684
+					userJSONBytes2, _ := json.Marshal(respJSON2)
685
+
686
+					var res2 ResultSix
687
+					if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
688
+						utils.ErrorLog("解析失败:%v", err)
689
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
690
+						return
691
+					}
692
+					if res2.Infcode == -1 {
693
+						adminUser := c.GetAdminUserInfo()
694
+						errlog := &models.HisOrderError{
695
+							UserOrgId:  adminUser.CurrentOrgId,
696
+							Ctime:      time.Now().Unix(),
697
+							Mtime:      time.Now().Unix(),
698
+							ErrMsg:     res2.ErrMsg,
699
+							Status:     1,
700
+							PatientId:  id,
701
+							RecordTime: recordDateTime,
702
+							Stage:      3,
703
+						}
704
+						service.CreateErrMsgLog(errlog)
705
+
706
+						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterThreeException)
707
+						return
708
+					}
709 709
 
710 710
 					c.ServeSuccessJSON(map[string]interface{}{
711 711
 						"his_info": his,